Posted June 16, 201510 yr So what I am trying to do is to get my custom fire block to break like the vanilla one, so far I have it working in survival mode, but it still breaks the block that the fire is on in creative mode. This is my current working code: public class BreakEvents { @SubscribeEvent public void extinguishFire(PlayerInteractEvent event) { boolean flag = event.action == PlayerInteractEvent.Action.LEFT_CLICK_BLOCK ? true : false; BlockPos pos = event.pos; World theWorld = event.world; EnumFacing side = event.face; ItemInWorldManager theItemInWorldManager = new ItemInWorldManager(theWorld); EntityPlayerMP thisPlayerMP = theItemInWorldManager.thisPlayerMP; if (flag) { Block block = theWorld.getBlockState(pos).getBlock(); if (!block.isAir(theWorld, pos)) { if (event.useBlock != Result.DENY) { block.onBlockClicked(theWorld, pos, thisPlayerMP); this.extinguishFire((EntityPlayer) null, pos, side, event); } else { thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(theWorld, pos)); } } } } private boolean extinguishFire(EntityPlayer player, BlockPos pos, EnumFacing side, PlayerInteractEvent event) { World world = event.world; pos = pos.offset(side); if (world.getBlockState(pos).getBlock() == Blocks_and_Items.fire_block) { world.playAuxSFXAtEntity(player, 1004, pos, 0); world.setBlockToAir(pos); return true; } else { return false; } } }
June 16, 201510 yr I think you should call block.onBlockClicked(theWorld, pos, thisPlayerMP); after extinguishFire, and do not click the block when there was no fire there. I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP) II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.
June 16, 201510 yr Author So I tried putting the onBlockClicked after the extinguishFire, but it still doesn't work. Also in my console I have "Model defenition for location modid:block_fire#inventory not found, how do I get rid of this?
June 16, 201510 yr So I tried putting the onBlockClicked after the extinguishFire, but it still doesn't work. Also in my console I have "Model defenition for location modid:block_fire#inventory not found, how do I get rid of this? and do not click the block when there was no fire there And that message is another problem. Do you have proper model for your fire? I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP) II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.
June 16, 201510 yr Author Yes, its just for the inventory model that I don't need, cause if you check, vanilla doesn't have an inventory model for fire
June 16, 201510 yr Yes, its just for the inventory model that I don't need, cause if you check, vanilla doesn't have an inventory model for fire Then that is not a problem I think. (Also I dont know how to make the message disappear) Anyway, Do this: and do not click the block when there was no fire there I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP) II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.
June 16, 201510 yr I did this same thing not to long ago, here is my thread where we had a lengthy discussion as to how to get this to work http://www.minecraftforge.net/forum/index.php/topic,30040.0.html Hope it helps.
June 16, 201510 yr You will still need an inventory model for that error to go away. Could be useful for people using nei/tmi that want to place down the fire
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.