This commit is contained in:
Modmuss50 2015-12-16 15:56:12 +00:00
parent 5324016199
commit 96a7b56b5f
4 changed files with 50 additions and 15 deletions

View file

@ -1,6 +1,9 @@
package techreborn.client.container;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot;
import reborncore.client.gui.SlotOutput;
import techreborn.tiles.TileGrinder;
@ -11,7 +14,7 @@ public class ContainerGrinder extends ContainerCrafting {
TileGrinder tile;
public int tickTime;
public int connectionStatus;
public ContainerGrinder(TileGrinder tileGrinder,
EntityPlayer player) {
@ -50,4 +53,29 @@ public class ContainerGrinder extends ContainerCrafting {
return true;
}
@Override
public void detectAndSendChanges() {
super.detectAndSendChanges();
for (int i = 0; i < this.crafters.size(); i++) {
ICrafting icrafting = (ICrafting) this.crafters.get(i);
if (this.connectionStatus != tile.connectionStatus) {
icrafting.sendProgressBarUpdate(this, 10, tile.connectionStatus);
}
}
}
@Override
public void addCraftingToCrafters(ICrafting crafting) {
super.addCraftingToCrafters(crafting);
crafting.sendProgressBarUpdate(this, 10, tile.connectionStatus);
}
@SideOnly(Side.CLIENT)
@Override
public void updateProgressBar(int id, int value) {
if (id == 10) {
this.connectionStatus = value;
}
}
}

View file

@ -17,12 +17,14 @@ public class GuiGrinder extends GuiContainer {
private static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/industrial_grinder.png");
TileGrinder grinder;
ContainerGrinder containerGrinder;
public GuiGrinder(EntityPlayer player, TileGrinder tilegrinder) {
super(new ContainerGrinder(tilegrinder, player));
this.xSize = 176;
this.ySize = 167;
grinder = tilegrinder;
containerGrinder = (ContainerGrinder) this.inventorySlots;
}
@Override
@ -44,7 +46,7 @@ public class GuiGrinder extends GuiContainer {
this.drawTexturedModalRect(k + 132, l + 63 + 12 - j, 176, 12 - j, 14, j + 2);
}
if (grinder.getMutliBlock() != true) {
if (containerGrinder.connectionStatus != 1) {
GuiDraw.drawTooltipBox(k + 30, l + 50 + 12 - j, 114, 10);
this.fontRendererObj.drawString(StatCollector.translateToLocal("techreborn.message.missingmultiblock"), k + 38, l + 52 + 12 - j, -1);
}

View file

@ -15,12 +15,24 @@ public class MultiBlockCasing extends RectangularMultiblockControllerBase {
public boolean hasLava;
public boolean isStar = false;
public int height = 0;
public MultiBlockCasing(World world) {
super(world);
}
public String getInfo(){
String value = "Intact";
try {
isMachineWhole();
} catch (MultiblockValidationException e) {
e.printStackTrace();
value = e.getLocalizedMessage();
}
return value;
}
/**
* @return True if the machine is "whole" and should be assembled. False
* otherwise.
@ -82,7 +94,7 @@ public class MultiBlockCasing extends RectangularMultiblockControllerBase {
"Machine is too small, it must be at least %d blocks in the Z dimension",
minZ));
}
height = deltaY;
// if(checkIfStarShape(minimumCoord.x, minimumCoord.y, minimumCoord.z)){
// isStar = true;
@ -91,7 +103,7 @@ public class MultiBlockCasing extends RectangularMultiblockControllerBase {
// isStar = false;
// }
if (deltaY < 4) {
if (deltaY < minY) {
throw new MultiblockValidationException(
String.format(
"Machine is too small, it must be at least %d blocks in the Y dimension",

View file

@ -27,6 +27,7 @@ public class TileGrinder extends TilePowerAcceptor implements IWrenchable, IFlui
public Inventory inventory = new Inventory(6, "TileGrinder", 64);
public Tank tank = new Tank("TileGrinder", 16000, this);
public RecipeCrafter crafter;
public int connectionStatus;
public TileGrinder() {
super(ConfigTechReborn.CentrifugeTier);
@ -83,21 +84,13 @@ public class TileGrinder extends TilePowerAcceptor implements IWrenchable, IFlui
for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
TileEntity tileEntity = worldObj.getTileEntity(xCoord + direction.offsetX, yCoord + direction.offsetY, zCoord + direction.offsetZ);
if (tileEntity instanceof TileMachineCasing) {
if(!((TileMachineCasing) tileEntity).isConnected()){
return false;
}
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;
}
if(((TileMachineCasing) tileEntity).isConnected() && ((TileMachineCasing) tileEntity).getMultiblockController().isAssembled() && ((TileMachineCasing) tileEntity).getMultiblockController().height == 3){
connectionStatus = 1;
return true;
}
}
}
connectionStatus = 0;
return false;
}