Class BlockEntityWorking<T extends BlockEntityWorking<T,O>,O>

java.lang.Object
net.minecraftforge.common.capabilities.CapabilityProvider<net.minecraft.world.level.block.entity.BlockEntity>
net.minecraft.world.level.block.entity.BlockEntity
org.cyclops.cyclopscore.blockentity.CyclopsBlockEntity
Type Parameters:
O - The type of upgrade behaviour object.
All Implemented Interfaces:
net.minecraftforge.common.capabilities.ICapabilityProvider, net.minecraftforge.common.capabilities.ICapabilityProviderImpl<net.minecraft.world.level.block.entity.BlockEntity>, net.minecraftforge.common.capabilities.ICapabilitySerializable<net.minecraft.nbt.CompoundTag>, net.minecraftforge.common.extensions.IForgeBlockEntity, net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>, org.cyclops.cyclopscore.blockentity.IBlockEntityDelayedTickable, org.cyclops.cyclopscore.persist.IDirtyMarkListener, org.cyclops.cyclopscore.persist.nbt.INBTProvider, IUpgradable<T,O>
Direct Known Subclasses:
BlockEntityBloodInfuser, BlockEntityColossalBloodChest, BlockEntitySanguinaryEnvironmentalAccumulator, BlockEntitySpiritFurnace, BlockEntitySpiritReanimator

public abstract class BlockEntityWorking<T extends BlockEntityWorking<T,O>,O> extends BlockEntityTickingTankInventory<T> implements IUpgradable<T,O>
Evilcraft working block entity with upgrade declaration.
  • Field Details

  • Constructor Details

    • BlockEntityWorking

      public BlockEntityWorking(net.minecraft.world.level.block.entity.BlockEntityType<?> type, net.minecraft.core.BlockPos blockPos, net.minecraft.world.level.block.state.BlockState blockState, int inventorySize, int stackSize, int tankSize, net.minecraft.world.level.material.Fluid acceptedFluid)
  • Method Details

    • getBasicInventorySize

      public int getBasicInventorySize()
    • getTileWorkingMetadata

      public abstract BlockEntityWorking.Metadata getTileWorkingMetadata()
    • canWork

      public abstract boolean canWork()
      Check if this tile is valid and can start working. Mostly defined by environmental parameters.
      Returns:
      If it is valid and can work.
    • isWorking

      public boolean isWorking()
      If this tile is working.
      Returns:
      If it is abstract.
    • isVisuallyWorking

      public boolean isVisuallyWorking()
      If the furnace should visually (blockState icon) show it is working, should only be called client-side.
      Returns:
      If the state is working.
    • getWorkTickScaled

      public int getWorkTickScaled(int scale)
      Get the work progress scaled, to be used in GUI's.
      Parameters:
      scale - The scale this progress should be applied to.
      Returns:
      The scaled working progress.
    • getWorkTicker

      protected abstract int getWorkTicker()
    • getWorkTick

      protected int getWorkTick()
    • getRequiredWorkTicks

      protected float getRequiredWorkTicks()
    • resetWork

      public void resetWork()
      Resets the ticks of the work.
    • resetWork

      public void resetWork(boolean hardReset)
      Resets the ticks of the work.
      Parameters:
      hardReset - If the tick and required tick should also be set to zero.
    • getNewState

      public int getNewState()
      Description copied from class: BlockEntityTickingTankInventory
      Get the new (numerical) state for this tile entity.
      Specified by:
      getNewState in class BlockEntityTickingTankInventory<T extends BlockEntityWorking<T,O>>
      Returns:
      The new state.
    • hasJustWorked

      protected boolean hasJustWorked()
      Overrides:
      hasJustWorked in class BlockEntityTickingTankInventory<T extends BlockEntityWorking<T,O>>
    • onStateChanged

      public void onStateChanged()
      Description copied from class: BlockEntityTickingTankInventory
      What needs to happen when the (numerical) state is changed.
      Specified by:
      onStateChanged in class BlockEntityTickingTankInventory<T extends BlockEntityWorking<T,O>>
    • getUpgradeItems

      protected List<net.minecraft.world.item.ItemStack> getUpgradeItems()
    • resetUpgradeLevels

      protected void resetUpgradeLevels()
    • createInventory

      protected org.cyclops.cyclopscore.inventory.SimpleInventory createInventory(int inventorySize, int stackSize)
      Overrides:
      createInventory in class BlockEntityTankInventory
    • getUpgradeLevels

      public Map<Upgrades.Upgrade,Integer> getUpgradeLevels()
    • getUpgradeBehaviour

      public Map<Upgrades.Upgrade,IUpgradeBehaviour<T,O>> getUpgradeBehaviour()
      Specified by:
      getUpgradeBehaviour in interface IUpgradable<T extends BlockEntityWorking<T,O>,O>
      Returns:
      The possible upgrades.
    • getUpgradeType

      public Upgrades.Upgrade getUpgradeType(net.minecraft.world.item.ItemStack itemStack)
      Get the type of upgrade corresponding to the given itemstack.
      Parameters:
      itemStack - The itemstack. Not null.
      Returns:
      The upgrade type.
    • getUpgradeLevel

      public int getUpgradeLevel(net.minecraft.world.item.ItemStack itemStack)
      Get the level of upgrade corresponding to the given itemstack.
      Parameters:
      itemStack - The itemstack. Not null.
      Returns:
      The upgrade level.
    • onUpgradeSlotChanged

      public boolean onUpgradeSlotChanged(int slotId, net.minecraft.world.item.ItemStack oldItemStack, net.minecraft.world.item.ItemStack itemStack)
    • getTankTierMultiplier

      public static int getTankTierMultiplier(int tier)
      Get the tank capacity multiplier.
      Parameters:
      tier - The tier to multiply for.
      Returns:
      The multiplier.