Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package dovahofkiin.brewery.common.tileentity;
- import dovahofkiin.brewery.BreweryRecipeHelper;
- import net.minecraft.entity.item.EntityItem;
- import net.minecraft.item.ItemStack;
- import net.minecraft.tileentity.TileEntity;
- import net.minecraft.util.ITickable;
- import net.minecraft.util.math.BlockPos;
- public class BreweryTileEntity extends TileEntity implements ITickable {
- private int timer;
- public BreweryTileEntity() {
- super();
- this.timer = 0;
- }
- @Override
- public void update() {
- ItemStack i = BreweryRecipeHelper.checkIfRecipeExists(worldObj.getBlockState(new BlockPos(pos.getX(), pos.getY()+1, pos.getZ())).getBlock(),
- worldObj.getBlockState(new BlockPos(pos.getX(), pos.getY()+3, pos.getZ())).getBlock());
- if (i != null) {
- if (timer == 100) {
- if (!worldObj.isRemote) {
- worldObj.spawnEntityInWorld(new EntityItem(worldObj, pos.getX() + 2, pos.getY(), pos.getZ(), i));
- timer = 0;
- }
- }
- timer++;
- }
- else {
- timer = 0;
- }
- }
- }
Add Comment
Please, Sign In to add comment