Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package noahc3.MaterialBlobs;
- import net.minecraft.entity.EntityLivingBase;
- import net.minecraft.entity.projectile.EntityThrowable;
- import net.minecraft.init.Blocks;
- import net.minecraft.util.MovingObjectPosition;
- import net.minecraft.util.MovingObjectPosition.MovingObjectType;
- import net.minecraft.world.World;
- public class EntityDirtBlob extends EntityThrowable
- {
- //world setBlock() = new world.setBlock();
- public EntityDirtBlob(World par1World, double par2, double par4, double par6)
- {
- super(par1World, par2, par4, par6);
- }
- public EntityDirtBlob(World par1World, EntityLivingBase par2EntityLivingBase)
- {
- super(par1World, par2EntityLivingBase);
- }
- public EntityDirtBlob(World par1World)
- {
- super(par1World);
- }
- @Override
- protected void onImpact(MovingObjectPosition mop)
- {
- if(mop.typeOfHit == MovingObjectType.BLOCK)
- {
- switch(mop.sideHit)
- {
- case 0: //BOTTOM
- mop.blockY--;
- break;
- case 1: //TOP
- mop.blockY++;
- break;
- case 2: //EAST
- mop.blockZ--;
- break;
- case 3: //WEST
- mop.blockZ++;
- break;
- case 4: //NORTH
- mop.blockX--;
- break;
- case 5: //SOUTH
- mop.blockX++;
- break;
- }
- world.setBlock(mop.blockX, mop.blockY, mop.blockZ, Blocks.dirt);
- //world in world.setBlock(...) is underlined, when hovering over it, eclipse says world cannot be resolved.
- }
- if (!this.worldObj.isRemote)
- {
- this.setDead();
- }
- System.out.println("Entity landed!");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement