Update AlloySmelter to new system

This commit is contained in:
modmuss50 2016-04-12 08:39:50 +01:00
parent 23d55e6251
commit 4fccaa1f5f
3 changed files with 54 additions and 18 deletions

View file

@ -97,7 +97,7 @@ public class GuiHandler implements IGuiHandler
return new ContainerBlastFurnace((TileBlastFurnace) world.getTileEntity(new BlockPos(x, y, z)), player); return new ContainerBlastFurnace((TileBlastFurnace) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == alloySmelterID) } else if (ID == alloySmelterID)
{ {
return new ContainerAlloySmelter((TileAlloySmelter) world.getTileEntity(new BlockPos(x, y, z)), player); container = new ContainerAlloySmelter();
} else if (ID == industrialGrinderID) } else if (ID == industrialGrinderID)
{ {
return new ContainerIndustrialGrinder((TileIndustrialGrinder) world.getTileEntity(new BlockPos(x, y, z)), return new ContainerIndustrialGrinder((TileIndustrialGrinder) world.getTileEntity(new BlockPos(x, y, z)),

View file

@ -1,37 +1,50 @@
package techreborn.client.container; package techreborn.client.container;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.EnumFacing;
import reborncore.api.tile.IContainerLayout;
import reborncore.client.gui.BaseSlot; import reborncore.client.gui.BaseSlot;
import reborncore.client.gui.SlotCharge;
import reborncore.client.gui.SlotInput;
import reborncore.client.gui.SlotOutput; import reborncore.client.gui.SlotOutput;
import techreborn.api.gui.SlotUpgrade; import techreborn.api.gui.SlotUpgrade;
import techreborn.tiles.TileAlloySmelter; import techreborn.tiles.TileAlloySmelter;
public class ContainerAlloySmelter extends ContainerCrafting import javax.annotation.Nullable;
import java.util.List;
public class ContainerAlloySmelter extends ContainerCrafting implements IContainerLayout<TileAlloySmelter>
{ {
public int tickTime; public int tickTime;
EntityPlayer player; EntityPlayer player;
TileAlloySmelter tile; TileAlloySmelter tile;
public ContainerAlloySmelter(TileAlloySmelter tileAlloysmelter, EntityPlayer player) @Override
public boolean canInteractWith(EntityPlayer player)
{ {
super(tileAlloysmelter.crafter); return true;
tile = tileAlloysmelter; }
this.player = player;
@Override
public void addInventorySlots() {
// input // input
this.addSlotToContainer(new BaseSlot(tileAlloysmelter.inventory, 0, 47, 17)); this.addSlotToContainer(new SlotInput(tile.inventory, 0, 47, 17));
this.addSlotToContainer(new BaseSlot(tileAlloysmelter.inventory, 1, 65, 17)); this.addSlotToContainer(new SlotInput(tile.inventory, 1, 65, 17));
// outputs // outputs
this.addSlotToContainer(new SlotOutput(tileAlloysmelter.inventory, 2, 116, 35)); this.addSlotToContainer(new SlotOutput(tile.inventory, 2, 116, 35));
// battery // battery
this.addSlotToContainer(new BaseSlot(tileAlloysmelter.inventory, 3, 56, 53)); this.addSlotToContainer(new SlotCharge(tile.inventory, 3, 56, 53));
// upgrades // upgrades
this.addSlotToContainer(new SlotUpgrade(tileAlloysmelter.inventory, 4, 152, 8)); this.addSlotToContainer(new SlotUpgrade(tile.inventory, 4, 152, 8));
this.addSlotToContainer(new SlotUpgrade(tileAlloysmelter.inventory, 5, 152, 26)); this.addSlotToContainer(new SlotUpgrade(tile.inventory, 5, 152, 26));
this.addSlotToContainer(new SlotUpgrade(tileAlloysmelter.inventory, 6, 152, 44)); this.addSlotToContainer(new SlotUpgrade(tile.inventory, 6, 152, 44));
this.addSlotToContainer(new SlotUpgrade(tileAlloysmelter.inventory, 7, 152, 62)); this.addSlotToContainer(new SlotUpgrade(tile.inventory, 7, 152, 62));
}
@Override
public void addPlayerSlots() {
int i; int i;
for (i = 0; i < 3; ++i) for (i = 0; i < 3; ++i)
@ -49,9 +62,31 @@ public class ContainerAlloySmelter extends ContainerCrafting
} }
@Override @Override
public boolean canInteractWith(EntityPlayer player) public void setTile(TileAlloySmelter tile) {
{ this.tile = tile;
return true; setCrafter(tile.crafter);
} }
@Nullable
@Override
public TileAlloySmelter getTile() {
return tile;
}
@Override
public void setPlayer(EntityPlayer player) {
this.player = player;
}
@Nullable
@Override
public EntityPlayer getPlayer() {
return player;
}
@Nullable
@Override
public List<Integer> getSlotsForSide(EnumFacing facing) {
return null;
}
} }

View file

@ -5,6 +5,7 @@ import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n; import net.minecraft.util.text.translation.I18n;
import reborncore.common.container.RebornContainer;
import techreborn.client.container.ContainerAlloySmelter; import techreborn.client.container.ContainerAlloySmelter;
import techreborn.tiles.TileAlloySmelter; import techreborn.tiles.TileAlloySmelter;
@ -18,7 +19,7 @@ public class GuiAlloySmelter extends GuiContainer
public GuiAlloySmelter(EntityPlayer player, TileAlloySmelter tilealloysmelter) public GuiAlloySmelter(EntityPlayer player, TileAlloySmelter tilealloysmelter)
{ {
super(new ContainerAlloySmelter(tilealloysmelter, player)); super(RebornContainer.createContainer(ContainerAlloySmelter.class, tilealloysmelter, player));
this.xSize = 176; this.xSize = 176;
this.ySize = 167; this.ySize = 167;
alloysmelter = tilealloysmelter; alloysmelter = tilealloysmelter;