From 9a4d1e95ea7784f0f98ea2913701a3a3c28aefaa Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Thu, 24 May 2018 16:03:42 -0400 Subject: Formatting pass --- .../darkknight/jewelrycraft/util/BlockUtils.java | 111 +++++++++++---------- 1 file changed, 59 insertions(+), 52 deletions(-) (limited to 'src/main/java/darkknight/jewelrycraft/util/BlockUtils.java') diff --git a/src/main/java/darkknight/jewelrycraft/util/BlockUtils.java b/src/main/java/darkknight/jewelrycraft/util/BlockUtils.java index 18dc191..17a6cdc 100755 --- a/src/main/java/darkknight/jewelrycraft/util/BlockUtils.java +++ b/src/main/java/darkknight/jewelrycraft/util/BlockUtils.java @@ -10,21 +10,21 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; public class BlockUtils { - public static final ForgeDirection DEFAULT_BLOCK_DIRECTION = - ForgeDirection.WEST; + public static final ForgeDirection DEFAULT_BLOCK_DIRECTION = ForgeDirection.WEST; /** - * This method is used to get the direction an entity is facing (NORTH, - * SOUTH, EAST or WEST) based on the entity's rotationYaw. + * This method is used to get the direction an entity is facing + * (NORTH, SOUTH, EAST or WEST) based on the entity's rotationYaw. * * @param entity - * the living entity + * the living entity * @return a direction */ - public static ForgeDirection - get2dOrientation(EntityLivingBase entity) { + public static ForgeDirection get2dOrientation( + EntityLivingBase entity) { int l = MathHelper.floor_double( - entity.rotationYaw * 4.0F / 360.0F + 0.5D) & 0x3; + entity.rotationYaw * 4.0F / 360.0F + 0.5D) + & 0x3; switch (l) { case 0: return ForgeDirection.SOUTH; @@ -43,11 +43,11 @@ public class BlockUtils { * This gets a float value depending on a direction * * @param direction - * the forge direction + * the forge direction * @return value depending on direction */ - public static float - getRotationFromDirection(ForgeDirection direction) { + public static float getRotationFromDirection( + ForgeDirection direction) { switch (direction) { case NORTH: return 0F; @@ -68,15 +68,15 @@ public class BlockUtils { } /** - * This method is used to get the direction an entity is looking at (UP - * or DOWN) based on the entitiy's rotationPitch + * This method is used to get the direction an entity is looking at + * (UP or DOWN) based on the entitiy's rotationPitch * * @param entity - * the living entity + * the living entity * @return a forge direction */ - public static ForgeDirection - get3dOrientation(EntityLivingBase entity) { + public static ForgeDirection get3dOrientation( + EntityLivingBase entity) { if (entity.rotationPitch > 45.5F) return ForgeDirection.DOWN; else if (entity.rotationPitch < -45.5F) @@ -85,32 +85,38 @@ public class BlockUtils { } /** - * This spawns the item specified and returns the EntityItem it created + * This spawns the item specified and returns the EntityItem it + * created * * @param worldObj - * the world + * the world * @param x - * position of the item to drop on the X axis + * position of the item to drop on the X axis * @param y - * position of the item to drop on the Y axis + * position of the item to drop on the Y axis * @param z - * position of the item to drop on the Z axis + * position of the item to drop on the Z axis * @param stack - * the item to spawn + * the item to spawn * @return the EntityItem of the stack */ - public static EntityItem dropItemStackInWorld(World worldObj, double x, - double y, double z, ItemStack stack) { + public static EntityItem dropItemStackInWorld(World worldObj, + double x, double y, double z, ItemStack stack) { float f = 0.7F; - float d0 = worldObj.rand.nextFloat() * f + (1.0F - f) * 0.5F; - float d1 = worldObj.rand.nextFloat() * f + (1.0F - f) * 0.5F; - float d2 = worldObj.rand.nextFloat() * f + (1.0F - f) * 0.5F; - EntityItem entityitem = - new EntityItem(worldObj, x + d0, y + d1, z + d2, stack); + float d0 = worldObj.rand.nextFloat() * f + + (1.0F - f) * 0.5F; + float d1 = worldObj.rand.nextFloat() * f + + (1.0F - f) * 0.5F; + float d2 = worldObj.rand.nextFloat() * f + + (1.0F - f) * 0.5F; + EntityItem entityitem = new EntityItem(worldObj, x + d0, + y + d1, z + d2, stack); entityitem.delayBeforeCanPickup = 10; if (stack.hasTagCompound()) entityitem.getEntityItem().setTagCompound( - (NBTTagCompound) stack.getTagCompound().copy()); + (NBTTagCompound) stack + .getTagCompound() + .copy()); worldObj.spawnEntityInWorld(entityitem); return entityitem; } @@ -119,24 +125,24 @@ public class BlockUtils { * It spawns the item with momentum in a certain direction * * @param world - * the world to spawn the item + * the world to spawn the item * @param x - * the X coordinate to spawn it in + * the X coordinate to spawn it in * @param y - * the Y coordinate to spawn it in + * the Y coordinate to spawn it in * @param z - * the Z coordinate to spawn it in + * the Z coordinate to spawn it in * @param direction - * the direction towards which it should eject + * the direction towards which it should eject * @param stack - * the item to spawn + * the item to spawn * @return the spawned EntityItem */ - public static EntityItem ejectItemInDirection(World world, double x, - double y, double z, ForgeDirection direction, - ItemStack stack) { - EntityItem item = - BlockUtils.dropItemStackInWorld(world, x, y, z, stack); + public static EntityItem ejectItemInDirection(World world, + double x, double y, double z, + ForgeDirection direction, ItemStack stack) { + EntityItem item = BlockUtils.dropItemStackInWorld(world, x, + y, z, stack); item.motionX = direction.offsetX / 5F; item.motionY = direction.offsetY / 5F; item.motionZ = direction.offsetZ / 5F; @@ -147,15 +153,15 @@ public class BlockUtils { * Drops the content of an inventory with doubles as coordinates * * @param inventory - * the inventory the items are contained in + * the inventory the items are contained in * @param world - * the world in which to spawn + * the world in which to spawn * @param x - * the X coordinate to spawn it in + * the X coordinate to spawn it in * @param y - * the Y coordinate to spawn it in + * the Y coordinate to spawn it in * @param z - * the Z coordinate to spawn it in + * the Z coordinate to spawn it in */ public static void dropInventory(IInventory inventory, World world, double x, double y, double z) { @@ -164,7 +170,8 @@ public class BlockUtils { for (int i = 0; i < inventory.getSizeInventory(); ++i) { ItemStack itemStack = inventory.getStackInSlot(i); if (itemStack != null) - dropItemStackInWorld(world, x, y, z, itemStack); + dropItemStackInWorld(world, x, y, z, + itemStack); } } @@ -172,15 +179,15 @@ public class BlockUtils { * Drops the content of an inventory with integer as coordinates * * @param inventory - * the inventory the items are contained in + * the inventory the items are contained in * @param world - * the world in which to spawn + * the world in which to spawn * @param x - * the X coordinate to spawn it in + * the X coordinate to spawn it in * @param y - * the Y coordinate to spawn it in + * the Y coordinate to spawn it in * @param z - * the Z coordinate to spawn it in + * the Z coordinate to spawn it in */ public static void dropInventory(IInventory inventory, World world, int x, int y, int z) { -- cgit v1.2.3