Guest User

Untitled

a guest
Apr 27th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. package dovahofkiin.brewery.common.tileentity;
  2.  
  3. import dovahofkiin.brewery.BreweryRecipeHelper;
  4. import net.minecraft.entity.item.EntityItem;
  5. import net.minecraft.item.ItemStack;
  6. import net.minecraft.tileentity.TileEntity;
  7. import net.minecraft.util.ITickable;
  8. import net.minecraft.util.math.BlockPos;
  9.  
  10. public class BreweryTileEntity extends TileEntity implements ITickable {
  11.  
  12. private int timer;
  13.  
  14. public BreweryTileEntity() {
  15. super();
  16. this.timer = 0;
  17. }
  18.  
  19. @Override
  20. public void update() {
  21. ItemStack i = BreweryRecipeHelper.checkIfRecipeExists(worldObj.getBlockState(new BlockPos(pos.getX(), pos.getY()+1, pos.getZ())).getBlock(),
  22. worldObj.getBlockState(new BlockPos(pos.getX(), pos.getY()+3, pos.getZ())).getBlock());
  23. if (i != null) {
  24. if (timer == 100) {
  25. if (!worldObj.isRemote) {
  26. worldObj.spawnEntityInWorld(new EntityItem(worldObj, pos.getX() + 2, pos.getY(), pos.getZ(), i));
  27. timer = 0;
  28. }
  29. }
  30. timer++;
  31. }
  32. else {
  33. timer = 0;
  34. }
  35. }
  36.  
  37. }
Add Comment
Please, Sign In to add comment