Jump to content

Unbreakable Block even in creative mode


talera

Recommended Posts

I have created a block that is not breakable . But this only works when you are in survival mode. When I am in Creative mode I can destroy it. Is there anything that makes it unbreakable in Creative mode?

Edited by talera
wrong description
Link to comment
Share on other sites

Doesn't BlockEvent.BreakEvent let you do this?

It seems weird to have an unbreakable block in creative. ūüôā

 

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

Thanks first. I have the following function. I can only break blocks if I have the block in my hand. but if I don't have the block in my hand I can't break it but unfortunately I see the block particle when I hit it in creative. Can you please write me an example of how I might get this into this function?

 

    @SubscribeEvent
    public static void blockBreakEv(final BreakEvent event) {
        final Block block = event.getState().getBlock();
        if (block instanceof Inversiveblock) {
            final EntityPlayer player = event.getPlayer();
            final Item item = player.getHeldItemMainhand().getItem();
            if (!(Block.getBlockFromItem(item) instanceof Inversiveblock)) {
                event.setCanceled(true);
                return;
            }
        }
    }

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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