Fix buffer and regulator RS signals

This commit is contained in:
Blood-Asp 2017-06-16 01:40:16 +02:00
parent 810e46d753
commit b588e82ef7

View file

@ -224,13 +224,16 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM
if (aBaseMetaTileEntity.isAllowedToWork() && aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.isUniversalEnergyStored(getMinimumStoredEU()) && (aBaseMetaTileEntity.hasWorkJustBeenEnabled() || aBaseMetaTileEntity.hasInventoryBeenModified() || aTimer % 200 == 0 || mSuccess > 0)) {
mSuccess--;
moveItems(aBaseMetaTileEntity, aTimer);
aBaseMetaTileEntity.setGenericRedstoneOutput(bInvert);
for(byte b = 0;b<6;b++)
aBaseMetaTileEntity.setInternalOutputRedstoneSignal(b,bInvert ? (byte)15 : (byte)0);
if (bRedstoneIfFull) {
aBaseMetaTileEntity.setGenericRedstoneOutput(!bInvert);
for(byte b = 0;b<6;b++)
aBaseMetaTileEntity.setInternalOutputRedstoneSignal(b,bInvert ? (byte)0 : (byte)15);
for (int i = 0; i < mInventory.length; i++)
if (isValidSlot(i)) {
if (mInventory[i] == null) {
aBaseMetaTileEntity.setGenericRedstoneOutput(bInvert);
for(byte b = 0;b<6;b++)
aBaseMetaTileEntity.setInternalOutputRedstoneSignal(b,bInvert ? (byte)15 : (byte)0);
aBaseMetaTileEntity.decreaseStoredEnergyUnits(1, true);
break;
}
@ -239,6 +242,12 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM
}
}
@Override
public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) {
for(byte b = 0;b<6;b++)
aBaseMetaTileEntity.setInternalOutputRedstoneSignal(b,(byte)0);
}
protected void moveItems(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) {
int tCost = GT_Utility.moveOneItemStack(aBaseMetaTileEntity, aBaseMetaTileEntity.getTileEntityAtSide(aBaseMetaTileEntity.getBackFacing()), aBaseMetaTileEntity.getBackFacing(), aBaseMetaTileEntity.getFrontFacing(), null, false, mTargetStackSize == 0 ? 64 : (byte) mTargetStackSize, mTargetStackSize == 0 ? 1 : (byte) mTargetStackSize, (byte) 64, (byte) 1);
if (tCost > 0 || aBaseMetaTileEntity.hasInventoryBeenModified()) {