Enum Class CommonArmorRegistry

java.lang.Object
java.lang.Enum<CommonArmorRegistry>
me.desht.pneumaticcraft.common.pneumatic_armor.CommonArmorRegistry
All Implemented Interfaces:
Serializable, Comparable<CommonArmorRegistry>, Constable, ICommonArmorRegistry

public enum CommonArmorRegistry extends Enum<CommonArmorRegistry> implements ICommonArmorRegistry
  • Enum Constant Details

  • Field Details

    • hackableEntities

      public final Map<Class<? extends net.minecraft.world.entity.Entity>,Supplier<? extends IHackableEntity<?>>> hackableEntities
    • idToEntityHackables

      public final Map<net.minecraft.resources.ResourceLocation,Supplier<? extends IHackableEntity<?>>> idToEntityHackables
  • Method Details

    • values

      public static CommonArmorRegistry[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static CommonArmorRegistry valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getInstance

      public static CommonArmorRegistry getInstance()
    • registerUpgradeHandler

      public <T extends IArmorUpgradeHandler<?>> T registerUpgradeHandler(T handler)
      Description copied from interface: ICommonArmorRegistry
      Register a common (client and server) handler for a Pneumatic Armor upgrade. This must be called from a FMLCommonSetupEvent handler (do not use ParallelDispatchEvent.enqueueWork(Runnable)).
      Specified by:
      registerUpgradeHandler in interface ICommonArmorRegistry
      Parameters:
      handler - the handler to register
    • getCommonArmorHandler

      public ICommonArmorHandler getCommonArmorHandler(net.minecraft.world.entity.player.Player player)
      Description copied from interface: ICommonArmorRegistry
      Retrieve the ICommonArmorHandler for the given player. Note that this will return a non-null result even if the player isn't currently wearing any Pneumatic Armor.
      Specified by:
      getCommonArmorHandler in interface ICommonArmorRegistry
      Parameters:
      player - the player who is wearing one or more pieces of Pneumatic Armor
      Returns:
      the common armor handler
    • addHackable

      public void addHackable(Class<? extends net.minecraft.world.entity.Entity> entityClazz, Supplier<? extends IHackableEntity<?>> iHackable)
      Description copied from interface: ICommonArmorRegistry
      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 implement IHackableEntity.

      This must be called from a FMLCommonSetupEvent handler (it is not necessary to use ParallelDispatchEvent.enqueueWork(Runnable)).

      Specified by:
      addHackable in interface ICommonArmorRegistry
      Parameters:
      entityClazz - entity class; subclasses of this entity will also be affected
      iHackable - the hack to register
    • addHackable

      public void addHackable(net.minecraft.world.level.block.Block block, Supplier<? extends IHackableBlock> iHackable)
      Description copied from interface: ICommonArmorRegistry
      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 implement IHackableBlock.

      This must be called from a FMLCommonSetupEvent handler (it is not necessary to use ParallelDispatchEvent.enqueueWork(Runnable)).

      Specified by:
      addHackable in interface ICommonArmorRegistry
      Parameters:
      block - the block class; subclasses of this block will also be affected
      iHackable - the hack to register
    • addHackable

      public void addHackable(net.minecraft.tags.TagKey<net.minecraft.world.level.block.Block> blockTag, Supplier<? extends IHackableBlock> iHackable)
      Description copied from interface: ICommonArmorRegistry
      Register a block tag with your hackable. By default, the vanilla doors, buttons & 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 FMLCommonSetupEvent handler (it is not necessary to use ParallelDispatchEvent.enqueueWork(Runnable)).

      Specified by:
      addHackable in interface ICommonArmorRegistry
      Parameters:
      blockTag - the block tag to register
      iHackable - the hack to register
    • getCurrentEntityHacks

      public Collection<IHackableEntity<?>> getCurrentEntityHacks(net.minecraft.world.entity.Entity entity)
      Description copied from interface: ICommonArmorRegistry
      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.
      Specified by:
      getCurrentEntityHacks in interface ICommonArmorRegistry
      Parameters:
      entity - the entity to check
      Returns:
      a list of hacks currently on the entity, or an empty list if no hacks
    • registerBlockTrackerLootable

      public void registerBlockTrackerLootable(BiConsumer<net.minecraft.world.entity.player.Player,net.minecraft.world.level.block.entity.BlockEntity> consumer)
      Description copied from interface: ICommonArmorRegistry
      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.

      Specified by:
      registerBlockTrackerLootable in interface ICommonArmorRegistry
      Parameters:
      consumer - consumer accepting a player (who is doing the scanning) and the block entity of interest
    • resolveBlockTags

      public void resolveBlockTags()
      Non-API. Called when a TagsUpdatedEvent is received, on both server and client, to refresh the actual blocks referred to by the tags we've registered.
    • getHackable

      public IHackableBlock getHackable(net.minecraft.world.level.block.Block block)
    • getHackable

      public IHackableEntity<?> getHackable(net.minecraft.world.entity.Entity entity, net.minecraft.world.entity.player.Player player)
    • getHackableEntityForId

      public Optional<IHackableEntity<?>> getHackableEntityForId(net.minecraft.resources.ResourceLocation id)
    • getHackableBlockForId

      public Optional<IHackableBlock> getHackableBlockForId(net.minecraft.resources.ResourceLocation id)