Convert Scrapboxinator

This commit is contained in:
Ourten 2017-01-08 12:05:57 +01:00
parent 3c40e25b6a
commit 619ddb14b8
5 changed files with 41 additions and 98 deletions

View file

@ -1,58 +0,0 @@
package techreborn.client.container;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import reborncore.client.gui.slots.BaseSlot;
import reborncore.client.gui.slots.SlotOutput;
import reborncore.common.container.RebornContainer;
import techreborn.api.gui.SlotUpgrade;
import techreborn.tiles.TileScrapboxinator;
public class ContainerScrapboxinator extends RebornContainer {
public int connectionStatus;
EntityPlayer player;
TileScrapboxinator tile;
public ContainerScrapboxinator(TileScrapboxinator tileScrapboxinator, EntityPlayer player) {
super();
tile = tileScrapboxinator;
this.player = player;
// input
this.addSlotToContainer(new SlotScrapbox(tileScrapboxinator.inventory, 0, 56, 34));
this.addSlotToContainer(new SlotOutput(tileScrapboxinator.inventory, 1, 116, 34));
// upgrades
this.addSlotToContainer(new SlotUpgrade(tileScrapboxinator.inventory, 2, 152, 8));
this.addSlotToContainer(new SlotUpgrade(tileScrapboxinator.inventory, 3, 152, 26));
this.addSlotToContainer(new SlotUpgrade(tileScrapboxinator.inventory, 4, 152, 44));
this.addSlotToContainer(new SlotUpgrade(tileScrapboxinator.inventory, 5, 152, 62));
int i;
for (i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
this.addSlotToContainer(new BaseSlot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 9; ++i) {
this.addSlotToContainer(new BaseSlot(player.inventory, i, 8 + i * 18, 142));
}
}
@Override
public boolean canInteractWith(EntityPlayer p_75145_1_) {
return true;
}
@SideOnly(Side.CLIENT)
@Override
public void updateProgressBar(int id, int value) {
if (id == 10) {
this.connectionStatus = value;
}
}
}

View file

@ -1,21 +0,0 @@
package techreborn.client.container;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import reborncore.client.gui.slots.BaseSlot;
import techreborn.init.ModItems;
public class SlotScrapbox extends BaseSlot {
public SlotScrapbox(IInventory par1iInventory, int par2, int par3, int par4) {
super(par1iInventory, par2, par3, par4);
}
public boolean isItemValid(ItemStack par1ItemStack) {
return par1ItemStack.getItem() == ModItems.SCRAP_BOX;
}
public int getSlotStackLimit() {
return 64;
}
}

View file

@ -5,6 +5,7 @@ import org.apache.commons.lang3.tuple.Pair;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.SlotFurnaceFuel;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.energy.CapabilityEnergy;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
@ -22,6 +23,7 @@ import techreborn.utils.upgrade.IMachineUpgrade;
import java.util.function.IntConsumer;
import java.util.function.IntSupplier;
import java.util.function.Predicate;
public class ContainerTileInventoryBuilder {
@ -50,6 +52,12 @@ public class ContainerTileInventoryBuilder {
return this;
}
public ContainerTileInventoryBuilder filterSlot(final int index, final int x, final int y,
final Predicate<ItemStack> filter) {
this.parent.slots.add(new FilteredSlot(this.tile, index, x, y).setFilter(filter));
return this;
}
@SuppressWarnings("null")
public ContainerTileInventoryBuilder energySlot(final int index, final int x, final int y) {
this.parent.slots.add(new FilteredSlot(this.tile, index, x, y)
@ -121,7 +129,7 @@ public class ContainerTileInventoryBuilder {
(currentNeededTicks) -> ((IRecipeCrafterProvider) this.tile)
.getRecipeCrafter().currentNeededTicks = currentNeededTicks);
Core.logHelper
.error(this.tile + " is not an instance of IRecipeCrafterProvider! Craft progress cannot be synced.");
.error(this.tile + " is not an instance of IRecipeCrafterProvider! Craft progress cannot be synced.");
return this;
}