Jump to content

Error_Coding

Members
  • Posts

    4
  • Joined

  • Last visited

Recent Profile Visitors

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

Error_Coding's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. That works. Thanks, you just saved my day.
  2. Oh, thanks. Guess I will have to read into packet transfer.
  3. There isn't much more to it but sure, here's the whole class. @Mod.EventBusSubscriber(modid = FirstMod.MOD_ID, bus = Bus.FORGE) public class DropDirtOnCrouchEvent { @SubscribeEvent public static void dropDirtOnCrouchEvent(InputUpdateEvent event) { if(event.getMovementInput().sneaking) { PlayerEntity p = event.getPlayer(); ItemEntity dirt = new ItemEntity(p.world, p.getPosX(), p.getPosY(), p.getPosZ(), new ItemStack(Items.DIRT, 16)); dirt.setLocationAndAngles(p.getPosX(), p.getPosY(), p.getPosZ(), 0.0F, 0.0F); p.world.addEntity(dirt); } } } I'm pretty sure that the error has to be in the code snippet I posted above tho(I tried adding a potion effect to the player to check if the event fires and that worked)
  4. So I want the player to drop 16 blocks of dirt when crouching(yes I know, very funny) but the items just won't spawn. The event definitelly fires. Here's the code. PlayerEntity p = event.getPlayer(); ItemEntity dirt = new ItemEntity(p.world, p.getPosX(), p.getPosY(), p.getPosZ(), new ItemStack(Items.DIRT, 16)); dirt.setLocationAndAngles(p.getPosX(), p.getPosY(), p.getPosZ(), 0.0F, 0.0F); p.world.addEntity(dirt);
×
×
  • Create New...

Important Information

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