Package com.hbm_m.module.machine
Class MachineModuleChemplant
java.lang.Object
com.hbm_m.module.machine.MachineModuleBase<ChemicalPlantRecipe>
com.hbm_m.module.machine.MachineModuleChemplant
-
Field Summary
Fields inherited from class com.hbm_m.module.machine.MachineModuleBase
autoSelectRecipe, currentRecipe, didProcess, energyStorage, inputSlots, itemHandler, level, maxProgress, moduleIndex, needsSync, outputSlots, preferredRecipeId, progress, selectedRecipeId -
Constructor Summary
ConstructorsConstructorDescriptionMachineModuleChemplant(IEnergyReceiver energy, ModItemStackHandler inv, int[] solidIn, int[] solidOut, FluidTank[] fluidIn, FluidTank[] fluidOut, net.minecraft.world.level.Level level) -
Method Summary
Modifier and TypeMethodDescriptionprotected booleancanProcess(ChemicalPlantRecipe recipe) protected ChemicalPlantRecipeprotected ChemicalPlantRecipefindRecipeForItem(net.minecraft.world.item.ItemStack stack) protected intgetRecipeDuration(ChemicalPlantRecipe recipe) protected longprotected net.minecraft.world.item.crafting.RecipeType<ChemicalPlantRecipe>protected booleanisRecipeAllowedByBlueprint(ChemicalPlantRecipe recipe, net.minecraft.world.item.ItemStack blueprint) Optional hook: recipe is allowed for current blueprint.protected booleanprotected voidonRecipeChanged(ChemicalPlantRecipe previous, ChemicalPlantRecipe current) Optional hook: вызывается при смене рецепта (ID или auto-выбор).peekRecipe(net.minecraft.world.level.Level level) Рецепт из менеджера по id — для сети и капабилити.protected voidprocessCraft(ChemicalPlantRecipe recipe) protected voidreadExtraFromBuf(net.minecraft.network.FriendlyByteBuf buf) protected voidreadExtraFromNbt(net.minecraft.nbt.CompoundTag nbt) protected booleanХук семантики энергогейта: - true (default): как у ассемблера — при старте ждём энергию на весь циклvoidsetSelectedRecipe(net.minecraft.resources.ResourceLocation id) voidsetupTanks(ChemicalPlantRecipe recipe) voidsyncTankConfigurationToRecipe(net.minecraft.world.level.Level level) После выбора рецепта на сервере: немедленно конфигурирует входные/выходные баки, чтобы блок-синх не уходил клиенту со старыми типами до следующегоMachineModuleBase.update(double, double, boolean).booleanupdateAndGetDirty(double speed, double powerMul, boolean extraCondition, net.minecraft.world.item.ItemStack blueprint) Основной метод обновления — вызывается из BE каждый серверный тик.protected voidwriteExtraToBuf(net.minecraft.network.FriendlyByteBuf buf) protected voidwriteExtraToNbt(net.minecraft.nbt.CompoundTag nbt) Доп. состояние модуля, которое не относится к базовому прогрессу (например выбранный рецепт).Methods inherited from class com.hbm_m.module.machine.MachineModuleBase
canFitAllItemOutputs, deserialize, getCurrentRecipe, getDidProcess, getGhostItems, getMaxProgress, getProgress, getProgressInt, getProgressPercent, getRecipeByIdCached, getSelectedRecipeId, hasEnoughEnergyForTick, hasEnoughEnergyToStartCraft, isBlueprintAllowedForPool, isBlueprintPoolAllowed, isItemValidForSlot, isProcessing, isSlotClogged, pickRecipeForTick, placeAllItemOutputs, readFromNBT, readNBT, resetProgress, serialize, setLevel, setPreferredRecipeId, setSelectedRecipeId, update, update, writeNBT, writeToNBT
-
Constructor Details
-
MachineModuleChemplant
public MachineModuleChemplant(IEnergyReceiver energy, ModItemStackHandler inv, int[] solidIn, int[] solidOut, FluidTank[] fluidIn, FluidTank[] fluidOut, net.minecraft.world.level.Level level)
-
-
Method Details
-
updateAndGetDirty
public boolean updateAndGetDirty(double speed, double powerMul, boolean extraCondition, net.minecraft.world.item.ItemStack blueprint) Основной метод обновления — вызывается из BE каждый серверный тик.- Parameters:
level- мир (для поиска рецепта)blueprint- стак папки чертежей (может быть пуст)speed- множитель скорости (1.0 = базовая, модифицируется апгрейдами)powerMul- множитель потребления энергии (1.0 = базовое)- Returns:
- true, если состояние изменилось и нужен sync
-
requiresFullEnergyBufferToStart
protected boolean requiresFullEnergyBufferToStart()Description copied from class:MachineModuleBaseХук семантики энергогейта: - true (default): как у ассемблера — при старте ждём энергию на весь цикл. - false: как у химмашины в 1.7.10 — достаточно энергии только на текущий тик.- Overrides:
requiresFullEnergyBufferToStartin classMachineModuleBase<ChemicalPlantRecipe>
-
onRecipeChanged
protected void onRecipeChanged(@Nullable ChemicalPlantRecipe previous, @Nullable ChemicalPlantRecipe current) Description copied from class:MachineModuleBaseOptional hook: вызывается при смене рецепта (ID или auto-выбор). Например, машины с жидкостными баками могут сконфигурировать типы баков.- Overrides:
onRecipeChangedin classMachineModuleBase<ChemicalPlantRecipe>
-
syncTankConfigurationToRecipe
public void syncTankConfigurationToRecipe(net.minecraft.world.level.Level level) После выбора рецепта на сервере: немедленно конфигурирует входные/выходные баки, чтобы блок-синх не уходил клиенту со старыми типами до следующегоMachineModuleBase.update(double, double, boolean). -
getRecipeType
- Specified by:
getRecipeTypein classMachineModuleBase<ChemicalPlantRecipe>
-
findRecipeForInputs
- Specified by:
findRecipeForInputsin classMachineModuleBase<ChemicalPlantRecipe>
-
canProcess
- Specified by:
canProcessin classMachineModuleBase<ChemicalPlantRecipe>
-
processCraft
- Specified by:
processCraftin classMachineModuleBase<ChemicalPlantRecipe>
-
matchesCurrentRecipe
- Specified by:
matchesCurrentRecipein classMachineModuleBase<ChemicalPlantRecipe>
-
getRecipeDuration
- Specified by:
getRecipeDurationin classMachineModuleBase<ChemicalPlantRecipe>
-
getRecipeEnergyCost
- Specified by:
getRecipeEnergyCostin classMachineModuleBase<ChemicalPlantRecipe>
-
findRecipeForItem
- Specified by:
findRecipeForItemin classMachineModuleBase<ChemicalPlantRecipe>
-
isRecipeAllowedByBlueprint
protected boolean isRecipeAllowedByBlueprint(ChemicalPlantRecipe recipe, @Nullable net.minecraft.world.item.ItemStack blueprint) Description copied from class:MachineModuleBaseOptional hook: recipe is allowed for current blueprint. Default: always allowed (machines without blueprint system).- Overrides:
isRecipeAllowedByBlueprintin classMachineModuleBase<ChemicalPlantRecipe>
-
setupTanks
-
peekRecipe
Рецепт из менеджера по id — для сети и капабилити. -
setSelectedRecipe
public void setSelectedRecipe(@Nullable net.minecraft.resources.ResourceLocation id) -
writeExtraToNbt
protected void writeExtraToNbt(net.minecraft.nbt.CompoundTag nbt) Description copied from class:MachineModuleBaseДоп. состояние модуля, которое не относится к базовому прогрессу (например выбранный рецепт).- Overrides:
writeExtraToNbtin classMachineModuleBase<ChemicalPlantRecipe>
-
readExtraFromNbt
protected void readExtraFromNbt(net.minecraft.nbt.CompoundTag nbt) - Overrides:
readExtraFromNbtin classMachineModuleBase<ChemicalPlantRecipe>
-
writeExtraToBuf
protected void writeExtraToBuf(net.minecraft.network.FriendlyByteBuf buf) - Overrides:
writeExtraToBufin classMachineModuleBase<ChemicalPlantRecipe>
-
readExtraFromBuf
protected void readExtraFromBuf(net.minecraft.network.FriendlyByteBuf buf) - Overrides:
readExtraFromBufin classMachineModuleBase<ChemicalPlantRecipe>
-