Package me.desht.pneumaticcraft.common
Enum Class MiscAPIHandler
- All Implemented Interfaces:
Serializable,Comparable<MiscAPIHandler>,Constable,IMiscHelpers
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.core.particles.ParticleOptionsGet an air particle data object, suitable for passing toLevel.addParticle(ParticleOptions, double, double, double, double, double, double)and related methods.net.minecraftforge.items.IItemHandlerdeserializeSmartChest(net.minecraft.nbt.CompoundTag tag) Return a Smart Chest item handler properly deserialized from the supplied NBT.voidforceClientShapeRecalculation(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.static MiscAPIHandlerintgetProtectingSecurityStations(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.voidplayMachineBreakEffect(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".voidregisterPlayerMatcher(net.minecraft.resources.ResourceLocation id, IPlayerMatcher.MatcherFactory<?> factory) Register a custom player matcher object.voidregisterXPFluid(FluidIngredient tag, int liquidToPointRatio) Register a fluid ingredient that represents liquid XP.voidsyncGlobalVariable(net.minecraft.server.level.ServerPlayer player, String varName) Sync a global variable from server to client for the given player.static MiscAPIHandlerReturns the enum constant of this class with the specified name.static MiscAPIHandler[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
INSTANCE
-
-
Method Details
-
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
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 nameNullPointerException- if the argument is null
-
getInstance
-
getProtectingSecurityStations
public int getProtectingSecurityStations(net.minecraft.world.entity.player.Player player, net.minecraft.core.BlockPos pos) Description copied from interface:IMiscHelpersReturns 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:
getProtectingSecurityStationsin interfaceIMiscHelpers- Parameters:
player- the player who is trying to access the blockpos- blockpos of the block being tested- Returns:
- the number of Security Stations that disallow interaction for the given player.
-
registerXPFluid
Description copied from interface:IMiscHelpersRegister 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:
registerXPFluidin interfaceIMiscHelpers- Parameters:
tag- the fluid tag to register; all fluids in this tag will have the given XP valueliquidToPointRatio- 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
Description copied from interface:IMiscHelpersSync a global variable from server to client for the given player. Primarily intended for use byIPositionProvider.syncVariables(ServerPlayer, ItemStack)- Specified by:
syncGlobalVariablein interfaceIMiscHelpers- Parameters:
player- the player to sync tovarName- 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:IMiscHelpersRegister a custom player matcher object. This is safe to call from aFMLCommonSetupEventhandler. Note that matchers should be able to run on both client and server.- Specified by:
registerPlayerMatcherin interfaceIMiscHelpers- Parameters:
id- matcher ID, can be used as a key in recipe JSON'sfactory- 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:IMiscHelpersReturn 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:
deserializeSmartChestin interfaceIMiscHelpers- 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:IMiscHelpersNotify 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:
forceClientShapeRecalculationin interfaceIMiscHelpers- Parameters:
world- the worldpos- 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:IMiscHelpersPlay 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 overriddenBlockBehaviour.onRemove(BlockState, Level, BlockPos, BlockState, boolean)in your block objects.- Specified by:
playMachineBreakEffectin interfaceIMiscHelpers- Parameters:
blockEntity- the block entity of the machine being broken
-
airParticle
public net.minecraft.core.particles.ParticleOptions airParticle()Description copied from interface:IMiscHelpersGet an air particle data object, suitable for passing toLevel.addParticle(ParticleOptions, double, double, double, double, double, double)and related methods.- Specified by:
airParticlein interfaceIMiscHelpers- Returns:
- the air particle data
-