Class ProcessingBenchBlock

java.lang.Object
com.hypixel.hytale.builtin.crafting.component.ProcessingBenchBlock
All Implemented Interfaces:
Component<ChunkStore>, Cloneable

public class ProcessingBenchBlock extends Object implements Component<ChunkStore>
  • Field Details

    • LOGGER

      @Nonnull public static final HytaleLogger LOGGER
    • EXACT_RESOURCE_AMOUNTS

      public static final boolean EXACT_RESOURCE_AMOUNTS
      It's possible to have an item that has more resources than we require per item, this flag will force that we only take the exact amount that we need no more, no less.
      See Also:
    • CODEC

      @Nonnull public static final BuilderCodec<ProcessingBenchBlock> CODEC
    • PROCESSING

      @Nonnull public static final String PROCESSING
      See Also:
    • PROCESS_COMPLETED

      @Nonnull public static final String PROCESS_COMPLETED
      See Also:
  • Constructor Details

    • ProcessingBenchBlock

      public ProcessingBenchBlock()
  • Method Details

    • getComponentType

      public static ComponentType<ChunkStore, ProcessingBenchBlock> getComponentType()
    • getBench

      @Nullable public Bench getBench()
    • getProcessingBench

      @Nullable public ProcessingBench getProcessingBench()
    • getOutputContainer

      public ItemContainer getOutputContainer()
    • getInputContainer

      public ItemContainer getInputContainer()
    • getFuelContainer

      public ItemContainer getFuelContainer()
    • getFuelTime

      public float getFuelTime()
    • getProcessingSlots

      @Nonnull public it.unimi.dsi.fastutil.shorts.ShortSet getProcessingSlots()
    • getProcessingFuelSlots

      @Nonnull public it.unimi.dsi.fastutil.shorts.ShortSet getProcessingFuelSlots()
    • getLastTickGameTime

      @Nullable public Instant getLastTickGameTime()
    • setLastTickGameTime

      public void setLastTickGameTime(@Nullable Instant lastTickGameTime)
    • setLastConsumedFuelTotal

      public void setLastConsumedFuelTotal(int lastConsumedFuelTotal)
    • clearCurrentRecipe

      public void clearCurrentRecipe()
    • initializeBenchConfig

      public boolean initializeBenchConfig(@Nonnull BlockType blockType)
      Sets the bench config fields from the block type. Must be called before setupSlots or tick.
      Returns:
      true if the config was successfully set, false if the block type has no valid processing bench.
    • setupSlots

      public void setupSlots(@Nonnull World world, @Nonnull BenchBlock benchBlock, @Nonnull BlockModule.BlockStateInfo blockStateInfo, int blockX, int blockY, int blockZ, @Nonnull BlockType blockType, int rotationIndex)
    • isActive

      public boolean isActive()
    • setActive

      public boolean setActive(boolean active, @Nonnull BenchBlock benchBlock, @Nullable BlockModule.BlockStateInfo blockStateInfo)
      Changes the active state of this processor.
      Parameters:
      benchBlock - the companion BenchBlock (for windows and tier level)
      blockStateInfo - the block state info for marking dirty, or null if unavailable
      Returns:
      whether the value changed
    • updateFuelValues

      public void updateFuelValues(@Nonnull Map<UUID, BenchWindow> windows)
    • getItemContainer

      @Nullable public CombinedItemContainer getItemContainer()
    • getRecipe

      @Nullable public CraftingRecipe getRecipe()
    • getInputProgress

      public float getInputProgress()
    • setInputProgress

      public void setInputProgress(float inputProgress)
    • dropFuelItems

      public void dropFuelItems(@Nonnull List<ItemStack> itemStacks)
    • getRecipeTimeSeconds

      public float getRecipeTimeSeconds(int tierLevel)
    • advanceProcessing

      public int advanceProcessing(float dt, @Nonnull Store<EntityStore> entityStore, @Nonnull BenchBlock benchBlock, @Nonnull BlockModule.BlockStateInfo blockStateInfo, int blockX, int blockY, int blockZ, @Nonnull BlockType blockType, int rotationIndex)
      Analytical processing: computes the maximum number of recipe completions possible given the available time, fuel, input, and output capacity, then applies them in batch. Works for any dt -- small (normal tick) or large (offline catch-up).
      Returns:
      the number of recipe completions performed.
    • consumeFuelForDuration

      public void consumeFuelForDuration(float duration, @Nonnull Store<EntityStore> entityStore, int blockX, int blockY, int blockZ, @Nonnull BlockType blockType, int rotationIndex)
      Consumes fuel items to cover the requested duration. Only removes what is needed; existing fuelTime is used first.
    • sendProgress

      public void sendProgress(float progress, @Nonnull Map<UUID, BenchWindow> windows)
    • sendProcessingSlots

      public void sendProcessingSlots(@Nonnull Map<UUID, BenchWindow> windows)
    • sendProcessingFuelSlots

      public void sendProcessingFuelSlots(@Nonnull Map<UUID, BenchWindow> windows)
    • setBlockInteractionState

      public void setBlockInteractionState(@Nonnull String state, @Nonnull BlockType blockType, @Nonnull ChunkStore chunkStore, @Nonnull Ref<ChunkStore> sectionRef, int blockX, int blockY, int blockZ)
    • playSound

      public void playSound(int soundEventIndex, @Nonnull ComponentAccessor<EntityStore> componentAccessor, @Nonnull BlockType blockType, int rotationIndex, int blockX, int blockY, int blockZ)
    • checkForRecipeUpdate

      public void checkForRecipeUpdate(@Nonnull BenchBlock benchBlock)
    • clone

      @Nullable public Component<ChunkStore> clone()
      Specified by:
      clone in interface Component<ChunkStore>
      Returns:
      a clone instance of the original component instance.