Advertisement
PSquishyP

Untitled

Jun 2nd, 2015
376
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.45 KB | None | 0 0
  1. package noahc3.MaterialBlobs;
  2.  
  3. import net.minecraft.entity.EntityLivingBase;
  4. import net.minecraft.entity.projectile.EntityThrowable;
  5. import net.minecraft.init.Blocks;
  6. import net.minecraft.util.MovingObjectPosition;
  7. import net.minecraft.util.MovingObjectPosition.MovingObjectType;
  8. import net.minecraft.world.World;
  9.  
  10. public class EntityDirtBlob extends EntityThrowable
  11. {
  12.    
  13.     //world setBlock() = new world.setBlock();
  14.    
  15.     public EntityDirtBlob(World par1World, double par2, double par4, double par6)
  16.     {
  17.     super(par1World, par2, par4, par6);
  18.     }
  19.     public EntityDirtBlob(World par1World, EntityLivingBase par2EntityLivingBase)
  20.     {
  21.     super(par1World, par2EntityLivingBase);
  22.     }
  23.     public EntityDirtBlob(World par1World)
  24.     {
  25.     super(par1World);
  26.     }
  27.     @Override
  28.     protected void onImpact(MovingObjectPosition mop)
  29.     {
  30.         if(mop.typeOfHit == MovingObjectType.BLOCK)
  31.         {
  32.         switch(mop.sideHit)
  33.         {
  34.         case 0: //BOTTOM
  35.         mop.blockY--;
  36.         break;
  37.         case 1: //TOP
  38.         mop.blockY++;
  39.         break;
  40.         case 2: //EAST
  41.         mop.blockZ--;
  42.         break;
  43.         case 3: //WEST
  44.         mop.blockZ++;
  45.         break;
  46.         case 4: //NORTH
  47.         mop.blockX--;
  48.         break;
  49.         case 5: //SOUTH
  50.         mop.blockX++;
  51.         break;
  52.         }
  53.        
  54.         world.setBlock(mop.blockX, mop.blockY, mop.blockZ, Blocks.dirt);
  55.        
  56.         //world in world.setBlock(...) is underlined, when hovering over it, eclipse says world cannot be resolved.
  57.         }
  58.         if (!this.worldObj.isRemote)
  59.         {
  60.         this.setDead();
  61.         }
  62.      System.out.println("Entity landed!");
  63.     }
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement