Lathe Working
This commit is contained in:
@@ -14,7 +14,7 @@ public class FlintLathe extends LatheBase{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int i) {
|
public TileEntity createNewTileEntity(World world, int i) {
|
||||||
return new TileEntLatheBase("TileEntFlintLathe");
|
return new TileEntLatheBase();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,17 @@
|
|||||||
package nmd.primal.energy.block.lathe;
|
package nmd.primal.energy.block.lathe;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockContainer;
|
import net.minecraft.block.BlockContainer;
|
||||||
import net.minecraft.block.ITileEntityProvider;
|
import net.minecraft.block.ITileEntityProvider;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.item.EntityItem;
|
import net.minecraft.entity.item.EntityItem;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import nmd.primal.energy.common.ModInfo;
|
import nmd.primal.energy.common.ModInfo;
|
||||||
import nmd.primal.energy.item.ModItems;
|
import nmd.primal.energy.item.ModItems;
|
||||||
@@ -15,6 +21,8 @@ import nmd.primal.energy.util.CustomTab;
|
|||||||
|
|
||||||
public abstract class LatheBase extends BlockContainer implements ITileEntityProvider{
|
public abstract class LatheBase extends BlockContainer implements ITileEntityProvider{
|
||||||
|
|
||||||
|
private final Random random = new Random();
|
||||||
|
|
||||||
protected LatheBase(String unlocalizedName, Material material) {
|
protected LatheBase(String unlocalizedName, Material material) {
|
||||||
super(material);
|
super(material);
|
||||||
this.setBlockName(unlocalizedName);
|
this.setBlockName(unlocalizedName);
|
||||||
@@ -29,37 +37,48 @@ public abstract class LatheBase extends BlockContainer implements ITileEntityPro
|
|||||||
|
|
||||||
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int q, float a, float b, float c) {
|
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int q, float a, float b, float c) {
|
||||||
|
|
||||||
TileEntLatheBase tileEnt = (TileEntLatheBase) world.getTileEntity(x, y, z);
|
|
||||||
if(!world.isRemote){
|
if(!world.isRemote){
|
||||||
|
TileEntLatheBase tileEnt = (TileEntLatheBase) world.getTileEntity(x, y, z);
|
||||||
if(player.inventory.getCurrentItem()!=null){
|
if(player.inventory.getCurrentItem()!=null){
|
||||||
if(player.inventory.getCurrentItem().getItem()!=ModItems.schiselItem){
|
if(player.inventory.getCurrentItem().getItem()!=ModItems.schiselItem){
|
||||||
if (tileEnt.getStackInSlot(0)==null){
|
if (tileEnt.getStackInSlot(0)==null){
|
||||||
tileEnt.setInventorySlotContents(0, player.inventory.getCurrentItem());
|
tileEnt.setInventorySlotContents(0, player.inventory.getCurrentItem());
|
||||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
|
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
|
||||||
|
tileEnt.markForUpdate();
|
||||||
|
tileEnt.markDirty();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
if (tileEnt.getStackInSlot(0)!=null){
|
if (tileEnt.getStackInSlot(0)!=null){
|
||||||
if(player.inventory.getCurrentItem()!=null){
|
if(player.inventory.getCurrentItem()!=null){
|
||||||
ItemStack pStack = player.inventory.getCurrentItem().copy();
|
if(player.inventory.getCurrentItem().getItem()!=ModItems.schiselItem){
|
||||||
ItemStack sStack = tileEnt.getStackInSlot(0).copy();
|
ItemStack pStack = player.inventory.getCurrentItem().copy();
|
||||||
ItemStack sStackTemp = tileEnt.getStackInSlot(0).copy();
|
ItemStack sStack = tileEnt.getStackInSlot(0).copy();
|
||||||
if(tileEnt.getStackInSlot(0).stackSize < 64){
|
ItemStack sStackTemp = tileEnt.getStackInSlot(0).copy();
|
||||||
sStackTemp.stackSize++;
|
if(tileEnt.getStackInSlot(0).stackSize < 64){
|
||||||
if ((sStack.getItem().equals(pStack.getItem())) && (sStack.getItemDamage() == pStack.getItemDamage()) ){
|
sStackTemp.stackSize++;
|
||||||
tileEnt.setInventorySlotContents(0, sStackTemp);
|
if ((sStack.getItem().equals(pStack.getItem())) && (sStack.getItemDamage() == pStack.getItemDamage()) ){
|
||||||
player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
tileEnt.setInventorySlotContents(0, sStackTemp);
|
||||||
|
player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
||||||
|
tileEnt.markForUpdate();
|
||||||
|
tileEnt.markDirty();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (player.isSneaking() && player.inventory.getCurrentItem()==null) {
|
if (player.isSneaking() && player.inventory.getCurrentItem()==null) {
|
||||||
if(tileEnt.getStackInSlot(0)!=null){
|
if(tileEnt.getStackInSlot(0)!=null){
|
||||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, tileEnt.getStackInSlot(0));
|
player.inventory.setInventorySlotContents(player.inventory.currentItem, tileEnt.getStackInSlot(0));
|
||||||
tileEnt.setInventorySlotContents(0, null);
|
tileEnt.setInventorySlotContents(0, null);
|
||||||
|
tileEnt.markForUpdate();
|
||||||
|
tileEnt.markDirty();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
if (!player.isSneaking()) {
|
if (!player.isSneaking()) {
|
||||||
if((player.inventory.getCurrentItem()==null)){
|
if((player.inventory.getCurrentItem()==null)){
|
||||||
@@ -68,16 +87,70 @@ public abstract class LatheBase extends BlockContainer implements ITileEntityPro
|
|||||||
pStack.stackSize = 1;
|
pStack.stackSize = 1;
|
||||||
world.spawnEntityInWorld(new EntityItem(world, player.posX, player.posY, player.posZ, pStack));
|
world.spawnEntityInWorld(new EntityItem(world, player.posX, player.posY, player.posZ, pStack));
|
||||||
tileEnt.decrStackSize(0, 1);
|
tileEnt.decrStackSize(0, 1);
|
||||||
|
tileEnt.markForUpdate();
|
||||||
|
tileEnt.markDirty();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if(player.inventory.getCurrentItem()!=null){
|
||||||
|
if(player.inventory.getCurrentItem().getItem()==ModItems.schiselItem){
|
||||||
|
if(tileEnt.getStackInSlot(0)!=null){
|
||||||
|
if(tileEnt.getStackInSlot(0).getItem().equals(Item.getItemFromBlock(Blocks.wooden_slab))){
|
||||||
|
tileEnt.workCount++;
|
||||||
|
player.inventory.getCurrentItem().damageItem(1, player);
|
||||||
|
//System.out.println(tileEnt.workCount);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tileEnt.markForUpdate();
|
|
||||||
tileEnt.markDirty();
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
|
||||||
|
TileEntLatheBase tileEnt = (TileEntLatheBase) world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
|
if (tileEnt != null) {
|
||||||
|
for (int i = 0; i < tileEnt.getSizeInventory(); ++i) {
|
||||||
|
ItemStack itemstack = tileEnt.getStackInSlot(i);
|
||||||
|
|
||||||
|
if (itemstack != null) {
|
||||||
|
float f = this.random.nextFloat() * 0.6F + 0.1F;
|
||||||
|
float f1 = this.random.nextFloat() * 0.6F + 0.1F;
|
||||||
|
float f2 = this.random.nextFloat() * 0.6F + 0.1F;
|
||||||
|
|
||||||
|
while (itemstack.stackSize > 0) {
|
||||||
|
int j = this.random.nextInt(21) + 10;
|
||||||
|
|
||||||
|
if (j > itemstack.stackSize) {
|
||||||
|
j = itemstack.stackSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
itemstack.stackSize -= j;
|
||||||
|
EntityItem entityitem = new EntityItem(world, x + f, y + f1, z + f2, new ItemStack(itemstack.getItem(), j, itemstack.getItemDamage()));
|
||||||
|
|
||||||
|
if (itemstack.hasTagCompound()) {
|
||||||
|
entityitem.getEntityItem().setTagCompound(((NBTTagCompound) itemstack.getTagCompound().copy()));
|
||||||
|
}
|
||||||
|
|
||||||
|
float f3 = 0.025F;
|
||||||
|
entityitem.motionX = (float) this.random.nextGaussian() * f3;
|
||||||
|
entityitem.motionY = (float) this.random.nextGaussian() * f3 + 0.1F;
|
||||||
|
entityitem.motionZ = (float) this.random.nextGaussian() * f3;
|
||||||
|
world.spawnEntityInWorld(entityitem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
world.func_147453_f(x, y, z, block);
|
||||||
|
}
|
||||||
|
|
||||||
|
super.breakBlock(world, x, y, z, block, meta);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderType() {
|
public int getRenderType() {
|
||||||
return RenderID.latheID;
|
return RenderID.latheID;
|
||||||
|
|||||||
@@ -1,14 +1,18 @@
|
|||||||
package nmd.primal.energy.item;
|
package nmd.primal.energy.item;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.util.MovingObjectPosition;
|
import net.minecraft.util.MovingObjectPosition;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import nmd.primal.energy.block.ModBlocks;
|
import nmd.primal.energy.block.ModBlocks;
|
||||||
import nmd.primal.energy.common.ModInfo;
|
import nmd.primal.energy.common.ModInfo;
|
||||||
|
import nmd.primal.energy.tileents.TileEntLatheBase;
|
||||||
import nmd.primal.energy.util.CustomTab;
|
import nmd.primal.energy.util.CustomTab;
|
||||||
import cpw.mods.fml.common.registry.GameRegistry;
|
import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
|
|
||||||
@@ -30,22 +34,62 @@ public class SChiselItem extends Item{
|
|||||||
GameRegistry.registerItem(this, name);
|
GameRegistry.registerItem(this, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onUsingTick(ItemStack stack, EntityPlayer player, int count){
|
/*public void onUpdate(ItemStack stack, World world, Entity ent, int slot, boolean active) {
|
||||||
|
|
||||||
}
|
if(active == true){
|
||||||
|
EntityPlayer player = (EntityPlayer) ent;
|
||||||
|
|
||||||
|
if(player.isUsingItem()==true){
|
||||||
|
int dir = (MathHelper.floor_double((double)(player.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3);
|
||||||
|
if(dir==0){
|
||||||
|
world.getBlock((int)Math.floor(player.posX), (int)Math.floor(player.posY), (int)Math.floor(player.posZ)+1);
|
||||||
|
System.out.println(world.getBlock((int)Math.floor(player.posX), (int)Math.floor(player.posY), (int)Math.floor(player.posZ)+1));
|
||||||
|
System.out.println(((int)Math.floor(player.posX)) +" "+ ((int)Math.floor(player.posY)) +" "+ ((int)Math.floor(player.posZ)+1));
|
||||||
|
}
|
||||||
|
if(dir==1){
|
||||||
|
|
||||||
|
}
|
||||||
|
if(dir==2){
|
||||||
|
|
||||||
|
}
|
||||||
|
if(dir==3){
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}*/
|
||||||
|
|
||||||
|
/*@Override
|
||||||
|
public void onPlayerStoppedUsing(ItemStack stack, World world, EntityPlayer player, int count) {
|
||||||
|
System.out.println("Stopped Using "+ count);
|
||||||
|
}*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPlayerStoppedUsing(ItemStack stack, World world, EntityPlayer player, int count) {
|
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int d, float u, float i, float j)
|
||||||
System.out.println("Stopped Using "+ count);
|
{
|
||||||
}
|
|
||||||
|
/*if(!world.isRemote){
|
||||||
|
System.out.println("Using");
|
||||||
|
if(world.getBlock(x, y, z).equals(ModBlocks.flintLathe)){
|
||||||
|
TileEntLatheBase tileLathe = (TileEntLatheBase) world.getTileEntity(x, y, z);
|
||||||
|
//if(tileLathe.getStackInSlot(0).getItem().equals(Item.getItemFromBlock(Blocks.wooden_slab))){
|
||||||
|
//tileLathe.workCount++;
|
||||||
|
tileLathe.markForUpdate();
|
||||||
|
System.out.println(tileLathe.workCount);
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
|
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
|
||||||
{
|
{
|
||||||
//System.out.println("In Use");
|
//System.out.println("In Use");
|
||||||
player.setItemInUse(stack, 72000);
|
|
||||||
if(!world.isRemote){
|
|
||||||
|
|
||||||
|
if(!world.isRemote){
|
||||||
|
//player.setItemInUse(stack, 72000);
|
||||||
}
|
}
|
||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import net.minecraft.client.renderer.entity.RenderItem;
|
|||||||
import net.minecraft.client.renderer.entity.RenderManager;
|
import net.minecraft.client.renderer.entity.RenderManager;
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||||
import net.minecraft.entity.item.EntityItem;
|
import net.minecraft.entity.item.EntityItem;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
@@ -56,18 +58,25 @@ public class RenderLathe extends TileEntitySpecialRenderer {
|
|||||||
this.entItem.hoverStart = 0.0F;
|
this.entItem.hoverStart = 0.0F;
|
||||||
RenderItem.renderInFrame = true;
|
RenderItem.renderInFrame = true;
|
||||||
GL11.glScalef(1.0f, 1.0f, 1.0f);
|
GL11.glScalef(1.0f, 1.0f, 1.0f);
|
||||||
GL11.glRotatef(90f, 0.0F, 1.0F, 0.0F);
|
if(tile.getStackInSlot(0).getItem().equals(Item.getItemFromBlock(Blocks.wooden_slab))){
|
||||||
|
GL11.glRotatef(90f, 1.0F, 0.0F, 0.0F);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if(tile.isPowered == true){
|
if(tile.isPowered == true){
|
||||||
|
if(tile.getStackInSlot(0).getItem().equals(Item.getItemFromBlock(Blocks.wooden_slab))){
|
||||||
|
GL11.glRotatef(i, 0.0F, 1.0F, 0.0F);
|
||||||
|
}else{
|
||||||
|
GL11.glRotatef(i, 0.0F, 0.0F, 1.0F);
|
||||||
|
}
|
||||||
|
|
||||||
GL11.glRotatef(i, 1.0F, 0.0F, 0.0F);
|
RenderManager.instance.renderEntityWithPosYaw(entItem, 0.0D, -0.223D, 0.0D, 0.0F, 0.0F);
|
||||||
RenderManager.instance.renderEntityWithPosYaw(entItem, 0.0D, -0.15D, 0.0D, 0.0F, 0.0F);
|
|
||||||
a++;
|
a++;
|
||||||
if(a==1){
|
if(a==1){
|
||||||
i=i+14;
|
i=i-14;
|
||||||
a=0;
|
a=0;
|
||||||
}
|
}
|
||||||
if(i==360){
|
if(i>=360||i<=-360){
|
||||||
i=0;
|
i=0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,28 +20,6 @@ public class TileBase extends TileEntity{
|
|||||||
worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
|
worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateEntity() {
|
|
||||||
World world = this.getWorldObj();
|
|
||||||
int x = this.xCoord;
|
|
||||||
int y = this.yCoord;
|
|
||||||
int z = this.zCoord;
|
|
||||||
if (worldObj.isRemote) return;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readFromNBT(NBTTagCompound tagCompound)
|
|
||||||
{
|
|
||||||
super.readFromNBT(tagCompound);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToNBT(NBTTagCompound tagCompound)
|
|
||||||
{
|
|
||||||
super.writeToNBT(tagCompound);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Packet getDescriptionPacket() {
|
public Packet getDescriptionPacket() {
|
||||||
NBTTagCompound nbt = new NBTTagCompound();
|
NBTTagCompound nbt = new NBTTagCompound();
|
||||||
|
|||||||
@@ -1,20 +1,29 @@
|
|||||||
package nmd.primal.energy.tileents;
|
package nmd.primal.energy.tileents;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.nbt.NBTTagList;
|
import net.minecraft.nbt.NBTTagList;
|
||||||
|
import net.minecraft.network.NetworkManager;
|
||||||
|
import net.minecraft.network.Packet;
|
||||||
|
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.common.IExtendedEntityProperties;
|
||||||
|
import nmd.primal.energy.item.ModItems;
|
||||||
|
|
||||||
public class TileEntLatheBase extends TileBase implements IInventory {
|
public class TileEntLatheBase extends TileEntity implements IInventory {
|
||||||
|
|
||||||
private ItemStack[] inv;
|
private ItemStack[] inv;
|
||||||
private int i;
|
private int i;
|
||||||
public boolean isPowered;
|
public boolean isPowered = true;
|
||||||
|
public int workCount;
|
||||||
|
protected String specName = "TileEntLatheBase";
|
||||||
|
|
||||||
public TileEntLatheBase(String name) {
|
public TileEntLatheBase() {
|
||||||
super(name);
|
|
||||||
this.inv = new ItemStack[1];
|
this.inv = new ItemStack[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -28,6 +37,23 @@ public class TileEntLatheBase extends TileBase implements IInventory {
|
|||||||
return this.inv[slot];
|
return this.inv[slot];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void markForUpdate(){
|
||||||
|
worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Packet getDescriptionPacket() {
|
||||||
|
NBTTagCompound nbt = new NBTTagCompound();
|
||||||
|
writeToNBT(nbt);
|
||||||
|
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -998, nbt);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
||||||
|
readFromNBT(pkt.func_148857_g());
|
||||||
|
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
World world = this.getWorldObj();
|
World world = this.getWorldObj();
|
||||||
@@ -37,11 +63,19 @@ public class TileEntLatheBase extends TileBase implements IInventory {
|
|||||||
if(this.isPowered==true){
|
if(this.isPowered==true){
|
||||||
i++;
|
i++;
|
||||||
if(i>16){
|
if(i>16){
|
||||||
this.isPowered=false;
|
//this.isPowered=false;
|
||||||
i=0;
|
i=0;
|
||||||
|
if(this.workCount>=20){
|
||||||
|
this.setInventorySlotContents(0, new ItemStack(ModItems.swheelItem, 1));
|
||||||
|
this.workCount=0;
|
||||||
|
this.markForUpdate();
|
||||||
|
this.markDirty();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (worldObj.isRemote) return;
|
if (worldObj.isRemote) return;
|
||||||
|
if (!worldObj.isRemote) return;
|
||||||
//System.out.println(this.isPowered + " " + i);
|
//System.out.println(this.isPowered + " " + i);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,7 +150,7 @@ public class TileEntLatheBase extends TileBase implements IInventory {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getInventoryStackLimit() {
|
public int getInventoryStackLimit() {
|
||||||
return 64;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -155,6 +189,7 @@ public class TileEntLatheBase extends TileBase implements IInventory {
|
|||||||
this.specName = tagCompound.getString("CustomName");
|
this.specName = tagCompound.getString("CustomName");
|
||||||
}
|
}
|
||||||
this.isPowered = tagCompound.getBoolean("ISPOWERED");
|
this.isPowered = tagCompound.getBoolean("ISPOWERED");
|
||||||
|
this.workCount = tagCompound.getInteger("WORKCOUNT");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -172,6 +207,7 @@ public class TileEntLatheBase extends TileBase implements IInventory {
|
|||||||
}
|
}
|
||||||
tagCompound.setTag("Inventory", itemList);
|
tagCompound.setTag("Inventory", itemList);
|
||||||
tagCompound.setBoolean("ISPOWERED", this.isPowered);
|
tagCompound.setBoolean("ISPOWERED", this.isPowered);
|
||||||
|
tagCompound.setInteger("WORKCOUNT", this.workCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user