Interface ICommonArmorRegistry
- All Known Implementing Classes:
CommonArmorRegistry
PneumaticRegistry.IPneumaticCraftInterface.getCommonArmorRegistry()
Contains some common registration & query methods for Pneumatic Armor.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddHackable(Class<? extends net.minecraft.world.entity.Entity> entityClazz, Supplier<? extends IHackableEntity<?>> iHackable) Register a "foreign" entity with your hackable.voidaddHackable(net.minecraft.tags.TagKey<net.minecraft.world.level.block.Block> blockTag, Supplier<? extends IHackableBlock> iHackable) Register a block tag with your hackable.voidaddHackable(net.minecraft.world.level.block.Block block, Supplier<? extends IHackableBlock> iHackable) Register a "foreign" block with your hackable.getArmorUpgradeHandler(net.minecraft.resources.ResourceLocation id) Get the common armor handler object for the given upgrade ID.getCommonArmorHandler(net.minecraft.world.entity.player.Player player) Retrieve theICommonArmorHandlerfor the given player.getCurrentEntityHacks(net.minecraft.world.entity.Entity entity) Get a list of all current successful hacks on a given entity.voidregisterBlockTrackerLootable(BiConsumer<net.minecraft.world.entity.player.Player, net.minecraft.world.level.block.entity.BlockEntity> consumer) Register a block entity as being able to have a loot table for the purposes of dungeon-style loot generation.<T extends IArmorUpgradeHandler<?>>
TregisterUpgradeHandler(T handler) Register a common (client and server) handler for a Pneumatic Armor upgrade.
-
Method Details
-
registerUpgradeHandler
Register a common (client and server) handler for a Pneumatic Armor upgrade. This must be called from aFMLCommonSetupEventhandler (do not useParallelDispatchEvent.enqueueWork(Runnable)).- Parameters:
handler- the handler to register
-
getCommonArmorHandler
Retrieve theICommonArmorHandlerfor the given player. Note that this will return a non-null result even if the player isn't currently wearing any Pneumatic Armor.- Parameters:
player- the player who is wearing one or more pieces of Pneumatic Armor- Returns:
- the common armor handler
-
addHackable
void addHackable(@Nonnull Class<? extends net.minecraft.world.entity.Entity> entityClazz, @Nonnull Supplier<? extends IHackableEntity<?>> iHackable) Register a "foreign" entity with your hackable. This should be used for entities you didn't create, i.e. vanilla or from a different mod. For your own entities, just have your entity implementIHackableEntity.This must be called from a
FMLCommonSetupEventhandler (it is not necessary to useParallelDispatchEvent.enqueueWork(Runnable)).- Parameters:
entityClazz- entity class; subclasses of this entity will also be affectediHackable- the hack to register
-
addHackable
void addHackable(@Nonnull net.minecraft.world.level.block.Block block, @Nonnull Supplier<? extends IHackableBlock> iHackable) Register a "foreign" block with your hackable. This should be used for blocks you didn't create, i.e. vanilla or from a different mod. For your own blocks, just have your block implementIHackableBlock.This must be called from a
FMLCommonSetupEventhandler (it is not necessary to useParallelDispatchEvent.enqueueWork(Runnable)).- Parameters:
block- the block class; subclasses of this block will also be affectediHackable- the hack to register
-
addHackable
void addHackable(@Nonnull net.minecraft.tags.TagKey<net.minecraft.world.level.block.Block> blockTag, @Nonnull Supplier<? extends IHackableBlock> iHackable) Register a block tag with your hackable. By default, the vanilla doors, buttons and trapdoors block tags are registered, meaning any block added to any of those tags (e.g. modded doors) will also be considered hackable.This must be called from a
FMLCommonSetupEventhandler (it is not necessary to useParallelDispatchEvent.enqueueWork(Runnable)).- Parameters:
blockTag- the block tag to registeriHackable- the hack to register
-
getCurrentEntityHacks
@Nonnull Collection<IHackableEntity<?>> getCurrentEntityHacks(@Nonnull net.minecraft.world.entity.Entity entity) Get a list of all current successful hacks on a given entity. This is used for example in Enderman hacking, so the user can only hack an enderman once (more times wouldn't have any effect). This is mostly used for display purposes.- Parameters:
entity- the entity to check- Returns:
- a list of hacks currently on the entity, or an empty list if no hacks
-
registerBlockTrackerLootable
void registerBlockTrackerLootable(BiConsumer<net.minecraft.world.entity.player.Player, net.minecraft.world.level.block.entity.BlockEntity> consumer) Register a block entity as being able to have a loot table for the purposes of dungeon-style loot generation. This is for the benefit of the Pneumatic Helmet Block Tracker module (inventory scanning).The supplied consumer must check that the block entity is of the appropriate type, and that the player may loot the chest (e.g. vanilla locking is honoured), and if so generate the chest's loot as if the player had just opened the chest.
Vanilla chests and PneumaticCraft chests are registered with this by default; this method can be used for third party mods which add chests or other inventories with their own custom loot tables.
- Parameters:
consumer- consumer accepting a player (who is doing the scanning) and the block entity of interest
-
getArmorUpgradeHandler
Optional<IArmorUpgradeHandler<?>> getArmorUpgradeHandler(net.minecraft.resources.ResourceLocation id) Get the common armor handler object for the given upgrade ID. A collection of known upgrade ID's can be found inBuiltinArmorUpgrades.- Parameters:
id- the ID of the upgrade to retrieve- Returns:
- the upgrade optional, or
Optional.empty()if the ID is not known
-