Package me.desht.pneumaticcraft.api.misc
Interface IMiscHelpers
- All Known Implementing Classes:
MiscAPIHandler
public interface IMiscHelpers
A collection of miscellaneous helper methods which don't fit elsewhere. Get an instance of this with
PneumaticRegistry.IPneumaticCraftInterface.getMiscHelpers().-
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.intgetProtectingSecurityStations(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 fluid, 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.
-
Method Details
-
getProtectingSecurityStations
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. Usually you'd disallow interaction when this returns > 0.- 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.
- Throws:
IllegalArgumentException- when called from the client side
-
registerXPFluid
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.- Parameters:
fluid- 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
Sync a global variable from server to client for the given player. Primarily intended for use byIPositionProvider.syncVariables(ServerPlayer, ItemStack)- Parameters:
player- the player to sync tovarName- the global variable name (with or without the leading '#')
-
registerPlayerMatcher
void registerPlayerMatcher(net.minecraft.resources.ResourceLocation id, IPlayerMatcher.MatcherFactory<?> factory) Register 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.- 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
net.minecraftforge.items.IItemHandler deserializeSmartChest(net.minecraft.nbt.CompoundTag tag) 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.- Parameters:
tag- NBT to be deserialized, previously serialized from a Smart Chest- Returns:
- an item handler deserialized by the Smart Chest
-
forceClientShapeRecalculation
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. 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.
- Parameters:
world- the worldpos- the position of the block that has been changed or removed
-
playMachineBreakEffect
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". This is intended to be called from the overriddenBlockBehaviour.onRemove(BlockState, Level, BlockPos, BlockState, boolean)in your block objects.- Parameters:
blockEntity- the block entity of the machine being broken
-
airParticle
net.minecraft.core.particles.ParticleOptions airParticle()Get an air particle data object, suitable for passing toLevel.addParticle(ParticleOptions, double, double, double, double, double, double)and related methods.- Returns:
- the air particle data
-