diff --git a/src/main/java/com/jerry/mekaf/common/content/blocktype/AdvancedFactoryBlockShapes.java b/src/main/java/com/jerry/mekaf/common/content/blocktype/AdvancedFactoryBlockShapes.java index 26d7d4a6..5894206f 100644 --- a/src/main/java/com/jerry/mekaf/common/content/blocktype/AdvancedFactoryBlockShapes.java +++ b/src/main/java/com/jerry/mekaf/common/content/blocktype/AdvancedFactoryBlockShapes.java @@ -140,10 +140,10 @@ private static VoxelShape box(double minX, double minY, double minZ, double maxX VoxelShapeUtils.setShape(VoxelShapeUtils.combine( Block.box(4, 4, 16, 12, 12, 16), Block.box(4, 4, 15, 12, 12, 16), - Block.box(4, 16, 1, 12, 26, 1), - Block.box(1, 16, 4, 1, 26, 12), - Block.box(4, 16, 15, 12, 26, 15), - Block.box(15, 16, 4, 15, 26, 12), + Block.box(4, 16, 1, 12, 26, 2), + Block.box(1, 16, 4, 2, 26, 12), + Block.box(4, 16, 14, 12, 26, 15), + Block.box(14, 16, 4, 15, 26, 12), Block.box(0, 0, 0, 16, 16, 4), Block.box(0, 12, 4, 16, 16, 16), Block.box(1, 4, 4, 15, 12, 15), diff --git a/src/main/java/com/jerry/mekaf/generated/mekaf/ComputerMethodRegistry_mekaf.java b/src/main/java/com/jerry/mekaf/generated/mekaf/ComputerMethodRegistry_mekaf.java new file mode 100644 index 00000000..803e526f --- /dev/null +++ b/src/main/java/com/jerry/mekaf/generated/mekaf/ComputerMethodRegistry_mekaf.java @@ -0,0 +1,9 @@ +package com.jerry.mekaf.generated.mekaf; + +import mekanism.common.integration.computer.IComputerMethodRegistry; + +public class ComputerMethodRegistry_mekaf implements IComputerMethodRegistry { + + @Override + public void register() {} +} diff --git a/src/main/java/com/jerry/meklm/generated/meklm/ComputerMethodRegistry_meklm.java b/src/main/java/com/jerry/meklm/generated/meklm/ComputerMethodRegistry_meklm.java new file mode 100644 index 00000000..13ed4834 --- /dev/null +++ b/src/main/java/com/jerry/meklm/generated/meklm/ComputerMethodRegistry_meklm.java @@ -0,0 +1,9 @@ +package com.jerry.meklm.generated.meklm; + +import mekanism.common.integration.computer.IComputerMethodRegistry; + +public class ComputerMethodRegistry_meklm implements IComputerMethodRegistry { + + @Override + public void register() {} +} diff --git a/src/main/java/com/jerry/mekmm/api/recipes/basic/BasicRecyclerRecipe.java b/src/main/java/com/jerry/mekmm/api/recipes/basic/BasicRecyclerRecipe.java index 91d082a8..5aa47390 100644 --- a/src/main/java/com/jerry/mekmm/api/recipes/basic/BasicRecyclerRecipe.java +++ b/src/main/java/com/jerry/mekmm/api/recipes/basic/BasicRecyclerRecipe.java @@ -74,6 +74,26 @@ public RecipeSerializer getSerializer() { return MoreMachineRecipeSerializers.RECYCLER.get(); } + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } else if (o == null || getClass() != o.getClass()) { + return false; + } + BasicRecyclerRecipe other = (BasicRecyclerRecipe) o; + return input.equals(other.input) && ItemStack.matches(chanceOutput, other.chanceOutput) && chance == other.chance; + } + + @Override + public int hashCode() { + int hash = input.hashCode(); + hash = 31 * hash + ItemStack.hashItemAndComponents(chanceOutput); + hash = 31 * hash + chanceOutput.getCount(); + hash = 31 * hash + Double.hashCode(chance); + return hash; + } + /** * Represents a precalculated chance based output. This output keeps track of what random value was calculated for * use in comparing if the secondary output should be diff --git a/src/main/java/com/jerry/mekmm/api/recipes/basic/BasicStamperRecipe.java b/src/main/java/com/jerry/mekmm/api/recipes/basic/BasicStamperRecipe.java index c3a7bf5d..699613e3 100644 --- a/src/main/java/com/jerry/mekmm/api/recipes/basic/BasicStamperRecipe.java +++ b/src/main/java/com/jerry/mekmm/api/recipes/basic/BasicStamperRecipe.java @@ -20,18 +20,18 @@ @NothingNullByDefault public class BasicStamperRecipe extends StamperRecipe { - protected final ItemStackIngredient mainInput; - protected final ItemStackIngredient extraInput; + protected final ItemStackIngredient input; + protected final ItemStackIngredient mold; protected final ItemStack output; /** - * @param mainInput Main input. - * @param extraInput Secondary/extra input. - * @param output Output. + * @param input Input. + * @param mold Mold. + * @param output Output. */ - public BasicStamperRecipe(ItemStackIngredient mainInput, ItemStackIngredient extraInput, ItemStack output) { - this.mainInput = Objects.requireNonNull(mainInput, "Main input cannot be null."); - this.extraInput = Objects.requireNonNull(extraInput, "Secondary/Extra input cannot be null."); + public BasicStamperRecipe(ItemStackIngredient input, ItemStackIngredient mold, ItemStack output) { + this.input = Objects.requireNonNull(input, "Input cannot be null."); + this.mold = Objects.requireNonNull(mold, "Mold cannot be null."); Objects.requireNonNull(output, "Output cannot be null."); if (output.isEmpty()) { throw new IllegalArgumentException("Output cannot be empty."); @@ -41,17 +41,17 @@ public BasicStamperRecipe(ItemStackIngredient mainInput, ItemStackIngredient ext @Override public boolean test(ItemStack input, ItemStack extra) { - return mainInput.test(input) && extraInput.test(extra); + return this.input.test(input) && mold.test(extra); } @Override public ItemStackIngredient getInput() { - return mainInput; + return input; } @Override public ItemStackIngredient getMold() { - return extraInput; + return mold; } @Override @@ -88,12 +88,12 @@ public boolean equals(Object o) { return false; } BasicStamperRecipe other = (BasicStamperRecipe) o; - return mainInput.equals(other.mainInput) && extraInput.equals(other.extraInput) && ItemStack.matches(output, other.output); + return input.equals(other.input) && mold.equals(other.mold) && ItemStack.matches(output, other.output); } @Override public int hashCode() { - int hash = Objects.hash(mainInput, extraInput); + int hash = Objects.hash(input, mold); hash = 31 * hash + ItemStack.hashItemAndComponents(output); hash = 31 * hash + output.getCount(); return hash; diff --git a/src/main/java/com/jerry/mekmm/client/gui/machine/GuiAmbientGasCollector.java b/src/main/java/com/jerry/mekmm/client/gui/machine/GuiAmbientGasCollector.java index 358988ea..8ea70aa4 100644 --- a/src/main/java/com/jerry/mekmm/client/gui/machine/GuiAmbientGasCollector.java +++ b/src/main/java/com/jerry/mekmm/client/gui/machine/GuiAmbientGasCollector.java @@ -48,12 +48,7 @@ protected void addGuiElements() { } ChemicalStack chemicalStack = tile.chemicalTank.getStack(); if (chemicalStack.isEmpty()) { - ChemicalStack fallBack = tile.getActiveType(); - if (fallBack.isEmpty()) { - list.add(MekanismLang.NO_CHEMICAL.translate()); - } else { - list.add(fallBack.getTextComponent()); - } + list.add(MekanismLang.NO_CHEMICAL.translate()); } else { list.add(MekanismLang.GENERIC_STORED_MB.translate(chemicalStack, TextUtils.format(chemicalStack.getAmount()))); } diff --git a/src/main/java/com/jerry/mekmm/client/gui/machine/GuiChemicalReplicator.java b/src/main/java/com/jerry/mekmm/client/gui/machine/GuiChemicalReplicator.java index 41e12266..18a55164 100644 --- a/src/main/java/com/jerry/mekmm/client/gui/machine/GuiChemicalReplicator.java +++ b/src/main/java/com/jerry/mekmm/client/gui/machine/GuiChemicalReplicator.java @@ -31,11 +31,11 @@ public GuiChemicalReplicator(MekanismTileContainer protected void addGuiElements() { super.addGuiElements(); addRenderableWidget(new GuiEnergyTab(this, tile.getEnergyContainer(), tile::getActive)); - addRenderableWidget(new GuiChemicalGauge(() -> tile.firstInputTank, () -> tile.getChemicalTanks(null), GaugeType.STANDARD, this, 28, 4)) + addRenderableWidget(new GuiChemicalGauge(() -> tile.inputTank, () -> tile.getChemicalTanks(null), GaugeType.STANDARD, this, 28, 4)) .warning(WarningTracker.WarningType.NO_MATCHING_RECIPE, tile.getWarningCheck(CachedRecipe.OperationTracker.RecipeError.NOT_ENOUGH_INPUT)); - addRenderableWidget(new GuiChemicalGauge(() -> tile.secondaryInputTank, () -> tile.getChemicalTanks(null), GaugeType.STANDARD, this, 7, 4)) + addRenderableWidget(new GuiChemicalGauge(() -> tile.uuTank, () -> tile.getChemicalTanks(null), GaugeType.STANDARD, this, 7, 4)) .warning(WarningTracker.WarningType.NO_MATCHING_RECIPE, tile.getWarningCheck(CachedRecipe.OperationTracker.RecipeError.NOT_ENOUGH_SECONDARY_INPUT)); - addRenderableWidget(new GuiChemicalGauge(() -> tile.chemicalOutputTank, () -> tile.getChemicalTanks(null), GaugeType.STANDARD, this, 131, 4)) + addRenderableWidget(new GuiChemicalGauge(() -> tile.outputTank, () -> tile.getChemicalTanks(null), GaugeType.STANDARD, this, 131, 4)) .warning(WarningTracker.WarningType.NO_SPACE_IN_OUTPUT, tile.getWarningCheck(CachedRecipe.OperationTracker.RecipeError.NOT_ENOUGH_OUTPUT_SPACE)); addRenderableWidget(new GuiEnergyGauge(tile.getEnergyContainer(), GaugeType.STANDARD, this, 151, 4)) .warning(WarningTracker.WarningType.NOT_ENOUGH_ENERGY, tile.getWarningCheck(CachedRecipe.OperationTracker.RecipeError.NOT_ENOUGH_ENERGY)); diff --git a/src/main/java/com/jerry/mekmm/client/gui/machine/GuiFluidReplicator.java b/src/main/java/com/jerry/mekmm/client/gui/machine/GuiFluidReplicator.java index 8100a5ed..3406def8 100644 --- a/src/main/java/com/jerry/mekmm/client/gui/machine/GuiFluidReplicator.java +++ b/src/main/java/com/jerry/mekmm/client/gui/machine/GuiFluidReplicator.java @@ -37,11 +37,11 @@ protected void addGuiElements() { super.addGuiElements(); addRenderableWidget(new GuiDownArrow(this, imageWidth + 8, 90)); addRenderableWidget(new GuiEnergyTab(this, tile.getEnergyContainer(), tile::getActive)); - addRenderableWidget(new GuiFluidGauge(() -> tile.fluidInputTank, () -> tile.getFluidTanks(null), GaugeType.STANDARD, this, 28, 4)) + addRenderableWidget(new GuiFluidGauge(() -> tile.inputTank, () -> tile.getFluidTanks(null), GaugeType.STANDARD, this, 28, 4)) .warning(WarningTracker.WarningType.NO_MATCHING_RECIPE, tile.getWarningCheck(CachedRecipe.OperationTracker.RecipeError.NOT_ENOUGH_INPUT)); - addRenderableWidget(new GuiChemicalGauge(() -> tile.chemicalTank, () -> tile.getChemicalTanks(null), GaugeType.STANDARD, this, 7, 4)) + addRenderableWidget(new GuiChemicalGauge(() -> tile.uuTank, () -> tile.getChemicalTanks(null), GaugeType.STANDARD, this, 7, 4)) .warning(WarningTracker.WarningType.NO_MATCHING_RECIPE, tile.getWarningCheck(CachedRecipe.OperationTracker.RecipeError.NOT_ENOUGH_SECONDARY_INPUT)); - addRenderableWidget(new GuiFluidGauge(() -> tile.fluidOutputTank, () -> tile.getFluidTanks(null), GaugeType.STANDARD, this, 131, 4)) + addRenderableWidget(new GuiFluidGauge(() -> tile.outputTank, () -> tile.getFluidTanks(null), GaugeType.STANDARD, this, 131, 4)) .warning(WarningTracker.WarningType.NO_SPACE_IN_OUTPUT, tile.getWarningCheck(CachedRecipe.OperationTracker.RecipeError.NOT_ENOUGH_OUTPUT_SPACE)); addRenderableWidget(new GuiEnergyGauge(tile.getEnergyContainer(), GaugeType.STANDARD, this, 151, 4)) .warning(WarningTracker.WarningType.NOT_ENOUGH_ENERGY, tile.getWarningCheck(CachedRecipe.OperationTracker.RecipeError.NOT_ENOUGH_ENERGY)); diff --git a/src/main/java/com/jerry/mekmm/common/tile/machine/TileEntityAmbientGasCollector$ComputerHandler.java b/src/main/java/com/jerry/mekmm/common/tile/machine/TileEntityAmbientGasCollector$ComputerHandler.java new file mode 100644 index 00000000..be2d103d --- /dev/null +++ b/src/main/java/com/jerry/mekmm/common/tile/machine/TileEntityAmbientGasCollector$ComputerHandler.java @@ -0,0 +1,44 @@ +package com.jerry.mekmm.common.tile.machine; + +import mekanism.api.chemical.ChemicalStack; +import mekanism.common.integration.computer.*; +import mekanism.common.integration.computer.annotation.MethodFactory; + +import net.minecraft.world.item.ItemStack; + +@MethodFactory(target = TileEntityAmbientGasCollector.class) +public class TileEntityAmbientGasCollector$ComputerHandler extends ComputerMethodFactory { + + public TileEntityAmbientGasCollector$ComputerHandler() { + register(MethodData.builder("getChemical", TileEntityAmbientGasCollector$ComputerHandler::chemicalTank$getChemical).returnType(ChemicalStack.class).methodDescription("Get the contents of the chemical tank.")); + register(MethodData.builder("getChemicalCapacity", TileEntityAmbientGasCollector$ComputerHandler::chemicalTank$getChemicalCapacity).returnType(int.class).methodDescription("Get the capacity of the chemical tank.")); + register(MethodData.builder("getChemicalNeeded", TileEntityAmbientGasCollector$ComputerHandler::chemicalTank$getChemicalNeeded).returnType(int.class).methodDescription("Get the amount needed to fill the chemical tank.")); + register(MethodData.builder("getChemicalFilledPercentage", TileEntityAmbientGasCollector$ComputerHandler::chemicalTank$getChemicalFilledPercentage).returnType(double.class).methodDescription("Get the filled percentage of the buffer tank.")); + register(MethodData.builder("getChemicalItem", TileEntityAmbientGasCollector$ComputerHandler::inputSlot$getChemicalItem).returnType(ItemStack.class).methodDescription("Get the contents of the input slot.")); + register(MethodData.builder("getEnergyItem", TileEntityAmbientGasCollector$ComputerHandler::energySlot$getEnergyItem).returnType(ItemStack.class).methodDescription("Get the contents of the energy slot.")); + } + + public static Object chemicalTank$getChemical(TileEntityAmbientGasCollector subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerChemicalTankWrapper.getStack(subject.chemicalTank)); + } + + public static Object chemicalTank$getChemicalCapacity(TileEntityAmbientGasCollector subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerChemicalTankWrapper.getCapacity(subject.chemicalTank)); + } + + public static Object chemicalTank$getChemicalNeeded(TileEntityAmbientGasCollector subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerChemicalTankWrapper.getNeeded(subject.chemicalTank)); + } + + public static Object chemicalTank$getChemicalFilledPercentage(TileEntityAmbientGasCollector subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerChemicalTankWrapper.getFilledPercentage(subject.chemicalTank)); + } + + public static Object inputSlot$getChemicalItem(TileEntityAmbientGasCollector subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerIInventorySlotWrapper.getStack(subject.chemicalSlot)); + } + + public static Object energySlot$getEnergyItem(TileEntityAmbientGasCollector subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerIInventorySlotWrapper.getStack(subject.energySlot)); + } +} diff --git a/src/main/java/com/jerry/mekmm/common/tile/machine/TileEntityAmbientGasCollector.java b/src/main/java/com/jerry/mekmm/common/tile/machine/TileEntityAmbientGasCollector.java index 005a64b6..67d01647 100644 --- a/src/main/java/com/jerry/mekmm/common/tile/machine/TileEntityAmbientGasCollector.java +++ b/src/main/java/com/jerry/mekmm/common/tile/machine/TileEntityAmbientGasCollector.java @@ -18,10 +18,12 @@ import mekanism.common.capabilities.holder.energy.IEnergyContainerHolder; import mekanism.common.capabilities.holder.slot.IInventorySlotHolder; import mekanism.common.capabilities.holder.slot.InventorySlotHelper; +import mekanism.common.integration.computer.SpecialComputerMethodWrapper.ComputerChemicalTankWrapper; +import mekanism.common.integration.computer.SpecialComputerMethodWrapper.ComputerIInventorySlotWrapper; +import mekanism.common.integration.computer.annotation.WrappingComputerMethod; import mekanism.common.inventory.container.MekanismContainer; import mekanism.common.inventory.container.slot.SlotOverlay; import mekanism.common.inventory.container.sync.SyncableBoolean; -import mekanism.common.inventory.container.sync.chemical.SyncableChemicalStack; import mekanism.common.inventory.slot.EnergyInventorySlot; import mekanism.common.inventory.slot.chemical.ChemicalInventorySlot; import mekanism.common.tile.base.TileEntityMekanism; @@ -39,6 +41,7 @@ import net.neoforged.neoforge.capabilities.BlockCapabilityCache; import net.neoforged.neoforge.fluids.FluidType; +import lombok.Getter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -56,12 +59,12 @@ public class TileEntityAmbientGasCollector extends TileEntityMekanism { private static final int BASE_OUTPUT_RATE = 256; // 化学品存储槽 + @WrappingComputerMethod(wrapper = ComputerChemicalTankWrapper.class, + methodNames = { "getChemical", "getChemicalCapacity", "getChemicalNeeded", + "getChemicalFilledPercentage" }, + docPlaceholder = "chemical tank") public IChemicalTank chemicalTank; - /** - * The type of chemical this collector is collecting - */ - @NotNull - private ChemicalStack activeType = ChemicalStack.EMPTY; + public int ticksRequired = BASE_TICKS_REQUIRED; /** * How many ticks this machine has been operating for. @@ -73,8 +76,11 @@ public class TileEntityAmbientGasCollector extends TileEntityMekanism { private boolean noBlocking = true; private List> chemicalHandlerAbove = Collections.emptyList(); + @Getter private MachineEnergyContainer energyContainer; + @WrappingComputerMethod(wrapper = ComputerIInventorySlotWrapper.class, methodNames = "getChemicalItem", docPlaceholder = "chemical slot") ChemicalInventorySlot chemicalSlot; + @WrappingComputerMethod(wrapper = ComputerIInventorySlotWrapper.class, methodNames = "getEnergyItem", docPlaceholder = "energy slot") EnergyInventorySlot energySlot; public TileEntityAmbientGasCollector(BlockPos pos, BlockState state) { @@ -115,26 +121,14 @@ protected boolean onUpdateServer() { if (canFunction() && (chemicalTank.isEmpty() || estimateIncrementAmount() <= chemicalTank.getNeeded())) { long energyPerTick = energyContainer.getEnergyPerTick(); if (energyContainer.extract(energyPerTick, Action.SIMULATE, AutomationType.INTERNAL) == energyPerTick) { - if (!activeType.isEmpty()) { - // If we have an active type of fluid, use energy. This can cause there to be ticks where there - // isn't actually - // anything to suck that use energy, but those will balance out with the first set of ticks where it - // doesn't - // use any energy until it actually picks up the first block - clientEnergyUsed = energyContainer.extract(energyPerTick, Action.EXECUTE, AutomationType.INTERNAL); - } operatingTicks++; if (operatingTicks >= ticksRequired) { operatingTicks = 0; // 判断收集器上方是否是空气 if (suck(worldPosition.relative(Direction.UP))) { - if (clientEnergyUsed == 0L) { - // If it didn't already have an active type (hasn't used energy this tick), then extract - // energy - clientEnergyUsed = energyContainer.extract(energyPerTick, Action.EXECUTE, AutomationType.INTERNAL); - } - } else { - reset(); + // If it didn't already have an active type (hasn't used energy this tick), then extract + // energy + clientEnergyUsed = energyContainer.extract(energyPerTick, Action.EXECUTE, AutomationType.INTERNAL); } } } @@ -160,7 +154,6 @@ private boolean suck(BlockPos pos) { Block block = blockState.getBlock(); if (isAir(block)) { ChemicalStack chemicalStack = new ChemicalStack(MoreMachineChemicals.UNSTABLE_DIMENSIONAL_GAS, estimateIncrementAmount()); - activeType = chemicalStack.copyWithAmount(estimateIncrementAmount()); chemicalTank.insert(chemicalStack, Action.EXECUTE, AutomationType.INTERNAL); return true; } @@ -176,23 +169,10 @@ public boolean getNotBlocking() { return noBlocking; } - public void reset() { - activeType = ChemicalStack.EMPTY; - } - - @Override - public void saveAdditional(@NotNull CompoundTag nbtTags, HolderLookup.@NotNull Provider provider) { - super.saveAdditional(nbtTags, provider); - if (!activeType.isEmpty()) { - nbtTags.put(SerializationConstants.CHEMICAL, activeType.save(provider)); - } - } - @Override public void loadAdditional(@NotNull CompoundTag nbt, HolderLookup.@NotNull Provider provider) { super.loadAdditional(nbt, provider); operatingTicks = nbt.getInt(SerializationConstants.PROGRESS); - NBTUtils.setChemicalStackIfPresent(provider, nbt, SerializationConstants.CHEMICAL, chemical -> activeType = chemical); } @Override @@ -225,24 +205,14 @@ public List getInfo(@NotNull Upgrade upgrade) { return UpgradeUtils.getMultScaledInfo(this, upgrade); } - public MachineEnergyContainer getEnergyContainer() { - return energyContainer; - } - public boolean usedEnergy() { return usedEnergy; } - @NotNull - public ChemicalStack getActiveType() { - return this.activeType; - } - @Override public void addContainerTrackers(MekanismContainer container) { super.addContainerTrackers(container); container.track(SyncableBoolean.create(this::usedEnergy, value -> usedEnergy = value)); container.track(SyncableBoolean.create(this::getNotBlocking, value -> noBlocking = value)); - container.track(SyncableChemicalStack.create(this::getActiveType, value -> activeType = value)); } } diff --git a/src/main/java/com/jerry/mekmm/common/tile/machine/TileEntityChemicalReplicator$ComputerHandler.java b/src/main/java/com/jerry/mekmm/common/tile/machine/TileEntityChemicalReplicator$ComputerHandler.java new file mode 100644 index 00000000..ee78ac6f --- /dev/null +++ b/src/main/java/com/jerry/mekmm/common/tile/machine/TileEntityChemicalReplicator$ComputerHandler.java @@ -0,0 +1,99 @@ +package com.jerry.mekmm.common.tile.machine; + +import mekanism.api.chemical.ChemicalStack; +import mekanism.common.integration.computer.*; +import mekanism.common.integration.computer.annotation.MethodFactory; + +import net.minecraft.world.item.ItemStack; + +@MethodFactory(target = TileEntityChemicalReplicator.class) +public class TileEntityChemicalReplicator$ComputerHandler extends ComputerMethodFactory { + + public TileEntityChemicalReplicator$ComputerHandler() { + register(MethodData.builder("getInput", TileEntityChemicalReplicator$ComputerHandler::inputTank$getChemical).returnType(ChemicalStack.class).methodDescription("Get the contents of the input tank.")); + register(MethodData.builder("getInputCapacity", TileEntityChemicalReplicator$ComputerHandler::inputTank$getChemicalCapacity).returnType(long.class).methodDescription("Get the capacity of the input tank.")); + register(MethodData.builder("getInputNeeded", TileEntityChemicalReplicator$ComputerHandler::inputTank$getChemicalNeeded).returnType(long.class).methodDescription("Get the amount needed to fill the input tank.")); + register(MethodData.builder("getInputFilledPercentage", TileEntityChemicalReplicator$ComputerHandler::inputTank$getChemicalFilledPercentage).returnType(double.class).methodDescription("Get the filled percentage of the input tank.")); + register(MethodData.builder("getOutput", TileEntityChemicalReplicator$ComputerHandler::outputTank$getChemical).returnType(ChemicalStack.class).methodDescription("Get the contents of the output tank.")); + register(MethodData.builder("getOutputCapacity", TileEntityChemicalReplicator$ComputerHandler::outputTank$getChemicalCapacity).returnType(long.class).methodDescription("Get the capacity of the output tank.")); + register(MethodData.builder("getOutputNeeded", TileEntityChemicalReplicator$ComputerHandler::outputTank$getChemicalNeeded).returnType(long.class).methodDescription("Get the amount needed to fill the output tank.")); + register(MethodData.builder("getOutputFilledPercentage", TileEntityChemicalReplicator$ComputerHandler::outputTank$getChemicalFilledPercentage).returnType(double.class).methodDescription("Get the filled percentage of the output tank.")); + register(MethodData.builder("getUU", TileEntityChemicalReplicator$ComputerHandler::uuTank$getChemical).returnType(ChemicalStack.class).methodDescription("Get the contents of the uu tank.")); + register(MethodData.builder("getUUCapacity", TileEntityChemicalReplicator$ComputerHandler::uuTank$getChemicalCapacity).returnType(long.class).methodDescription("Get the capacity of the uu tank.")); + register(MethodData.builder("getUUNeeded", TileEntityChemicalReplicator$ComputerHandler::uuTank$getChemicalNeeded).returnType(long.class).methodDescription("Get the amount needed to fill the uu tank.")); + register(MethodData.builder("getUUFilledPercentage", TileEntityChemicalReplicator$ComputerHandler::uuTank$getChemicalFilledPercentage).returnType(double.class).methodDescription("Get the filled percentage of the uu tank.")); + register(MethodData.builder("getUUSlot", TileEntityChemicalReplicator$ComputerHandler::uuSlot$getUUSlot).returnType(ItemStack.class).methodDescription("Get the contents of the uu slot.")); + register(MethodData.builder("getInputSlot", TileEntityChemicalReplicator$ComputerHandler::inputSlot$getInputSlot).returnType(ItemStack.class).methodDescription("Get the contents of the input slot.")); + register(MethodData.builder("getOutputSlot", TileEntityChemicalReplicator$ComputerHandler::outputSlot$getOutputSlot).returnType(ItemStack.class).methodDescription("Get the contents of the output slot.")); + register(MethodData.builder("getEnergyItem", TileEntityChemicalReplicator$ComputerHandler::energySlot$getEnergyItem).returnType(ItemStack.class).methodDescription("Get the contents of the energy slot.")); + register(MethodData.builder("getEnergyUsage", TileEntityChemicalReplicator$ComputerHandler::getEnergyUsage_0).returnType(long.class).methodDescription("Get the energy used in the last tick by the machine")); + } + + public static Object inputTank$getChemical(TileEntityChemicalReplicator subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerChemicalTankWrapper.getStack(subject.inputTank)); + } + + public static Object inputTank$getChemicalCapacity(TileEntityChemicalReplicator subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerChemicalTankWrapper.getCapacity(subject.inputTank)); + } + + public static Object inputTank$getChemicalNeeded(TileEntityChemicalReplicator subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerChemicalTankWrapper.getNeeded(subject.inputTank)); + } + + public static Object inputTank$getChemicalFilledPercentage(TileEntityChemicalReplicator subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerChemicalTankWrapper.getFilledPercentage(subject.inputTank)); + } + + public static Object outputTank$getChemical(TileEntityChemicalReplicator subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerChemicalTankWrapper.getStack(subject.outputTank)); + } + + public static Object outputTank$getChemicalCapacity(TileEntityChemicalReplicator subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerChemicalTankWrapper.getCapacity(subject.outputTank)); + } + + public static Object outputTank$getChemicalNeeded(TileEntityChemicalReplicator subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerChemicalTankWrapper.getNeeded(subject.outputTank)); + } + + public static Object outputTank$getChemicalFilledPercentage(TileEntityChemicalReplicator subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerChemicalTankWrapper.getFilledPercentage(subject.outputTank)); + } + + public static Object uuTank$getChemical(TileEntityChemicalReplicator subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerChemicalTankWrapper.getStack(subject.uuTank)); + } + + public static Object uuTank$getChemicalCapacity(TileEntityChemicalReplicator subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerChemicalTankWrapper.getCapacity(subject.uuTank)); + } + + public static Object uuTank$getChemicalNeeded(TileEntityChemicalReplicator subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerChemicalTankWrapper.getNeeded(subject.uuTank)); + } + + public static Object uuTank$getChemicalFilledPercentage(TileEntityChemicalReplicator subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerChemicalTankWrapper.getFilledPercentage(subject.uuTank)); + } + + public static Object uuSlot$getUUSlot(TileEntityChemicalReplicator subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerIInventorySlotWrapper.getStack(subject.uuSlot)); + } + + public static Object inputSlot$getInputSlot(TileEntityChemicalReplicator subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerIInventorySlotWrapper.getStack(subject.inputSlot)); + } + + public static Object outputSlot$getOutputSlot(TileEntityChemicalReplicator subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerIInventorySlotWrapper.getStack(subject.outputSlot)); + } + + public static Object energySlot$getEnergyItem(TileEntityChemicalReplicator subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerIInventorySlotWrapper.getStack(subject.energySlot)); + } + + public static Object getEnergyUsage_0(TileEntityChemicalReplicator subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(subject.getEnergyUsage()); + } +} diff --git a/src/main/java/com/jerry/mekmm/common/tile/machine/TileEntityChemicalReplicator.java b/src/main/java/com/jerry/mekmm/common/tile/machine/TileEntityChemicalReplicator.java index 41e50a78..2c7d3a20 100644 --- a/src/main/java/com/jerry/mekmm/common/tile/machine/TileEntityChemicalReplicator.java +++ b/src/main/java/com/jerry/mekmm/common/tile/machine/TileEntityChemicalReplicator.java @@ -30,6 +30,11 @@ import mekanism.common.capabilities.holder.energy.IEnergyContainerHolder; import mekanism.common.capabilities.holder.slot.IInventorySlotHolder; import mekanism.common.capabilities.holder.slot.InventorySlotHelper; +import mekanism.common.integration.computer.SpecialComputerMethodWrapper.ComputerChemicalTankWrapper; +import mekanism.common.integration.computer.SpecialComputerMethodWrapper.ComputerIInventorySlotWrapper; +import mekanism.common.integration.computer.annotation.ComputerMethod; +import mekanism.common.integration.computer.annotation.WrappingComputerMethod; +import mekanism.common.integration.computer.computercraft.ComputerConstants; import mekanism.common.inventory.container.slot.SlotOverlay; import mekanism.common.inventory.slot.EnergyInventorySlot; import mekanism.common.inventory.slot.chemical.ChemicalInventorySlot; @@ -70,10 +75,23 @@ public class TileEntityChemicalReplicator extends TileEntityProgressMachine customRecipeMap = ValidatorUtils.getRecipeFromConfig(MoreMachineConfig.general.chemicalReplicatorRecipe.get()); - public IChemicalTank firstInputTank; - public IChemicalTank chemicalOutputTank; + // 要复制的化学品 + @WrappingComputerMethod(wrapper = ComputerChemicalTankWrapper.class, + methodNames = { "getInput", "getInputCapacity", "getInputNeeded", + "getInputFilledPercentage" }, + docPlaceholder = "input tank") + public IChemicalTank inputTank; + @WrappingComputerMethod(wrapper = ComputerChemicalTankWrapper.class, + methodNames = { "getOutput", "getOutputCapacity", "getOutputNeeded", + "getOutputFilledPercentage" }, + docPlaceholder = "output tank") + public IChemicalTank outputTank; // UU - public IChemicalTank secondaryInputTank; + @WrappingComputerMethod(wrapper = ComputerChemicalTankWrapper.class, + methodNames = { "getUU", "getUUCapacity", "getUUNeeded", + "getUUFilledPercentage" }, + docPlaceholder = "uu tank") + public IChemicalTank uuTank; private MachineEnergyContainer energyContainer; @@ -82,39 +100,43 @@ public class TileEntityChemicalReplicator extends TileEntityProgressMachine outputHandler; // 气罐槽 // UU物质 - ChemicalInventorySlot firstSlot; + @WrappingComputerMethod(wrapper = ComputerIInventorySlotWrapper.class, methodNames = "getUUSlot", docPlaceholder = "uu slot") + ChemicalInventorySlot uuSlot; // 要复制的化学品 - ChemicalInventorySlot secondarySlot; + @WrappingComputerMethod(wrapper = ComputerIInventorySlotWrapper.class, methodNames = "getInputSlot", docPlaceholder = "input slot") + ChemicalInventorySlot inputSlot; + @WrappingComputerMethod(wrapper = ComputerIInventorySlotWrapper.class, methodNames = "getOutputSlot", docPlaceholder = "output slot") ChemicalInventorySlot outputSlot; + @WrappingComputerMethod(wrapper = ComputerIInventorySlotWrapper.class, methodNames = "getEnergyItem", docPlaceholder = "energy slot") EnergyInventorySlot energySlot; public TileEntityChemicalReplicator(BlockPos pos, BlockState state) { super(MoreMachineBlocks.CHEMICAL_REPLICATOR, pos, state, TRACKED_ERROR_TYPES, BASE_TICKS_REQUIRED); - configComponent.setupItemIOExtraConfig(firstSlot, outputSlot, secondarySlot, energySlot); + configComponent.setupItemIOExtraConfig(uuSlot, outputSlot, inputSlot, energySlot); ConfigInfo fluidConfig = configComponent.getConfig(TransmissionType.CHEMICAL); if (fluidConfig != null) { - fluidConfig.addSlotInfo(DataType.INPUT_1, new ChemicalSlotInfo(true, false, firstInputTank)); - fluidConfig.addSlotInfo(DataType.INPUT_2, new ChemicalSlotInfo(true, false, secondaryInputTank)); - fluidConfig.addSlotInfo(DataType.OUTPUT, new ChemicalSlotInfo(false, true, chemicalOutputTank)); + fluidConfig.addSlotInfo(DataType.INPUT_1, new ChemicalSlotInfo(true, false, inputTank)); + fluidConfig.addSlotInfo(DataType.INPUT_2, new ChemicalSlotInfo(true, false, uuTank)); + fluidConfig.addSlotInfo(DataType.OUTPUT, new ChemicalSlotInfo(false, true, outputTank)); } configComponent.setupInputConfig(TransmissionType.ENERGY, energyContainer); ejectorComponent = new TileComponentEjector(this); ejectorComponent.setOutputData(configComponent, TransmissionType.CHEMICAL, TransmissionType.ITEM) - .setCanTankEject(tank -> tank == chemicalOutputTank); + .setCanTankEject(tank -> tank == outputTank); - firstInputHandler = InputHelper.getInputHandler(firstInputTank, RecipeError.NOT_ENOUGH_INPUT); - outputHandler = OutputHelper.getOutputHandler(chemicalOutputTank, RecipeError.NOT_ENOUGH_OUTPUT_SPACE); - secondaryInputHandler = InputHelper.getConstantInputHandler(secondaryInputTank); + firstInputHandler = InputHelper.getInputHandler(inputTank, RecipeError.NOT_ENOUGH_INPUT); + outputHandler = OutputHelper.getOutputHandler(outputTank, RecipeError.NOT_ENOUGH_OUTPUT_SPACE); + secondaryInputHandler = InputHelper.getConstantInputHandler(uuTank); } @NotNull @Override public IChemicalTankHolder getInitialChemicalTanks(IContentsListener listener, IContentsListener recipeCacheListener, IContentsListener recipeCacheUnpauseListener) { ChemicalTankHelper builder = ChemicalTankHelper.forSideWithConfig(this); - builder.addTank(firstInputTank = BasicChemicalTank.inputModern(MAX_GAS, TileEntityChemicalReplicator::isValidInputChemical, recipeCacheListener)); - builder.addTank(secondaryInputTank = BasicChemicalTank.inputModern(MAX_GAS, TileEntityChemicalReplicator::isValidChemicalInput, recipeCacheListener)); - builder.addTank(chemicalOutputTank = BasicChemicalTank.output(MAX_GAS, recipeCacheUnpauseListener)); + builder.addTank(inputTank = BasicChemicalTank.inputModern(MAX_GAS, TileEntityChemicalReplicator::isValidInputChemical, recipeCacheListener)); + builder.addTank(uuTank = BasicChemicalTank.inputModern(MAX_GAS, TileEntityChemicalReplicator::isValidChemicalInput, recipeCacheListener)); + builder.addTank(outputTank = BasicChemicalTank.output(MAX_GAS, recipeCacheUnpauseListener)); return builder.build(); } @@ -130,14 +152,14 @@ protected IEnergyContainerHolder getInitialEnergyContainers(IContentsListener li protected @Nullable IInventorySlotHolder getInitialInventory(IContentsListener listener, IContentsListener recipeCacheListener, IContentsListener recipeCacheUnpauseListener) { InventorySlotHelper builder = InventorySlotHelper.forSideWithConfig(this); // 化学品罐槽位置 - builder.addSlot(firstSlot = ChemicalInventorySlot.fillOrConvert(firstInputTank, this::getLevel, listener, 29, 65)); - builder.addSlot(secondarySlot = ChemicalInventorySlot.fillOrConvert(secondaryInputTank, this::getLevel, listener, 8, 65)); - builder.addSlot(outputSlot = ChemicalInventorySlot.drain(chemicalOutputTank, listener, 132, 65)); + builder.addSlot(uuSlot = ChemicalInventorySlot.fillOrConvert(inputTank, this::getLevel, listener, 29, 65)); + builder.addSlot(inputSlot = ChemicalInventorySlot.fillOrConvert(uuTank, this::getLevel, listener, 8, 65)); + builder.addSlot(outputSlot = ChemicalInventorySlot.drain(outputTank, listener, 132, 65)); // 能量槽位置 builder.addSlot(energySlot = EnergyInventorySlot.fillOrConvert(energyContainer, this::getLevel, listener, 152, 65)); // 化学品罐槽减号图标 - firstSlot.setSlotOverlay(SlotOverlay.MINUS); - secondarySlot.setSlotOverlay(SlotOverlay.MINUS); + uuSlot.setSlotOverlay(SlotOverlay.MINUS); + inputSlot.setSlotOverlay(SlotOverlay.MINUS); outputSlot.setSlotOverlay(SlotOverlay.PLUS); return builder.build(); } @@ -159,8 +181,8 @@ public static boolean isValidChemicalInput(ChemicalStack stack) { protected boolean onUpdateServer() { boolean sendUpdatePacket = super.onUpdateServer(); energySlot.fillContainerOrConvert(); - firstSlot.fillTankOrConvert(); - secondarySlot.fillTankOrConvert(); + uuSlot.fillTankOrConvert(); + inputSlot.fillTankOrConvert(); recipeCacheLookupMonitor.updateAndProcess(); return sendUpdatePacket; } @@ -219,4 +241,11 @@ public static MMBasicChemicalChemicalToChemicalRecipe getRecipe(ChemicalStack ch public boolean isConfigurationDataCompatible(Block type) { return super.isConfigurationDataCompatible(type) || MoreMachineUtils.isSameMMTypeFactory(getBlockHolder(), type); } + + // Methods relating to IComputerTile + @ComputerMethod(methodDescription = ComputerConstants.DESCRIPTION_GET_ENERGY_USAGE) + long getEnergyUsage() { + return getActive() ? energyContainer.getEnergyPerTick() : 0; + } + // End methods IComputerTile } diff --git a/src/main/java/com/jerry/mekmm/common/tile/machine/TileEntityFluidReplicator$ComputerHandler.java b/src/main/java/com/jerry/mekmm/common/tile/machine/TileEntityFluidReplicator$ComputerHandler.java new file mode 100644 index 00000000..dd5afeb5 --- /dev/null +++ b/src/main/java/com/jerry/mekmm/common/tile/machine/TileEntityFluidReplicator$ComputerHandler.java @@ -0,0 +1,110 @@ +package com.jerry.mekmm.common.tile.machine; + +import mekanism.api.chemical.ChemicalStack; +import mekanism.common.integration.computer.*; +import mekanism.common.integration.computer.annotation.MethodFactory; + +import net.minecraft.world.item.ItemStack; +import net.neoforged.neoforge.fluids.FluidStack; + +@MethodFactory(target = TileEntityFluidReplicator.class) +public class TileEntityFluidReplicator$ComputerHandler extends ComputerMethodFactory { + + public TileEntityFluidReplicator$ComputerHandler() { + register(MethodData.builder("getInput", TileEntityFluidReplicator$ComputerHandler::inputTank$getFluid).returnType(FluidStack.class).methodDescription("Get the contents of the input tank.")); + register(MethodData.builder("getInputCapacity", TileEntityFluidReplicator$ComputerHandler::inputTank$getFluidCapacity).returnType(int.class).methodDescription("Get the capacity of the input tank.")); + register(MethodData.builder("getInputNeeded", TileEntityFluidReplicator$ComputerHandler::inputTank$getFluidNeeded).returnType(int.class).methodDescription("Get the amount needed to fill the input tank.")); + register(MethodData.builder("getInputFilledPercentage", TileEntityFluidReplicator$ComputerHandler::inputTank$getFluidFilledPercentage).returnType(double.class).methodDescription("Get the filled percentage of the input tank.")); + register(MethodData.builder("getOutput", TileEntityFluidReplicator$ComputerHandler::outputTank$getFluid).returnType(FluidStack.class).methodDescription("Get the contents of the output tank.")); + register(MethodData.builder("getOutputCapacity", TileEntityFluidReplicator$ComputerHandler::outputTank$getFluidCapacity).returnType(int.class).methodDescription("Get the capacity of the output tank.")); + register(MethodData.builder("getOutputNeeded", TileEntityFluidReplicator$ComputerHandler::outputTank$getFluidNeeded).returnType(int.class).methodDescription("Get the amount needed to fill the output tank.")); + register(MethodData.builder("getOutputFilledPercentage", TileEntityFluidReplicator$ComputerHandler::outputTank$getFluidFilledPercentage).returnType(double.class).methodDescription("Get the filled percentage of the output tank.")); + register(MethodData.builder("getUU", TileEntityFluidReplicator$ComputerHandler::uuTank$getChemical).returnType(ChemicalStack.class).methodDescription("Get the contents of the uu tank.")); + register(MethodData.builder("getUUCapacity", TileEntityFluidReplicator$ComputerHandler::uuTank$getChemicalCapacity).returnType(long.class).methodDescription("Get the capacity of the uu tank.")); + register(MethodData.builder("getUUNeeded", TileEntityFluidReplicator$ComputerHandler::uuTank$getChemicalNeeded).returnType(long.class).methodDescription("Get the amount needed to fill the uu tank.")); + register(MethodData.builder("getUUFilledPercentage", TileEntityFluidReplicator$ComputerHandler::uuTank$getChemicalFilledPercentage).returnType(double.class).methodDescription("Get the filled percentage of the uu tank.")); + register(MethodData.builder("getInputTankOutputSlot", TileEntityFluidReplicator$ComputerHandler::inputTankOutputSlot$getInputTankOutputSlot).returnType(ItemStack.class).methodDescription("Get the contents of the input tank output slot.")); + register(MethodData.builder("getOutputTankOutputSlot", TileEntityFluidReplicator$ComputerHandler::outputTankOutputSlot$getOutputTankOutputSlot).returnType(ItemStack.class).methodDescription("Get the contents of the output tank output slot.")); + register(MethodData.builder("getInputSlot", TileEntityFluidReplicator$ComputerHandler::inputSlot$getInputSlot).returnType(ItemStack.class).methodDescription("Get the contents of the input slot.")); + register(MethodData.builder("getOutputSlot", TileEntityFluidReplicator$ComputerHandler::outputSlot$getOutputSlot).returnType(ItemStack.class).methodDescription("Get the contents of the output slot.")); + register(MethodData.builder("getUUSlot", TileEntityFluidReplicator$ComputerHandler::uuSlot$getUUSlot).returnType(ItemStack.class).methodDescription("Get the contents of the uu slot.")); + register(MethodData.builder("getEnergyItem", TileEntityFluidReplicator$ComputerHandler::energySlot$getEnergyItem).returnType(ItemStack.class).methodDescription("Get the contents of the energy slot.")); + register(MethodData.builder("getEnergyUsage", TileEntityFluidReplicator$ComputerHandler::getEnergyUsage_0).returnType(long.class).methodDescription("Get the energy used in the last tick by the machine")); + } + + public static Object inputTank$getFluid(TileEntityFluidReplicator subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerFluidTankWrapper.getStack(subject.inputTank)); + } + + public static Object inputTank$getFluidCapacity(TileEntityFluidReplicator subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerFluidTankWrapper.getCapacity(subject.inputTank)); + } + + public static Object inputTank$getFluidNeeded(TileEntityFluidReplicator subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerFluidTankWrapper.getNeeded(subject.inputTank)); + } + + public static Object inputTank$getFluidFilledPercentage(TileEntityFluidReplicator subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerFluidTankWrapper.getFilledPercentage(subject.inputTank)); + } + + public static Object outputTank$getFluid(TileEntityFluidReplicator subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerFluidTankWrapper.getStack(subject.outputTank)); + } + + public static Object outputTank$getFluidCapacity(TileEntityFluidReplicator subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerFluidTankWrapper.getCapacity(subject.outputTank)); + } + + public static Object outputTank$getFluidNeeded(TileEntityFluidReplicator subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerFluidTankWrapper.getNeeded(subject.outputTank)); + } + + public static Object outputTank$getFluidFilledPercentage(TileEntityFluidReplicator subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerFluidTankWrapper.getFilledPercentage(subject.outputTank)); + } + + public static Object uuTank$getChemical(TileEntityFluidReplicator subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerChemicalTankWrapper.getStack(subject.uuTank)); + } + + public static Object uuTank$getChemicalCapacity(TileEntityFluidReplicator subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerChemicalTankWrapper.getCapacity(subject.uuTank)); + } + + public static Object uuTank$getChemicalNeeded(TileEntityFluidReplicator subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerChemicalTankWrapper.getNeeded(subject.uuTank)); + } + + public static Object uuTank$getChemicalFilledPercentage(TileEntityFluidReplicator subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerChemicalTankWrapper.getFilledPercentage(subject.uuTank)); + } + + public static Object inputTankOutputSlot$getInputTankOutputSlot(TileEntityFluidReplicator subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerIInventorySlotWrapper.getStack(subject.inputTankOutputSlot)); + } + + public static Object outputTankOutputSlot$getOutputTankOutputSlot(TileEntityFluidReplicator subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerIInventorySlotWrapper.getStack(subject.outputTankOutputSlot)); + } + + public static Object inputSlot$getInputSlot(TileEntityFluidReplicator subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerIInventorySlotWrapper.getStack(subject.fluidInputSlot)); + } + + public static Object outputSlot$getOutputSlot(TileEntityFluidReplicator subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerIInventorySlotWrapper.getStack(subject.fluidOutputSlot)); + } + + public static Object uuSlot$getUUSlot(TileEntityFluidReplicator subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerIInventorySlotWrapper.getStack(subject.uuSlot)); + } + + public static Object energySlot$getEnergyItem(TileEntityFluidReplicator subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerIInventorySlotWrapper.getStack(subject.energySlot)); + } + + public static Object getEnergyUsage_0(TileEntityFluidReplicator subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(subject.getEnergyUsage()); + } +} diff --git a/src/main/java/com/jerry/mekmm/common/tile/machine/TileEntityFluidReplicator.java b/src/main/java/com/jerry/mekmm/common/tile/machine/TileEntityFluidReplicator.java index dfcbcb71..24149839 100644 --- a/src/main/java/com/jerry/mekmm/common/tile/machine/TileEntityFluidReplicator.java +++ b/src/main/java/com/jerry/mekmm/common/tile/machine/TileEntityFluidReplicator.java @@ -33,6 +33,12 @@ import mekanism.common.capabilities.holder.fluid.IFluidTankHolder; import mekanism.common.capabilities.holder.slot.IInventorySlotHolder; import mekanism.common.capabilities.holder.slot.InventorySlotHelper; +import mekanism.common.integration.computer.SpecialComputerMethodWrapper.ComputerChemicalTankWrapper; +import mekanism.common.integration.computer.SpecialComputerMethodWrapper.ComputerFluidTankWrapper; +import mekanism.common.integration.computer.SpecialComputerMethodWrapper.ComputerIInventorySlotWrapper; +import mekanism.common.integration.computer.annotation.ComputerMethod; +import mekanism.common.integration.computer.annotation.WrappingComputerMethod; +import mekanism.common.integration.computer.computercraft.ComputerConstants; import mekanism.common.inventory.container.slot.SlotOverlay; import mekanism.common.inventory.slot.EnergyInventorySlot; import mekanism.common.inventory.slot.FluidInventorySlot; @@ -79,10 +85,22 @@ public class TileEntityFluidReplicator extends TileEntityProgressMachine customRecipeMap = ValidatorUtils.getRecipeFromConfig(MoreMachineConfig.general.fluidReplicatorRecipe.get()); - public BasicFluidTank fluidInputTank; - public BasicFluidTank fluidOutputTank; + @WrappingComputerMethod(wrapper = ComputerFluidTankWrapper.class, + methodNames = { "getInput", "getInputCapacity", "getInputNeeded", + "getInputFilledPercentage" }, + docPlaceholder = "input tank") + public BasicFluidTank inputTank; + @WrappingComputerMethod(wrapper = ComputerFluidTankWrapper.class, + methodNames = { "getOutput", "getOutputCapacity", "getOutputNeeded", + "getOutputFilledPercentage" }, + docPlaceholder = "output tank") + public BasicFluidTank outputTank; // 化学品存储槽 - public IChemicalTank chemicalTank; + @WrappingComputerMethod(wrapper = ComputerChemicalTankWrapper.class, + methodNames = { "getUU", "getUUCapacity", "getUUNeeded", + "getUUFilledPercentage" }, + docPlaceholder = "uu tank") + public IChemicalTank uuTank; private MachineEnergyContainer energyContainer; @@ -90,45 +108,49 @@ public class TileEntityFluidReplicator extends TileEntityProgressMachine fluidOutputHandler; private final ILongInputHandler chemicalInputHandler; - FluidInventorySlot lFluidInputSlot; - FluidInventorySlot rFluidInputSlot; + @WrappingComputerMethod(wrapper = ComputerIInventorySlotWrapper.class, methodNames = "getInputTankOutputSlot", docPlaceholder = "input tank output slot") + FluidInventorySlot inputTankOutputSlot; + @WrappingComputerMethod(wrapper = ComputerIInventorySlotWrapper.class, methodNames = "getOutputTankOutputSlot", docPlaceholder = "output tank output slot") + FluidInventorySlot outputTankOutputSlot; // 流体储罐输入输出物品槽(GUI外的两个槽) + @WrappingComputerMethod(wrapper = ComputerIInventorySlotWrapper.class, methodNames = "getInputSlot", docPlaceholder = "input slot") FluidInventorySlot fluidInputSlot; + @WrappingComputerMethod(wrapper = ComputerIInventorySlotWrapper.class, methodNames = "getOutputSlot", docPlaceholder = "output slot") OutputInventorySlot fluidOutputSlot; // 气罐槽 - ChemicalInventorySlot chemicalSlot; + @WrappingComputerMethod(wrapper = ComputerIInventorySlotWrapper.class, methodNames = "getUUSlot", docPlaceholder = "uu slot") + ChemicalInventorySlot uuSlot; EnergyInventorySlot energySlot; public TileEntityFluidReplicator(BlockPos pos, BlockState state) { super(MoreMachineBlocks.FLUID_REPLICATOR, pos, state, TRACKED_ERROR_TYPES, BASE_TICKS_REQUIRED); - // configComponent.setupItemIOExtraConfig(fluidInputSlot, fluidOutputSlot, chemicalSlot, energySlot); - configComponent.setupItemIOConfig(List.of(fluidInputSlot, lFluidInputSlot), List.of(rFluidInputSlot, fluidOutputSlot), energySlot, false); + configComponent.setupItemIOConfig(List.of(fluidInputSlot, inputTankOutputSlot), List.of(outputTankOutputSlot, fluidOutputSlot), energySlot, false); ConfigInfo itemConfig = configComponent.getConfig(TransmissionType.ITEM); if (itemConfig != null) { - itemConfig.addSlotInfo(DataType.EXTRA, new InventorySlotInfo(true, true, chemicalSlot)); + itemConfig.addSlotInfo(DataType.EXTRA, new InventorySlotInfo(true, true, uuSlot)); } ConfigInfo fluidConfig = configComponent.getConfig(TransmissionType.FLUID); if (fluidConfig != null) { - fluidConfig.addSlotInfo(DataType.INPUT, new FluidSlotInfo(true, false, fluidInputTank)); - fluidConfig.addSlotInfo(DataType.OUTPUT, new FluidSlotInfo(false, true, fluidOutputTank)); + fluidConfig.addSlotInfo(DataType.INPUT, new FluidSlotInfo(true, false, inputTank)); + fluidConfig.addSlotInfo(DataType.OUTPUT, new FluidSlotInfo(false, true, outputTank)); } configComponent.setupInputConfig(TransmissionType.ENERGY, energyContainer); - configComponent.setupInputConfig(TransmissionType.CHEMICAL, chemicalTank); + configComponent.setupInputConfig(TransmissionType.CHEMICAL, uuTank); ejectorComponent = new TileComponentEjector(this); ejectorComponent.setOutputData(configComponent, TransmissionType.FLUID, TransmissionType.ITEM) - .setCanTankEject(tank -> tank == fluidOutputTank); + .setCanTankEject(tank -> tank == outputTank); - fluidInputHandler = InputHelper.getInputHandler(fluidInputTank, RecipeError.NOT_ENOUGH_INPUT); - fluidOutputHandler = OutputHelper.getOutputHandler(fluidOutputTank, RecipeError.NOT_ENOUGH_OUTPUT_SPACE); - chemicalInputHandler = InputHelper.getConstantInputHandler(chemicalTank); + fluidInputHandler = InputHelper.getInputHandler(inputTank, RecipeError.NOT_ENOUGH_INPUT); + fluidOutputHandler = OutputHelper.getOutputHandler(outputTank, RecipeError.NOT_ENOUGH_OUTPUT_SPACE); + chemicalInputHandler = InputHelper.getConstantInputHandler(uuTank); } @Override protected @Nullable IFluidTankHolder getInitialFluidTanks(IContentsListener listener, IContentsListener recipeCacheListener, IContentsListener recipeCacheUnpauseListener) { FluidTankHelper builder = FluidTankHelper.forSideWithConfig(this); - builder.addTank(fluidInputTank = BasicFluidTank.input(FluidType.BUCKET_VOLUME, TileEntityFluidReplicator::isValidFluidInput, recipeCacheListener)); - builder.addTank(fluidOutputTank = BasicFluidTank.output(MAX_FLUID, recipeCacheUnpauseListener)); + builder.addTank(inputTank = BasicFluidTank.input(FluidType.BUCKET_VOLUME, TileEntityFluidReplicator::isValidFluidInput, recipeCacheListener)); + builder.addTank(outputTank = BasicFluidTank.output(MAX_FLUID, recipeCacheUnpauseListener)); return builder.build(); } @@ -136,7 +158,7 @@ public TileEntityFluidReplicator(BlockPos pos, BlockState state) { @Override public IChemicalTankHolder getInitialChemicalTanks(IContentsListener listener, IContentsListener recipeCacheListener, IContentsListener recipeCacheUnpauseListener) { ChemicalTankHelper builder = ChemicalTankHelper.forSideWithConfig(this); - builder.addTank(chemicalTank = BasicChemicalTank.inputModern(MAX_GAS, TileEntityFluidReplicator::isValidChemicalInput, recipeCacheListener)); + builder.addTank(uuTank = BasicChemicalTank.inputModern(MAX_GAS, TileEntityFluidReplicator::isValidChemicalInput, recipeCacheListener)); return builder.build(); } @@ -152,20 +174,20 @@ protected IEnergyContainerHolder getInitialEnergyContainers(IContentsListener li protected @Nullable IInventorySlotHolder getInitialInventory(IContentsListener listener, IContentsListener recipeCacheListener, IContentsListener recipeCacheUnpauseListener) { InventorySlotHelper builder = InventorySlotHelper.forSideWithConfig(this); // 输入 - builder.addSlot(fluidInputSlot = FluidInventorySlot.fill(fluidInputTank, listener, 180, 71)); + builder.addSlot(fluidInputSlot = FluidInventorySlot.fill(inputTank, listener, 180, 71)); builder.addSlot(fluidOutputSlot = OutputInventorySlot.at(listener, 180, 102)); // 输出 - builder.addSlot(lFluidInputSlot = FluidInventorySlot.drain(fluidInputTank, listener, 29, 65)); - builder.addSlot(rFluidInputSlot = FluidInventorySlot.drain(fluidOutputTank, listener, 132, 65)); + builder.addSlot(inputTankOutputSlot = FluidInventorySlot.drain(inputTank, listener, 29, 65)); + builder.addSlot(outputTankOutputSlot = FluidInventorySlot.drain(outputTank, listener, 132, 65)); // 化学品罐槽位置 - builder.addSlot(chemicalSlot = ChemicalInventorySlot.fillOrConvert(chemicalTank, this::getLevel, listener, 8, 65)); + builder.addSlot(uuSlot = ChemicalInventorySlot.fillOrConvert(uuTank, this::getLevel, listener, 8, 65)); // 能量槽位置 builder.addSlot(energySlot = EnergyInventorySlot.fillOrConvert(energyContainer, this::getLevel, listener, 152, 65)); // 化学品罐槽减号图标 - chemicalSlot.setSlotOverlay(SlotOverlay.MINUS); + uuSlot.setSlotOverlay(SlotOverlay.MINUS); fluidInputSlot.setSlotOverlay(SlotOverlay.MINUS); - lFluidInputSlot.setSlotOverlay(SlotOverlay.PLUS); - rFluidInputSlot.setSlotOverlay(SlotOverlay.PLUS); + inputTankOutputSlot.setSlotOverlay(SlotOverlay.PLUS); + outputTankOutputSlot.setSlotOverlay(SlotOverlay.PLUS); return builder.build(); } @@ -185,9 +207,9 @@ protected boolean onUpdateServer() { boolean sendUpdatePacket = super.onUpdateServer(); energySlot.fillContainerOrConvert(); fluidInputSlot.fillTank(fluidOutputSlot); - chemicalSlot.fillTankOrConvert(); - lFluidInputSlot.drainTank(fluidOutputSlot); - rFluidInputSlot.drainTank(fluidOutputSlot); + uuSlot.fillTankOrConvert(); + inputTankOutputSlot.drainTank(fluidOutputSlot); + outputTankOutputSlot.drainTank(fluidOutputSlot); recipeCacheLookupMonitor.updateAndProcess(); return sendUpdatePacket; } @@ -246,4 +268,11 @@ public static BasicFluidChemicalToFluidRecipe getRecipe(FluidStack fluidStack, C public boolean isConfigurationDataCompatible(Block type) { return super.isConfigurationDataCompatible(type) || MoreMachineUtils.isSameMMTypeFactory(getBlockHolder(), type); } + + // Methods relating to IComputerTile + @ComputerMethod(methodDescription = ComputerConstants.DESCRIPTION_GET_ENERGY_USAGE) + long getEnergyUsage() { + return getActive() ? energyContainer.getEnergyPerTick() : 0; + } + // End methods IComputerTile } diff --git a/src/main/java/com/jerry/mekmm/common/tile/machine/TileEntityPlantingStation$ComputerHandler.java b/src/main/java/com/jerry/mekmm/common/tile/machine/TileEntityPlantingStation$ComputerHandler.java new file mode 100644 index 00000000..f6497242 --- /dev/null +++ b/src/main/java/com/jerry/mekmm/common/tile/machine/TileEntityPlantingStation$ComputerHandler.java @@ -0,0 +1,64 @@ +package com.jerry.mekmm.common.tile.machine; + +import mekanism.api.chemical.ChemicalStack; +import mekanism.common.integration.computer.*; +import mekanism.common.integration.computer.annotation.MethodFactory; + +import net.minecraft.world.item.ItemStack; + +@MethodFactory(target = TileEntityPlantingStation.class) +public class TileEntityPlantingStation$ComputerHandler extends ComputerMethodFactory { + + public TileEntityPlantingStation$ComputerHandler() { + register(MethodData.builder("getInput", TileEntityPlantingStation$ComputerHandler::inputSlot$getInput).returnType(ItemStack.class).methodDescription("Get the contents of the input slot.")); + register(MethodData.builder("getChemical", TileEntityPlantingStation$ComputerHandler::chemicalTank$getChemical).returnType(ChemicalStack.class).methodDescription("Get the contents of the chemical tank.")); + register(MethodData.builder("getChemicalCapacity", TileEntityPlantingStation$ComputerHandler::chemicalTank$getChemicalCapacity).returnType(long.class).methodDescription("Get the capacity of the chemical tank.")); + register(MethodData.builder("getChemicalNeeded", TileEntityPlantingStation$ComputerHandler::chemicalTank$getChemicalNeeded).returnType(long.class).methodDescription("Get the amount needed to fill the chemical tank.")); + register(MethodData.builder("getChemicalFilledPercentage", TileEntityPlantingStation$ComputerHandler::chemicalTank$getChemicalFilledPercentage).returnType(double.class).methodDescription("Get the filled percentage of the chemical tank.")); + register(MethodData.builder("getOutput", TileEntityPlantingStation$ComputerHandler::outputSlot$getOutput).returnType(ItemStack.class).methodDescription("Get the contents of the output slot.")); + register(MethodData.builder("getSecondaryOutput", TileEntityPlantingStation$ComputerHandler::secondaryOutputSlot$getSecondaryOutput).returnType(ItemStack.class).methodDescription("Get the contents of the secondary output slot.")); + register(MethodData.builder("getChemicalItem", TileEntityPlantingStation$ComputerHandler::chemicalSlot$getChemicalItem).returnType(ItemStack.class).methodDescription("Get the contents of the chemical input slot.")); + register(MethodData.builder("getEnergyItem", TileEntityPlantingStation$ComputerHandler::energySlot$getEnergyItem).returnType(ItemStack.class).methodDescription("Get the contents of the energy slot.")); + register(MethodData.builder("getEnergyUsage", TileEntityPlantingStation$ComputerHandler::getEnergyUsage_0).returnType(long.class).methodDescription("Get the energy used in the last tick by the machine")); + } + + public static Object inputSlot$getInput(TileEntityPlantingStation subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerIInventorySlotWrapper.getStack(subject.inputSlot)); + } + + public static Object chemicalTank$getChemical(TileEntityPlantingStation subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerChemicalTankWrapper.getStack(subject.chemicalTank)); + } + + public static Object chemicalTank$getChemicalCapacity(TileEntityPlantingStation subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerChemicalTankWrapper.getCapacity(subject.chemicalTank)); + } + + public static Object chemicalTank$getChemicalNeeded(TileEntityPlantingStation subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerChemicalTankWrapper.getNeeded(subject.chemicalTank)); + } + + public static Object chemicalTank$getChemicalFilledPercentage(TileEntityPlantingStation subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerChemicalTankWrapper.getFilledPercentage(subject.chemicalTank)); + } + + public static Object outputSlot$getOutput(TileEntityPlantingStation subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerIInventorySlotWrapper.getStack(subject.mainOutputSlot)); + } + + public static Object secondaryOutputSlot$getSecondaryOutput(TileEntityPlantingStation subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerIInventorySlotWrapper.getStack(subject.secondaryOutputSlot)); + } + + public static Object chemicalSlot$getChemicalItem(TileEntityPlantingStation subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerIInventorySlotWrapper.getStack(subject.chemicalSlot)); + } + + public static Object energySlot$getEnergyItem(TileEntityPlantingStation subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerIInventorySlotWrapper.getStack(subject.energySlot)); + } + + public static Object getEnergyUsage_0(TileEntityPlantingStation subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(subject.getEnergyUsage()); + } +} diff --git a/src/main/java/com/jerry/mekmm/common/tile/machine/TileEntityPlantingStation.java b/src/main/java/com/jerry/mekmm/common/tile/machine/TileEntityPlantingStation.java index 748824a2..2e32ebe1 100644 --- a/src/main/java/com/jerry/mekmm/common/tile/machine/TileEntityPlantingStation.java +++ b/src/main/java/com/jerry/mekmm/common/tile/machine/TileEntityPlantingStation.java @@ -35,6 +35,11 @@ import mekanism.common.capabilities.holder.slot.IInventorySlotHolder; import mekanism.common.capabilities.holder.slot.InventorySlotHelper; import mekanism.common.config.MekanismConfig; +import mekanism.common.integration.computer.SpecialComputerMethodWrapper.ComputerChemicalTankWrapper; +import mekanism.common.integration.computer.SpecialComputerMethodWrapper.ComputerIInventorySlotWrapper; +import mekanism.common.integration.computer.annotation.ComputerMethod; +import mekanism.common.integration.computer.annotation.WrappingComputerMethod; +import mekanism.common.integration.computer.computercraft.ComputerConstants; import mekanism.common.integration.energy.EnergyCompatUtils; import mekanism.common.inventory.slot.EnergyInventorySlot; import mekanism.common.inventory.slot.InputInventorySlot; @@ -43,7 +48,7 @@ import mekanism.common.inventory.warning.WarningTracker; import mekanism.common.lib.transmitter.TransmissionType; import mekanism.common.recipe.IMekanismRecipeTypeProvider; -import mekanism.common.recipe.lookup.IDoubleRecipeLookupHandler; +import mekanism.common.recipe.lookup.IDoubleRecipeLookupHandler.ItemChemicalRecipeLookupHandler; import mekanism.common.recipe.lookup.IRecipeLookupHandler.ConstantUsageRecipeLookupHandler; import mekanism.common.recipe.lookup.cache.InputRecipeCache.ItemChemical; import mekanism.common.tile.component.TileComponentEjector; @@ -73,11 +78,9 @@ import java.util.Objects; public class TileEntityPlantingStation extends TileEntityProgressMachine implements ConstantUsageRecipeLookupHandler, - IDoubleRecipeLookupHandler.ItemChemicalRecipeLookupHandler, IBoundingBlock { + ItemChemicalRecipeLookupHandler, IBoundingBlock { public static final RecipeError NOT_ENOUGH_SPACE_SECONDARY_OUTPUT_ERROR = RecipeError.create(); - public static final int BASE_TICKS_REQUIRED = 10 * SharedConstants.TICKS_PER_SECOND; - public static final long MAX_GAS = 210; private static final List TRACKED_ERROR_TYPES = List.of( RecipeError.NOT_ENOUGH_ENERGY, RecipeError.NOT_ENOUGH_ENERGY_REDUCED_RATE, @@ -87,17 +90,33 @@ public class TileEntityPlantingStation extends TileEntityProgressMachine outputHandler; private final IInputHandler itemInputHandler; private final ILongInputHandler chemicalInputHandler; - // 化学品存储槽 - public IChemicalTank chemicalTank; + + @WrappingComputerMethod(wrapper = ComputerIInventorySlotWrapper.class, methodNames = "getInput", docPlaceholder = "input slot") InputInventorySlot inputSlot; + @WrappingComputerMethod(wrapper = ComputerIInventorySlotWrapper.class, methodNames = "getOutput", docPlaceholder = "output slot") OutputInventorySlot mainOutputSlot; + @WrappingComputerMethod(wrapper = ComputerIInventorySlotWrapper.class, methodNames = "getSecondaryOutput", docPlaceholder = "secondary output slot") OutputInventorySlot secondaryOutputSlot; // 气罐槽 + @WrappingComputerMethod(wrapper = ComputerIInventorySlotWrapper.class, methodNames = "getChemicalItem", docPlaceholder = "chemical input slot") ChemicalInventorySlot chemicalSlot; + @WrappingComputerMethod(wrapper = ComputerIInventorySlotWrapper.class, methodNames = "getEnergyItem", docPlaceholder = "energy slot") EnergyInventorySlot energySlot; + private double chemicalPerTickMeanMultiplier = 1; private long baseTotalUsage; private long usedSoFar; @@ -297,4 +316,11 @@ private boolean notEnergyPort(Direction side, Vec3i offset) { } return true; } + + // Methods relating to IComputerTile + @ComputerMethod(methodDescription = ComputerConstants.DESCRIPTION_GET_ENERGY_USAGE) + long getEnergyUsage() { + return getActive() ? energyContainer.getEnergyPerTick() : 0; + } + // End methods IComputerTile } diff --git a/src/main/java/com/jerry/mekmm/common/tile/machine/TileEntityRecycler$ComputerHandler.java b/src/main/java/com/jerry/mekmm/common/tile/machine/TileEntityRecycler$ComputerHandler.java new file mode 100644 index 00000000..b1a58fae --- /dev/null +++ b/src/main/java/com/jerry/mekmm/common/tile/machine/TileEntityRecycler$ComputerHandler.java @@ -0,0 +1,33 @@ +package com.jerry.mekmm.common.tile.machine; + +import mekanism.common.integration.computer.*; +import mekanism.common.integration.computer.annotation.MethodFactory; + +import net.minecraft.world.item.ItemStack; + +@MethodFactory(target = TileEntityRecycler.class) +public class TileEntityRecycler$ComputerHandler extends ComputerMethodFactory { + + public TileEntityRecycler$ComputerHandler() { + register(MethodData.builder("getInput", TileEntityRecycler$ComputerHandler::inputSlot$getInput).returnType(ItemStack.class).methodDescription("Get the contents of the input slot.")); + register(MethodData.builder("getOutput", TileEntityRecycler$ComputerHandler::outputSlot$getOutput).returnType(ItemStack.class).methodDescription("Get the contents of the output slot.")); + register(MethodData.builder("getEnergyItem", TileEntityRecycler$ComputerHandler::energySlot$getEnergyItem).returnType(ItemStack.class).methodDescription("Get the contents of the energy slot.")); + register(MethodData.builder("getEnergyUsage", TileEntityRecycler$ComputerHandler::getEnergyUsage_0).returnType(long.class).methodDescription("Get the energy used in the last tick by the machine")); + } + + public static Object inputSlot$getInput(TileEntityRecycler subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerIInventorySlotWrapper.getStack(subject.inputSlot)); + } + + public static Object outputSlot$getOutput(TileEntityRecycler subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerIInventorySlotWrapper.getStack(subject.outputSlot)); + } + + public static Object energySlot$getEnergyItem(TileEntityRecycler subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerIInventorySlotWrapper.getStack(subject.energySlot)); + } + + public static Object getEnergyUsage_0(TileEntityRecycler subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(subject.getEnergyUsage()); + } +} diff --git a/src/main/java/com/jerry/mekmm/common/tile/machine/TileEntityRecycler.java b/src/main/java/com/jerry/mekmm/common/tile/machine/TileEntityRecycler.java index b1112828..2b085bd2 100644 --- a/src/main/java/com/jerry/mekmm/common/tile/machine/TileEntityRecycler.java +++ b/src/main/java/com/jerry/mekmm/common/tile/machine/TileEntityRecycler.java @@ -1,6 +1,7 @@ package com.jerry.mekmm.common.tile.machine; import com.jerry.mekmm.api.recipes.RecyclerRecipe; +import com.jerry.mekmm.api.recipes.RecyclerRecipe.ChanceOutput; import com.jerry.mekmm.api.recipes.cache.MoreMachineOneInputCachedRecipe; import com.jerry.mekmm.api.recipes.outputs.MoreMachineOutputHelper; import com.jerry.mekmm.client.recipe_viewer.MMRecipeViewerRecipeType; @@ -20,6 +21,10 @@ import mekanism.common.capabilities.holder.energy.IEnergyContainerHolder; import mekanism.common.capabilities.holder.slot.IInventorySlotHolder; import mekanism.common.capabilities.holder.slot.InventorySlotHelper; +import mekanism.common.integration.computer.SpecialComputerMethodWrapper.ComputerIInventorySlotWrapper; +import mekanism.common.integration.computer.annotation.ComputerMethod; +import mekanism.common.integration.computer.annotation.WrappingComputerMethod; +import mekanism.common.integration.computer.computercraft.ComputerConstants; import mekanism.common.inventory.slot.EnergyInventorySlot; import mekanism.common.inventory.slot.InputInventorySlot; import mekanism.common.inventory.slot.OutputInventorySlot; @@ -40,6 +45,7 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; +import lombok.Getter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -56,25 +62,29 @@ public class TileEntityRecycler extends TileEntityProgressMachine chanceOutputHandler; + private final IOutputHandler<@NotNull ChanceOutput> chanceOutputHandler; private final IInputHandler<@NotNull ItemStack> inputHandler; + @Getter private MachineEnergyContainer energyContainer; + @WrappingComputerMethod(wrapper = ComputerIInventorySlotWrapper.class, methodNames = "getInput", docPlaceholder = "input slot") InputInventorySlot inputSlot; - OutputInventorySlot chanceOutputSlot; + @WrappingComputerMethod(wrapper = ComputerIInventorySlotWrapper.class, methodNames = "getOutput", docPlaceholder = "output slot") + OutputInventorySlot outputSlot; + @WrappingComputerMethod(wrapper = ComputerIInventorySlotWrapper.class, methodNames = "getEnergyItem", docPlaceholder = "energy slot") EnergyInventorySlot energySlot; public TileEntityRecycler(BlockPos pos, BlockState state) { super(MoreMachineBlocks.RECYCLER, pos, state, TRACKED_ERROR_TYPES, BASE_TICKS_REQUIRED); - configComponent.setupItemIOConfig(Collections.singletonList(inputSlot), Collections.singletonList(chanceOutputSlot), energySlot, false); + configComponent.setupItemIOConfig(Collections.singletonList(inputSlot), Collections.singletonList(outputSlot), energySlot, false); configComponent.setupInputConfig(TransmissionType.ENERGY, energyContainer); ejectorComponent = new TileComponentEjector(this); ejectorComponent.setOutputData(configComponent, TransmissionType.ITEM); inputHandler = InputHelper.getInputHandler(inputSlot, RecipeError.NOT_ENOUGH_INPUT); - chanceOutputHandler = MoreMachineOutputHelper.getOutputHandler(chanceOutputSlot, RecipeError.NOT_ENOUGH_OUTPUT_SPACE); + chanceOutputHandler = MoreMachineOutputHelper.getOutputHandler(outputSlot, RecipeError.NOT_ENOUGH_OUTPUT_SPACE); } @NotNull @@ -92,7 +102,7 @@ protected IEnergyContainerHolder getInitialEnergyContainers(IContentsListener li builder.addSlot(inputSlot = InputInventorySlot.at(this::containsRecipe, recipeCacheListener, 64, 17)) .tracksWarnings(slot -> slot.warning(WarningType.NO_MATCHING_RECIPE, getWarningCheck(RecipeError.NOT_ENOUGH_INPUT))); // 输出槽位置 - builder.addSlot(chanceOutputSlot = OutputInventorySlot.at(recipeCacheUnpauseListener, 116, 35)) + builder.addSlot(outputSlot = OutputInventorySlot.at(recipeCacheUnpauseListener, 116, 35)) .tracksWarnings(slot -> slot.warning(WarningType.NO_SPACE_IN_OUTPUT, getWarningCheck(RecipeError.NOT_ENOUGH_OUTPUT_SPACE))); // 能量槽位置 builder.addSlot(energySlot = EnergyInventorySlot.fillOrConvert(energyContainer, this::getLevel, listener, 64, 53)); @@ -136,10 +146,6 @@ public CachedRecipe createNewCachedRecipe(@NotNull RecyclerRecip .setBaselineMaxOperations(this::getOperationsPerTick); } - public MachineEnergyContainer getEnergyContainer() { - return energyContainer; - } - @Override public boolean isConfigurationDataCompatible(Block type) { return super.isConfigurationDataCompatible(type) || MoreMachineUtils.isSameMMTypeFactory(getBlockHolder(), type); @@ -148,6 +154,13 @@ public boolean isConfigurationDataCompatible(Block type) { @NotNull @Override public MachineUpgradeData getUpgradeData(HolderLookup.Provider provider) { - return new MachineUpgradeData(provider, redstone, getControlType(), getEnergyContainer(), getOperatingTicks(), energySlot, inputSlot, chanceOutputSlot, getComponents()); + return new MachineUpgradeData(provider, redstone, getControlType(), getEnergyContainer(), getOperatingTicks(), energySlot, inputSlot, outputSlot, getComponents()); + } + + // Methods relating to IComputerTile + @ComputerMethod(methodDescription = ComputerConstants.DESCRIPTION_GET_ENERGY_USAGE) + long getEnergyUsage() { + return getActive() ? energyContainer.getEnergyPerTick() : 0; } + // End methods IComputerTile } diff --git a/src/main/java/com/jerry/mekmm/common/tile/machine/TileEntityReplicator$ComputerHandler.java b/src/main/java/com/jerry/mekmm/common/tile/machine/TileEntityReplicator$ComputerHandler.java new file mode 100644 index 00000000..a10824db --- /dev/null +++ b/src/main/java/com/jerry/mekmm/common/tile/machine/TileEntityReplicator$ComputerHandler.java @@ -0,0 +1,59 @@ +package com.jerry.mekmm.common.tile.machine; + +import mekanism.api.chemical.ChemicalStack; +import mekanism.common.integration.computer.*; +import mekanism.common.integration.computer.annotation.MethodFactory; + +import net.minecraft.world.item.ItemStack; + +@MethodFactory(target = TileEntityReplicator.class) +public class TileEntityReplicator$ComputerHandler extends ComputerMethodFactory { + + public TileEntityReplicator$ComputerHandler() { + register(MethodData.builder("getChemical", TileEntityReplicator$ComputerHandler::chemicalTank$getChemical).returnType(ChemicalStack.class).methodDescription("Get the contents of the chemical tank.")); + register(MethodData.builder("getChemicalCapacity", TileEntityReplicator$ComputerHandler::chemicalTank$getChemicalCapacity).returnType(long.class).methodDescription("Get the capacity of the chemical tank.")); + register(MethodData.builder("getChemicalNeeded", TileEntityReplicator$ComputerHandler::chemicalTank$getChemicalNeeded).returnType(long.class).methodDescription("Get the amount needed to fill the chemical tank.")); + register(MethodData.builder("getChemicalFilledPercentage", TileEntityReplicator$ComputerHandler::chemicalTank$getChemicalFilledPercentage).returnType(double.class).methodDescription("Get the filled percentage of the chemical tank.")); + register(MethodData.builder("getInput", TileEntityReplicator$ComputerHandler::inputSlot$getInput).returnType(ItemStack.class).methodDescription("Get the contents of the input slot.")); + register(MethodData.builder("getOutput", TileEntityReplicator$ComputerHandler::outputSlot$getOutput).returnType(ItemStack.class).methodDescription("Get the contents of the output slot.")); + register(MethodData.builder("getChemicalItem", TileEntityReplicator$ComputerHandler::chemicalSlot$getChemicalItem).returnType(ItemStack.class).methodDescription("Get the contents of the chemical input slot.")); + register(MethodData.builder("getEnergyItem", TileEntityReplicator$ComputerHandler::energySlot$getEnergyItem).returnType(ItemStack.class).methodDescription("Get the contents of the energy slot.")); + register(MethodData.builder("getEnergyUsage", TileEntityReplicator$ComputerHandler::getEnergyUsage_0).returnType(long.class).methodDescription("Get the energy used in the last tick by the machine")); + } + + public static Object chemicalTank$getChemical(TileEntityReplicator subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerChemicalTankWrapper.getStack(subject.chemicalTank)); + } + + public static Object chemicalTank$getChemicalCapacity(TileEntityReplicator subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerChemicalTankWrapper.getCapacity(subject.chemicalTank)); + } + + public static Object chemicalTank$getChemicalNeeded(TileEntityReplicator subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerChemicalTankWrapper.getNeeded(subject.chemicalTank)); + } + + public static Object chemicalTank$getChemicalFilledPercentage(TileEntityReplicator subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerChemicalTankWrapper.getFilledPercentage(subject.chemicalTank)); + } + + public static Object inputSlot$getInput(TileEntityReplicator subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerIInventorySlotWrapper.getStack(subject.inputSlot)); + } + + public static Object outputSlot$getOutput(TileEntityReplicator subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerIInventorySlotWrapper.getStack(subject.outputSlot)); + } + + public static Object chemicalSlot$getChemicalItem(TileEntityReplicator subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerIInventorySlotWrapper.getStack(subject.chemicalSlot)); + } + + public static Object energySlot$getEnergyItem(TileEntityReplicator subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerIInventorySlotWrapper.getStack(subject.energySlot)); + } + + public static Object getEnergyUsage_0(TileEntityReplicator subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(subject.getEnergyUsage()); + } +} diff --git a/src/main/java/com/jerry/mekmm/common/tile/machine/TileEntityReplicator.java b/src/main/java/com/jerry/mekmm/common/tile/machine/TileEntityReplicator.java index 5f929ac6..7705677b 100644 --- a/src/main/java/com/jerry/mekmm/common/tile/machine/TileEntityReplicator.java +++ b/src/main/java/com/jerry/mekmm/common/tile/machine/TileEntityReplicator.java @@ -31,6 +31,11 @@ import mekanism.common.capabilities.holder.energy.IEnergyContainerHolder; import mekanism.common.capabilities.holder.slot.IInventorySlotHolder; import mekanism.common.capabilities.holder.slot.InventorySlotHelper; +import mekanism.common.integration.computer.SpecialComputerMethodWrapper.ComputerChemicalTankWrapper; +import mekanism.common.integration.computer.SpecialComputerMethodWrapper.ComputerIInventorySlotWrapper; +import mekanism.common.integration.computer.annotation.ComputerMethod; +import mekanism.common.integration.computer.annotation.WrappingComputerMethod; +import mekanism.common.integration.computer.computercraft.ComputerConstants; import mekanism.common.inventory.container.slot.SlotOverlay; import mekanism.common.inventory.slot.EnergyInventorySlot; import mekanism.common.inventory.slot.InputInventorySlot; @@ -77,6 +82,10 @@ public class TileEntityReplicator extends TileEntityProgressMachine customRecipeMap = ValidatorUtils.getRecipeFromConfig(MoreMachineConfig.general.itemReplicatorRecipe.get()); // 化学品存储槽 + @WrappingComputerMethod(wrapper = ComputerChemicalTankWrapper.class, + methodNames = { "getChemical", "getChemicalCapacity", "getChemicalNeeded", + "getChemicalFilledPercentage" }, + docPlaceholder = "chemical tank") public IChemicalTank chemicalTank; private MachineEnergyContainer energyContainer; @@ -85,10 +94,14 @@ public class TileEntityReplicator extends TileEntityProgressMachine outputHandler; private final ILongInputHandler chemicalInputHandler; + @WrappingComputerMethod(wrapper = ComputerIInventorySlotWrapper.class, methodNames = "getItemInput", docPlaceholder = "item input slot") InputInventorySlot inputSlot; + @WrappingComputerMethod(wrapper = ComputerIInventorySlotWrapper.class, methodNames = "getOutput", docPlaceholder = "output slot") OutputInventorySlot outputSlot; // 气罐槽 + @WrappingComputerMethod(wrapper = ComputerIInventorySlotWrapper.class, methodNames = "getChemicalInput", docPlaceholder = "chemical input slot") ChemicalInventorySlot chemicalSlot; + @WrappingComputerMethod(wrapper = ComputerIInventorySlotWrapper.class, methodNames = "getEnergyItem", docPlaceholder = "energy slot") EnergyInventorySlot energySlot; public TileEntityReplicator(BlockPos pos, BlockState state) { @@ -232,4 +245,11 @@ public void parseUpgradeData(HolderLookup.Provider provider, @NotNull IUpgradeDa return new AdvancedMachineUpgradeData(provider, redstone, getControlType(), getEnergyContainer(), getOperatingTicks(), 0, chemicalTank, chemicalSlot, energySlot, inputSlot, outputSlot, getComponents()); } + + // Methods relating to IComputerTile + @ComputerMethod(methodDescription = ComputerConstants.DESCRIPTION_GET_ENERGY_USAGE) + long getEnergyUsage() { + return getActive() ? energyContainer.getEnergyPerTick() : 0; + } + // End methods IComputerTile } diff --git a/src/main/java/com/jerry/mekmm/common/tile/machine/TileEntityStamper$ComputerHandler.java b/src/main/java/com/jerry/mekmm/common/tile/machine/TileEntityStamper$ComputerHandler.java new file mode 100644 index 00000000..6d4116be --- /dev/null +++ b/src/main/java/com/jerry/mekmm/common/tile/machine/TileEntityStamper$ComputerHandler.java @@ -0,0 +1,38 @@ +package com.jerry.mekmm.common.tile.machine; + +import mekanism.common.integration.computer.*; +import mekanism.common.integration.computer.annotation.MethodFactory; + +import net.minecraft.world.item.ItemStack; + +@MethodFactory(target = TileEntityStamper.class) +public class TileEntityStamper$ComputerHandler extends ComputerMethodFactory { + + public TileEntityStamper$ComputerHandler() { + register(MethodData.builder("getMainInput", TileEntityStamper$ComputerHandler::itemInputSlot$getItemInput).returnType(ItemStack.class).methodDescription("Get the contents of the item input slot.")); + register(MethodData.builder("getSecondaryInput", TileEntityStamper$ComputerHandler::moldInputSlot$getMoldInput).returnType(ItemStack.class).methodDescription("Get the contents of the mold input slot.")); + register(MethodData.builder("getOutput", TileEntityStamper$ComputerHandler::outputSlot$getOutput).returnType(ItemStack.class).methodDescription("Get the contents of the output slot.")); + register(MethodData.builder("getEnergyItem", TileEntityStamper$ComputerHandler::energySlot$getEnergyItem).returnType(ItemStack.class).methodDescription("Get the contents of the energy slot.")); + register(MethodData.builder("getEnergyUsage", TileEntityStamper$ComputerHandler::getEnergyUsage_0).returnType(long.class).methodDescription("Get the energy used in the last tick by the machine")); + } + + public static Object itemInputSlot$getItemInput(TileEntityStamper subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerIInventorySlotWrapper.getStack(subject.itemInputSlot)); + } + + public static Object moldInputSlot$getMoldInput(TileEntityStamper subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerIInventorySlotWrapper.getStack(subject.moldInputSlot)); + } + + public static Object outputSlot$getOutput(TileEntityStamper subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerIInventorySlotWrapper.getStack(subject.outputSlot)); + } + + public static Object energySlot$getEnergyItem(TileEntityStamper subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(SpecialComputerMethodWrapper.ComputerIInventorySlotWrapper.getStack(subject.energySlot)); + } + + public static Object getEnergyUsage_0(TileEntityStamper subject, BaseComputerHelper helper) throws ComputerException { + return helper.convert(subject.getEnergyUsage()); + } +} diff --git a/src/main/java/com/jerry/mekmm/common/tile/machine/TileEntityStamper.java b/src/main/java/com/jerry/mekmm/common/tile/machine/TileEntityStamper.java index 66a09952..774364b2 100644 --- a/src/main/java/com/jerry/mekmm/common/tile/machine/TileEntityStamper.java +++ b/src/main/java/com/jerry/mekmm/common/tile/machine/TileEntityStamper.java @@ -21,7 +21,7 @@ import mekanism.common.capabilities.holder.energy.IEnergyContainerHolder; import mekanism.common.capabilities.holder.slot.IInventorySlotHolder; import mekanism.common.capabilities.holder.slot.InventorySlotHelper; -import mekanism.common.integration.computer.SpecialComputerMethodWrapper; +import mekanism.common.integration.computer.SpecialComputerMethodWrapper.ComputerIInventorySlotWrapper; import mekanism.common.integration.computer.annotation.ComputerMethod; import mekanism.common.integration.computer.annotation.WrappingComputerMethod; import mekanism.common.integration.computer.computercraft.ComputerConstants; @@ -44,6 +44,7 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; +import lombok.Getter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -60,29 +61,30 @@ public class TileEntityStamper extends TileEntityProgressMachine public static final int BASE_TICKS_REQUIRED = 10 * SharedConstants.TICKS_PER_SECOND; private final IOutputHandler<@NotNull ItemStack> outputHandler; - private final IInputHandler<@NotNull ItemStack> inputHandler; - private final IInputHandler<@NotNull ItemStack> extraInputHandler; + private final IInputHandler<@NotNull ItemStack> itemInputHandler; + private final IInputHandler<@NotNull ItemStack> moldInputHandler; + @Getter private MachineEnergyContainer energyContainer; - @WrappingComputerMethod(wrapper = SpecialComputerMethodWrapper.ComputerIInventorySlotWrapper.class, methodNames = "getMainInput", docPlaceholder = "main input slot") - InputInventorySlot mainInputSlot; - @WrappingComputerMethod(wrapper = SpecialComputerMethodWrapper.ComputerIInventorySlotWrapper.class, methodNames = "getSecondaryInput", docPlaceholder = "secondary input slot") - InputInventorySlot extraInputSlot; - @WrappingComputerMethod(wrapper = SpecialComputerMethodWrapper.ComputerIInventorySlotWrapper.class, methodNames = "getOutput", docPlaceholder = "output slot") + @WrappingComputerMethod(wrapper = ComputerIInventorySlotWrapper.class, methodNames = "getItemInput", docPlaceholder = "item input slot") + InputInventorySlot itemInputSlot; + @WrappingComputerMethod(wrapper = ComputerIInventorySlotWrapper.class, methodNames = "getMoldInput", docPlaceholder = "mold input slot") + InputInventorySlot moldInputSlot; + @WrappingComputerMethod(wrapper = ComputerIInventorySlotWrapper.class, methodNames = "getOutput", docPlaceholder = "output slot") OutputInventorySlot outputSlot; - @WrappingComputerMethod(wrapper = SpecialComputerMethodWrapper.ComputerIInventorySlotWrapper.class, methodNames = "getEnergyItem", docPlaceholder = "energy slot") + @WrappingComputerMethod(wrapper = ComputerIInventorySlotWrapper.class, methodNames = "getEnergyItem", docPlaceholder = "energy slot") EnergyInventorySlot energySlot; public TileEntityStamper(BlockPos pos, BlockState state) { super(MoreMachineBlocks.CNC_STAMPER, pos, state, TRACKED_ERROR_TYPES, BASE_TICKS_REQUIRED); - configComponent.setupItemIOExtraConfig(mainInputSlot, outputSlot, extraInputSlot, energySlot); + configComponent.setupItemIOExtraConfig(itemInputSlot, outputSlot, moldInputSlot, energySlot); configComponent.setupInputConfig(TransmissionType.ENERGY, energyContainer); ejectorComponent = new TileComponentEjector(this); ejectorComponent.setOutputData(configComponent, TransmissionType.ITEM); - inputHandler = InputHelper.getInputHandler(mainInputSlot, RecipeError.NOT_ENOUGH_INPUT); - extraInputHandler = InputHelper.getInputHandler(extraInputSlot, RecipeError.NOT_ENOUGH_SECONDARY_INPUT); + itemInputHandler = InputHelper.getInputHandler(itemInputSlot, RecipeError.NOT_ENOUGH_INPUT); + moldInputHandler = InputHelper.getInputHandler(moldInputSlot, RecipeError.NOT_ENOUGH_SECONDARY_INPUT); outputHandler = OutputHelper.getOutputHandler(outputSlot, RecipeError.NOT_ENOUGH_OUTPUT_SPACE); } @@ -98,14 +100,14 @@ protected IEnergyContainerHolder getInitialEnergyContainers(IContentsListener li @Override protected IInventorySlotHolder getInitialInventory(IContentsListener listener, IContentsListener recipeCacheListener, IContentsListener recipeCacheUnpauseListener) { InventorySlotHelper builder = InventorySlotHelper.forSideWithConfig(this); - builder.addSlot(mainInputSlot = InputInventorySlot.at(item -> containsRecipeAB(item, extraInputSlot.getStack()), this::containsRecipeA, recipeCacheListener, + builder.addSlot(itemInputSlot = InputInventorySlot.at(item -> containsRecipeAB(item, moldInputSlot.getStack()), this::containsRecipeA, recipeCacheListener, 64, 17)).tracksWarnings(slot -> slot.warning(WarningType.NO_MATCHING_RECIPE, getWarningCheck(RecipeError.NOT_ENOUGH_INPUT))); - builder.addSlot(extraInputSlot = InputInventorySlot.at(item -> containsRecipeBA(mainInputSlot.getStack(), item), this::containsRecipeB, recipeCacheListener, + builder.addSlot(moldInputSlot = InputInventorySlot.at(item -> containsRecipeBA(itemInputSlot.getStack(), item), this::containsRecipeB, recipeCacheListener, 64, 53)).tracksWarnings(slot -> slot.warning(WarningType.NO_MATCHING_RECIPE, getWarningCheck(RecipeError.NOT_ENOUGH_SECONDARY_INPUT))); builder.addSlot(outputSlot = OutputInventorySlot.at(recipeCacheUnpauseListener, 116, 35)) .tracksWarnings(slot -> slot.warning(WarningType.NO_SPACE_IN_OUTPUT, getWarningCheck(RecipeError.NOT_ENOUGH_OUTPUT_SPACE))); builder.addSlot(energySlot = EnergyInventorySlot.fillOrConvert(energyContainer, this::getLevel, listener, 39, 35)); - extraInputSlot.setSlotType(ContainerSlotType.EXTRA); + moldInputSlot.setSlotType(ContainerSlotType.EXTRA); return builder.build(); } @@ -130,13 +132,13 @@ protected boolean onUpdateServer() { @Nullable @Override public StamperRecipe getRecipe(int cacheIndex) { - return findFirstRecipe(inputHandler, extraInputHandler); + return findFirstRecipe(itemInputHandler, moldInputHandler); } @NotNull @Override public CachedRecipe createNewCachedRecipe(@NotNull StamperRecipe recipe, int cacheIndex) { - return StamperCachedRecipe.createCache(recipe, recheckAllRecipeErrors, inputHandler, extraInputHandler, outputHandler) + return StamperCachedRecipe.createCache(recipe, recheckAllRecipeErrors, itemInputHandler, moldInputHandler, outputHandler) .setErrorsChanged(this::onErrorsChanged) .setCanHolderFunction(this::canFunction) .setActive(this::setActive) @@ -150,11 +152,7 @@ public CachedRecipe createNewCachedRecipe(@NotNull StamperRecipe @NotNull @Override public StamperUpgradeData getUpgradeData(HolderLookup.Provider provider) { - return new StamperUpgradeData(provider, redstone, getControlType(), getEnergyContainer(), getOperatingTicks(), energySlot, extraInputSlot, mainInputSlot, outputSlot, getComponents()); - } - - public MachineEnergyContainer getEnergyContainer() { - return energyContainer; + return new StamperUpgradeData(provider, redstone, getControlType(), getEnergyContainer(), getOperatingTicks(), energySlot, moldInputSlot, itemInputSlot, outputSlot, getComponents()); } @Override diff --git a/src/main/java/com/jerry/mekmm/generated/mekmm/ComputerMethodRegistry_mekmm.java b/src/main/java/com/jerry/mekmm/generated/mekmm/ComputerMethodRegistry_mekmm.java new file mode 100644 index 00000000..5cb636cf --- /dev/null +++ b/src/main/java/com/jerry/mekmm/generated/mekmm/ComputerMethodRegistry_mekmm.java @@ -0,0 +1,24 @@ +package com.jerry.mekmm.generated.mekmm; + +import com.jerry.mekmm.common.tile.machine.*; + +import mekanism.common.integration.computer.FactoryRegistry; +import mekanism.common.integration.computer.IComputerMethodRegistry; +import mekanism.common.tile.base.CapabilityTileEntity; +import mekanism.common.tile.base.TileEntityMekanism; +import mekanism.common.tile.base.TileEntityUpdateable; +import mekanism.common.tile.prefab.*; + +public class ComputerMethodRegistry_mekmm implements IComputerMethodRegistry { + + @Override + public void register() { + FactoryRegistry.register(TileEntityAmbientGasCollector.class, TileEntityAmbientGasCollector$ComputerHandler::new, TileEntityUpdateable.class, CapabilityTileEntity.class, TileEntityMekanism.class); + FactoryRegistry.register(TileEntityChemicalReplicator.class, TileEntityChemicalReplicator$ComputerHandler::new, TileEntityUpdateable.class, CapabilityTileEntity.class, TileEntityMekanism.class, TileEntityConfigurableMachine.class, TileEntityRecipeMachine.class, TileEntityProgressMachine.class); + FactoryRegistry.register(TileEntityFluidReplicator.class, TileEntityFluidReplicator$ComputerHandler::new, TileEntityUpdateable.class, CapabilityTileEntity.class, TileEntityMekanism.class, TileEntityConfigurableMachine.class, TileEntityRecipeMachine.class, TileEntityProgressMachine.class); + FactoryRegistry.register(TileEntityPlantingStation.class, TileEntityPlantingStation$ComputerHandler::new, TileEntityUpdateable.class, CapabilityTileEntity.class, TileEntityMekanism.class, TileEntityConfigurableMachine.class, TileEntityRecipeMachine.class, TileEntityProgressMachine.class); + FactoryRegistry.register(TileEntityRecycler.class, TileEntityRecycler$ComputerHandler::new, TileEntityUpdateable.class, CapabilityTileEntity.class, TileEntityMekanism.class, TileEntityConfigurableMachine.class, TileEntityRecipeMachine.class, TileEntityProgressMachine.class); + FactoryRegistry.register(TileEntityReplicator.class, TileEntityReplicator$ComputerHandler::new, TileEntityUpdateable.class, CapabilityTileEntity.class, TileEntityMekanism.class, TileEntityConfigurableMachine.class, TileEntityRecipeMachine.class, TileEntityProgressMachine.class); + FactoryRegistry.register(TileEntityStamper.class, TileEntityStamper$ComputerHandler::new, TileEntityUpdateable.class, CapabilityTileEntity.class, TileEntityMekanism.class, TileEntityConfigurableMachine.class, TileEntityRecipeMachine.class, TileEntityProgressMachine.class); + } +} diff --git a/src/main/resources/assets/mekmm/lang/zh_cn.json b/src/main/resources/assets/mekmm/lang/zh_cn.json index 777ab282..6a1e9c86 100644 --- a/src/main/resources/assets/mekmm/lang/zh_cn.json +++ b/src/main/resources/assets/mekmm/lang/zh_cn.json @@ -151,11 +151,11 @@ "block.mekmm.basic_mid_chemical_tank": "基础中型化学品储罐", "block.mekmm.advanced_mid_chemical_tank": "高级中型化学品储罐", - "block.mekmm.elite_mid_chemical_tank": "先进中型化学品储罐", + "block.mekmm.elite_mid_chemical_tank": "精英中型化学品储罐", "block.mekmm.ultimate_mid_chemical_tank": "终极中型化学品储罐", "block.mekmm.basic_max_chemical_tank": "基础大型化学品储罐", "block.mekmm.advanced_max_chemical_tank": "高级大型化学品储罐", - "block.mekmm.elite_max_chemical_tank": "先进大型化学品储罐", + "block.mekmm.elite_max_chemical_tank": "精英大型化学品储罐", "block.mekmm.ultimate_max_chemical_tank": "终极大型化学品储罐", "block.mekmm.large_rotary_condensentrator": "大型回旋式气液转换机", "block.mekmm.large_chemical_infuser": "大型化学灌注机", @@ -309,11 +309,11 @@ "container.mekmm.basic_mid_chemical_tank": "基础中型化学品储罐", "container.mekmm.advanced_mid_chemical_tank": "高级中型化学品储罐", - "container.mekmm.elite_mid_chemical_tank": "先进中型化学品储罐", + "container.mekmm.elite_mid_chemical_tank": "精英中型化学品储罐", "container.mekmm.ultimate_mid_chemical_tank": "终极中型化学品储罐", "container.mekmm.basic_max_chemical_tank": "基础大型化学品储罐", "container.mekmm.advanced_max_chemical_tank": "高级大型化学品储罐", - "container.mekmm.elite_max_chemical_tank": "先进大型化学品储罐", + "container.mekmm.elite_max_chemical_tank": "精英大型化学品储罐", "container.mekmm.ultimate_max_chemical_tank": "终极大型化学品储罐", "container.mekmm.large_rotary_condensentrator": "大型回旋式气液转换机", "container.mekmm.large_chemical_infuser": "大型化学灌注机", diff --git a/src/main/resources/assets/mekmm/models/block/factory/centrifuging/active/advanced.json b/src/main/resources/assets/mekmm/models/block/factory/centrifuging/active/advanced.json index 80dee181..381c2b2a 100644 --- a/src/main/resources/assets/mekmm/models/block/factory/centrifuging/active/advanced.json +++ b/src/main/resources/assets/mekmm/models/block/factory/centrifuging/active/advanced.json @@ -18,7 +18,7 @@ { "name": "glass", "from": [4, 16, 1], - "to": [12, 26, 1], + "to": [12, 26, 2], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "north": {"uv": [4, 6, 12, 16], "texture": "#4"}, @@ -28,7 +28,7 @@ { "name": "glass", "from": [1, 16, 4], - "to": [1, 26, 12], + "to": [2, 26, 12], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "east": {"uv": [4, 6, 12, 16], "texture": "#4"}, @@ -37,7 +37,7 @@ }, { "name": "glass", - "from": [4, 16, 15], + "from": [4, 16, 14], "to": [12, 26, 15], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { @@ -47,7 +47,7 @@ }, { "name": "glass", - "from": [15, 16, 4], + "from": [14, 16, 4], "to": [15, 26, 12], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { diff --git a/src/main/resources/assets/mekmm/models/block/factory/centrifuging/active/basic.json b/src/main/resources/assets/mekmm/models/block/factory/centrifuging/active/basic.json index 9a1256ad..ef7f3551 100644 --- a/src/main/resources/assets/mekmm/models/block/factory/centrifuging/active/basic.json +++ b/src/main/resources/assets/mekmm/models/block/factory/centrifuging/active/basic.json @@ -18,7 +18,7 @@ { "name": "glass", "from": [4, 16, 1], - "to": [12, 26, 1], + "to": [12, 26, 2], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "north": {"uv": [4, 6, 12, 16], "texture": "#4"}, @@ -28,7 +28,7 @@ { "name": "glass", "from": [1, 16, 4], - "to": [1, 26, 12], + "to": [2, 26, 12], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "east": {"uv": [4, 6, 12, 16], "texture": "#4"}, @@ -37,7 +37,7 @@ }, { "name": "glass", - "from": [4, 16, 15], + "from": [4, 16, 14], "to": [12, 26, 15], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { @@ -47,7 +47,7 @@ }, { "name": "glass", - "from": [15, 16, 4], + "from": [14, 16, 4], "to": [15, 26, 12], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { diff --git a/src/main/resources/assets/mekmm/models/block/factory/centrifuging/active/creative.json b/src/main/resources/assets/mekmm/models/block/factory/centrifuging/active/creative.json index 3ee32586..1f010f6f 100644 --- a/src/main/resources/assets/mekmm/models/block/factory/centrifuging/active/creative.json +++ b/src/main/resources/assets/mekmm/models/block/factory/centrifuging/active/creative.json @@ -18,7 +18,7 @@ { "name": "glass", "from": [4, 16, 1], - "to": [12, 26, 1], + "to": [12, 26, 2], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "north": {"uv": [4, 6, 12, 16], "texture": "#4"}, @@ -28,7 +28,7 @@ { "name": "glass", "from": [1, 16, 4], - "to": [1, 26, 12], + "to": [2, 26, 12], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "east": {"uv": [4, 6, 12, 16], "texture": "#4"}, @@ -37,7 +37,7 @@ }, { "name": "glass", - "from": [4, 16, 15], + "from": [4, 16, 14], "to": [12, 26, 15], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { @@ -47,7 +47,7 @@ }, { "name": "glass", - "from": [15, 16, 4], + "from": [14, 16, 4], "to": [15, 26, 12], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { diff --git a/src/main/resources/assets/mekmm/models/block/factory/centrifuging/active/dense.json b/src/main/resources/assets/mekmm/models/block/factory/centrifuging/active/dense.json index 37091ddb..259608a1 100644 --- a/src/main/resources/assets/mekmm/models/block/factory/centrifuging/active/dense.json +++ b/src/main/resources/assets/mekmm/models/block/factory/centrifuging/active/dense.json @@ -18,7 +18,7 @@ { "name": "glass", "from": [4, 16, 1], - "to": [12, 26, 1], + "to": [12, 26, 2], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "north": {"uv": [4, 6, 12, 16], "texture": "#4"}, @@ -28,7 +28,7 @@ { "name": "glass", "from": [1, 16, 4], - "to": [1, 26, 12], + "to": [2, 26, 12], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "east": {"uv": [4, 6, 12, 16], "texture": "#4"}, @@ -37,7 +37,7 @@ }, { "name": "glass", - "from": [4, 16, 15], + "from": [4, 16, 14], "to": [12, 26, 15], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { @@ -47,7 +47,7 @@ }, { "name": "glass", - "from": [15, 16, 4], + "from": [14, 16, 4], "to": [15, 26, 12], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { diff --git a/src/main/resources/assets/mekmm/models/block/factory/centrifuging/active/elite.json b/src/main/resources/assets/mekmm/models/block/factory/centrifuging/active/elite.json index f2b241cf..79eb87c0 100644 --- a/src/main/resources/assets/mekmm/models/block/factory/centrifuging/active/elite.json +++ b/src/main/resources/assets/mekmm/models/block/factory/centrifuging/active/elite.json @@ -18,7 +18,7 @@ { "name": "glass", "from": [4, 16, 1], - "to": [12, 26, 1], + "to": [12, 26, 2], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "north": {"uv": [4, 6, 12, 16], "texture": "#4"}, @@ -28,7 +28,7 @@ { "name": "glass", "from": [1, 16, 4], - "to": [1, 26, 12], + "to": [2, 26, 12], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "east": {"uv": [4, 6, 12, 16], "texture": "#4"}, @@ -37,7 +37,7 @@ }, { "name": "glass", - "from": [4, 16, 15], + "from": [4, 16, 14], "to": [12, 26, 15], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { @@ -47,7 +47,7 @@ }, { "name": "glass", - "from": [15, 16, 4], + "from": [14, 16, 4], "to": [15, 26, 12], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { diff --git a/src/main/resources/assets/mekmm/models/block/factory/centrifuging/active/multiversal.json b/src/main/resources/assets/mekmm/models/block/factory/centrifuging/active/multiversal.json index af06d963..b307350d 100644 --- a/src/main/resources/assets/mekmm/models/block/factory/centrifuging/active/multiversal.json +++ b/src/main/resources/assets/mekmm/models/block/factory/centrifuging/active/multiversal.json @@ -18,7 +18,7 @@ { "name": "glass", "from": [4, 16, 1], - "to": [12, 26, 1], + "to": [12, 26, 2], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "north": {"uv": [4, 6, 12, 16], "texture": "#4"}, @@ -28,7 +28,7 @@ { "name": "glass", "from": [1, 16, 4], - "to": [1, 26, 12], + "to": [2, 26, 12], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "east": {"uv": [4, 6, 12, 16], "texture": "#4"}, @@ -37,7 +37,7 @@ }, { "name": "glass", - "from": [4, 16, 15], + "from": [4, 16, 14], "to": [12, 26, 15], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { @@ -47,7 +47,7 @@ }, { "name": "glass", - "from": [15, 16, 4], + "from": [14, 16, 4], "to": [15, 26, 12], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { diff --git a/src/main/resources/assets/mekmm/models/block/factory/centrifuging/active/overclocked.json b/src/main/resources/assets/mekmm/models/block/factory/centrifuging/active/overclocked.json index 5a837fc4..84cc9436 100644 --- a/src/main/resources/assets/mekmm/models/block/factory/centrifuging/active/overclocked.json +++ b/src/main/resources/assets/mekmm/models/block/factory/centrifuging/active/overclocked.json @@ -18,7 +18,7 @@ { "name": "glass", "from": [4, 16, 1], - "to": [12, 26, 1], + "to": [12, 26, 2], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "north": {"uv": [4, 6, 12, 16], "texture": "#4"}, @@ -28,7 +28,7 @@ { "name": "glass", "from": [1, 16, 4], - "to": [1, 26, 12], + "to": [2, 26, 12], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "east": {"uv": [4, 6, 12, 16], "texture": "#4"}, @@ -37,7 +37,7 @@ }, { "name": "glass", - "from": [4, 16, 15], + "from": [4, 16, 14], "to": [12, 26, 15], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { @@ -47,7 +47,7 @@ }, { "name": "glass", - "from": [15, 16, 4], + "from": [14, 16, 4], "to": [15, 26, 12], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { diff --git a/src/main/resources/assets/mekmm/models/block/factory/centrifuging/active/quantum.json b/src/main/resources/assets/mekmm/models/block/factory/centrifuging/active/quantum.json index ffb8355c..085ae49a 100644 --- a/src/main/resources/assets/mekmm/models/block/factory/centrifuging/active/quantum.json +++ b/src/main/resources/assets/mekmm/models/block/factory/centrifuging/active/quantum.json @@ -18,7 +18,7 @@ { "name": "glass", "from": [4, 16, 1], - "to": [12, 26, 1], + "to": [12, 26, 2], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "north": {"uv": [4, 6, 12, 16], "texture": "#4"}, @@ -28,7 +28,7 @@ { "name": "glass", "from": [1, 16, 4], - "to": [1, 26, 12], + "to": [2, 26, 12], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "east": {"uv": [4, 6, 12, 16], "texture": "#4"}, @@ -37,7 +37,7 @@ }, { "name": "glass", - "from": [4, 16, 15], + "from": [4, 16, 14], "to": [12, 26, 15], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { @@ -47,7 +47,7 @@ }, { "name": "glass", - "from": [15, 16, 4], + "from": [14, 16, 4], "to": [15, 26, 12], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { diff --git a/src/main/resources/assets/mekmm/models/block/factory/centrifuging/active/ultimate.json b/src/main/resources/assets/mekmm/models/block/factory/centrifuging/active/ultimate.json index c2f77774..7c5515c7 100644 --- a/src/main/resources/assets/mekmm/models/block/factory/centrifuging/active/ultimate.json +++ b/src/main/resources/assets/mekmm/models/block/factory/centrifuging/active/ultimate.json @@ -18,7 +18,7 @@ { "name": "glass", "from": [4, 16, 1], - "to": [12, 26, 1], + "to": [12, 26, 2], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "north": {"uv": [4, 6, 12, 16], "texture": "#4"}, @@ -28,7 +28,7 @@ { "name": "glass", "from": [1, 16, 4], - "to": [1, 26, 12], + "to": [2, 26, 12], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "east": {"uv": [4, 6, 12, 16], "texture": "#4"}, @@ -37,7 +37,7 @@ }, { "name": "glass", - "from": [4, 16, 15], + "from": [4, 16, 14], "to": [12, 26, 15], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { @@ -47,7 +47,7 @@ }, { "name": "glass", - "from": [15, 16, 4], + "from": [14, 16, 4], "to": [15, 26, 12], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { diff --git a/src/main/resources/assets/mekmm/models/block/factory/centrifuging/advanced.json b/src/main/resources/assets/mekmm/models/block/factory/centrifuging/advanced.json index 6aefe52a..187b69ec 100644 --- a/src/main/resources/assets/mekmm/models/block/factory/centrifuging/advanced.json +++ b/src/main/resources/assets/mekmm/models/block/factory/centrifuging/advanced.json @@ -1,5 +1,6 @@ { "loader": "neoforge:composite", + "gui_light": "side", "parent": "block/block", "textures": { "particle": "mekanism:block/factory/factory_front_back" @@ -18,7 +19,7 @@ { "name": "glass", "from": [4, 16, 1], - "to": [12, 26, 1], + "to": [12, 26, 2], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "north": {"uv": [4, 6, 12, 16], "texture": "#4"}, @@ -28,7 +29,7 @@ { "name": "glass", "from": [1, 16, 4], - "to": [1, 26, 12], + "to": [2, 26, 12], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "east": {"uv": [4, 6, 12, 16], "texture": "#4"}, @@ -37,7 +38,7 @@ }, { "name": "glass", - "from": [4, 16, 15], + "from": [4, 16, 14], "to": [12, 26, 15], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { @@ -47,7 +48,7 @@ }, { "name": "glass", - "from": [15, 16, 4], + "from": [14, 16, 4], "to": [15, 26, 12], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { diff --git a/src/main/resources/assets/mekmm/models/block/factory/centrifuging/base.json b/src/main/resources/assets/mekmm/models/block/factory/centrifuging/base.json index b4175e01..f3c9640d 100644 --- a/src/main/resources/assets/mekmm/models/block/factory/centrifuging/base.json +++ b/src/main/resources/assets/mekmm/models/block/factory/centrifuging/base.json @@ -1,7 +1,7 @@ { "format_version": "1.9.0", "credit": "Made with Blockbench, made by TedXenon", - "parent": "block/block", + "parent": "block_block", "render_type": "cutout", "textures": { "0": "mekanism:block/factory/factory_front_back", @@ -22,7 +22,7 @@ "from": [4, 4, 16.01], "to": [12, 12, 16.01], "faces": { - "south": {"uv": [8, 8, 16, 16], "texture": "#9", "cullface": "south", "neoforge_data": {"block_light": 15, "sky_light": 15}} + "south": {"uv": [8, 8, 16, 16], "texture": "#9", "neoforge_data": {"block_light": 15, "sky_light": 15}} } }, { diff --git a/src/main/resources/assets/mekmm/models/block/factory/centrifuging/basic.json b/src/main/resources/assets/mekmm/models/block/factory/centrifuging/basic.json index 9b610411..2f37aa46 100644 --- a/src/main/resources/assets/mekmm/models/block/factory/centrifuging/basic.json +++ b/src/main/resources/assets/mekmm/models/block/factory/centrifuging/basic.json @@ -1,5 +1,7 @@ { "loader": "neoforge:composite", + "gui_light": "side", + "parent": "block/block", "textures": { "particle": "mekanism:block/factory/factory_front_back" }, @@ -17,7 +19,7 @@ { "name": "glass", "from": [4, 16, 1], - "to": [12, 26, 1], + "to": [12, 26, 2], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "north": {"uv": [4, 6, 12, 16], "texture": "#4"}, @@ -27,7 +29,7 @@ { "name": "glass", "from": [1, 16, 4], - "to": [1, 26, 12], + "to": [2, 26, 12], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "east": {"uv": [4, 6, 12, 16], "texture": "#4"}, @@ -36,7 +38,7 @@ }, { "name": "glass", - "from": [4, 16, 15], + "from": [4, 16, 14], "to": [12, 26, 15], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { @@ -46,7 +48,7 @@ }, { "name": "glass", - "from": [15, 16, 4], + "from": [14, 16, 4], "to": [15, 26, 12], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { diff --git a/src/main/resources/assets/mekmm/models/block/factory/centrifuging/creative.json b/src/main/resources/assets/mekmm/models/block/factory/centrifuging/creative.json index deceeccb..dda0137a 100644 --- a/src/main/resources/assets/mekmm/models/block/factory/centrifuging/creative.json +++ b/src/main/resources/assets/mekmm/models/block/factory/centrifuging/creative.json @@ -1,5 +1,6 @@ { "loader": "neoforge:composite", + "gui_light": "side", "parent": "block/block", "textures": { "particle": "mekanism:block/factory/factory_front_back" @@ -18,7 +19,7 @@ { "name": "glass", "from": [4, 16, 1], - "to": [12, 26, 1], + "to": [12, 26, 2], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "north": {"uv": [4, 6, 12, 16], "texture": "#4"}, @@ -28,7 +29,7 @@ { "name": "glass", "from": [1, 16, 4], - "to": [1, 26, 12], + "to": [2, 26, 12], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "east": {"uv": [4, 6, 12, 16], "texture": "#4"}, @@ -37,7 +38,7 @@ }, { "name": "glass", - "from": [4, 16, 15], + "from": [4, 16, 14], "to": [12, 26, 15], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { @@ -47,7 +48,7 @@ }, { "name": "glass", - "from": [15, 16, 4], + "from": [14, 16, 4], "to": [15, 26, 12], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { diff --git a/src/main/resources/assets/mekmm/models/block/factory/centrifuging/dense.json b/src/main/resources/assets/mekmm/models/block/factory/centrifuging/dense.json index ec6c2c94..c3759466 100644 --- a/src/main/resources/assets/mekmm/models/block/factory/centrifuging/dense.json +++ b/src/main/resources/assets/mekmm/models/block/factory/centrifuging/dense.json @@ -1,5 +1,6 @@ { "loader": "neoforge:composite", + "gui_light": "side", "parent": "block/block", "textures": { "particle": "mekanism:block/factory/factory_front_back" @@ -18,7 +19,7 @@ { "name": "glass", "from": [4, 16, 1], - "to": [12, 26, 1], + "to": [12, 26, 2], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "north": {"uv": [4, 6, 12, 16], "texture": "#4"}, @@ -28,7 +29,7 @@ { "name": "glass", "from": [1, 16, 4], - "to": [1, 26, 12], + "to": [2, 26, 12], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "east": {"uv": [4, 6, 12, 16], "texture": "#4"}, @@ -37,7 +38,7 @@ }, { "name": "glass", - "from": [4, 16, 15], + "from": [4, 16, 14], "to": [12, 26, 15], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { @@ -47,7 +48,7 @@ }, { "name": "glass", - "from": [15, 16, 4], + "from": [14, 16, 4], "to": [15, 26, 12], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { diff --git a/src/main/resources/assets/mekmm/models/block/factory/centrifuging/elite.json b/src/main/resources/assets/mekmm/models/block/factory/centrifuging/elite.json index 383e1a78..bf231edf 100644 --- a/src/main/resources/assets/mekmm/models/block/factory/centrifuging/elite.json +++ b/src/main/resources/assets/mekmm/models/block/factory/centrifuging/elite.json @@ -1,5 +1,6 @@ { "loader": "neoforge:composite", + "gui_light": "side", "parent": "block/block", "textures": { "particle": "mekanism:block/factory/factory_front_back" @@ -18,7 +19,7 @@ { "name": "glass", "from": [4, 16, 1], - "to": [12, 26, 1], + "to": [12, 26, 2], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "north": {"uv": [4, 6, 12, 16], "texture": "#4"}, @@ -28,7 +29,7 @@ { "name": "glass", "from": [1, 16, 4], - "to": [1, 26, 12], + "to": [2, 26, 12], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "east": {"uv": [4, 6, 12, 16], "texture": "#4"}, @@ -37,7 +38,7 @@ }, { "name": "glass", - "from": [4, 16, 15], + "from": [4, 16, 14], "to": [12, 26, 15], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { @@ -47,7 +48,7 @@ }, { "name": "glass", - "from": [15, 16, 4], + "from": [14, 16, 4], "to": [15, 26, 12], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { diff --git a/src/main/resources/assets/mekmm/models/block/factory/centrifuging/multiversal.json b/src/main/resources/assets/mekmm/models/block/factory/centrifuging/multiversal.json index 59ded5ab..df8fc136 100644 --- a/src/main/resources/assets/mekmm/models/block/factory/centrifuging/multiversal.json +++ b/src/main/resources/assets/mekmm/models/block/factory/centrifuging/multiversal.json @@ -1,5 +1,6 @@ { "loader": "neoforge:composite", + "gui_light": "side", "parent": "block/block", "textures": { "particle": "mekanism:block/factory/factory_front_back" @@ -18,7 +19,7 @@ { "name": "glass", "from": [4, 16, 1], - "to": [12, 26, 1], + "to": [12, 26, 2], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "north": {"uv": [4, 6, 12, 16], "texture": "#4"}, @@ -28,7 +29,7 @@ { "name": "glass", "from": [1, 16, 4], - "to": [1, 26, 12], + "to": [2, 26, 12], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "east": {"uv": [4, 6, 12, 16], "texture": "#4"}, @@ -37,7 +38,7 @@ }, { "name": "glass", - "from": [4, 16, 15], + "from": [4, 16, 14], "to": [12, 26, 15], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { @@ -47,7 +48,7 @@ }, { "name": "glass", - "from": [15, 16, 4], + "from": [14, 16, 4], "to": [15, 26, 12], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { diff --git a/src/main/resources/assets/mekmm/models/block/factory/centrifuging/overclocked.json b/src/main/resources/assets/mekmm/models/block/factory/centrifuging/overclocked.json index fc5d05a6..c31df565 100644 --- a/src/main/resources/assets/mekmm/models/block/factory/centrifuging/overclocked.json +++ b/src/main/resources/assets/mekmm/models/block/factory/centrifuging/overclocked.json @@ -1,5 +1,6 @@ { "loader": "neoforge:composite", + "gui_light": "side", "parent": "block/block", "textures": { "particle": "mekanism:block/factory/factory_front_back" @@ -18,7 +19,7 @@ { "name": "glass", "from": [4, 16, 1], - "to": [12, 26, 1], + "to": [12, 26, 2], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "north": {"uv": [4, 6, 12, 16], "texture": "#4"}, @@ -28,7 +29,7 @@ { "name": "glass", "from": [1, 16, 4], - "to": [1, 26, 12], + "to": [2, 26, 12], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "east": {"uv": [4, 6, 12, 16], "texture": "#4"}, @@ -37,7 +38,7 @@ }, { "name": "glass", - "from": [4, 16, 15], + "from": [4, 16, 14], "to": [12, 26, 15], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { @@ -47,7 +48,7 @@ }, { "name": "glass", - "from": [15, 16, 4], + "from": [14, 16, 4], "to": [15, 26, 12], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { diff --git a/src/main/resources/assets/mekmm/models/block/factory/centrifuging/quantum.json b/src/main/resources/assets/mekmm/models/block/factory/centrifuging/quantum.json index d78f4753..3ba8cf0c 100644 --- a/src/main/resources/assets/mekmm/models/block/factory/centrifuging/quantum.json +++ b/src/main/resources/assets/mekmm/models/block/factory/centrifuging/quantum.json @@ -1,5 +1,6 @@ { "loader": "neoforge:composite", + "gui_light": "side", "parent": "block/block", "textures": { "particle": "mekanism:block/factory/factory_front_back" @@ -18,7 +19,7 @@ { "name": "glass", "from": [4, 16, 1], - "to": [12, 26, 1], + "to": [12, 26, 2], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "north": {"uv": [4, 6, 12, 16], "texture": "#4"}, @@ -28,7 +29,7 @@ { "name": "glass", "from": [1, 16, 4], - "to": [1, 26, 12], + "to": [2, 26, 12], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "east": {"uv": [4, 6, 12, 16], "texture": "#4"}, @@ -37,7 +38,7 @@ }, { "name": "glass", - "from": [4, 16, 15], + "from": [4, 16, 14], "to": [12, 26, 15], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { @@ -47,7 +48,7 @@ }, { "name": "glass", - "from": [15, 16, 4], + "from": [14, 16, 4], "to": [15, 26, 12], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { diff --git a/src/main/resources/assets/mekmm/models/block/factory/centrifuging/ultimate.json b/src/main/resources/assets/mekmm/models/block/factory/centrifuging/ultimate.json index 40ef943b..a8223e72 100644 --- a/src/main/resources/assets/mekmm/models/block/factory/centrifuging/ultimate.json +++ b/src/main/resources/assets/mekmm/models/block/factory/centrifuging/ultimate.json @@ -1,5 +1,6 @@ { "loader": "neoforge:composite", + "gui_light": "side", "parent": "block/block", "textures": { "particle": "mekanism:block/factory/factory_front_back" @@ -18,7 +19,7 @@ { "name": "glass", "from": [4, 16, 1], - "to": [12, 26, 1], + "to": [12, 26, 2], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "north": {"uv": [4, 6, 12, 16], "texture": "#4"}, @@ -28,7 +29,7 @@ { "name": "glass", "from": [1, 16, 4], - "to": [1, 26, 12], + "to": [2, 26, 12], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "east": {"uv": [4, 6, 12, 16], "texture": "#4"}, @@ -37,7 +38,7 @@ }, { "name": "glass", - "from": [4, 16, 15], + "from": [4, 16, 14], "to": [12, 26, 15], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { @@ -47,7 +48,7 @@ }, { "name": "glass", - "from": [15, 16, 4], + "from": [14, 16, 4], "to": [15, 26, 12], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { diff --git a/src/main/resources/assets/mekmm/models/block/large_machine/mid_chemical_tank/base.json b/src/main/resources/assets/mekmm/models/block/large_machine/mid_chemical_tank/base.json index 5c98dacd..d2c07842 100644 --- a/src/main/resources/assets/mekmm/models/block/large_machine/mid_chemical_tank/base.json +++ b/src/main/resources/assets/mekmm/models/block/large_machine/mid_chemical_tank/base.json @@ -226,10 +226,12 @@ }, "firstperson_righthand": { "rotation": [0, 45, 0], + "translation": [0, -4, 0], "scale": [0.4, 0.4, 0.4] }, "firstperson_lefthand": { "rotation": [0, -45, 0], + "translation": [0, -4, 0], "scale": [0.4, 0.4, 0.4] }, "ground": { diff --git a/src/main/templates/META-INF/services/mekanism.common.integration.computer.IComputerMethodRegistry b/src/main/templates/META-INF/services/mekanism.common.integration.computer.IComputerMethodRegistry new file mode 100644 index 00000000..85f1369c --- /dev/null +++ b/src/main/templates/META-INF/services/mekanism.common.integration.computer.IComputerMethodRegistry @@ -0,0 +1,3 @@ +com.jerry.mekaf.generated.mekaf.ComputerMethodRegistry_mekaf +com.jerry.meklm.generated.meklm.ComputerMethodRegistry_meklm +com.jerry.mekmm.generated.mekmm.ComputerMethodRegistry_mekmm \ No newline at end of file