Implement #292.
This commit is contained in:
parent
d7203bccbd
commit
76e82ed355
3 changed files with 41 additions and 9 deletions
|
@ -36,6 +36,8 @@ public class GT_Container_Regulator
|
|||
addSlotToContainer(new Slot(this.mTileEntity, 7, 26, 42));
|
||||
addSlotToContainer(new Slot(this.mTileEntity, 8, 44, 42));
|
||||
|
||||
addSlotToContainer(new Slot(this.mTileEntity, 19, 44, 63));
|
||||
|
||||
addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 9, 64, 7, false, true, 1));
|
||||
addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 10, 81, 7, false, true, 1));
|
||||
addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 11, 98, 7, false, true, 1));
|
||||
|
@ -60,7 +62,7 @@ public class GT_Container_Regulator
|
|||
}
|
||||
|
||||
public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) {
|
||||
if (aSlotIndex < 9) {
|
||||
if (aSlotIndex < 10) {
|
||||
return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer);
|
||||
}
|
||||
Slot tSlot = (Slot) this.inventorySlots.get(aSlotIndex);
|
||||
|
@ -68,7 +70,7 @@ public class GT_Container_Regulator
|
|||
if (this.mTileEntity.getMetaTileEntity() == null) {
|
||||
return null;
|
||||
}
|
||||
if (aSlotIndex == 27) {
|
||||
if (aSlotIndex == 28) {
|
||||
((GT_MetaTileEntity_Regulator) this.mTileEntity.getMetaTileEntity()).bOutput = (!((GT_MetaTileEntity_Regulator) this.mTileEntity.getMetaTileEntity()).bOutput);
|
||||
if (((GT_MetaTileEntity_Regulator) this.mTileEntity.getMetaTileEntity()).bOutput) {
|
||||
GT_Utility.sendChatToPlayer(aPlayer, "Emit Energy to Outputside");
|
||||
|
@ -77,7 +79,7 @@ public class GT_Container_Regulator
|
|||
}
|
||||
return null;
|
||||
}
|
||||
if ((aSlotIndex < 18)) {
|
||||
if ((aSlotIndex < 19)) {
|
||||
ItemStack tStack = aPlayer.inventory.getItemStack();
|
||||
if (tStack != null) {
|
||||
tSlot.putStack(GT_Utility.copy(new Object[]{tStack}));
|
||||
|
@ -96,8 +98,8 @@ public class GT_Container_Regulator
|
|||
}
|
||||
return null;
|
||||
}
|
||||
if ((aSlotIndex < 27)) {
|
||||
((GT_MetaTileEntity_Regulator) this.mTileEntity.getMetaTileEntity()).mTargetSlots[(aSlotIndex - 18)] = Math.min(99, Math.max(0, ((GT_MetaTileEntity_Regulator) this.mTileEntity.getMetaTileEntity()).mTargetSlots[(aSlotIndex - 18)] + (aMouseclick == 0 ? -1 : 1) * (aShifthold == 0 ? 1 : 16)));
|
||||
if ((aSlotIndex < 28)) {
|
||||
((GT_MetaTileEntity_Regulator) this.mTileEntity.getMetaTileEntity()).mTargetSlots[(aSlotIndex - 19)] = Math.min(99, Math.max(0, ((GT_MetaTileEntity_Regulator) this.mTileEntity.getMetaTileEntity()).mTargetSlots[(aSlotIndex - 19)] + (aMouseclick == 0 ? -1 : 1) * (aShifthold == 0 ? 1 : 16)));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -156,10 +158,10 @@ public class GT_Container_Regulator
|
|||
}
|
||||
|
||||
public int getSlotCount() {
|
||||
return 9;
|
||||
return 10;
|
||||
}
|
||||
|
||||
public int getShiftClickSlotCount() {
|
||||
return 9;
|
||||
return 10;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,9 +18,10 @@ import java.util.Arrays;
|
|||
public class GT_MetaTileEntity_Regulator
|
||||
extends GT_MetaTileEntity_Buffer {
|
||||
public int[] mTargetSlots = {0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
private boolean charge = false, decharge = false;
|
||||
|
||||
public GT_MetaTileEntity_Regulator(int aID, String aName, String aNameRegional, int aTier) {
|
||||
super(aID, aName, aNameRegional, aTier, 19, "Regulating incoming Items");
|
||||
super(aID, aName, aNameRegional, aTier, 20, "Regulating incoming Items");
|
||||
}
|
||||
|
||||
public GT_MetaTileEntity_Regulator(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) {
|
||||
|
@ -36,7 +37,7 @@ public class GT_MetaTileEntity_Regulator
|
|||
}
|
||||
|
||||
public boolean isValidSlot(int aIndex) {
|
||||
return aIndex < 9;
|
||||
return aIndex < 9 || aIndex == 19;
|
||||
}
|
||||
|
||||
public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
|
||||
|
@ -90,4 +91,33 @@ public class GT_MetaTileEntity_Regulator
|
|||
public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
|
||||
return (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) && (GT_Utility.areStacksEqual(aStack, this.mInventory[(aIndex + 9)]));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int rechargerSlotStartIndex() {
|
||||
return 19;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int dechargerSlotStartIndex() {
|
||||
return 19;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int rechargerSlotCount() {
|
||||
return charge ? 1 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int dechargerSlotCount() {
|
||||
return decharge ? 1 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
|
||||
super.onPostTick(aBaseMetaTileEntity, aTick);
|
||||
if (aBaseMetaTileEntity.isServerSide()) {
|
||||
charge = aBaseMetaTileEntity.getStoredEU() / 2 > aBaseMetaTileEntity.getEUCapacity() / 3;
|
||||
decharge = aBaseMetaTileEntity.getStoredEU() < aBaseMetaTileEntity.getEUCapacity() / 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 1.9 KiB |
Loading…
Reference in a new issue