Skip to content

Commit 15d1809

Browse files
committed
Remove direct crafter field accesses on AbstractCraftingMultiblockBlockEntity, add onCraft to CrafterComponent
1 parent ea5060f commit 15d1809

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/main/java/aztech/modern_industrialization/machines/blockentities/multiblocks/AbstractCraftingMultiblockBlockEntity.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,17 +94,17 @@ public final void tick() {
9494
boolean newActive = false;
9595

9696
if (operatingState == OperatingState.TRYING_TO_RESUME) {
97-
if (crafter.tryContinueRecipe()) {
97+
if (getCrafterComponent().tryContinueRecipe()) {
9898
operatingState = OperatingState.NORMAL_OPERATION;
9999
}
100100
}
101101

102102
if (operatingState == OperatingState.NORMAL_OPERATION) {
103-
if (crafter.tickRecipe()) {
103+
if (getCrafterComponent().tickRecipe()) {
104104
newActive = true;
105105
}
106106
} else {
107-
crafter.decreaseEfficiencyTicks();
107+
getCrafterComponent().decreaseEfficiencyTicks();
108108
}
109109

110110
isActive.updateActive(newActive, this);

src/main/java/aztech/modern_industrialization/machines/components/CrafterComponent.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,9 @@ public void increaseEfficiencyTicks(int increment) {
184184
efficiencyTicks = Math.min(efficiencyTicks + increment, maxEfficiencyTicks);
185185
}
186186

187+
protected void onCraft() {
188+
}
189+
187190
@Override
188191
public long getCurrentRecipeEu() {
189192
Preconditions.checkArgument(hasActiveRecipe());
@@ -240,6 +243,7 @@ public boolean tickRecipe() {
240243
clearLocks();
241244
usedEnergy = 0;
242245
finishedRecipe = true;
246+
onCraft();
243247
}
244248
} else if (behavior.isOverdriving()) {
245249
eu = activeRecipe.value().conditionsMatch(conditionContext) ? behavior.consumeEu(recipeMaxEu, ACT) : 0;

0 commit comments

Comments
 (0)