Jump to content

ZemahZalek

Members
  • Posts

    15
  • Joined

  • Last visited

Posts posted by ZemahZalek

  1. On 1/29/2020 at 8:22 AM, Cadiboo said:

    All you need to do is install DCEVM (I do it as a full rather than alt JVM) and then change your project SDK to point to it. HotSwapAgent isn’t necessary.

    I believe I have installed it correctly now. Is there a way to know it's working? I'm not sure of changes that can be made to the code during runtime when using DCEVM.

  2. On 1/27/2020 at 5:23 AM, Cadiboo said:

    Download DCEVM, go to project settings and change the project SDK to DCEVM. You can also select a specific JVM per run config

    Should I follow these steps: https://liferay.dev/blogs/-/blogs/java-classes-instant-reloading-using-dcevm-hotswap-agent to set up the DCEVM JDK, or just download the DCEVM (from the same link) and use that as the SDK?

  3. I'm just wondering if there is a way to develop a mod during runtime? It's quite annoying to restart Minecraft every time I need to change something small.

    I tried changing textures for a single block, rebuilding the project and then refreshing the textures (F3 + T or whatever the command was) but instead IntelliJ gives an error (something about access denied) and all items and blocks included in the mod lose their textures (even the textures I never touched).

    Is is possible? And if so, what is changeable during runtime?

  4. 4 minutes ago, diesieben07 said:

    I don't know what you mean by "basic functionality".

    To make your block do something when right click you just need to override onBlockActivated and do whatever it is you want it to do in that method.

    Well I shouldn't use the onBlockActivated from Block as it is deprecated. But at the same time I cannot access and override the one from BlockState because my block class isn't a subclass of BlockState. So how do I override a method I do not have access to?

  5. 8 minutes ago, diesieben07 said:

    Well, calling onBlockActivated again from within onBlockActivated will of course result in an infinite loop which causes a stack overflow (onBlockActivated is called, which calls onBlockActivated again, which calls onBlockActivated again, which calls...).

    What are you trying to achieve?

    I simply want to set up basic functionality when right clicking on a block. 

    And the infinite loop makes sense, however I have tried to create my own method and call the BlockState method from that but it doesn't work. Probably because my method is never getting called anywhere, so I don't know how to go about this.

  6. 3 minutes ago, diesieben07 said:

    If you need to call the method then you need to call the one in BlockState. Show your attempt at doing so if thats what you are doing.

    If you need to override the method, then thats fine. Mojang abuses @Deprecated in this way.

    public class ModBlock extends Block {
    
        @Override
        public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
            return super.onBlockActivated(state, worldIn, pos, player, handIn, hit);
            //return state.onBlockActivated(worldIn, player, handIn, hit);
            //return this.getBlock().getDefaultState().onBlockActivated(worldIn, player, handIn, hit);
        }
    }

    Here is the onBlockActivated method in my own block class. The two commented lines are the ones I tried, but they resulted in a crash; java.lang.StackOverflowError: null. I guess it's because the BlockState parameter hasn't been instantiated yet? I just don't know how to access the BlockState method.

  7. The onBlockActivated method in the class Block (along with many other methods) are deprecated, however I need to call them. I read that I need (or should) use this same method but from the class BlockState instead and not use the deprecated one. However I do not know how to access this method. My own block class is a subclass of Block and therefore cannot also be a subclass of BlockState to access the method . The deprecated method in Block has a BlockState parameter but whenever I try to access onBlockActivated through that parameter the game crashes when I right click on my blocks. I also tried to get the blockstate through getBlock().getDefualtBlockstate() but that also resulted in a crash. Is there a specific way to to this? Or should I just use the deprecated method anyways?

  8. 5 minutes ago, diesieben07 said:

    Screen.hasShiftDown

    Worked wonderfully. Searched so long on all kind of websites and couldn't find anything that actually worked the way it should. Thank you so much!

    A follow-up question if you don't mind; is there a website or archive where you can learn about the different classes and methods in Minecraft and their functionality? With examples maybe?

    Because, like I said, I would never have found this solution on my own. I didn't even find anything on the web mentioning  the class Screen.

  9. I recently got into Minecraft modding and I think it's alot of fun.

    I have created a block and added a tooltip to it through overriding the addInformation method. However, the tooltip is always showing while hovering the mouse over the block (as it should).

    I want it to only show when the user is holding down shift; like it is in most other mods (the tooltip says something like "Hold shift for more information" until you actually hold down shift and it shows the whole tooltip).

    Is there an effective way to to this? Another method or a boolean I have to change maybe?

    Thanks for all help.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.