Class AbstractMachineBlockEntity

java.lang.Object
net.neoforged.neoforge.attachment.AttachmentHolder
net.minecraft.world.level.block.entity.BlockEntity
com.wdiscute.artisan.machines.AbstractMachineBlockEntity
All Implemented Interfaces:
net.neoforged.neoforge.attachment.IAttachmentHolder, net.neoforged.neoforge.common.extensions.IBlockEntityExtension
Direct Known Subclasses:
AgingCaskBlockEntity, AncientCaskBlockEntity, BaitMakerBlockEntity, ChargingRodBlockEntity, CheesePressBlockEntity, CrystalariumBlockEntity, DehydratorBlockEntity, DeluxeWormFarmBlockEntity, EspressoMachineBlockEntity, FishSmokerBlockEntity, LoomBlockEntity, MayonnaiseMachineBlockEntity, MushroomLogBlockEntity, OilMakerBlockEntity, PreservesJarBlockEntity, RecyclingMachineBlockEntity, SeedMakerBlockEntity, TapperBlockEntity, WineKegBlockEntity

public abstract class AbstractMachineBlockEntity extends net.minecraft.world.level.block.entity.BlockEntity
  • Nested Class Summary

    Nested classes/interfaces inherited from class net.minecraft.world.level.block.entity.BlockEntity

    net.minecraft.world.level.block.entity.BlockEntity.DataComponentInput

    Nested classes/interfaces inherited from class net.neoforged.neoforge.attachment.AttachmentHolder

    net.neoforged.neoforge.attachment.AttachmentHolder.AsField
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    int
     
    List<com.wdiscute.utils.MaybeStack>
     
    long
     
     
    int
     
    List<com.wdiscute.utils.MaybeStack>
     

    Fields inherited from class net.minecraft.world.level.block.entity.BlockEntity

    level, remove, worldPosition

    Fields inherited from class net.neoforged.neoforge.attachment.AttachmentHolder

    ATTACHMENTS_NBT_KEY
  • Constructor Summary

    Constructors
    Constructor
    Description
    AbstractMachineBlockEntity(net.minecraft.world.level.block.entity.BlockEntityType<?> type, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState blockState)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    List<net.minecraft.world.item.ItemStack>
     
    int
     
    List<com.wdiscute.utils.MaybeStack>
     
    abstract net.minecraft.world.item.crafting.RecipeType<? extends AbstractArtisanRecipe>
     
     
    static <T extends net.minecraft.world.level.block.entity.BlockEntity>
    net.minecraft.world.level.block.entity.BlockEntityTicker<T>
    getTicker(net.minecraft.world.level.Level l)
     
    @Nullable net.minecraft.network.protocol.Packet<net.minecraft.network.protocol.game.ClientGamePacketListener>
     
    net.minecraft.nbt.CompoundTag
    getUpdateTag(net.minecraft.core.HolderLookup.Provider registries)
     
     
    List<net.minecraft.world.item.ItemStack>
    harvest(List<AbstractUpgrade> playerUpgrades)
     
    List<net.minecraft.world.item.ItemStack>
    harvest(List<AbstractUpgrade> playerUpgrades, List<net.minecraft.world.item.ItemStack> results)
     
    void
    hourlyTick(long hour, net.minecraft.world.level.block.state.BlockState state)
    ticks hourly, adds one to last tick hour so if the machine was unloaded all days are ticked
    void
     
    boolean
     
    protected void
    loadAdditional(net.minecraft.nbt.CompoundTag tag, net.minecraft.core.HolderLookup.Provider registries)
     
    void
    putItem(net.minecraft.world.item.ItemStack itemStack)
     
    void
    putUpgrade(net.minecraft.world.item.ItemStack itemStack, MachineUpgrade machineUpgrade)
     
    protected void
    saveAdditional(net.minecraft.nbt.CompoundTag tag, net.minecraft.core.HolderLookup.Provider registries)
     
    boolean
     
    void
     
    void
     
    void
    ticks with an offset based on the tick delay config - does NOT tick every tick
    boolean
    tryStartRecipe(net.minecraft.world.item.ItemStack stack, List<net.minecraft.world.item.ItemStack> inventory, boolean consume)
     

    Methods inherited from class net.minecraft.world.level.block.entity.BlockEntity

    addEntityType, applyComponents, applyComponentsFromItemStack, applyImplicitComponents, clearRemoved, collectComponents, collectImplicitComponents, components, fillCrashReportCategory, getBlockPos, getBlockState, getLevel, getPersistentData, getPosFromTag, getType, hasLevel, isRemoved, isValidBlockState, loadCustomOnly, loadStatic, loadWithComponents, onlyOpCanSetNbt, parseCustomNameSafe, removeComponentsFromTag, removeData, saveCustomAndMetadata, saveCustomOnly, saveToItem, saveWithFullMetadata, saveWithId, saveWithoutMetadata, setBlockState, setChanged, setChanged, setComponents, setData, setLevel, setRemoved, syncData, triggerEvent

    Methods inherited from class net.neoforged.neoforge.attachment.AttachmentHolder

    deserializeAttachments, getData, getExistingDataOrNull, hasAttachments, hasData, serializeAttachments

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface net.neoforged.neoforge.attachment.IAttachmentHolder

    getData, getExistingData, getExistingData, getExistingDataOrNull, hasData, removeData, setData, syncData

    Methods inherited from interface net.neoforged.neoforge.common.extensions.IBlockEntityExtension

    getModelData, handleUpdateTag, hasCustomOutlineRendering, invalidateCapabilities, onChunkUnloaded, onDataPacket, onLoad, requestModelDataUpdate
  • Field Details

    • tickOffset

      public int tickOffset
    • lastTickHour

      public long lastTickHour
    • hoursRemaining

      public int hoursRemaining
    • upgrades

      public List<com.wdiscute.utils.MaybeStack> upgrades
    • items

      public List<com.wdiscute.utils.MaybeStack> items
    • recipeResult

      public List<ChancedStack> recipeResult
  • Constructor Details

    • AbstractMachineBlockEntity

      public AbstractMachineBlockEntity(net.minecraft.world.level.block.entity.BlockEntityType<?> type, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState blockState)
  • Method Details

    • isWorking

      public boolean isWorking()
    • getHoursRemaining

      public int getHoursRemaining()
    • shouldTickNonWorking

      public boolean shouldTickNonWorking()
    • putItem

      public void putItem(net.minecraft.world.item.ItemStack itemStack)
    • putUpgrade

      public void putUpgrade(net.minecraft.world.item.ItemStack itemStack, MachineUpgrade machineUpgrade)
    • invalidateUpgradeCache

      public void invalidateUpgradeCache()
    • getUpgrades

      public List<AbstractUpgrade> getUpgrades()
    • getHarvestResults

      public List<net.minecraft.world.item.ItemStack> getHarvestResults()
    • harvest

      public List<net.minecraft.world.item.ItemStack> harvest(List<AbstractUpgrade> playerUpgrades)
    • harvest

      public List<net.minecraft.world.item.ItemStack> harvest(List<AbstractUpgrade> playerUpgrades, List<net.minecraft.world.item.ItemStack> results)
    • tryStartRecipe

      public boolean tryStartRecipe(net.minecraft.world.item.ItemStack stack, List<net.minecraft.world.item.ItemStack> inventory, boolean consume)
    • startRecipe

      public void startRecipe(AbstractArtisanRecipe recipe)
    • sync

      public void sync()
    • getItems

      public List<com.wdiscute.utils.MaybeStack> getItems()
    • getResultItem

      public List<ChancedStack> getResultItem()
    • getRecipeType

      public abstract net.minecraft.world.item.crafting.RecipeType<? extends AbstractArtisanRecipe> getRecipeType()
    • tick

      public void tick()
      ticks with an offset based on the tick delay config - does NOT tick every tick
    • hourlyTick

      public void hourlyTick(long hour, net.minecraft.world.level.block.state.BlockState state)
      ticks hourly, adds one to last tick hour so if the machine was unloaded all days are ticked
    • saveAdditional

      protected void saveAdditional(net.minecraft.nbt.CompoundTag tag, net.minecraft.core.HolderLookup.Provider registries)
      Overrides:
      saveAdditional in class net.minecraft.world.level.block.entity.BlockEntity
    • loadAdditional

      protected void loadAdditional(net.minecraft.nbt.CompoundTag tag, net.minecraft.core.HolderLookup.Provider registries)
      Overrides:
      loadAdditional in class net.minecraft.world.level.block.entity.BlockEntity
    • getUpdatePacket

      @Nullable public @Nullable net.minecraft.network.protocol.Packet<net.minecraft.network.protocol.game.ClientGamePacketListener> getUpdatePacket()
      Overrides:
      getUpdatePacket in class net.minecraft.world.level.block.entity.BlockEntity
    • getUpdateTag

      public net.minecraft.nbt.CompoundTag getUpdateTag(net.minecraft.core.HolderLookup.Provider registries)
      Overrides:
      getUpdateTag in class net.minecraft.world.level.block.entity.BlockEntity
    • getTicker

      public static <T extends net.minecraft.world.level.block.entity.BlockEntity> net.minecraft.world.level.block.entity.BlockEntityTicker<T> getTicker(net.minecraft.world.level.Level l)