diff --git a/src/generated/resources/.cache/e54e4c34b4f65d271b7b9f53d4ba815125cff8b9 b/src/generated/resources/.cache/e54e4c34b4f65d271b7b9f53d4ba815125cff8b9 index dee5b43a..846538b9 100644 --- a/src/generated/resources/.cache/e54e4c34b4f65d271b7b9f53d4ba815125cff8b9 +++ b/src/generated/resources/.cache/e54e4c34b4f65d271b7b9f53d4ba815125cff8b9 @@ -1,4 +1,4 @@ -// 1.20.1 2025-07-03T14:20:42.800196 Registrate Provider for tfmg [Recipes, Advancements, Loot Tables, Tags (blocks), Tags (items), Tags (fluids), Tags (entity_types), Blockstates, Item models, Lang (en_us/en_ud)] +// 1.20.1 2025-07-08T20:26:28.2936491 Registrate Provider for tfmg [Recipes, Advancements, Loot Tables, Tags (blocks), Tags (items), Tags (fluids), Tags (entity_types), Blockstates, Item models, Lang (en_us/en_ud)] ff5a5721633b83465ab501cbdfdc579a0f20e938 assets/tfmg/blockstates/accumulator.json e982a263b6af75821042107fdeff7bd809436d08 assets/tfmg/blockstates/air_intake.json e7f63aadfc892e337d9f87b5e50af8b1c7e4103f assets/tfmg/blockstates/aluminum_bars.json @@ -436,8 +436,8 @@ a1988ec6a98f23cad8321b46345fbf1c5fd20489 assets/tfmg/blockstates/yellow_rebar_co c58fa20c091e5ecddfb7164cba45538a8f911431 assets/tfmg/blockstates/yellow_rebar_concrete_wall.json 0271e2b940bb94cdb7e951b81e277ee633d64d62 assets/tfmg/blockstates/zinc_frame.json 1bd66f29acffb67f30bfe94c8535509bd009beab assets/tfmg/blockstates/zinc_truss.json -8489b12e9de05253138b7dbf6a09639d0bd0108b assets/tfmg/lang/en_ud.json -d1d839eaaafa2f59677b435ec41e917d8ea0a6db assets/tfmg/lang/en_us.json +357f4d6abeef0bde539d7075fea14bc2853eb121 assets/tfmg/lang/en_ud.json +4178184df5302698896a54d0d9d9eaef71340069 assets/tfmg/lang/en_us.json 9e6a6b62f5e7528c4e4d4f72f3510edcd8f0c078 assets/tfmg/models/block/aluminum_block.json 1d33a893d6ac05f9adaceb7f84423ebe9b195c01 assets/tfmg/models/block/aluminum_cable_hub.json da469bf3233944085f07d4ef437827061e408838 assets/tfmg/models/block/aluminum_cap.json diff --git a/src/generated/resources/assets/tfmg/lang/en_ud.json b/src/generated/resources/assets/tfmg/lang/en_ud.json index 0fc0f7e9..718f4f9b 100644 --- a/src/generated/resources/assets/tfmg/lang/en_ud.json +++ b/src/generated/resources/assets/tfmg/lang/en_ud.json @@ -588,6 +588,7 @@ "create.goggles.vat.heat_status": " :snʇɐʇS ʇɐǝH", "create.goggles.vat.heated": "pǝʇɐǝH", "create.goggles.vat.no_heat": "ʇɐǝH oN", + "create.goggles.vat.not_operational": "ןɐuoıʇɐɹǝdO ʇoN", "create.goggles.vat.superheated": "pǝʇɐǝɥɹǝdnS", "create.goggles.vat.tfmg.centrifuge": "ǝbnɟıɹʇuǝƆ ", "create.goggles.vat.tfmg.electrode": "ǝpoɹʇɔǝןƎ ", diff --git a/src/generated/resources/assets/tfmg/lang/en_us.json b/src/generated/resources/assets/tfmg/lang/en_us.json index 2bd66b40..df552941 100644 --- a/src/generated/resources/assets/tfmg/lang/en_us.json +++ b/src/generated/resources/assets/tfmg/lang/en_us.json @@ -588,6 +588,7 @@ "create.goggles.vat.heat_status": "Heat Status: ", "create.goggles.vat.heated": "Heated", "create.goggles.vat.no_heat": "No Heat", + "create.goggles.vat.not_operational": "Not Operational", "create.goggles.vat.superheated": "Superheated", "create.goggles.vat.tfmg.centrifuge": " Centrifuge", "create.goggles.vat.tfmg.electrode": " Electrode", diff --git a/src/main/java/com/drmangotea/tfmg/content/machinery/vat/base/IVatMachine.java b/src/main/java/com/drmangotea/tfmg/content/machinery/vat/base/IVatMachine.java index ac49eea7..1098f15d 100644 --- a/src/main/java/com/drmangotea/tfmg/content/machinery/vat/base/IVatMachine.java +++ b/src/main/java/com/drmangotea/tfmg/content/machinery/vat/base/IVatMachine.java @@ -8,6 +8,8 @@ public interface IVatMachine { */ String getOperationId(); + boolean canOperate(VatBlockEntity vat); + /** * operations that cant mix with this machine */ diff --git a/src/main/java/com/drmangotea/tfmg/content/machinery/vat/base/VatBlockEntity.java b/src/main/java/com/drmangotea/tfmg/content/machinery/vat/base/VatBlockEntity.java index ccfe1cc1..3abd94db 100644 --- a/src/main/java/com/drmangotea/tfmg/content/machinery/vat/base/VatBlockEntity.java +++ b/src/main/java/com/drmangotea/tfmg/content/machinery/vat/base/VatBlockEntity.java @@ -7,11 +7,15 @@ import com.drmangotea.tfmg.registry.TFMGPackets; import com.simibubi.create.api.boiler.BoilerHeater; import com.simibubi.create.api.connectivity.ConnectivityHandler; import com.simibubi.create.api.equipment.goggles.IHaveGoggleInformation; +import com.simibubi.create.content.kinetics.mixer.MechanicalMixerBlockEntity; +import com.simibubi.create.content.processing.basin.BasinBlockEntity; import com.simibubi.create.content.processing.recipe.HeatCondition; import com.simibubi.create.content.processing.recipe.ProcessingOutput; import com.simibubi.create.foundation.blockEntity.IMultiBlockEntityContainer; import com.simibubi.create.foundation.blockEntity.SmartBlockEntity; import com.simibubi.create.foundation.blockEntity.behaviour.BlockEntityBehaviour; +import com.simibubi.create.foundation.blockEntity.behaviour.ValueBoxTransform; +import com.simibubi.create.foundation.blockEntity.behaviour.filtering.FilteringBehaviour; import com.simibubi.create.foundation.blockEntity.behaviour.fluid.SmartFluidTankBehaviour; import com.simibubi.create.foundation.fluid.CombinedTankWrapper; import com.simibubi.create.foundation.fluid.FluidIngredient; @@ -23,6 +27,7 @@ import com.simibubi.create.infrastructure.config.AllConfigs; import io.netty.util.internal.MathUtil; import net.createmod.catnip.animation.LerpedFloat; import net.createmod.catnip.lang.LangBuilder; +import net.createmod.catnip.math.VecHelper; import net.createmod.catnip.theme.Color; import net.createmod.ponder.api.level.PonderLevel; import net.minecraft.ChatFormatting; @@ -40,6 +45,7 @@ import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.AABB; +import net.minecraft.world.phys.Vec3; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.common.util.LazyOptional; @@ -86,7 +92,9 @@ public class VatBlockEntity extends SmartBlockEntity implements IHaveGoggleInfor // public LerpedFloat[] fluidLevel = new LerpedFloat[8]; /// / - public List machines = new ArrayList<>(); + public Map machineMap = new HashMap<>(); + public Map operationalMachinesMap = new HashMap<>(); + public boolean areMachinesValid = true; boolean evaluateNextTick = true; float efficiency = 1; int timer = 0; @@ -217,7 +225,11 @@ public class VatBlockEntity extends SmartBlockEntity implements IHaveGoggleInfor continue; boolean doesntMatch = false; - if (!Objects.equals(testedRecipe.machines, machines)) { + if (!Objects.equals(testedRecipe.machines, machineMap.keySet().stream().toList())) { + continue; + } + + if (!getControllerBE().areMachinesValid) { continue; } @@ -382,6 +394,18 @@ public class VatBlockEntity extends SmartBlockEntity implements IHaveGoggleInfor handleRecipe(); + if (isController()) { + for (BlockPos machinePos : machineMap.values()) { + BlockEntity blockEntity = level.getBlockEntity(machinePos); + if (blockEntity instanceof IVatMachine vatMachine) { + boolean operational = vatMachine.canOperate(this); + operationalMachinesMap.put(machinePos, operational); + } + } + } + + areMachinesValid = operationalMachinesMap.entrySet().stream().allMatch((op) -> op.getValue() == true); + if (syncCooldown > 0) { syncCooldown--; if (syncCooldown == 0 && queuedSync) @@ -613,8 +637,8 @@ public class VatBlockEntity extends SmartBlockEntity implements IHaveGoggleInfor return; } - List oldMachines = machines; - machines = new ArrayList<>(); + Map oldMachineMap = machineMap; + machineMap = new HashMap<>(); heatLevel = 0; heatCondition = HeatCondition.NONE; @@ -641,7 +665,7 @@ public class VatBlockEntity extends SmartBlockEntity implements IHaveGoggleInfor continue; be.vatUpdated(this); - machines.add(be.getOperationId()); + machineMap.put(be.getOperationId(), pos); efficiency *= (be.getWorkPercentage() / 100); } @@ -650,13 +674,12 @@ public class VatBlockEntity extends SmartBlockEntity implements IHaveGoggleInfor } } efficiency = speed; - if (oldMachines != machines) + if (oldMachineMap != machineMap) recipe = null; notifyUpdate(); } - public boolean isAtValidLocation(IVatMachine.PositionRequirement requirement, BlockPos pos) { return switch (requirement) { case ANY -> true; @@ -859,9 +882,13 @@ public class VatBlockEntity extends SmartBlockEntity implements IHaveGoggleInfor return null; } - public void addMachineTooltip(String operationId, List tooltip) { - CreateLang.translate("goggles.vat."+operationId.replace(":",".")) - .forGoggles(tooltip); + public void addMachineTooltip(String operationId, boolean isOperational, List tooltip) { + LangBuilder operation = CreateLang.translate("goggles.vat."+operationId.replace(":",".")); + if (!isOperational) { + operation.add(CreateLang.text(" - ")).add(CreateLang.translate("goggles.vat.not_operational") + .style(ChatFormatting.RED)); + } + operation.forGoggles(tooltip); } @Override @@ -879,8 +906,11 @@ public class VatBlockEntity extends SmartBlockEntity implements IHaveGoggleInfor CreateLang.translate("goggles.vat.attachments") .style(ChatFormatting.GRAY) .forGoggles(tooltip); - for (String operation : machines) - addMachineTooltip(operation, tooltip); + for (Map.Entry machines : machineMap.entrySet()) { + boolean operational = operationalMachinesMap.getOrDefault(machines.getValue(), true); + addMachineTooltip(machines.getKey(), operational, tooltip); + } + CreateLang.translate("goggles.vat.heat_status") diff --git a/src/main/java/com/drmangotea/tfmg/content/machinery/vat/electrode_holder/ElectrodeHolderBlockEntity.java b/src/main/java/com/drmangotea/tfmg/content/machinery/vat/electrode_holder/ElectrodeHolderBlockEntity.java index ac3bfe62..9c7d182e 100644 --- a/src/main/java/com/drmangotea/tfmg/content/machinery/vat/electrode_holder/ElectrodeHolderBlockEntity.java +++ b/src/main/java/com/drmangotea/tfmg/content/machinery/vat/electrode_holder/ElectrodeHolderBlockEntity.java @@ -126,7 +126,7 @@ public class ElectrodeHolderBlockEntity extends ElectricBlockEntity implements I @Override public String getOperationId() { - return isOperational() ? electrode.getOperationId() : ""; + return electrode.getOperationId(); //return switch (electrodeType) { // @@ -136,6 +136,11 @@ public class ElectrodeHolderBlockEntity extends ElectricBlockEntity implements I //}; } + @Override + public boolean canOperate(VatBlockEntity vat) { + return isOperational(); + } + @Override public int getWorkPercentage() { return (getPowerUsage() / 5000) * 100; diff --git a/src/main/java/com/drmangotea/tfmg/content/machinery/vat/industrial_mixer/IndustrialMixerBlockEntity.java b/src/main/java/com/drmangotea/tfmg/content/machinery/vat/industrial_mixer/IndustrialMixerBlockEntity.java index bca61123..0bd4c811 100644 --- a/src/main/java/com/drmangotea/tfmg/content/machinery/vat/industrial_mixer/IndustrialMixerBlockEntity.java +++ b/src/main/java/com/drmangotea/tfmg/content/machinery/vat/industrial_mixer/IndustrialMixerBlockEntity.java @@ -7,10 +7,14 @@ import com.drmangotea.tfmg.content.machinery.vat.base.VatBlockEntity; import com.drmangotea.tfmg.registry.TFMGItems; import com.drmangotea.tfmg.registry.TFMGPartialModels; import com.simibubi.create.AllPartialModels; +import com.simibubi.create.Create; +import com.simibubi.create.content.kinetics.base.IRotate; import com.simibubi.create.content.kinetics.base.KineticBlockEntity; import com.simibubi.create.content.kinetics.base.OrientedRotatingVisual; import com.simibubi.create.content.kinetics.gantry.GantryShaftBlock; import com.simibubi.create.content.kinetics.gantry.GantryShaftBlockEntity; +import com.simibubi.create.content.kinetics.mixer.MechanicalMixerBlock; +import com.simibubi.create.infrastructure.config.AllConfigs; import dev.engine_room.flywheel.api.visual.BlockEntityVisual; import dev.engine_room.flywheel.api.visualization.VisualizationContext; import dev.engine_room.flywheel.lib.model.Models; @@ -109,6 +113,11 @@ public class IndustrialMixerBlockEntity extends KineticBlockEntity implements IV }; } + @Override + public boolean canOperate(VatBlockEntity vat) { + return getSpeed() >= IRotate.SpeedLevel.MEDIUM.getSpeedValue() || getSpeed() <= -IRotate.SpeedLevel.MEDIUM.getSpeedValue(); + } + public boolean setMixerMode(ItemStack modeItem, boolean simulate) { for (MixerMode mode : MixerMode.values()) { if (mode.item.is(modeItem.getItem())) { diff --git a/src/main/resources/assets/tfmg/lang/default/interface.json b/src/main/resources/assets/tfmg/lang/default/interface.json index 5f6e5bdc..cefe6b6b 100644 --- a/src/main/resources/assets/tfmg/lang/default/interface.json +++ b/src/main/resources/assets/tfmg/lang/default/interface.json @@ -92,6 +92,7 @@ "create.goggles.vat.no_heat": "No Heat", "create.goggles.vat.heated": "Heated", "create.goggles.vat.superheated": "Superheated", + "create.goggles.vat.not_operational": "Not Operational", "create.goggles.vat.tfmg.graphite_electrode": " Graphite Electrode", "create.goggles.vat.tfmg.electrode": " Electrode", "create.goggles.vat.tfmg.mixing": " Mixer",