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)