Class BlockTrackEntryMobSpawner
java.lang.Object
me.desht.pneumaticcraft.client.pneumatic_armor.block_tracker.BlockTrackEntryMobSpawner
- All Implemented Interfaces:
IBlockTrackEntry
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddInformation(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.entity.BlockEntity te, net.minecraft.core.Direction face, List<net.minecraft.network.chat.Component> infoList) This method is called each client tick to retrieve the block's additional information.net.minecraft.resources.ResourceLocationReturn a unique identifier for this block track entry.List<net.minecraft.core.BlockPos>getServerUpdatePositions(net.minecraft.world.level.block.entity.BlockEntity te) This method controls whether to send server update requests, at 3 second intervals while the player is looking at the block.booleanshouldTrackWithThisEntry(net.minecraft.world.level.BlockGetter world, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.block.entity.BlockEntity te) This method should return true if the block at the coordinate checked is one that should be tracked.intThe return of this method defines at how many tracked blocks of this type the HUD should stop displaying text at the tracked blocks of this type.
-
Field Details
-
ID
public static final net.minecraft.resources.ResourceLocation ID
-
-
Constructor Details
-
BlockTrackEntryMobSpawner
public BlockTrackEntryMobSpawner()
-
-
Method Details
-
shouldTrackWithThisEntry
public boolean shouldTrackWithThisEntry(net.minecraft.world.level.BlockGetter world, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.block.entity.BlockEntity te) Description copied from interface:IBlockTrackEntryThis method should return true if the block at the coordinate checked is one that should be tracked. This is often as simple as just checking the block type, but could be more complex for some trackers, i.e. checking if a certain capability exists on the block entity. This gets called a lot when the block tracker is active, so keep it as simple as possible.- Specified by:
shouldTrackWithThisEntryin interfaceIBlockTrackEntry- Parameters:
world- the worldpos- the blockposstate- blockstate at this blockposte- the block entity at this blockpos (may be null)- Returns:
- true if this block should be tracked by this BlockTrackEntry
-
getServerUpdatePositions
public List<net.minecraft.core.BlockPos> getServerUpdatePositions(net.minecraft.world.level.block.entity.BlockEntity te) Description copied from interface:IBlockTrackEntryThis method controls whether to send server update requests, at 3 second intervals while the player is looking at the block. This is specifically aimed at Block Entities, as the server will send an NBT update packet in response. Return an empty list if no updates are needed, otherwise a (possibly immutable) list of the block positions for which updates should be requested (in most cases, only the BE's own block pos, but potentially others for multiblocks like the vanilla double chest)- Specified by:
getServerUpdatePositionsin interfaceIBlockTrackEntry- Parameters:
te- the block entity at the currently checked location, may be null- Returns:
- a list of the block positions for which update request packets should be sent
-
spamThreshold
public int spamThreshold()Description copied from interface:IBlockTrackEntryThe return of this method defines at how many tracked blocks of this type the HUD should stop displaying text at the tracked blocks of this type.- Specified by:
spamThresholdin interfaceIBlockTrackEntry- Returns:
- amount of blocks the HUD should stop displaying the block info.
-
addInformation
public void addInformation(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.entity.BlockEntity te, net.minecraft.core.Direction face, List<net.minecraft.network.chat.Component> infoList) Description copied from interface:IBlockTrackEntryThis method is called each client tick to retrieve the block's additional information. The method behaves much the same asItem.appendHoverText(ItemStack, Level, List, TooltipFlag). This method is only called ifIBlockTrackEntry.shouldTrackWithThisEntry(BlockGetter, BlockPos, BlockState, BlockEntity)returned true, and the player is currently focused on the block.- Specified by:
addInformationin interfaceIBlockTrackEntry- Parameters:
world- the worldpos- the blockposte- the block entity at this blockpos (may be null)face- the block face the player is looking at (null if player is not looking directly at the block)infoList- list of text to add information to
-
getEntryID
public net.minecraft.resources.ResourceLocation getEntryID()Description copied from interface:IBlockTrackEntryReturn a unique identifier for this block track entry. This is also used for translation key and keybind naming purposes; seeIArmorUpgradeHandler.getStringKey(ResourceLocation)- Specified by:
getEntryIDin interfaceIBlockTrackEntry- Returns:
- the ID of this entry
-