Sawmill now needs multiblock

This commit is contained in:
Gig 2015-06-27 16:10:43 +01:00
parent a5a8265c8b
commit 3c4439ec5c
2 changed files with 36 additions and 2 deletions

View file

@ -8,11 +8,14 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.*;
import techreborn.api.recipe.RecipeCrafter;
import techreborn.blocks.BlockMachineCasing;
import techreborn.init.ModBlocks;
import techreborn.init.ModFluids;
import techreborn.lib.Location;
import techreborn.util.Inventory;
import techreborn.util.Tank;
@ -45,9 +48,32 @@ public class TileIndustrialSawmill extends TileMachineBase implements IWrenchabl
public void updateEntity()
{
super.updateEntity();
energy.updateEntity();
crafter.updateEntity();
if(getMutliBlock())
{
energy.updateEntity();
crafter.updateEntity();
}
}
public boolean getMutliBlock() {
for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
TileEntity tileEntity = worldObj.getTileEntity(xCoord + direction.offsetX, yCoord + direction.offsetY, zCoord + direction.offsetZ);
if (tileEntity instanceof TileMachineCasing) {
if ((tileEntity.getBlockType() instanceof BlockMachineCasing)) {
int heat;
heat = BlockMachineCasing.getHeatFromMeta(tileEntity.getBlockMetadata());
Location location = new Location(xCoord, yCoord, zCoord, direction);
location.modifyPositionFromSide(direction, 1);
if (worldObj.getBlock(location.getX(), location.getY(), location.getZ()).getUnlocalizedName().equals("tile.lava")) {
heat += 500;
}
return true;
}
}
}
return false;
}
@Override
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side)