Most of the Vacuum Freezer(Not working just yet)

This commit is contained in:
Modmuss50 2015-11-17 21:48:06 +00:00
parent 219f2a0df7
commit 3114576e7b
13 changed files with 495 additions and 0 deletions

View file

@ -40,6 +40,7 @@ public class GuiHandler implements IGuiHandler {
public static final int idsuID = 27;
public static final int chargeBench = 28;
public static final int fusionID = 29;
public static final int vacuumFreezerID = 30;
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world,
@ -119,6 +120,8 @@ public class GuiHandler implements IGuiHandler {
return new ContainerChargeBench((TileChargeBench) world.getTileEntity(x, y, z), player);
} else if (ID == fusionID) {
return new ContainerFusionReactor((TileEntityFusionController) world.getTileEntity(x, y, z), player);
}else if (ID == vacuumFreezerID) {
return new ContainerVacuumFreezer((TileVacuumFreezer) world.getTileEntity(x, y, z), player);
}
@ -203,6 +206,8 @@ public class GuiHandler implements IGuiHandler {
return new GuiChargeBench(player, (TileChargeBench) world.getTileEntity(x, y, z));
}else if (ID == fusionID) {
return new GuiFusionReactor(player, (TileEntityFusionController) world.getTileEntity(x, y, z));
}else if (ID == vacuumFreezerID) {
return new GuiVacuumFreezer(player, (TileVacuumFreezer) world.getTileEntity(x, y, z));
}
return null;
}

View file

@ -0,0 +1,76 @@
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.TileVacuumFreezer;
public class ContainerVacuumFreezer extends ContainerCrafting {
EntityPlayer player;
TileVacuumFreezer tile;
@Override
public boolean canInteractWith(EntityPlayer player) {
return true;
}
public int tickTime;
public int machineStatus;
public ContainerVacuumFreezer(TileVacuumFreezer tileAlloysmelter,
EntityPlayer player) {
super(tileAlloysmelter.crafter);
tile = tileAlloysmelter;
this.player = player;
// input
this.addSlotToContainer(new Slot(tileAlloysmelter.inventory, 0, 56, 34));
// outputs
this.addSlotToContainer(new SlotOutput(tileAlloysmelter.inventory, 1, 116, 35));
int i;
for (i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
this.addSlotToContainer(new Slot(player.inventory, j + i * 9
+ 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 9; ++i) {
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18,
142));
}
}
@Override
public void detectAndSendChanges() {
super.detectAndSendChanges();
for (int i = 0; i < this.crafters.size(); i++) {
ICrafting icrafting = (ICrafting) this.crafters.get(i);
if (this.machineStatus != tile.multiBlockStatus) {
icrafting.sendProgressBarUpdate(this, 3, tile.multiBlockStatus);
}
}
}
@Override
public void addCraftingToCrafters(ICrafting crafting) {
super.addCraftingToCrafters(crafting);
crafting.sendProgressBarUpdate(this, 3, tile.multiBlockStatus);
}
@SideOnly(Side.CLIENT)
@Override
public void updateProgressBar(int id, int value) {
if (id == 3) {
machineStatus = value;
}
}
}

View file

@ -0,0 +1,64 @@
package techreborn.client.gui;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import reborncore.client.gui.GuiUtil;
import techreborn.client.container.ContainerVacuumFreezer;
import techreborn.tiles.TileVacuumFreezer;
public class GuiVacuumFreezer extends GuiContainer {
private static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/vacuum_freezer.png");
TileVacuumFreezer crafter;
ContainerVacuumFreezer containerVacuumFreezer;
public GuiVacuumFreezer(EntityPlayer player, TileVacuumFreezer tilealloysmelter) {
super(new ContainerVacuumFreezer(tilealloysmelter, player));
this.xSize = 176;
this.ySize = 167;
crafter = tilealloysmelter;
this.containerVacuumFreezer = (ContainerVacuumFreezer) this.inventorySlots;
}
@Override
public void initGui() {
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
super.initGui();
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
int j = 0;
j = crafter.getProgressScaled(24);
if (j > 0) {
this.drawTexturedModalRect(k + 79, l + 34, 176, 14, j + 1, 16);
}
j = crafter.getEnergyScaled(12);
if (j > 0) {
this.drawTexturedModalRect(k + 26, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
}
if (containerVacuumFreezer.machineStatus == 0) {
GuiUtil.drawTooltipBox(k + 30, l + 50 + 12 - 0, 114, 10);
this.fontRendererObj.drawString(StatCollector.translateToLocal("techreborn.message.missingmultiblock"), k + 38, l + 52 + 12 - 0, -1);
}
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
String name = StatCollector.translateToLocal("tile.techreborn.alloysmelter.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
}
}