Fusion reactor uses inputs before the craft starts to prevent power exploit, closes #1539

This commit is contained in:
modmuss50 2018-06-10 11:53:03 +01:00
parent c201b3dbcf
commit 7db0097d23
No known key found for this signature in database
GPG key ID: 773D17BE8BF49C82

View file

@ -222,7 +222,7 @@ public class TileFusionControlComputer extends TilePowerAcceptor
}
if (this.currentRecipe != null) {
if (this.inventory.hasChanged && !validateReactorRecipe(this.currentRecipe)) {
if (!hasStartedCrafting && this.inventory.hasChanged && !validateReactorRecipe(this.currentRecipe)) {
resetCrafter();
return;
}
@ -232,6 +232,10 @@ public class TileFusionControlComputer extends TilePowerAcceptor
if (this.canUseEnergy(this.currentRecipe.getStartEU())) {
this.useEnergy(this.currentRecipe.getStartEU());
this.hasStartedCrafting = true;
this.decrStackSize(this.topStackSlot, this.currentRecipe.getTopInput().getCount());
if (!this.currentRecipe.getBottomInput().isEmpty()) {
this.decrStackSize(this.bottomStackSlot, this.currentRecipe.getBottomInput().getCount());
}
}
}
if (hasStartedCrafting && this.crafingTickTime < this.finalTickTime) {
@ -253,10 +257,6 @@ public class TileFusionControlComputer extends TilePowerAcceptor
} else {
this.decrStackSize(this.outputStackSlot, -this.currentRecipe.getOutput().getCount());
}
this.decrStackSize(this.topStackSlot, this.currentRecipe.getTopInput().getCount());
if (!this.currentRecipe.getBottomInput().isEmpty()) {
this.decrStackSize(this.bottomStackSlot, this.currentRecipe.getBottomInput().getCount());
}
if (this.validateReactorRecipe(this.currentRecipe)) {
this.crafingTickTime = 0;
} else {