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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Also why roosters don't spawn naturally Shouldn't this do the thing? // CommonModEvents @SubscribeEvent public static void registerSpawnPlacements(SpawnPlacementRegisterEvent e) { e.register(_Entities.ROOSTER.get(), ON_GROUND, WORLD_SURFACE, AbstractChicken::canSpawn, AND); } ¬† public static boolean canSpawn(EntityType<? extends AbstractChicken> entityType, LevelAccessor level, MobSpawnType spawnType, BlockPos pos, RandomSource random) { return entityType != _Entities.CHICK.get() && Animal.checkAnimalSpawnRules(entityType, level, spawnType, pos, random); } ¬† ¬† ¬†
    • Hey guys, I was playing on my mod pack (1.16.5) and¬†recently got this error when I wanted to enter the game and I don't understand it. I updated the mod thinking that was the problem, but it didn't work either, could someone so nice help me? Thank you --- Minecraft Crash Report ---- // Don't be sad, have a hug! <3 Time: 5/12/23 9:01 Description: Mod loading error has occurred java.lang.Exception: Mod Loading has failed ¬†¬† ¬†at net.minecraftforge.fml.CrashReportExtender.dumpModLoadingCrashReport(CrashReportExtender.java:71) [?:?] {re:classloading} ¬†¬† ¬†at net.minecraftforge.fml.client.ClientModLoader.completeModLoading(ClientModLoader.java:174) [?:?] {re:classloading,pl:runtimedistcleaner:A} ¬†¬† ¬†at net.minecraft.client.Minecraft.lambda$null$1(Minecraft.java:508) [?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} ¬†¬† ¬†at net.minecraft.client.Minecraft$$Lambda$5349/73334840.run(Unknown Source) [?:?] {} ¬†¬† ¬†at net.minecraft.util.Util.func_215077_a(Util.java:430) [?:?] {re:classloading,xf:OptiFine:default} ¬†¬† ¬†at net.minecraft.client.Minecraft.lambda$new$2(Minecraft.java:504) [?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} ¬†¬† ¬†at net.minecraft.client.Minecraft$$Lambda$5082/1010480754.accept(Unknown Source) [?:?] {} ¬†¬† ¬†at net.minecraft.client.gui.ResourceLoadProgressGui.func_230430_a_(ResourceLoadProgressGui.java:172) [?:?] {re:classloading,xf:OptiFine:default} ¬†¬† ¬†at net.minecraft.client.renderer.GameRenderer.func_195458_a(GameRenderer.java:802) [?:?] {re:classloading,pl:accesstransformer:B,xf:OptiFine:default} ¬†¬† ¬†at net.minecraft.client.Minecraft.func_195542_b(Minecraft.java:977) [?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} ¬†¬† ¬†at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:607) [?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} ¬†¬† ¬†at net.minecraft.client.main.Main.main(Main.java:184) [?:?] {re:classloading,pl:runtimedistcleaner:A} ¬†¬† ¬†at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_51] {} ¬†¬† ¬†at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_51] {} ¬†¬† ¬†at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_51] {} ¬†¬† ¬†at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_51] {} ¬†¬† ¬†at net.minecraftforge.fml.loading.FMLClientLaunchProvider.lambda$launchService$0(FMLClientLaunchProvider.java:37) [forge-1.16.5-36.2.39.jar:36.2] {} ¬†¬† ¬†at net.minecraftforge.fml.loading.FMLClientLaunchProvider$$Lambda$532/615830852.call(Unknown Source) [forge-1.16.5-36.2.39.jar:36.2] {} ¬†¬† ¬†at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-8.1.3.jar:?] {} ¬†¬† ¬†at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-8.1.3.jar:?] {} ¬†¬† ¬†at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-8.1.3.jar:?] {} ¬†¬† ¬†at cpw.mods.modlauncher.Launcher.run(Launcher.java:82) [modlauncher-8.1.3.jar:?] {} ¬†¬† ¬†at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) [modlauncher-8.1.3.jar:?] {} A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- System Details -- Details: ¬†¬† ¬†Minecraft Version: 1.16.5 ¬†¬† ¬†Minecraft Version ID: 1.16.5 ¬†¬† ¬†Operating System: Windows 10 (amd64) version 10.0 ¬†¬† ¬†Java Version: 1.8.0_51, Oracle Corporation ¬†¬† ¬†Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation ¬†¬† ¬†Memory: 1409376656 bytes (1344 MB) / 2046820352 bytes (1952 MB) up to 2097152000 bytes (2000 MB) ¬†¬† ¬†CPUs: 2 ¬†¬† ¬†JVM Flags: 9 total; -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=16M -Xmx1992m -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -XX:+IgnoreUnrecognizedVMOptions ¬†¬† ¬†ModLauncher: 8.1.3+8.1.3+main-8.1.x.c94d18ec ¬†¬† ¬†ModLauncher launch target: fmlclient ¬†¬† ¬†ModLauncher naming: srg ¬†¬† ¬†ModLauncher services:¬† ¬†¬† ¬†¬†¬† ¬†/mixin-0.8.4.jar mixin PLUGINSERVICE¬† ¬†¬† ¬†¬†¬† ¬†/eventbus-4.0.0.jar eventbus PLUGINSERVICE¬† ¬†¬† ¬†¬†¬† ¬†/forge-1.16.5-36.2.39.jar object_holder_definalize PLUGINSERVICE¬† ¬†¬† ¬†¬†¬† ¬†/forge-1.16.5-36.2.39.jar runtime_enum_extender PLUGINSERVICE¬† ¬†¬† ¬†¬†¬† ¬†/accesstransformers-3.0.1.jar accesstransformer PLUGINSERVICE¬† ¬†¬† ¬†¬†¬† ¬†/forge-1.16.5-36.2.39.jar capability_inject_definalize PLUGINSERVICE¬† ¬†¬† ¬†¬†¬† ¬†/forge-1.16.5-36.2.39.jar runtimedistcleaner PLUGINSERVICE¬† ¬†¬† ¬†¬†¬† ¬†/mixin-0.8.4.jar mixin TRANSFORMATIONSERVICE¬† ¬†¬† ¬†¬†¬† ¬†/OptiFine_1.16.5_HD_U_G8.jar OptiFine TRANSFORMATIONSERVICE¬† ¬†¬† ¬†¬†¬† ¬†/forge-1.16.5-36.2.39.jar fml TRANSFORMATIONSERVICE¬† ¬†¬† ¬†FML: 36.2 ¬†¬† ¬†Forge: net.minecraftforge:36.2.39 ¬†¬† ¬†FML Language Providers:¬† ¬†¬† ¬†¬†¬† ¬†javafml@36.2 ¬†¬† ¬†¬†¬† ¬†minecraft@1 ¬†¬† ¬†Mod List:¬† ¬†¬† ¬†¬†¬† ¬†forge-1.16.5-36.2.39-client.jar ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† |Minecraft ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† |minecraft ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† |1.16.5 ¬† ¬† ¬† ¬† ¬† ¬† ¬†|CREATE_REG|Manifest: NOSIGNATURE ¬†¬† ¬†¬†¬† ¬†YungsExtras-Forge-1.16.4-1.0.jar ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬†|YUNG's Extras ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† |yungsextras ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† |Forge-1.16.4-1.0 ¬† ¬†|CREATE_REG|Manifest: NOSIGNATURE ¬†¬† ¬†¬†¬† ¬†YungsApi-1.16.4-Forge-13.jar ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬†|YUNG's API ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬†|yungsapi ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬†|1.16.4-Forge-13 ¬† ¬† |CREATE_REG|Manifest: NOSIGNATURE ¬†¬† ¬†¬†¬† ¬†mowziesmobs-1.5.27.jar ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬†|Mowzie's Mobs ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† |mowziesmobs ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† |1.5.27 ¬† ¬† ¬† ¬† ¬† ¬† ¬†|CREATE_REG|Manifest: NOSIGNATURE ¬†¬† ¬†¬†¬† ¬†BetterDungeons-1.16.4-1.2.1.jar ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† |YUNG's Better Dungeons ¬† ¬† ¬† ¬†|betterdungeons ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬†|1.16.4-1.2.1 ¬† ¬† ¬† ¬†|CREATE_REG|Manifest: NOSIGNATURE ¬†¬† ¬†¬†¬† ¬†BetterStrongholds-1.16.4-1.2.1.jar ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬†|YUNG's Better Strongholds ¬† ¬† |betterstrongholds ¬† ¬† ¬† ¬† ¬† ¬† |1.16.4-1.2.1 ¬† ¬† ¬† ¬†|CREATE_REG|Manifest: NOSIGNATURE ¬†¬† ¬†¬†¬† ¬†sophisticatedbackpacks-1.16.5-3.15.20.755.jar ¬† ¬† |Sophisticated Backpacks ¬† ¬† ¬† |sophisticatedbackpacks ¬† ¬† ¬† ¬†|1.16.5-3.15.20.755 ¬†|CREATE_REG|Manifest: NOSIGNATURE ¬†¬† ¬†¬†¬† ¬†jei-1.16.5-7.8.0.1009.jar ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† |Just Enough Items ¬† ¬† ¬† ¬† ¬† ¬† |jei ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† |7.8.0.1009 ¬† ¬† ¬† ¬† ¬†|CREATE_REG|Manifest: NOSIGNATURE ¬†¬† ¬†¬†¬† ¬†byg-1.3.6.jar ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† |Oh The Biomes You'll Go ¬† ¬† ¬† |byg ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† |1.3.4 ¬† ¬† ¬† ¬† ¬† ¬† ¬† |CREATE_REG|Manifest: NOSIGNATURE ¬†¬† ¬†¬†¬† ¬†betternether_reforged-1.2.jar ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† |Better Nether Reforged ¬† ¬† ¬† ¬†|betternether ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬†|1.2 ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† |CREATE_REG|Manifest: NOSIGNATURE ¬†¬† ¬†¬†¬† ¬†forge-1.16.5-36.2.39-universal.jar ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬†|Forge ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† |forge ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† |36.2.39 ¬† ¬† ¬† ¬† ¬† ¬† |CREATE_REG|Manifest: 22:af:21:d8:19:82:7f:93:94:fe:2b:ac:b7:e4:41:57:68:39:87:b1:a7:5c:c6:44:f9:25:74:21:14:f5:0d:90 ¬†¬† ¬†¬†¬† ¬†twilightforest-1.16.5-4.0.546-universal.jar ¬† ¬† ¬† |The Twilight Forest ¬† ¬† ¬† ¬† ¬† |twilightforest ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬†|NONE ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬†|CREATE_REG|Manifest: NOSIGNATURE ¬†¬† ¬†¬†¬† ¬†BetterMineshafts-Forge-1.16.4-2.0.4.jar ¬† ¬† ¬† ¬† ¬† |YUNG's Better Mineshafts ¬† ¬† ¬†|bettermineshafts ¬† ¬† ¬† ¬† ¬† ¬† ¬†|1.16.4-2.0.4 ¬† ¬† ¬† ¬†|CREATE_REG|Manifest: NOSIGNATURE ¬†¬† ¬†¬†¬† ¬†BetterCaves-Forge-1.16.4-1.1.2.jar ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬†|YUNG's Better Caves ¬† ¬† ¬† ¬† ¬† |bettercaves ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† |1.16.4-1.1.2 ¬† ¬† ¬† ¬†|CREATE_REG|Manifest: NOSIGNATURE ¬†¬† ¬†¬†¬† ¬†geckolib-forge-1.16.5-3.0.106.jar ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† |GeckoLib ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬†|geckolib3 ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† |3.0.106 ¬† ¬† ¬† ¬† ¬† ¬† |CREATE_REG|Manifest: NOSIGNATURE ¬†¬† ¬†¬†¬† ¬†DynamicSurroundings-1.16.5-4.0.5.0.jar ¬† ¬† ¬† ¬† ¬† ¬†|¬ß3Dynamic Surroundings ¬† ¬† ¬† ¬†|dsurround ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† |4.0.5.0 ¬† ¬† ¬† ¬† ¬† ¬† |CREATE_REG|Manifest: NOSIGNATURE ¬†¬† ¬†¬†¬† ¬†journeymap-1.16.5-5.8.3.jar ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† |Journeymap ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬†|journeymap ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬†|5.8.3 ¬† ¬† ¬† ¬† ¬† ¬† ¬† |CREATE_REG|Manifest: NOSIGNATURE ¬†¬† ¬†¬†¬† ¬†DungeonsArise-1.16.5-2.1.49-beta.jar ¬† ¬† ¬† ¬† ¬† ¬† ¬†|When Dungeons Arise ¬† ¬† ¬† ¬† ¬† |dungeons_arise ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬†|2.1.49 ¬† ¬† ¬† ¬† ¬† ¬† ¬†|CREATE_REG|Manifest: NOSIGNATURE ¬†¬† ¬†¬†¬† ¬†citadel-1.8.1-1.16.5.jar ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬†|Citadel ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† |citadel ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† |1.8.1 ¬† ¬† ¬† ¬† ¬† ¬† ¬† |CREATE_REG|Manifest: NOSIGNATURE ¬†¬† ¬†¬†¬† ¬†untamedwilds-1.16.5-1.5.8.jar ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† |Untamed Wilds ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† |untamedwilds ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬†|1.5.8 ¬† ¬† ¬† ¬† ¬† ¬† ¬† |ERROR ¬† ¬† |Manifest: NOSIGNATURE ¬†¬† ¬†¬†¬† ¬†iceandfire-2.1.12-1.16.5-patch-1.jar ¬† ¬† ¬† ¬† ¬† ¬† ¬†|Ice and Fire ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬†|iceandfire ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬†|2.1.12-1.16.5-patch-|CREATE_REG|Manifest: NOSIGNATURE ¬†¬† ¬†Crash Report UUID: 5cfb2f17-4508-427f-9ef7-055c47f08891 ¬†¬† ¬†OptiFine Version: OptiFine_1.16.5_HD_U_G8 ¬†¬† ¬†OptiFine Build: 20210515-161946 ¬†¬† ¬†Render Distance Chunks: 8 ¬†¬† ¬†Mipmaps: 4 ¬†¬† ¬†Anisotropic Filtering: 1 ¬†¬† ¬†Antialiasing: 0 ¬†¬† ¬†Multitexture: false ¬†¬† ¬†Shaders: null ¬†¬† ¬†OpenGlVersion: 4.0.0 - Build 10.18.10.4358 ¬†¬† ¬†OpenGlRenderer: Intel(R) HD Graphics ¬†¬† ¬†OpenGlVendor: Intel ¬†¬† ¬†CpuCount: 2
    • idk how to reply here but no im not coding any mod, all of them are downloaded but its only gfs computer, on mine its ok and i was looking all around the internet and never seen anything similiar atleast ¬†
    • I changed it to public static void but I can't find anyway to get level from the event even if it isn't a listener parameter. @JimiIT92
    • I didn't yet see this happening on 1.20.2 forge, but sadly, I noticed that my mod is incompatible with this version because of this event handler: @SubscribeEvent public static void onPlayerRightClickItem(PlayerInteractEvent.RightClickItem e) { if (e.getItemStack().getItem() instanceof EggItem) { List<ThrownEgg> eggs = e.getLevel().getEntitiesOfClass(ThrownEgg.class, new AABB(e.getEntity().blockPosition().immutable() .below(5) .north(5) .west(5), e.getEntity().blockPosition().immutable() .above(10) .south(5) .east(5))); if (!eggs.isEmpty()) { eggs.forEach(ThrownEgg::discard); if (!e.getEntity().getAbilities().instabuild) e.getItemStack().grow(1); } if (!e.getEntity().level().isClientSide) { ((ServerPlayer) e.getEntity()).connection.send( new ClientboundStopSoundPacket(SoundEvents.EGG_THROW.getLocation(), SoundSource.PLAYERS)); // Minecraft Forge 1.20.2 crashes because of NoSuchMethodError here } e.setCancellationResult(InteractionResult.SUCCESS); e.setCanceled(true); } } ¬†
  • Topics

×
×
  • Create New...

Important Information

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