Advertisement
Guest User

TileEntity

a guest
May 29th, 2014
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.82 KB | None | 0 0
  1. package portuar.cubicBeyond.client.blocks.decondenseur;
  2.  
  3. import net.minecraft.entity.monster.EntityCaveSpider;
  4. import net.minecraft.entity.monster.EntityCreeper;
  5. import net.minecraft.entity.monster.EntityEnderman;
  6. import net.minecraft.entity.passive.EntityBat;
  7. import net.minecraft.entity.passive.EntityChicken;
  8. import net.minecraft.entity.passive.EntityCow;
  9. import net.minecraft.entity.passive.EntityMooshroom;
  10. import net.minecraft.entity.passive.EntityPig;
  11. import net.minecraft.entity.passive.EntitySheep;
  12. import net.minecraft.nbt.NBTTagCompound;
  13. import net.minecraft.network.NetworkManager;
  14. import net.minecraft.network.Packet;
  15. import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
  16. import net.minecraft.tileentity.TileEntity;
  17.  
  18. public class TileEntityDecondenseur extends TileEntity
  19.  
  20. {
  21.     public float motorAngle, prevMotorAngle;
  22.     public boolean isUse;
  23.     public int itemId, coolDown;
  24.  
  25.     public void readFromNBT(NBTTagCompound nbtTag)
  26.     {
  27.         super.readFromNBT(nbtTag);
  28.         isUse = nbtTag.getBoolean("isUse");
  29.         itemId = nbtTag.getInteger("itemId");
  30.         coolDown = nbtTag.getInteger("coolDown");
  31.     }
  32.  
  33.     public void writeToNBT(NBTTagCompound nbtTag)
  34.     {
  35.         super.writeToNBT(nbtTag);
  36.         nbtTag.setBoolean("isUse", isUse);
  37.         nbtTag.setInteger("itemId", itemId);
  38.         nbtTag.setInteger("coolDown", coolDown);
  39.     }
  40.  
  41.    
  42.     public void updateEntity()
  43.     {
  44.         System.out.println(this.isUse);
  45.         if(this.isUse == true)
  46.         {      
  47.             this.prevMotorAngle = this.motorAngle;
  48.             this.motorAngle += 0.05F;
  49.             this.coolDown--;
  50.            
  51.             if(this.coolDown < 0)
  52.             {
  53.                 if(this.itemId == 1)
  54.                 {
  55.                     EntityPig entity = new EntityPig(this.worldObj);
  56.                     entity.setLocationAndAngles(this.xCoord, this.yCoord + 1, this.zCoord, 0.0F, 0.0F);
  57.                     this.worldObj.spawnEntityInWorld(entity);
  58.                     this.itemId = 0;
  59.                 }
  60.  
  61. }
  62.  
  63.         }
  64.     }
  65.  
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement