Got the RollingMachine working

This commit is contained in:
Modmuss50 2015-04-15 17:27:05 +01:00
parent 8e7d6b011e
commit b7ccae4b8c
7 changed files with 278 additions and 151 deletions

View file

@ -1,7 +1,11 @@
package techreborn.client.container;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import techreborn.api.RollingMachineRecipe;
import techreborn.client.SlotFake;
import techreborn.client.SlotOutput;
import techreborn.tiles.TileRollingMachine;
@ -14,18 +18,18 @@ public class ContainerRollingMachine extends TechRebornContainer {
tile = tileRollingmachine;
this.player = player;
//input
this.addSlotToContainer(new Slot(tileRollingmachine.inventory, 0, 30, 17));
this.addSlotToContainer(new Slot(tileRollingmachine.inventory, 1, 30, 35));
this.addSlotToContainer(new Slot(tileRollingmachine.inventory, 2, 30, 53));
this.addSlotToContainer(new Slot(tileRollingmachine.inventory, 3, 48, 17));
this.addSlotToContainer(new Slot(tileRollingmachine.inventory, 4, 48, 35));
this.addSlotToContainer(new Slot(tileRollingmachine.inventory, 5, 48, 53));
this.addSlotToContainer(new Slot(tileRollingmachine.inventory, 6, 66, 17));
this.addSlotToContainer(new Slot(tileRollingmachine.inventory, 7, 66, 35));
this.addSlotToContainer(new Slot(tileRollingmachine.inventory, 8, 66, 53));
//outputs
this.addSlotToContainer(new SlotOutput(tileRollingmachine.inventory, 9, 124, 35));
for (int l = 0; l < 3; l++) {
for (int k1 = 0; k1 < 3; k1++) {
this.addSlotToContainer(new Slot(tileRollingmachine.craftMatrix, k1 + l * 3, 30 + k1 * 18, 17 + l * 18));
}
}
//output
this.addSlotToContainer(new SlotOutput(tileRollingmachine.inventory, 0, 124, 35));
//fakeOutput
this.addSlotToContainer(new SlotFake(tileRollingmachine.inventory, 1, 124, 10, false, false, 1));
int i;
@ -46,4 +50,11 @@ public class ContainerRollingMachine extends TechRebornContainer {
return true;
}
@Override
public final void onCraftMatrixChanged(IInventory inv) {
ItemStack output = RollingMachineRecipe.instance.findMatchingRecipe(tile.craftMatrix, tile.getWorldObj());
tile.inventory.setInventorySlotContents(1, output);
}
}