public abstract class TileEntityBase extends net.minecraft.tileentity.TileEntity implements net.minecraft.util.INameable, IGUIButtonSensitive, IDescSynced, IUpgradeAcceptor, IUpgradeHolder, ILuaMethodProvider
| Modifier and Type | Class and Description |
|---|---|
class |
TileEntityBase.UpgradeHandler |
| Constructor and Description |
|---|
TileEntityBase(net.minecraft.tileentity.TileEntityType type) |
TileEntityBase(net.minecraft.tileentity.TileEntityType type,
int upgradeSize) |
| Modifier and Type | Method and Description |
|---|---|
void |
addLuaMethods(LuaMethodRegistry registry)
Called lazily to populate the method registry with the methods.
|
void |
clearCache() |
int |
countPlayersUsing()
Get the number of players who have a GUI open for this tile entity.
|
java.util.Map<EnumUpgrade,java.lang.Integer> |
getApplicableUpgrades()
This method is called as soon as an instance of this interface is registered, be aware.
|
net.minecraft.tileentity.TileEntity |
getCachedNeighbor(net.minecraft.util.Direction dir) |
<T> net.minecraftforge.common.util.LazyOptional<T> |
getCapability(net.minecraftforge.common.capabilities.Capability<T> cap,
net.minecraft.util.Direction side) |
void |
getContentsToDrop(net.minecraft.util.NonNullList<net.minecraft.item.ItemStack> drops)
Collect all items which should be dropped when this TE is broken.
|
java.lang.String |
getCurrentRecipeIdSynced()
For machines which use recipes, get the synced recipe ID client-side for informational purposes
|
net.minecraft.util.text.ITextComponent |
getCustomName() |
java.util.List<SyncedField<?>> |
getDescriptionFields() |
net.minecraft.util.text.ITextComponent |
getDisplayName() |
net.minecraftforge.common.util.LazyOptional<IHeatExchangerLogic> |
getHeatCap(net.minecraft.util.Direction side) |
protected net.minecraftforge.common.util.LazyOptional<net.minecraftforge.items.IItemHandler> |
getInventoryCap() |
LuaMethodRegistry |
getLuaMethodRegistry()
Get this TE's method registry object.
|
net.minecraftforge.client.model.data.IModelData |
getModelData() |
net.minecraft.util.text.ITextComponent |
getName() |
java.lang.String |
getPeripheralType()
Get a unique identifier for this type of method provider.
|
net.minecraft.util.math.BlockPos |
getPosition()
We don't override getUpdatePacket() or onDataPacket() because TE sync'ing is all handled
by our custom PacketDescription and the @DescSynced system
|
abstract net.minecraftforge.items.IItemHandler |
getPrimaryInventory() |
net.minecraft.util.Direction |
getRotation() |
float |
getSpeedMultiplierFromUpgrades() |
float |
getSpeedUsageMultiplierFromUpgrades() |
net.minecraft.nbt.CompoundNBT |
getUpdateTag() |
java.lang.String |
getUpgradeAcceptorTranslationKey()
Get a translation key for this upgrade acceptor.
|
UpgradeCache |
getUpgradeCache() |
TileEntityBase.UpgradeHandler |
getUpgradeHandler() |
int |
getUpgrades(EnumUpgrade upgrade) |
void |
handleGUIButtonPress(java.lang.String tag,
boolean shiftHeld,
net.minecraft.entity.player.ServerPlayerEntity player) |
void |
handleUpdateTag(net.minecraft.block.BlockState state,
net.minecraft.nbt.CompoundNBT tag) |
boolean |
isGuiUseableByPlayer(net.minecraft.entity.player.PlayerEntity player) |
void |
load(net.minecraft.block.BlockState state,
net.minecraft.nbt.CompoundNBT tag) |
void |
onBlockRotated() |
void |
onDescUpdate() |
protected void |
onFirstServerTick() |
void |
onGuiUpdate()
Called when a key is synced in the container.
|
void |
onNeighborBlockUpdate(net.minecraft.util.math.BlockPos fromPos)
Called when a neighboring block changes state (i.e.
|
void |
onNeighborTileUpdate(net.minecraft.util.math.BlockPos tilePos)
Called when a neighboring tile entity changes state (specifically when
net.minecraft.world.World#updateComparatorOutputLevel(BlockPos, Block) is called. |
void |
onUpgradesChanged()
Called when a machine's upgrades have changed in any way.
|
void |
readFromPacket(net.minecraft.nbt.CompoundNBT tag)
Encoded into the description packet.
|
void |
requestModelDataUpdate() |
net.minecraft.nbt.CompoundNBT |
save(net.minecraft.nbt.CompoundNBT tag) |
void |
sendDescriptionPacket()
Force a sync of this TE to the client right now.
|
void |
serializeExtraItemData(net.minecraft.nbt.CompoundNBT blockEntityTag,
boolean preserveState)
Get any extra data to be serialized onto a dropped item stack.
|
void |
setCustomName(net.minecraft.util.text.ITextComponent customName) |
void |
setPreserveStateOnBreak(boolean preserveStateOnBreak) |
void |
setRemoved() |
boolean |
shouldPreserveStateOnBreak()
Should this tile entity preserve its state (currently: upgrades and stored air) when broken?
By default this is true when sneak-wrenched, and false when broken by pick.
|
protected boolean |
shouldRerenderChunkOnDescUpdate() |
boolean |
shouldSyncField(int idx) |
protected void |
updateNeighbours() |
void |
writeToPacket(net.minecraft.nbt.CompoundNBT tag)
Encoded into the description packet.
|
clearRemoved, fillCrashReportCategory, getBlockPos, getBlockState, getLevel, getTileData, getType, getUpdatePacket, getViewDistance, hasLevel, isRemoved, loadStatic, logInvalidState, mirror, onChunkUnloaded, onlyOpCanSetNbt, rotate, setChanged, setLevelAndPosition, setPosition, triggerEventareCapsCompatible, areCapsCompatible, deserializeCaps, gatherCapabilities, gatherCapabilities, getCapabilities, invalidateCaps, reviveCaps, serializeCapsclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic TileEntityBase(net.minecraft.tileentity.TileEntityType type)
public TileEntityBase(net.minecraft.tileentity.TileEntityType type,
int upgradeSize)
public java.lang.String getUpgradeAcceptorTranslationKey()
IUpgradeAcceptorgetUpgradeAcceptorTranslationKey in interface IUpgradeAcceptorpublic net.minecraft.util.text.ITextComponent getName()
getName in interface net.minecraft.util.INameable@Nullable public net.minecraft.util.text.ITextComponent getCustomName()
getCustomName in interface net.minecraft.util.INameablepublic void setCustomName(net.minecraft.util.text.ITextComponent customName)
public net.minecraft.util.text.ITextComponent getDisplayName()
getDisplayName in interface net.minecraft.util.INameablepublic net.minecraft.nbt.CompoundNBT getUpdateTag()
getUpdateTag in class net.minecraft.tileentity.TileEntitypublic void handleUpdateTag(net.minecraft.block.BlockState state,
net.minecraft.nbt.CompoundNBT tag)
handleUpdateTag in interface net.minecraftforge.common.extensions.IForgeTileEntitypublic net.minecraft.util.math.BlockPos getPosition()
getPosition in interface IDescSyncedpublic boolean shouldSyncField(int idx)
shouldSyncField in interface IDescSyncedpublic java.util.List<SyncedField<?>> getDescriptionFields()
getDescriptionFields in interface IDescSyncedpublic void sendDescriptionPacket()
public void setRemoved()
setRemoved in class net.minecraft.tileentity.TileEntityprotected void onFirstServerTick()
protected void updateNeighbours()
public void onBlockRotated()
protected boolean shouldRerenderChunkOnDescUpdate()
public void writeToPacket(net.minecraft.nbt.CompoundNBT tag)
TileEntityBase#write(CompoundNBT)
Prefer to use @DescSynced where possible - use this either for complex fields not handled by @DescSynced,
or for non-ticking tile entities.writeToPacket in interface IDescSyncedtag - NBT tagpublic void readFromPacket(net.minecraft.nbt.CompoundNBT tag)
TileEntityBase#read(BlockState, CompoundNBT).
Prefer to use @DescSynced where possible - use this either for complex fields not handled by @DescSynced,
or for non-ticking tile entities.readFromPacket in interface IDescSyncedtag - NBT tagpublic net.minecraft.nbt.CompoundNBT save(net.minecraft.nbt.CompoundNBT tag)
save in class net.minecraft.tileentity.TileEntitypublic void load(net.minecraft.block.BlockState state,
net.minecraft.nbt.CompoundNBT tag)
load in class net.minecraft.tileentity.TileEntitypublic void onDescUpdate()
onDescUpdate in interface IDescSynced@Nonnull public net.minecraftforge.client.model.data.IModelData getModelData()
getModelData in interface net.minecraftforge.common.extensions.IForgeTileEntitypublic void onGuiUpdate()
public net.minecraft.util.Direction getRotation()
public void clearCache()
clearCache in class net.minecraft.tileentity.TileEntitypublic int getUpgrades(EnumUpgrade upgrade)
public float getSpeedMultiplierFromUpgrades()
public float getSpeedUsageMultiplierFromUpgrades()
public void handleGUIButtonPress(java.lang.String tag,
boolean shiftHeld,
net.minecraft.entity.player.ServerPlayerEntity player)
handleGUIButtonPress in interface IGUIButtonSensitivepublic boolean isGuiUseableByPlayer(net.minecraft.entity.player.PlayerEntity player)
public net.minecraft.tileentity.TileEntity getCachedNeighbor(net.minecraft.util.Direction dir)
public void onNeighborTileUpdate(net.minecraft.util.math.BlockPos tilePos)
net.minecraft.world.World#updateComparatorOutputLevel(BlockPos, Block) is called.tilePos - the blockpos of the neighboring tile entitypublic void onNeighborBlockUpdate(net.minecraft.util.math.BlockPos fromPos)
fromPos - the blockpos of the block that caused this updatepublic java.util.Map<EnumUpgrade,java.lang.Integer> getApplicableUpgrades()
IUpgradeAcceptorgetApplicableUpgrades in interface IUpgradeAcceptorpublic void addLuaMethods(LuaMethodRegistry registry)
ILuaMethodProvideraddLuaMethods in interface ILuaMethodProviderregistry - the registry to populatepublic LuaMethodRegistry getLuaMethodRegistry()
ILuaMethodProvidergetLuaMethodRegistry in interface ILuaMethodProviderpublic java.lang.String getPeripheralType()
ILuaMethodProvidergetPeripheralType in interface ILuaMethodProviderpublic abstract net.minecraftforge.items.IItemHandler getPrimaryInventory()
public TileEntityBase.UpgradeHandler getUpgradeHandler()
getUpgradeHandler in interface IUpgradeHolder@Nonnull
public <T> net.minecraftforge.common.util.LazyOptional<T> getCapability(@Nonnull
net.minecraftforge.common.capabilities.Capability<T> cap,
@Nullable
net.minecraft.util.Direction side)
getCapability in interface net.minecraftforge.common.capabilities.ICapabilityProvidergetCapability in class net.minecraftforge.common.capabilities.CapabilityProvider<net.minecraft.tileentity.TileEntity>@Nonnull protected net.minecraftforge.common.util.LazyOptional<net.minecraftforge.items.IItemHandler> getInventoryCap()
@Nonnull public net.minecraftforge.common.util.LazyOptional<IHeatExchangerLogic> getHeatCap(net.minecraft.util.Direction side)
public void getContentsToDrop(net.minecraft.util.NonNullList<net.minecraft.item.ItemStack> drops)
drops - list in which to collect dropped itemspublic boolean shouldPreserveStateOnBreak()
public void setPreserveStateOnBreak(boolean preserveStateOnBreak)
public java.lang.String getCurrentRecipeIdSynced()
public void onUpgradesChanged()
onUpgradesChanged in interface IUpgradeHolderpublic UpgradeCache getUpgradeCache()
public void serializeExtraItemData(net.minecraft.nbt.CompoundNBT blockEntityTag,
boolean preserveState)
TileEntity#read(BlockState, CompoundNBT) method) when the itemblock is next placed.blockEntityTag - the existing "BlockEntityTag" subtag to add data topreserveState - true when dropped with a wrench, false when broken with a pickaxe etc.public int countPlayersUsing()
public void requestModelDataUpdate()
requestModelDataUpdate in interface net.minecraftforge.common.extensions.IForgeTileEntity