Attachment fix

- Changed key/value order in the Vat's machineMap (OLD <String, BlockPos> -> NEW <BlockPos, String>) to allow for multiple of the same operation.
This commit is contained in:
PouffyDev
2025-07-08 20:43:02 +01:00
parent 5eadb57708
commit 2eef2721b6

View File

@@ -92,7 +92,7 @@ public class VatBlockEntity extends SmartBlockEntity implements IHaveGoggleInfor
// //
public LerpedFloat[] fluidLevel = new LerpedFloat[8]; public LerpedFloat[] fluidLevel = new LerpedFloat[8];
/// / /// /
public Map<String, BlockPos> machineMap = new HashMap<>(); public Map<BlockPos, String> machineMap = new HashMap<>();
public Map<BlockPos, Boolean> operationalMachinesMap = new HashMap<>(); public Map<BlockPos, Boolean> operationalMachinesMap = new HashMap<>();
public boolean areMachinesValid = true; public boolean areMachinesValid = true;
boolean evaluateNextTick = true; boolean evaluateNextTick = true;
@@ -395,7 +395,7 @@ public class VatBlockEntity extends SmartBlockEntity implements IHaveGoggleInfor
handleRecipe(); handleRecipe();
if (isController()) { if (isController()) {
for (BlockPos machinePos : machineMap.values()) { for (BlockPos machinePos : machineMap.keySet()) {
BlockEntity blockEntity = level.getBlockEntity(machinePos); BlockEntity blockEntity = level.getBlockEntity(machinePos);
if (blockEntity instanceof IVatMachine vatMachine) { if (blockEntity instanceof IVatMachine vatMachine) {
boolean operational = vatMachine.canOperate(this); boolean operational = vatMachine.canOperate(this);
@@ -637,7 +637,7 @@ public class VatBlockEntity extends SmartBlockEntity implements IHaveGoggleInfor
return; return;
} }
Map<String, BlockPos> oldMachineMap = machineMap; Map<BlockPos, String> oldMachineMap = machineMap;
machineMap = new HashMap<>(); machineMap = new HashMap<>();
heatLevel = 0; heatLevel = 0;
heatCondition = HeatCondition.NONE; heatCondition = HeatCondition.NONE;
@@ -665,7 +665,7 @@ public class VatBlockEntity extends SmartBlockEntity implements IHaveGoggleInfor
continue; continue;
be.vatUpdated(this); be.vatUpdated(this);
machineMap.put(be.getOperationId(), pos); machineMap.put(pos, be.getOperationId());
efficiency *= (be.getWorkPercentage() / 100); efficiency *= (be.getWorkPercentage() / 100);
} }
@@ -906,9 +906,9 @@ public class VatBlockEntity extends SmartBlockEntity implements IHaveGoggleInfor
CreateLang.translate("goggles.vat.attachments") CreateLang.translate("goggles.vat.attachments")
.style(ChatFormatting.GRAY) .style(ChatFormatting.GRAY)
.forGoggles(tooltip); .forGoggles(tooltip);
for (Map.Entry<String, BlockPos> machines : machineMap.entrySet()) { for (Map.Entry<BlockPos, String> machines : machineMap.entrySet()) {
boolean operational = operationalMachinesMap.getOrDefault(machines.getValue(), true); boolean operational = operationalMachinesMap.getOrDefault(machines.getKey(), true);
addMachineTooltip(machines.getKey(), operational, tooltip); addMachineTooltip(machines.getValue(), operational, tooltip);
} }