Enum Class MiscAPIHandler

java.lang.Object
java.lang.Enum<MiscAPIHandler>
me.desht.pneumaticcraft.common.MiscAPIHandler
All Implemented Interfaces:
Serializable, Comparable<MiscAPIHandler>, Constable, IMiscHelpers

public enum MiscAPIHandler extends Enum<MiscAPIHandler> implements IMiscHelpers
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    net.minecraft.core.particles.ParticleOptions
    Get an air particle data object, suitable for passing to Level.addParticle(ParticleOptions, double, double, double, double, double, double) and related methods.
    net.minecraftforge.items.IItemHandler
    deserializeSmartChest(net.minecraft.nbt.CompoundTag tag)
    Return a Smart Chest item handler properly deserialized from the supplied NBT.
    void
    forceClientShapeRecalculation(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos)
    Notify tracking clients to recalculate the block shapes of all neighbours of the block at the given world and position.
     
    int
    getProtectingSecurityStations(net.minecraft.world.entity.player.Player player, net.minecraft.core.BlockPos pos)
    Returns the number of Security Stations that disallow interaction with the given coordinate for the given player.
    void
    playMachineBreakEffect(net.minecraft.world.level.block.entity.BlockEntity blockEntity)
    Play the standard PNC effect when a pneumatic machine (which contains some air) is broken with a pickaxe; a puff of air particles, and a short pneumatic "hiss".
    void
    registerPlayerMatcher(net.minecraft.resources.ResourceLocation id, IPlayerMatcher.MatcherFactory<?> factory)
    Register a custom player matcher object.
    void
    registerXPFluid(FluidIngredient tag, int liquidToPointRatio)
    Register a fluid ingredient that represents liquid XP.
    void
    syncGlobalVariable(net.minecraft.server.level.ServerPlayer player, String varName)
    Sync a global variable from server to client for the given player.
    Returns the enum constant of this class with the specified name.
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

  • Method Details

    • values

      public static MiscAPIHandler[] 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 MiscAPIHandler 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 MiscAPIHandler getInstance()
    • getProtectingSecurityStations

      public int getProtectingSecurityStations(net.minecraft.world.entity.player.Player player, net.minecraft.core.BlockPos pos)
      Description copied from interface: IMiscHelpers
      Returns the number of Security Stations that disallow interaction with the given coordinate for the given player. Usually you'd disallow interaction when this returns > 0.
      Specified by:
      getProtectingSecurityStations in interface IMiscHelpers
      Parameters:
      player - the player who is trying to access the block
      pos - blockpos of the block being tested
      Returns:
      the number of Security Stations that disallow interaction for the given player.
    • registerXPFluid

      public void registerXPFluid(FluidIngredient tag, int liquidToPointRatio)
      Description copied from interface: IMiscHelpers
      Register a fluid ingredient that represents liquid XP. This ingredient could be a fluid, or a fluid tag, or even a stream of fluid ingredients. Note that a fluid ingredient of the "forge:experience" fluid tag is registered by default with a ratio of 20mb per XP; this tag includes PneumaticCraft Memory Essence, and possibly other modded XP fluids too.
      Specified by:
      registerXPFluid in interface IMiscHelpers
      Parameters:
      tag - the fluid tag to register; all fluids in this tag will have the given XP value
      liquidToPointRatio - the amount of fluid (in mB) for one XP point; use a value of 0 or less to unregister all fluids matching this fluid ingredient
    • syncGlobalVariable

      public void syncGlobalVariable(net.minecraft.server.level.ServerPlayer player, String varName)
      Description copied from interface: IMiscHelpers
      Sync a global variable from server to client for the given player. Primarily intended for use by IPositionProvider.syncVariables(ServerPlayer, ItemStack)
      Specified by:
      syncGlobalVariable in interface IMiscHelpers
      Parameters:
      player - the player to sync to
      varName - the global variable name (with or without the leading '#')
    • registerPlayerMatcher

      public void registerPlayerMatcher(net.minecraft.resources.ResourceLocation id, IPlayerMatcher.MatcherFactory<?> factory)
      Description copied from interface: IMiscHelpers
      Register a custom player matcher object. This is safe to call from a FMLCommonSetupEvent handler. Note that matchers should be able to run on both client and server.
      Specified by:
      registerPlayerMatcher in interface IMiscHelpers
      Parameters:
      id - matcher ID, can be used as a key in recipe JSON's
      factory - a factory object used to create instances of this matcher from JSON or a packet buffer
    • deserializeSmartChest

      public net.minecraftforge.items.IItemHandler deserializeSmartChest(net.minecraft.nbt.CompoundTag tag)
      Description copied from interface: IMiscHelpers
      Return a Smart Chest item handler properly deserialized from the supplied NBT. Not for general use; here to help with Create compatibility, using Smart Chests as part of Create contraptions.
      Specified by:
      deserializeSmartChest in interface IMiscHelpers
      Parameters:
      tag - NBT to be deserialized, previously serialized from a Smart Chest
      Returns:
      an item handler deserialized by the Smart Chest
    • forceClientShapeRecalculation

      public void forceClientShapeRecalculation(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos)
      Description copied from interface: IMiscHelpers
      Notify tracking clients to recalculate the block shapes of all neighbours of the block at the given world and position. You should call this for any blocks which can connect pneumatically to neighbours when those blocks are changed server-side only (e.g. rotated, sneak-wrenched). This should only be called server-side (it is no-op if called on the client).

      This is a bit of a kludge, but necessary since blocks do not normally get signalled about neighbour changes on the client, which is needed for blocks such as Pressure Tubes to recalculate their cached block shapes.

      Specified by:
      forceClientShapeRecalculation in interface IMiscHelpers
      Parameters:
      world - the world
      pos - the position of the block that has been changed or removed
    • playMachineBreakEffect

      public void playMachineBreakEffect(net.minecraft.world.level.block.entity.BlockEntity blockEntity)
      Description copied from interface: IMiscHelpers
      Play the standard PNC effect when a pneumatic machine (which contains some air) is broken with a pickaxe; a puff of air particles, and a short pneumatic "hiss". This is intended to be called from the overridden BlockBehaviour.onRemove(BlockState, Level, BlockPos, BlockState, boolean) in your block objects.
      Specified by:
      playMachineBreakEffect in interface IMiscHelpers
      Parameters:
      blockEntity - the block entity of the machine being broken
    • airParticle

      public net.minecraft.core.particles.ParticleOptions airParticle()
      Description copied from interface: IMiscHelpers
      Get an air particle data object, suitable for passing to Level.addParticle(ParticleOptions, double, double, double, double, double, double) and related methods.
      Specified by:
      airParticle in interface IMiscHelpers
      Returns:
      the air particle data