public class PneumaticCraftUtils
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static int |
CIRCLE_POINTS |
static double[] |
cos |
static double[] |
sin |
| Constructor and Description |
|---|
PneumaticCraftUtils() |
| Modifier and Type | Method and Description |
|---|---|
static java.util.List<net.minecraft.util.text.ITextComponent> |
asStringComponent(java.util.List<java.lang.String> l) |
static boolean |
canPlayerReach(net.minecraft.entity.player.PlayerEntity player,
net.minecraft.util.math.BlockPos pos) |
static void |
collectNonEmptyItems(net.minecraftforge.items.IItemHandler handler,
net.minecraft.util.NonNullList<net.minecraft.item.ItemStack> items)
Add all of the non-empty items in the given item handler to the given list.
|
static boolean |
consumeInventoryItem(net.minecraft.entity.player.PlayerInventory inv,
net.minecraft.item.Item item)
Convenience method, ported from 1.8.
|
static boolean |
consumeInventoryItem(net.minecraft.entity.player.PlayerInventory inv,
net.minecraft.item.ItemStack stack)
Convenience method, ported from 1.8.
|
static java.lang.String |
convertAmountToString(int amount)
Takes in any integer, and converts it into a string with a additional postfix if needed.
|
static java.lang.String |
convertTicksToMinutesAndSeconds(long ticks,
boolean fraction)
Takes in the amount of ticks, and converts it into a time notation.
|
static void |
copyItemHandler(net.minecraftforge.items.IItemHandler source,
net.minecraftforge.items.ItemStackHandler dest) |
static void |
copyItemHandler(net.minecraftforge.items.IItemHandler source,
net.minecraftforge.items.ItemStackHandler dest,
int maxSlots) |
static net.minecraft.entity.MobEntity |
createDummyEntity(net.minecraft.entity.player.PlayerEntity player)
A little hack needed here; in 1.8 players were a subclass of EntityLiving and could be used as entities for
pathfinding purposes.
|
static double |
distBetween(double x1,
double y1,
double x2,
double y2) |
static double |
distBetween(double x1,
double y1,
double z1,
double x2,
double y2,
double z2) |
static double |
distBetween(net.minecraft.util.math.vector.Vector3i pos,
double x,
double y,
double z) |
static double |
distBetween(net.minecraft.util.math.vector.Vector3i pos1,
net.minecraft.util.math.vector.Vector3i pos2) |
static double |
distBetweenSq(net.minecraft.util.math.BlockPos pos1,
net.minecraft.util.math.BlockPos pos2) |
static double |
distBetweenSq(double x1,
double y1,
double x2,
double y2) |
static double |
distBetweenSq(double x1,
double y1,
double z1,
double x2,
double y2,
double z2) |
static double |
distBetweenSq(net.minecraft.util.math.vector.Vector3i pos,
double x,
double y,
double z) |
static boolean |
doesItemMatchFilter(net.minecraft.item.ItemStack filterStack,
net.minecraft.item.ItemStack stack,
boolean checkDurability,
boolean checkNBT,
boolean checkModSimilarity) |
static void |
dropItemOnGround(net.minecraft.item.ItemStack stack,
net.minecraft.world.World world,
net.minecraft.util.math.BlockPos pos) |
static void |
dropItemOnGround(net.minecraft.item.ItemStack stack,
net.minecraft.world.World world,
double x,
double y,
double z) |
static void |
dropItemOnGroundPrecisely(net.minecraft.item.ItemStack stack,
net.minecraft.world.World world,
double x,
double y,
double z) |
static net.minecraft.util.text.ITextComponent |
dyeColorDesc(int c) |
static boolean |
epsilonEquals(double d1,
double d2) |
static boolean |
epsilonEquals(double d1,
double d2,
double maxDifference) |
static boolean |
epsilonEquals(float f1,
float f2)
Compare two floats which are tested for having (almost) the same value.
|
static boolean |
epsilonEquals(float f1,
float f2,
float maxDifference) |
static boolean |
fillTankWithOrb(net.minecraftforge.fluids.capability.IFluidHandler handler,
net.minecraft.entity.item.ExperienceOrbEntity orb,
net.minecraftforge.fluids.capability.IFluidHandler.FluidAction action)
Try to transfer the XP from the given XP orb entity into the given fluid handler.
|
static net.minecraft.util.Direction |
getDirectionFacing(net.minecraft.entity.LivingEntity entity,
boolean includeUpAndDown)
Returns the EnumFacing of the given entity.
|
static int |
getMinHeight(net.minecraft.world.World world)
In 1.17 this will become non-trivial.
|
static java.lang.String |
getPage(java.lang.String urlString)
Retrieve a web page from the given URL.
|
static net.minecraft.entity.player.PlayerEntity |
getPlayerFromId(java.util.UUID uuid) |
static net.minecraft.entity.player.PlayerEntity |
getPlayerFromName(java.lang.String name) |
static double |
getPlayerReachDistance(net.minecraft.entity.player.PlayerEntity player) |
static net.minecraft.util.math.BlockPos |
getPosForEntity(net.minecraft.entity.Entity e) |
static <T extends net.minecraft.tileentity.TileEntity> |
getTileEntityAt(net.minecraft.world.IBlockReader w,
net.minecraft.util.math.BlockPos pos,
java.lang.Class<T> cls) |
static int |
getYawFromFacing(net.minecraft.util.Direction facing)
Get a yaw angle from an EnumFacing
|
static boolean |
isBlockLiquid(net.minecraft.block.Block block) |
static boolean |
isInteger(java.lang.String str)
Check if a given string encodes a valid integer (negative included).
|
static boolean |
isNumber(java.lang.String str)
Check if a given string encodes a valid number (negative & decimal point included).
|
static boolean |
isPlayerOp(net.minecraft.entity.player.PlayerEntity player) |
static net.minecraft.util.ResourceLocation |
modDefaultedRL(java.lang.String str)
Get a resource location from the given string, defaulting to "pneumaticcraft:" namespace
|
static java.lang.String |
modDefaultedString(net.minecraft.util.ResourceLocation rl)
Stringify a resource location, omitting the namespace if it's "pneumaticcraft:"
|
static java.lang.String |
posToString(net.minecraft.util.math.BlockPos pos) |
static java.lang.String |
roundNumberTo(double value,
int decimals)
Rounds numbers down at the given decimal.
|
static java.lang.String |
roundNumberTo(float value,
int decimals)
Rounds numbers down at the given decimal.
|
static double |
roundNumberToDouble(double value,
int decimals)
Rounds numbers down at the given decimal.
|
static java.util.List<java.lang.String> |
splitString(java.lang.String text) |
static java.util.List<java.lang.String> |
splitString(java.lang.String text,
int maxCharPerLine) |
static java.util.List<net.minecraft.util.text.ITextComponent> |
splitStringComponent(java.lang.String text) |
static java.util.List<net.minecraft.util.text.ITextComponent> |
splitStringComponent(java.lang.String text,
int maxCharPerLine) |
static void |
summariseItemStacks(java.util.List<net.minecraft.util.text.ITextComponent> textList,
net.minecraft.item.ItemStack[] originalStacks)
Sorts the stacks given alphabetically, combines them (so 2x64 will become 1x128), and adds the strings into the
given string list.
|
static void |
summariseItemStacks(java.util.List<net.minecraft.util.text.ITextComponent> textList,
net.minecraft.item.ItemStack[] originalStacks,
java.lang.String prefix)
Sort the given array of itemstacks alphabetically by display name, then combine them (so e.g.
|
static boolean |
tryPlaceBlock(net.minecraft.world.World w,
net.minecraft.util.math.BlockPos pos,
net.minecraft.entity.player.PlayerEntity player,
net.minecraft.util.Direction face,
net.minecraft.block.BlockState newState)
Attempt to place a block in the world, respecting BlockEvent.PlaceEvent results.
|
static net.minecraft.util.text.TranslationTextComponent |
xlate(java.lang.String s,
java.lang.Object... args)
Get a translation string for the given key.
|
public static final double[] sin
public static final double[] cos
public static final int CIRCLE_POINTS
public static net.minecraft.util.Direction getDirectionFacing(net.minecraft.entity.LivingEntity entity,
boolean includeUpAndDown)
entity - the entityincludeUpAndDown - false when UP/DOWN should not be included.public static int getYawFromFacing(net.minecraft.util.Direction facing)
facing - the facing directionpublic static java.util.List<net.minecraft.util.text.ITextComponent> splitStringComponent(java.lang.String text)
public static java.util.List<net.minecraft.util.text.ITextComponent> splitStringComponent(java.lang.String text,
int maxCharPerLine)
public static java.util.List<java.lang.String> splitString(java.lang.String text,
int maxCharPerLine)
public static java.util.List<java.lang.String> splitString(java.lang.String text)
public static java.util.List<net.minecraft.util.text.ITextComponent> asStringComponent(java.util.List<java.lang.String> l)
public static java.lang.String convertTicksToMinutesAndSeconds(long ticks,
boolean fraction)
ticks - number of ticksfraction - When true, 30 ticks will show as '1.5s' instead of '1s'.public static java.lang.String convertAmountToString(int amount)
amount - an integer quantitypublic static java.lang.String roundNumberTo(double value,
int decimals)
value - a double-precision quantitydecimals - number of digits to the right of the decimal pointpublic static double roundNumberToDouble(double value,
int decimals)
value - a double-precision quantitydecimals - number of digits to the right of the decimal pointpublic static java.lang.String roundNumberTo(float value,
int decimals)
value - a floating point quantitydecimals - number of digits to the right of the decimal pointpublic static boolean epsilonEquals(float f1,
float f2)
public static boolean epsilonEquals(float f1,
float f2,
float maxDifference)
public static boolean epsilonEquals(double d1,
double d2)
public static boolean epsilonEquals(double d1,
double d2,
double maxDifference)
public static void summariseItemStacks(java.util.List<net.minecraft.util.text.ITextComponent> textList,
net.minecraft.item.ItemStack[] originalStacks)
IInventoryItem interface.textList - string list to add information tooriginalStacks - array of item stacks to sort & combinepublic static void summariseItemStacks(java.util.List<net.minecraft.util.text.ITextComponent> textList,
net.minecraft.item.ItemStack[] originalStacks,
java.lang.String prefix)
IInventoryItem interface.textList - text component list to add information tooriginalStacks - array of item stacks to sort & combineprefix - prefix string to prepend to each line of outputpublic static java.lang.String getPage(java.lang.String urlString)
throws java.io.IOException
urlString - the URLjava.io.IOException - if there are any problemspublic static double distBetween(double x1,
double y1,
double z1,
double x2,
double y2,
double z2)
public static double distBetweenSq(double x1,
double y1,
double z1,
double x2,
double y2,
double z2)
public static double distBetweenSq(net.minecraft.util.math.vector.Vector3i pos,
double x,
double y,
double z)
public static double distBetweenSq(net.minecraft.util.math.BlockPos pos1,
net.minecraft.util.math.BlockPos pos2)
public static double distBetween(double x1,
double y1,
double x2,
double y2)
public static double distBetweenSq(double x1,
double y1,
double x2,
double y2)
public static double distBetween(net.minecraft.util.math.vector.Vector3i pos,
double x,
double y,
double z)
public static double distBetween(net.minecraft.util.math.vector.Vector3i pos1,
net.minecraft.util.math.vector.Vector3i pos2)
public static boolean doesItemMatchFilter(@Nonnull
net.minecraft.item.ItemStack filterStack,
@Nonnull
net.minecraft.item.ItemStack stack,
boolean checkDurability,
boolean checkNBT,
boolean checkModSimilarity)
public static boolean isBlockLiquid(net.minecraft.block.Block block)
public static void dropItemOnGround(net.minecraft.item.ItemStack stack,
net.minecraft.world.World world,
net.minecraft.util.math.BlockPos pos)
public static void dropItemOnGround(net.minecraft.item.ItemStack stack,
net.minecraft.world.World world,
double x,
double y,
double z)
public static void dropItemOnGroundPrecisely(net.minecraft.item.ItemStack stack,
net.minecraft.world.World world,
double x,
double y,
double z)
public static net.minecraft.entity.player.PlayerEntity getPlayerFromId(java.util.UUID uuid)
public static net.minecraft.entity.player.PlayerEntity getPlayerFromName(java.lang.String name)
public static boolean isPlayerOp(net.minecraft.entity.player.PlayerEntity player)
public static boolean tryPlaceBlock(net.minecraft.world.World w,
net.minecraft.util.math.BlockPos pos,
net.minecraft.entity.player.PlayerEntity player,
net.minecraft.util.Direction face,
net.minecraft.block.BlockState newState)
w - the worldpos - the position in the worldplayer - the player who is placing the blockface - the face against which the block is placednewState - the blockstate to change the position topublic static net.minecraft.entity.MobEntity createDummyEntity(net.minecraft.entity.player.PlayerEntity player)
player - the player to mimicpublic static boolean consumeInventoryItem(net.minecraft.entity.player.PlayerInventory inv,
net.minecraft.item.Item item)
inv - player's inventoryitem - item to consumepublic static void collectNonEmptyItems(net.minecraftforge.items.IItemHandler handler,
net.minecraft.util.NonNullList<net.minecraft.item.ItemStack> items)
handler - the item handleritems - the listpublic static boolean consumeInventoryItem(net.minecraft.entity.player.PlayerInventory inv,
net.minecraft.item.ItemStack stack)
inv - player's inventorystack - item to consumepublic static net.minecraft.util.text.TranslationTextComponent xlate(java.lang.String s,
java.lang.Object... args)
s - the translation keypublic static net.minecraft.util.text.ITextComponent dyeColorDesc(int c)
public static void copyItemHandler(net.minecraftforge.items.IItemHandler source,
net.minecraftforge.items.ItemStackHandler dest,
int maxSlots)
public static void copyItemHandler(net.minecraftforge.items.IItemHandler source,
net.minecraftforge.items.ItemStackHandler dest)
public static net.minecraft.util.math.BlockPos getPosForEntity(net.minecraft.entity.Entity e)
public static java.lang.String posToString(net.minecraft.util.math.BlockPos pos)
public static <T extends net.minecraft.tileentity.TileEntity> java.util.Optional<T> getTileEntityAt(net.minecraft.world.IBlockReader w,
net.minecraft.util.math.BlockPos pos,
java.lang.Class<T> cls)
public static boolean fillTankWithOrb(net.minecraftforge.fluids.capability.IFluidHandler handler,
net.minecraft.entity.item.ExperienceOrbEntity orb,
net.minecraftforge.fluids.capability.IFluidHandler.FluidAction action)
handler - the fluid handlerorb - the XP orbaction - whether or not to simulate the actionpublic static double getPlayerReachDistance(net.minecraft.entity.player.PlayerEntity player)
public static boolean canPlayerReach(net.minecraft.entity.player.PlayerEntity player,
net.minecraft.util.math.BlockPos pos)
public static int getMinHeight(net.minecraft.world.World world)
world - the worldpublic static boolean isInteger(java.lang.String str)
str - the string to testpublic static boolean isNumber(java.lang.String str)
str - the string to testpublic static net.minecraft.util.ResourceLocation modDefaultedRL(java.lang.String str)
str - a stringpublic static java.lang.String modDefaultedString(net.minecraft.util.ResourceLocation rl)
rl - a resource location