Jump to content

Ghten

Members
  • Posts

    8
  • Joined

  • Last visited

Ghten's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. But can I use the event.entityPlayer.isSneaking() inside the BlockEvent.BreakEvent or BlockEvent.HarvestDropsEvent? I couldn't find it :L
  2. That one works kinda. But I want to ignite the tnt when you punch it normally (and not drop anything) and when you punch it and hold shift it shouldn't explode and instead drop the item :L So the drop should only be disabled when I'm not holding shift
  3. @SubscribeEvent public void PlayerInteractEvent(PlayerInteractEvent event) { Block block = event.world.getBlock(event.x, event.y, event.z); if ((event.action == PlayerInteractEvent.Action.LEFT_CLICK_BLOCK) && (event.world.getBlock(event.x, event.y, event.z) == Blocks.tnt) && (!event.entityPlayer.isSneaking())) { EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(event.world, (double)((float)event.x + 0.5F), (double)event.y+0.5, (double)((float)event.z + 0.5F), null); event.world.spawnEntityInWorld(entitytntprimed); } } -------------------------------------------------------- I have this code to ignite tnt when you punch it. It works, but it still drops the tnt as an item. How can I fix that? C:
  4. Ok, I did this: @SubscribeEvent public void PlayerInteractEvent(PlayerInteractEvent event) { Block block = event.world.getBlock(event.x, event.y, event.z); if ((event.action == PlayerInteractEvent.Action.LEFT_CLICK_BLOCK) && (event.world.getBlock(event.x, event.y, event.z) == Blocks.tnt) && (!event.entityPlayer.isSneaking())) { EntityTNTPrimed tnt = new EntityTNTPrimed(event.world, event.x, event.y+0.5, event.z, null); event.world.spawnEntityInWorld(tnt); } } } ---------------------------------- It spawns the entity but it still drops the tnt as an item. How can I stop it from being dropped?
  5. Hello! I wanted to make tnt ignite when you punch/destroy it (Just like in the beta days). Couldn't get it to work though :L Does someone have any idea why this doesn't spawn anything? ---------------------------------------------------------------------------------------------------------------- @Mod(modid = ExampleModThree.MODID, version = ExampleModThree.VERSION) public class ExampleModThree { public static final String MODID = "examplemod3"; public static final String VERSION = "1.0"; public static Entity EntityTNTPrimed; @Mod.EventHandler public void preInit(FMLPreInitializationEvent event) { MinecraftForge.EVENT_BUS.register(this); } @SubscribeEvent public void onBreakEvent(BlockEvent.BreakEvent event) { if (event.world.isRemote) { return; } Block block = event.block; if (block == Blocks.tnt) { event.world.spawnEntityInWorld(EntityTNTPrimed); } } }
×
×
  • Create New...

Important Information

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