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

@ -1,5 +1,6 @@
package techreborn.client.gui; package techreborn.client.gui;
import codechicken.lib.gui.GuiDraw;
import ic2.core.util.DrawUtil; import ic2.core.util.DrawUtil;
import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.gui.inventory.GuiContainer;
@ -10,6 +11,7 @@ import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector; import net.minecraft.util.StatCollector;
import techreborn.client.container.ContainerIndustrialSawmill; import techreborn.client.container.ContainerIndustrialSawmill;
import techreborn.lib.ModInfo;
import techreborn.tiles.TileIndustrialSawmill; import techreborn.tiles.TileIndustrialSawmill;
public class GuiIndustrialSawmill extends GuiContainer { public class GuiIndustrialSawmill extends GuiContainer {
@ -75,6 +77,12 @@ public class GuiIndustrialSawmill extends GuiContainer {
drawTexturedModalRect(k + 11, l + 19, 176, 86, 12, 47); drawTexturedModalRect(k + 11, l + 19, 176, 86, 12, 47);
} }
} }
if(sawmill.getMutliBlock() != true)
{
GuiDraw.drawTooltipBox(k + 30, l + 50 + 12 - 0, 114, 10);
this.fontRendererObj.drawString(ModInfo.MISSING_MULTIBLOCK, k + 38, l + 52 + 12 - 0, -1);
}
} }

View file

@ -8,11 +8,14 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory; import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.*; import net.minecraftforge.fluids.*;
import techreborn.api.recipe.RecipeCrafter; import techreborn.api.recipe.RecipeCrafter;
import techreborn.blocks.BlockMachineCasing;
import techreborn.init.ModBlocks; import techreborn.init.ModBlocks;
import techreborn.init.ModFluids; import techreborn.init.ModFluids;
import techreborn.lib.Location;
import techreborn.util.Inventory; import techreborn.util.Inventory;
import techreborn.util.Tank; import techreborn.util.Tank;
@ -45,9 +48,32 @@ public class TileIndustrialSawmill extends TileMachineBase implements IWrenchabl
public void updateEntity() public void updateEntity()
{ {
super.updateEntity(); super.updateEntity();
energy.updateEntity(); if(getMutliBlock())
crafter.updateEntity(); {
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 @Override
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side)