Regulator fix
This commit is contained in:
parent
bde230b96d
commit
9edf005c3c
1 changed files with 32 additions and 2 deletions
|
@ -18,9 +18,10 @@ import java.util.Arrays;
|
||||||
public class GT_MetaTileEntity_Regulator
|
public class GT_MetaTileEntity_Regulator
|
||||||
extends GT_MetaTileEntity_Buffer {
|
extends GT_MetaTileEntity_Buffer {
|
||||||
public int[] mTargetSlots = {0, 0, 0, 0, 0, 0, 0, 0, 0};
|
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) {
|
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) {
|
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) {
|
public boolean isValidSlot(int aIndex) {
|
||||||
return aIndex < 9;
|
return aIndex < 9 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
|
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) {
|
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)]));
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue