Fixed Thermal boiler

Closes #92.
Also fixed duplicated tooltip of Lava filter
This commit is contained in:
TheDarkDnKTv 2021-03-26 05:00:42 +02:00
parent d73bde2694
commit 72c4420c1b
4 changed files with 47 additions and 39 deletions

View file

@ -1,10 +1,5 @@
package gregtechmod.api.items;
import java.util.List;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.resources.I18n;
import net.minecraft.item.ItemStack;
/**
@ -37,13 +32,4 @@ public class GT_Durable_Item extends GT_Generic_Item {
public boolean hasEffect(ItemStack par1ItemStack) {
return false;
}
@SideOnly(Side.CLIENT)
@Override
protected void addAdditionalToolTips(List<String> aList, ItemStack aStack) {
if (aStack != null && aStack.getItem() != null && aStack.getItem() instanceof GT_Durable_Item) {
int durability = aStack.getMaxDamage() - aStack.getItemDamage();
aList.add(I18n.format("item.durability.tooltip", durability, aStack.getMaxDamage()));
}
}
}

View file

@ -215,6 +215,7 @@ public class RecipeLogic {
if (amount > 0) {
GT_Log.log.error(String.format("Output overflow detected for machine (%s) left amount: %s, stack: %s", getMachine().getClass().getName(), amount, recipeOut));
getMachine().getBaseMetaTileEntity().disableWorking();
triggerMachine(false);
}
}
@ -236,6 +237,7 @@ public class RecipeLogic {
if (amount > 0) {
GT_Log.log.error(String.format("Output overflow detected for machine (%s) left amount: %s, fluid: %s", getMachine().getClass().getName(), amount, FluidRegistry.getFluidName(fluid)));
getMachine().getBaseMetaTileEntity().disableWorking();
triggerMachine(false);
}
}

View file

@ -118,28 +118,26 @@ public class GT_MetaTileEntity_FusionComputer extends MetaTileEntity implements
@Override
public void onPostTick() {
if (getBaseMetaTileEntity().isServerSide()) {
if (getBaseMetaTileEntity().isServerSide()) {
if (needCheckStruct) {
reset();
structComplete = checkMachine();
needCheckStruct = false;
if (structComplete) {
fluidInputs = new InventoryHandlerList<>(mPlasmaInjectors.stream().map(extr -> new ListAdapter<>(extr.mFluid)).collect(Collectors.toList()));
fluidOutputs = new InventoryHandlerList<>(mPlasmaExtractors.stream().map(extr -> new ListAdapter<>(extr.mFluid)).collect(Collectors.toList()));
itemInputs = new InventoryHandlerList<>(mPlasmaInjectors.stream().map(extr -> new ListAdapter<>(extr.mInventory, extr.getInputSlot(), extr.getInputSlot())).collect(Collectors.toList()));
itemOutputs = new InventoryHandlerList<>(mPlasmaExtractors.stream().map(extr -> new ListAdapter<>(extr.mInventory, extr.getOutputSlot(), extr.getOutputSlot())).collect(Collectors.toList()));
}
} else if (!structComplete && getBaseMetaTileEntity().getTimer() % 600 == 0) {
needCheckStruct = true;
}
if (structComplete) {
recipeLogic.update();
} else recipeLogic.stop();
}
}
if (getBaseMetaTileEntity().isServerSide()) {
if (needCheckStruct) {
reset();
structComplete = checkMachine();
needCheckStruct = false;
if (structComplete) {
fluidInputs = new InventoryHandlerList<>(mPlasmaInjectors.stream().map(extr -> new ListAdapter<>(extr.mFluid)).collect(Collectors.toList()));
fluidOutputs = new InventoryHandlerList<>(mPlasmaExtractors.stream().map(extr -> new ListAdapter<>(extr.mFluid)).collect(Collectors.toList()));
itemInputs = new InventoryHandlerList<>(mPlasmaInjectors.stream().map(extr -> new ListAdapter<>(extr.mInventory, extr.getInputSlot(), extr.getInputSlot())).collect(Collectors.toList()));
itemOutputs = new InventoryHandlerList<>(mPlasmaExtractors.stream().map(extr -> new ListAdapter<>(extr.mInventory, extr.getOutputSlot(), extr.getOutputSlot())).collect(Collectors.toList()));
}
} else if (!structComplete && getBaseMetaTileEntity().getTimer() % 600 == 0) {
needCheckStruct = true;
}
if (structComplete) {
recipeLogic.update();
} else recipeLogic.stop();
}
}
public boolean hasInventoryBeenModified() {

View file

@ -191,6 +191,8 @@ public class GT_MetaTileEntity_Multi_ThermalBoiler extends MTEWorkableMultiblock
private static class ThermalBoilerLogic extends GeneratorRecipeLogic {
protected boolean justFinished = false;
protected ThermalBoilerLogic(IntSupplier efficiency, RecipeMap<?> recipeMap, IRecipeWorkable machine) {
super(efficiency, recipeMap, machine);
}
@ -211,12 +213,12 @@ public class GT_MetaTileEntity_Multi_ThermalBoiler extends MTEWorkableMultiblock
if (base.isAllowedToWork()) {
if (leftEU == 0) {
if (machine.hasInventoryBeenModified() || base.hasWorkJustBeenEnabled() || success || base.getTimer() % 600 == 0) {
if (machine.hasInventoryBeenModified() || base.hasWorkJustBeenEnabled() || success || justFinished || base.getTimer() % 600 == 0) {
justFinished = false;
trySerachRecipe();
}
}
} else if (success)
triggerMachine(false);
}
return success;
}
@ -244,6 +246,26 @@ public class GT_MetaTileEntity_Multi_ThermalBoiler extends MTEWorkableMultiblock
return false;
}
@Override
protected void trySerachRecipe() {
if (getMachine().allowToCheckRecipe()) {
if (previousRecipe != null) {
if (match(previousRecipe)) {
startRecipe(previousRecipe);
} else {
previousRecipe = null;
justFinished = true;
triggerMachine(false);
}
} else {
// find new recipe
Recipe resRec = findRecipe();
if (resRec != null)
startRecipe(resRec);
}
}
}
@Override
public void stop() {
leftEU = 0;