tterrag1098

Untitled

Jul 6th, 2018
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.09 KB | None | 0 0
  1. public abstract class AbstractCapabilityMachineContainer<E extends AbstractCapabilityMachineEntity> extends ContainerEnderCap<EnderInventory, E> {
  2.  
  3. protected Slot upgradeSlot;
  4.  
  5. public AbstractCapabilityMachineContainer(@Nonnull InventoryPlayer playerInv, @Nonnull E te) {
  6. super(playerInv, te.getInventory(), te);
  7. }
  8.  
  9. @Override
  10. protected void addSlots() {
  11. addMachineSlots();
  12.  
  13. View upgrades = getItemHandler().getView(Type.UPGRADE);
  14. for (int i = 0; i < upgrades.getSlots(); i++) {
  15. addSlotToContainer(upgradeSlot = new EnderSlot(Type.UPGRADE, upgrades.getSlot(i), getUpgradeOffset().x, getUpgradeOffset().y) {
  16.  
  17. @Override
  18. public int getSlotStackLimit() {
  19. return 1;
  20. }
  21.  
  22. @Override
  23. public boolean isItemValid(@Nonnull ItemStack itemStack) {
  24. return getTileEntity().isValidUpgrade(itemStack);
  25. }
  26.  
  27. @Override
  28. @SideOnly(Side.CLIENT)
  29. public @Nonnull ResourceLocation getBackgroundLocation() {
  30. return IconEIO.CAPACITOR.getMap().getTexture();
  31. }
  32.  
  33. @Override
  34. @SideOnly(Side.CLIENT)
  35. public @Nonnull TextureAtlasSprite getBackgroundSprite() {
  36. return IconEIO.CAPACITOR.getAsTextureAtlasSprite();
  37. }
  38.  
  39. });
  40. }
  41. }
  42.  
  43. @Override
  44. public @Nonnull Point getPlayerInventoryOffset() {
  45. return new Point(8, 84);
  46. }
  47.  
  48. public @Nonnull Point getUpgradeOffset() {
  49. return new Point(12, 60);
  50. }
  51.  
  52. public Slot getUpgradeSlot() {
  53. return upgradeSlot;
  54. }
  55.  
  56. /**
  57. * ATTN: Do not access any non-static field from this method. Your object has not yet been constructed when it is called!
  58. */
  59. protected abstract void addMachineSlots();
  60.  
  61. protected int getProgressScaled(int scale) {
  62. AbstractCapabilityMachineEntity te = getTileEntity();
  63. if (te instanceof IProgressTile) {
  64. Util.getProgressScaled(scale, (IProgressTile) te);
  65. }
  66. return 0;
  67. }
  68.  
  69. private int guiID = -1;
  70.  
  71. public void setGuiID(int id) {
  72. guiID = id;
  73. }
  74.  
  75. public int getGuiID() {
  76. return guiID;
  77. }
  78. }
Advertisement
Add Comment
Please, Sign In to add comment