Advertisement
Guest User

Untitled

a guest
Nov 28th, 2015
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. package fr.elias.eliasgun.common;
  2.  
  3. import java.util.List;
  4.  
  5. import fr.elias.eliasgun.common.IGrenade.EnumGrenadeType;
  6. import net.minecraft.entity.Entity;
  7. import net.minecraft.entity.EntityLivingBase;
  8. import net.minecraft.entity.monster.EntityCreeper;
  9. import net.minecraft.init.Blocks;
  10. import net.minecraft.util.DamageSource;
  11. import net.minecraft.util.MovingObjectPosition;
  12. import net.minecraft.world.World;
  13.  
  14. public class EntityGrenadeSticky extends EntityGrenade implements IGrenade
  15. {
  16. public EntityGrenadeSticky(World world)
  17. {
  18. super(world);
  19. explosionStrength = 4F;
  20. }
  21.  
  22. public EntityGrenadeSticky(World world, double d, double d1, double d2) {
  23. super(world, d, d1, d2);
  24. explosionStrength = 4F;
  25. }
  26.  
  27. public EntityGrenadeSticky(World world, EntityLivingBase entityliving) {
  28. super(world, entityliving);
  29. explosionStrength = 4F;
  30. }
  31. public void onUpdate()
  32. {
  33. List list = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, getEntityBoundingBox());
  34. if(list.size() > 0)
  35. {
  36. Entity entity = (Entity)list.get(0);
  37. if(entity != getThrower())
  38. {
  39. this.mountEntity(entity);
  40. if(entity instanceof EntityCreeper)
  41. {
  42. explosionStrength = 16F;
  43. }
  44. }else{
  45. this.mountEntity(null);
  46. }
  47. }
  48. if(!worldObj.isAirBlock(getPosition().down()) || !worldObj.isAirBlock(getPosition().north())|| !worldObj.isAirBlock(getPosition().east()) || !worldObj.isAirBlock(getPosition().west()))
  49. {
  50. motionX = motionY = motionZ = 0.0D;
  51. }
  52. super.onUpdate();
  53. }
  54. protected void handleExplode()
  55. {
  56. super.handleExplode();
  57. }
  58. public EnumGrenadeType getGrenadeType()
  59. {
  60. return EnumGrenadeType.STICKY;
  61. }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement