TechReborn/src/main/java/techreborn/tiles/TileLathe.java

115 lines
2.3 KiB
Java
Raw Normal View History

2015-05-08 01:15:04 +02:00
package techreborn.tiles;
import ic2.api.energy.prefab.BasicSink;
import ic2.api.energy.tile.IEnergyTile;
2015-05-08 01:15:04 +02:00
import ic2.api.tile.IWrenchable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
2015-05-08 01:15:04 +02:00
import techreborn.api.recipe.RecipeCrafter;
import techreborn.config.ConfigTechReborn;
import techreborn.init.ModBlocks;
import techreborn.util.Inventory;
public class TileLathe extends TileMachineBase implements IWrenchable, IEnergyTile {
2015-05-08 01:15:04 +02:00
public int tickTime;
public BasicSink energy;
public Inventory inventory = new Inventory(3, "TileLathe", 64);
public RecipeCrafter crafter;
public TileLathe()
{
//TODO configs
energy = new BasicSink(this, 1000, 2);
//Input slots
int[] inputs = new int[1];
inputs[0] = 0;
int[] outputs = new int[1];
outputs[0] = 2;
crafter = new RecipeCrafter("latheRecipe", this, energy, 2, 2, inventory, inputs, outputs);
}
@Override
public void updateEntity()
{
super.updateEntity();
energy.updateEntity();
crafter.updateEntity();
}
@Override
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side)
{
return false;
}
@Override
public short getFacing()
{
return 0;
}
@Override
public void setFacing(short facing)
{
}
@Override
public boolean wrenchCanRemove(EntityPlayer entityPlayer)
{
if (entityPlayer.isSneaking())
{
return true;
}
return false;
2015-05-08 01:15:04 +02:00
}
@Override
public float getWrenchDropRate()
{
return 1.0F;
}
@Override
public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
{
2015-05-08 01:23:15 +02:00
return new ItemStack(ModBlocks.lathe, 1);
2015-05-08 01:15:04 +02:00
}
public boolean isComplete()
{
return false;
}
@Override
public void readFromNBT(NBTTagCompound tagCompound)
{
super.readFromNBT(tagCompound);
inventory.readFromNBT(tagCompound);
energy.readFromNBT(tagCompound);
crafter.readFromNBT(tagCompound);
}
@Override
public void writeToNBT(NBTTagCompound tagCompound)
{
super.writeToNBT(tagCompound);
inventory.writeToNBT(tagCompound);
energy.writeToNBT(tagCompound);
crafter.writeToNBT(tagCompound);
}
@Override
public void invalidate()
{
energy.invalidate();
}
@Override
public void onChunkUnload()
{
energy.onChunkUnload();
}
2015-05-08 01:15:04 +02:00
}