Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public abstract class AbstractCapabilityMachineContainer<E extends AbstractCapabilityMachineEntity> extends ContainerEnderCap<EnderInventory, E> {
- protected Slot upgradeSlot;
- public AbstractCapabilityMachineContainer(@Nonnull InventoryPlayer playerInv, @Nonnull E te) {
- super(playerInv, te.getInventory(), te);
- }
- @Override
- protected void addSlots() {
- addMachineSlots();
- View upgrades = getItemHandler().getView(Type.UPGRADE);
- for (int i = 0; i < upgrades.getSlots(); i++) {
- addSlotToContainer(upgradeSlot = new EnderSlot(Type.UPGRADE, upgrades.getSlot(i), getUpgradeOffset().x, getUpgradeOffset().y) {
- @Override
- public int getSlotStackLimit() {
- return 1;
- }
- @Override
- public boolean isItemValid(@Nonnull ItemStack itemStack) {
- return getTileEntity().isValidUpgrade(itemStack);
- }
- @Override
- @SideOnly(Side.CLIENT)
- public @Nonnull ResourceLocation getBackgroundLocation() {
- return IconEIO.CAPACITOR.getMap().getTexture();
- }
- @Override
- @SideOnly(Side.CLIENT)
- public @Nonnull TextureAtlasSprite getBackgroundSprite() {
- return IconEIO.CAPACITOR.getAsTextureAtlasSprite();
- }
- });
- }
- }
- @Override
- public @Nonnull Point getPlayerInventoryOffset() {
- return new Point(8, 84);
- }
- public @Nonnull Point getUpgradeOffset() {
- return new Point(12, 60);
- }
- public Slot getUpgradeSlot() {
- return upgradeSlot;
- }
- /**
- * ATTN: Do not access any non-static field from this method. Your object has not yet been constructed when it is called!
- */
- protected abstract void addMachineSlots();
- protected int getProgressScaled(int scale) {
- AbstractCapabilityMachineEntity te = getTileEntity();
- if (te instanceof IProgressTile) {
- Util.getProgressScaled(scale, (IProgressTile) te);
- }
- return 0;
- }
- private int guiID = -1;
- public void setGuiID(int id) {
- guiID = id;
- }
- public int getGuiID() {
- return guiID;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment