Jump to content

Pppineeeee3

Members
  • Posts

    14
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Pppineeeee3's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Yes, I see that now, however, there is still the problem with the block, as it is not being detected
  2. @SubscribeEvent public void exampleEvent(RightClickBlock event) { World world = event.getWorld(); EntityPlayer player = event.getEntityPlayer(); ItemStack itemstack = player.getItemStackFromSlot(EntityEquipmentSlot.MAINHAND); BlockPos pos = event.getPos(); IBlockState state = world.getBlockState(pos); Block block = state.getBlock(); if(itemstack == new ItemStack(Items.FLINT_AND_STEEL)) { System.out.println("Tested and Found Flint And Steel"); if(block == Blocks.SOUL_SAND.getDefaultState()) { BlockPos fire = pos.offset(EnumFacing.UP); world.setBlockState(fire, Blocks.GOLD_BLOCK.getDefaultState()); System.out.println("Event Success"); } } else { System.out.println("Event Completely Failed"); } } And in the console: [19:17:54] [main/INFO] [STDOUT]: [club.mcmodding.netherupdate.events.TestEvent:exampleEvent:43]: Event Completely Failed [19:17:54] [Server thread/INFO] [STDOUT]: [club.mcmodding.netherupdate.events.TestEvent:exampleEvent:43]: Event Completely Failed
  3. However, just right clicking is bringing up the message as well
  4. I have added 2 print lines (Event Failed, and Event Success), every time I right click with a flint and steel, the Event Failed comes through, even if I am aimed at soul sand
  5. So: @SubscribeEvent public void exampleEvent(RightClickBlock event) { World world = event.getWorld(); EntityPlayer player = event.getEntityPlayer(); ItemStack itemstack = player.getHeldItemMainhand(); BlockPos pos = event.getPos(); IBlockState state = world.getBlockState(pos); Block block = state.getBlock(); if(itemstack == new ItemStack(Items.FLINT_AND_STEEL) && block.equals(Blocks.SOUL_SAND)) { BlockPos fire = pos.offset(EnumFacing.UP); world.setBlockState(fire, Blocks.GOLD_BLOCK.getDefaultState()); } } This still isn't doing anything
  6. So where does this exactly go? I'm confused by the wording in the docs
  7. I'm guessing it has something to do with the fire being placed first?
  8. I made a new class - EventHandler and added this to it: public static void registerEvents() { TestEvent testEvent = new TestEvent(); MinecraftForge.EVENT_BUS.register(testEvent); } Then in my RegistryHandler (where the FMLInitialization events are) I have this in the preInit: EventHandler.registerEvents();
  9. Okay so I have this now... public class TestEvent { public void exampleEvent(RightClickBlock event) { World world = event.getWorld(); EntityPlayer player = event.getEntityPlayer(); ItemStack itemstack = player.getHeldItemMainhand(); BlockPos pos = event.getPos(); IBlockState state = world.getBlockState(pos); Block block = state.getBlock(); if(itemstack == new ItemStack(Items.FLINT_AND_STEEL) && block.equals(Blocks.SOUL_SAND)) { BlockPos fire = pos.offset(EnumFacing.UP); world.setBlockState(fire, Blocks.GOLD_BLOCK.getDefaultState()); } } } But nothing seems to happen in game, it still places the fire
  10. Okay, so I've managed to get this... public class TestEvent { public void exampleEvent(PlayerInteractEvent event) { World world = event.getWorld(); EntityPlayer player = event.getEntityPlayer(); ItemStack itemstack = player.getHeldItemMainhand(); BlockPos pos = event.getPos(); if(itemstack == new ItemStack(Items.FLINT_AND_STEEL)) { } } } But I'm not sure where to go from it
  11. That's the thing, I haven't got anything apart from a class, I'm not entirety sure how to check/cancel the event.
  12. I am wanting to create an event to do something rather strange... What I want is: when a player right clicks a gold block with a flint and steel I want it to spawn another gold block on top of it instead of fire I tried using events but I just can't wrap my head around it. Any help would be useful!
  13. The block was IG but no GUI opened.
  14. Hi, I wanted to make a custom crafting table. The idea I had was to basically to copy the vanilla crafting table - so have the 3 by 3 grid and the 1 output (I wanted to do this so my recipes wouldn't clash, in the vanilla table). Context aside for a minute. I tried to copy the classes, but nothing worked! I was just wondering if anyone would be able to help, either with reference code or just some help! Please and Thanks! This is for 1.12.2!
×
×
  • Create New...

Important Information

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