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
org.cyclops.evilcraft.core.blockentity.BlockEntityTankInventory
org.cyclops.evilcraft.core.blockentity.BlockEntityTickingTankInventory<T>
org.cyclops.evilcraft.core.blockentity.BlockEntityWorking<T,O>
- 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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBlockEntityWorking.Inventory<T extends BlockEntityWorking<T,?>> static classstatic classBlockEntityWorking.TickerServer<T extends BlockEntityWorking<T,O>, O> Nested classes/interfaces inherited from class org.cyclops.evilcraft.core.blockentity.BlockEntityTickingTankInventory
BlockEntityTickingTankInventory.TickerClient<T extends BlockEntityTickingTankInventory<T>>Nested classes/interfaces inherited from class net.minecraftforge.common.capabilities.CapabilityProvider
net.minecraftforge.common.capabilities.CapabilityProvider.AsField<B extends net.minecraftforge.common.capabilities.ICapabilityProviderImpl<B>> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanstatic final intSize of the upgrades inventory.protected Map<Upgrades.Upgrade,IUpgradeBehaviour<T, O>> Fields inherited from class org.cyclops.evilcraft.core.blockentity.BlockEntityTickingTankInventory
currentState, previousStateFields inherited from class org.cyclops.evilcraft.core.blockentity.BlockEntityTankInventory
tankSizeFields inherited from class net.minecraft.world.level.block.entity.BlockEntity
level, remove, worldPositionFields inherited from interface net.minecraftforge.common.extensions.IForgeBlockEntity
INFINITE_EXTENT_AABB -
Constructor Summary
ConstructorsConstructorDescriptionBlockEntityWorking(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 Summary
Modifier and TypeMethodDescriptionabstract booleancanWork()Check if this tile is valid and can start working.protected org.cyclops.cyclopscore.inventory.SimpleInventorycreateInventory(int inventorySize, int stackSize) intintGet the new (numerical) state for this tile entity.protected floatstatic intgetTankTierMultiplier(int tier) Get the tank capacity multiplier.abstract BlockEntityWorking.Metadataprotected List<net.minecraft.world.item.ItemStack>intgetUpgradeLevel(net.minecraft.world.item.ItemStack itemStack) Get the level of upgrade corresponding to the given itemstack.getUpgradeType(net.minecraft.world.item.ItemStack itemStack) Get the type of upgrade corresponding to the given itemstack.protected intprotected abstract intintgetWorkTickScaled(int scale) Get the work progress scaled, to be used in GUI's.protected booleanbooleanIf the furnace should visually (blockState icon) show it is working, should only be called client-side.booleanIf this tile is working.voidWhat needs to happen when the (numerical) state is changed.booleanonUpgradeSlotChanged(int slotId, net.minecraft.world.item.ItemStack oldItemStack, net.minecraft.world.item.ItemStack itemStack) protected voidvoidResets the ticks of the work.voidresetWork(boolean hardReset) Resets the ticks of the work.Methods inherited from class org.cyclops.evilcraft.core.blockentity.BlockEntityTickingTankInventory
addTicker, getCurrentState, getTickers, read, saveAdditionalMethods inherited from class org.cyclops.evilcraft.core.blockentity.BlockEntityTankInventory
addFluidHandlerCapabilities, addItemHandlerCapabilities, createTank, getInventory, getTank, onTankChangedMethods inherited from class org.cyclops.cyclopscore.blockentity.CyclopsBlockEntity
addCapabilityInternal, addCapabilitySided, canInteractWith, getCapability, getRotation, getStoredCapabilities, getUpdateBackoff, getUpdateBackoffTicks, getUpdatePacket, getUpdateTag, invalidateCaps, load, onDataPacket, onDirty, onLoad, onUpdateReceived, readGeneratedFieldsFromNBT, sendUpdate, setUpdateBackoff, shouldSendUpdate, transformFacingForRotation, unsetSendUpdate, writeGeneratedFieldsToNBT, writeToItemStackMethods inherited from class net.minecraft.world.level.block.entity.BlockEntity
addEntityType, clearRemoved, fillCrashReportCategory, getBlockPos, getBlockState, getLevel, getPersistentData, getPosFromTag, getType, hasLevel, isRemoved, loadStatic, onChunkUnloaded, onlyOpCanSetNbt, saveToItem, saveWithFullMetadata, saveWithId, saveWithoutMetadata, setBlockState, setChanged, setChanged, setLevel, setRemoved, triggerEventMethods inherited from class net.minecraftforge.common.capabilities.CapabilityProvider
areCapsCompatible, areCapsCompatible, deserializeCaps, gatherCapabilities, gatherCapabilities, gatherCapabilities, getCapabilities, reviveCaps, serializeCapsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.cyclops.cyclopscore.blockentity.IBlockEntityDelayedTickable
reduceUpdateBackoff, sendImmediateUpdateMethods inherited from interface net.minecraftforge.common.capabilities.ICapabilityProvider
getCapabilityMethods inherited from interface net.minecraftforge.common.extensions.IForgeBlockEntity
deserializeNBT, getModelData, getRenderBoundingBox, handleUpdateTag, requestModelDataUpdate, serializeNBT
-
Field Details
-
INVENTORY_SIZE_UPGRADES
public static final int INVENTORY_SIZE_UPGRADESSize of the upgrades inventory.- See Also:
-
upgradeBehaviour
protected Map<Upgrades.Upgrade,IUpgradeBehaviour<T extends BlockEntityWorking<T, upgradeBehaviourO>, O>> -
hasJustWorked
protected boolean hasJustWorked
-
-
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
-
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:BlockEntityTickingTankInventoryGet the new (numerical) state for this tile entity.- Specified by:
getNewStatein classBlockEntityTickingTankInventory<T extends BlockEntityWorking<T,O>> - Returns:
- The new state.
-
hasJustWorked
protected boolean hasJustWorked()- Overrides:
hasJustWorkedin classBlockEntityTickingTankInventory<T extends BlockEntityWorking<T,O>>
-
onStateChanged
public void onStateChanged()Description copied from class:BlockEntityTickingTankInventoryWhat needs to happen when the (numerical) state is changed.- Specified by:
onStateChangedin classBlockEntityTickingTankInventory<T extends BlockEntityWorking<T,O>>
-
getUpgradeItems
-
resetUpgradeLevels
protected void resetUpgradeLevels() -
createInventory
protected org.cyclops.cyclopscore.inventory.SimpleInventory createInventory(int inventorySize, int stackSize) - Overrides:
createInventoryin classBlockEntityTankInventory
-
getUpgradeLevels
-
getUpgradeBehaviour
- Specified by:
getUpgradeBehaviourin interfaceIUpgradable<T extends BlockEntityWorking<T,O>, O> - Returns:
- The possible upgrades.
-
getUpgradeType
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.
-