Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.chef.mod.tileentity;
- import com.chef.mod.Debugger;
- import com.chef.mod.blocks.ButterChurn;
- import net.minecraft.block.state.IBlockState;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.entity.player.InventoryPlayer;
- import net.minecraft.inventory.Container;
- import net.minecraft.item.ItemStack;
- import net.minecraft.nbt.NBTTagCompound;
- import net.minecraft.server.gui.IUpdatePlayerListBox;
- import net.minecraft.tileentity.TileEntity;
- import net.minecraft.util.IChatComponent;
- import net.minecraft.world.IInteractionObject;
- import net.minecraft.world.ILockableContainer;
- import net.minecraft.world.LockCode;
- public class TileEntityButterChurn extends TileEntity implements IUpdatePlayerListBox {
- private int butterTime;
- @Override
- public void update() {
- Debugger.log(butterTime);
- IBlockState state = this.worldObj.getBlockState(pos);
- int level = ((Integer) state.getValue(ButterChurn.LEVEL)).intValue();
- if (level == 5) {
- if (butterTime < 12000) {
- butterTime++;
- } else {
- this.worldObj.setBlockState(this.pos, state.withProperty(ButterChurn.LEVEL, level + 1), 2);
- }
- } else {
- butterTime = 0;
- }
- this.markDirty();
- }
- public void readFromNBT(NBTTagCompound compound) {
- Debugger.log("NBT");
- super.readFromNBT(compound);
- this.butterTime = compound.getShort("ButterTime");
- }
- public void writeToNBT(NBTTagCompound compound) {
- Debugger.log("NBT");
- super.writeToNBT(compound);
- compound.setShort("ButterTime", (short) this.butterTime);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement