Move assemblingmachine and centrifuge to the new system

This commit is contained in:
modmuss50 2016-04-13 16:25:51 +01:00
parent 8c49a27b76
commit 912eced5e5
7 changed files with 122 additions and 46 deletions

View file

@ -88,7 +88,7 @@ public class GuiHandler implements IGuiHandler
return new ContainerQuantumChest((TileQuantumChest) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == centrifugeID)
{
return new ContainerCentrifuge((TileCentrifuge) world.getTileEntity(new BlockPos(x, y, z)), player);
container = new ContainerCentrifuge();
} else if (ID == rollingMachineID)
{
return new ContainerRollingMachine((TileRollingMachine) world.getTileEntity(new BlockPos(x, y, z)), player);
@ -115,8 +115,7 @@ public class GuiHandler implements IGuiHandler
return new ContainerChunkloader((TileChunkLoader) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == assemblingmachineID)
{
return new ContainerAssemblingMachine((TileAssemblingMachine) world.getTileEntity(new BlockPos(x, y, z)),
player);
container = new ContainerAssemblingMachine();
} else if (ID == dieselGeneratorID)
{
return new ContainerDieselGenerator((TileDieselGenerator) world.getTileEntity(new BlockPos(x, y, z)),

View file

@ -1,37 +1,48 @@
package techreborn.client.container;
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.SlotOutput;
import techreborn.api.gui.SlotUpgrade;
import techreborn.tiles.TileAssemblingMachine;
import techreborn.tiles.teir1.TileGrinder;
public class ContainerAssemblingMachine extends ContainerCrafting
import javax.annotation.Nullable;
import java.util.List;
public class ContainerAssemblingMachine extends ContainerCrafting implements IContainerLayout<TileAssemblingMachine>
{
public int tickTime;
EntityPlayer player;
TileAssemblingMachine tile;
public ContainerAssemblingMachine(TileAssemblingMachine tileAssemblingMachine, EntityPlayer player)
@Override
public boolean canInteractWith(EntityPlayer player)
{
super(tileAssemblingMachine.crafter);
tile = tileAssemblingMachine;
this.player = player;
return true;
}
@Override
public void addInventorySlots() {
// input
this.addSlotToContainer(new BaseSlot(tileAssemblingMachine.inventory, 0, 47, 17));
this.addSlotToContainer(new BaseSlot(tileAssemblingMachine.inventory, 1, 65, 17));
this.addSlotToContainer(new BaseSlot(tile.inventory, 0, 47, 17));
this.addSlotToContainer(new BaseSlot(tile.inventory, 1, 65, 17));
// outputs
this.addSlotToContainer(new SlotOutput(tileAssemblingMachine.inventory, 2, 116, 35));
this.addSlotToContainer(new SlotOutput(tile.inventory, 2, 116, 35));
// power
this.addSlotToContainer(new BaseSlot(tileAssemblingMachine.inventory, 3, 56, 53));
this.addSlotToContainer(new BaseSlot(tile.inventory, 3, 56, 53));
// upgrades
this.addSlotToContainer(new SlotUpgrade(tileAssemblingMachine.inventory, 4, 152, 8));
this.addSlotToContainer(new SlotUpgrade(tileAssemblingMachine.inventory, 5, 152, 26));
this.addSlotToContainer(new SlotUpgrade(tileAssemblingMachine.inventory, 6, 152, 44));
this.addSlotToContainer(new SlotUpgrade(tileAssemblingMachine.inventory, 7, 152, 62));
this.addSlotToContainer(new SlotUpgrade(tile.inventory, 4, 152, 8));
this.addSlotToContainer(new SlotUpgrade(tile.inventory, 5, 152, 26));
this.addSlotToContainer(new SlotUpgrade(tile.inventory, 6, 152, 44));
this.addSlotToContainer(new SlotUpgrade(tile.inventory, 7, 152, 62));
}
@Override
public void addPlayerSlots() {
int i;
for (i = 0; i < 3; ++i)
@ -49,9 +60,31 @@ public class ContainerAssemblingMachine extends ContainerCrafting
}
@Override
public boolean canInteractWith(EntityPlayer player)
{
return true;
public void setTile(TileAssemblingMachine tile) {
this.tile = tile;
this.crafter = tile.crafter;
}
@Nullable
@Override
public TileAssemblingMachine 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

@ -1,40 +1,50 @@
package techreborn.client.container;
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.SlotOutput;
import techreborn.api.gui.SlotUpgrade;
import techreborn.tiles.TileCentrifuge;
public class ContainerCentrifuge extends ContainerCrafting
import javax.annotation.Nullable;
import java.util.List;
public class ContainerCentrifuge extends ContainerCrafting implements IContainerLayout<TileCentrifuge>
{
public int tickTime;
EntityPlayer player;
TileCentrifuge tile;
public ContainerCentrifuge(TileCentrifuge tileCentrifuge, EntityPlayer player)
@Override
public boolean canInteractWith(EntityPlayer player)
{
super(tileCentrifuge.crafter);
tile = tileCentrifuge;
this.player = player;
return true;
}
@Override
public void addInventorySlots() {
// input
this.addSlotToContainer(new BaseSlot(tileCentrifuge.inventory, 0, 80, 35));
this.addSlotToContainer(new BaseSlot(tileCentrifuge.inventory, 1, 50, 5));
this.addSlotToContainer(new BaseSlot(tile.inventory, 0, 80, 35));
this.addSlotToContainer(new BaseSlot(tile.inventory, 1, 50, 5));
// outputs
this.addSlotToContainer(new SlotOutput(tileCentrifuge.inventory, 2, 80, 5));
this.addSlotToContainer(new SlotOutput(tileCentrifuge.inventory, 3, 110, 35));
this.addSlotToContainer(new SlotOutput(tileCentrifuge.inventory, 4, 80, 65));
this.addSlotToContainer(new SlotOutput(tileCentrifuge.inventory, 5, 50, 35));
this.addSlotToContainer(new SlotOutput(tile.inventory, 2, 80, 5));
this.addSlotToContainer(new SlotOutput(tile.inventory, 3, 110, 35));
this.addSlotToContainer(new SlotOutput(tile.inventory, 4, 80, 65));
this.addSlotToContainer(new SlotOutput(tile.inventory, 5, 50, 35));
// battery
this.addSlotToContainer(new BaseSlot(tileCentrifuge.inventory, 6, 8, 51));
this.addSlotToContainer(new BaseSlot(tile.inventory, 6, 8, 51));
// upgrades
this.addSlotToContainer(new SlotUpgrade(tileCentrifuge.inventory, 7, 152, 8));
this.addSlotToContainer(new SlotUpgrade(tileCentrifuge.inventory, 8, 152, 26));
this.addSlotToContainer(new SlotUpgrade(tileCentrifuge.inventory, 9, 152, 44));
this.addSlotToContainer(new SlotUpgrade(tileCentrifuge.inventory, 10, 152, 62));
this.addSlotToContainer(new SlotUpgrade(tile.inventory, 7, 152, 8));
this.addSlotToContainer(new SlotUpgrade(tile.inventory, 8, 152, 26));
this.addSlotToContainer(new SlotUpgrade(tile.inventory, 9, 152, 44));
this.addSlotToContainer(new SlotUpgrade(tile.inventory, 10, 152, 62));
}
@Override
public void addPlayerSlots() {
int i;
for (i = 0; i < 3; ++i)
@ -52,9 +62,31 @@ public class ContainerCentrifuge extends ContainerCrafting
}
@Override
public boolean canInteractWith(EntityPlayer player)
{
return true;
public void setTile(TileCentrifuge tile) {
this.tile = tile;
this.crafter = tile.crafter;
}
@Nullable
@Override
public TileCentrifuge 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,7 +5,9 @@ import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import reborncore.common.container.RebornContainer;
import techreborn.client.container.ContainerAssemblingMachine;
import techreborn.client.container.ContainerGrinder;
import techreborn.tiles.TileAssemblingMachine;
public class GuiAssemblingMachine extends GuiContainer
@ -19,7 +21,7 @@ public class GuiAssemblingMachine extends GuiContainer
public GuiAssemblingMachine(EntityPlayer player, TileAssemblingMachine tileassemblinmachine)
{
super(new ContainerAssemblingMachine(tileassemblinmachine, player));
super(RebornContainer.createContainer(ContainerAssemblingMachine.class, tileassemblinmachine, player));
containerAssemblingMachine = (ContainerAssemblingMachine) this.inventorySlots;
this.xSize = 176;
this.ySize = 167;

View file

@ -5,7 +5,9 @@ import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import reborncore.common.container.RebornContainer;
import techreborn.client.container.ContainerCentrifuge;
import techreborn.client.container.ContainerGrinder;
import techreborn.tiles.TileCentrifuge;
public class GuiCentrifuge extends GuiContainer
@ -18,7 +20,7 @@ public class GuiCentrifuge extends GuiContainer
public GuiCentrifuge(EntityPlayer player, TileCentrifuge tileCentrifuge)
{
super(new ContainerCentrifuge(tileCentrifuge, player));
super(RebornContainer.createContainer(ContainerCentrifuge.class, tileCentrifuge, player));
this.xSize = 176;
this.ySize = 167;
centrifuge = tileCentrifuge;

View file

@ -7,14 +7,17 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import reborncore.api.power.EnumPowerTier;
import reborncore.api.recipe.IRecipeCrafterProvider;
import reborncore.api.tile.IContainerProvider;
import reborncore.api.tile.IInventoryProvider;
import reborncore.common.container.RebornContainer;
import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.recipes.RecipeCrafter;
import reborncore.common.util.Inventory;
import techreborn.api.Reference;
import techreborn.client.container.ContainerAssemblingMachine;
import techreborn.init.ModBlocks;
public class TileAssemblingMachine extends TilePowerAcceptor implements IWrenchable, ISidedInventory,IInventoryProvider, IRecipeCrafterProvider
public class TileAssemblingMachine extends TilePowerAcceptor implements IWrenchable, ISidedInventory,IInventoryProvider, IRecipeCrafterProvider, IContainerProvider
{
public int tickTime;
@ -161,4 +164,9 @@ public class TileAssemblingMachine extends TilePowerAcceptor implements IWrencha
public RecipeCrafter getRecipeCrafter() {
return crafter;
}
@Override
public RebornContainer getContainer() {
return RebornContainer.getContainerFromClass(ContainerAssemblingMachine.class, this);
}
}

View file

@ -24,7 +24,7 @@ import techreborn.init.ModBlocks;
import java.util.List;
public class TileCentrifuge extends TilePowerAcceptor
implements IWrenchable,IInventoryProvider, IListInfoProvider, IRecipeCrafterProvider//, IContainerProvider
implements IWrenchable,IInventoryProvider, IListInfoProvider, IRecipeCrafterProvider, IContainerProvider
{
public int tickTime;
@ -183,8 +183,8 @@ public class TileCentrifuge extends TilePowerAcceptor
return crafter;
}
// @Override
// public RebornContainer getContainer() {
// return RebornContainer.getContainerFromClass(ContainerCentrifuge.class);
// }
@Override
public RebornContainer getContainer() {
return RebornContainer.getContainerFromClass(ContainerCentrifuge.class, this);
}
}