Noxxous Posted October 9, 2022 Share Posted October 9, 2022 (edited) Hello, I have set it to Setblock Fire and I have tried copying from Flint and Steel and I have changed it to no. 3 flag, but it still burns forever and unloads when you go somewhere else @SubscribeEvent public static void Mine (LeftClickBlock event) { BlockPos bPos = event.getPos(); BlockPos DebugPos = bPos; if ((event.getEntity().getMainHandItem().getItem() == itemInit.lightsaber_on.get() || event.getEntity().getMainHandItem().getItem() == itemInit.lightsaber_off.get())/* && !event.getLevel().isClientSide*/){ if (event.getFace() == Direction.UP || event.getFace() == Direction.DOWN) { for (int i = 1; i > -2; i--) { for (int j = 1; j > -2; j--) { bPos = new BlockPos(DebugPos.getX() + i, DebugPos.getY(), DebugPos.getZ() + j); Minecraft.getInstance().level.setBlock(bPos, BaseFireBlock.getState(Minecraft.getInstance().level, bPos), 3); event.getLevel().gameEvent(event.getEntity(), GameEvent.BLOCK_PLACE, bPos); Minecraft.getInstance().level.setBlock(DebugPos, BaseFireBlock.getState(Minecraft.getInstance().level, DebugPos), 3); event.getLevel().gameEvent(event.getEntity(), GameEvent.BLOCK_PLACE, DebugPos); } } } if (event.getFace() == Direction.NORTH || event.getFace() == Direction.SOUTH) { for (int i = 1; i > -2; i--) { for (int j = 1; j > -2; j--) { bPos = new BlockPos(DebugPos.getX() + i, DebugPos.getY() + j, DebugPos.getZ()); Minecraft.getInstance().level.setBlock(bPos, BaseFireBlock.getState(Minecraft.getInstance().level, bPos), 3); event.getLevel().gameEvent(event.getEntity(), GameEvent.BLOCK_PLACE, bPos); Minecraft.getInstance().level.setBlock(DebugPos, BaseFireBlock.getState(Minecraft.getInstance().level, DebugPos), 3); event.getLevel().gameEvent(event.getEntity(), GameEvent.BLOCK_PLACE, DebugPos); } } } if (event.getFace() == Direction.EAST || event.getFace() == Direction.WEST) { for (int i = 1; i > -2; i--) { for (int j = 1; j > -2; j--) { bPos = new BlockPos(DebugPos.getX(), DebugPos.getY() + i, DebugPos.getZ() + j); Minecraft.getInstance().level.setBlock(bPos, BaseFireBlock.getState(Minecraft.getInstance().level, bPos), 3); event.getLevel().gameEvent(event.getEntity(), GameEvent.BLOCK_PLACE, bPos); Minecraft.getInstance().level.setBlock(DebugPos, BaseFireBlock.getState(Minecraft.getInstance().level, DebugPos), 3); event.getLevel().gameEvent(event.getEntity(), GameEvent.BLOCK_PLACE, DebugPos); } } } Minecraft.getInstance().player.playSound(SoundEvents.GENERIC_DRINK, 1.0f, 1.0f); event.setCanceled(true); } } Edited October 9, 2022 by Noxxous Added the version Quote Link to comment Share on other sites More sharing options...
warjort Posted October 9, 2022 Share Posted October 9, 2022 You are using that event in the wrong way and you are only doing things on the client side which means nothing gets persisted or seen by other players. You should be coding this in your useOn() method for your item like the flint and steel and pay attention to the use of sidedSuccess() https://forge.gemwire.uk/wiki/Sides https://forge.gemwire.uk/wiki/Block_Interaction Quote 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 More sharing options...
Noxxous Posted October 10, 2022 Author Share Posted October 10, 2022 The thing is I want to hit the ground and some fire spawns there Quote Link to comment Share on other sites More sharing options...
warjort Posted October 10, 2022 Share Posted October 10, 2022 This is how I got your requirements to work: @Mod.EventBusSubscriber(modid = ExampleMod.MODID) public class Events { @SubscribeEvent public static void startFires(LeftClickBlock event) { var itemStack = event.getItemStack(); if (itemStack.is(ExampleMod.MY_SWORD.get())) { var minecraft = Minecraft.getInstance(); BlockHitResult blockhitresult = (BlockHitResult) minecraft.hitResult; minecraft.gameMode.useItemOn(minecraft.player, minecraft.level, event.getHand(), blockhitresult); event.setCanceled(true); } } } Then I just copied the flint and steel useOn() code into my sword item. I still think this is kind of an abuse of that event though. Quote 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 More sharing options...
Noxxous Posted October 11, 2022 Author Share Posted October 11, 2022 Yeah it definitely is an abuse Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.