Advertisement
oneofthem999

NeutralizationBlock

Jun 11th, 2016
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. public class NeutralizationBlock extends Block
  2. {
  3. public NeutralizationBlock()
  4. {
  5. super(Material.IRON);
  6. this.setUnlocalizedName("neutralBlock");
  7. this.setCreativeTab(CreativeTabs.BUILDING_BLOCKS);
  8. this.setResistance(5.0F);
  9. this.setHardness(5.0F);
  10. this.setLightLevel(0.5F);
  11. this.setHarvestLevel("pickaxe", 1);
  12. }
  13.  
  14. /**
  15. * This method will check whether or not the block has been collied with vertically. If so, it will remove all of
  16. * the potion effects the player has.
  17. */
  18. @Override
  19. public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entity)
  20. {
  21. if (!(entity instanceof EntityPlayer))
  22. {
  23. return;
  24. }
  25.  
  26. EntityPlayer player = (EntityPlayer) entity;
  27.  
  28. if (!player.isCollidedVertically)
  29. {
  30. return;
  31. }
  32.  
  33. else
  34. {
  35. player.clearActivePotions();
  36. }
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement