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/item/ItemSpawnEgg.java | 75 +++++++++++++--------- 1 file changed, 44 insertions(+), 31 deletions(-) (limited to 'src/main/java/darkknight/jewelrycraft/item/ItemSpawnEgg.java') diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemSpawnEgg.java b/src/main/java/darkknight/jewelrycraft/item/ItemSpawnEgg.java index cceab12..bb57f9a 100755 --- a/src/main/java/darkknight/jewelrycraft/item/ItemSpawnEgg.java +++ b/src/main/java/darkknight/jewelrycraft/item/ItemSpawnEgg.java @@ -28,14 +28,16 @@ import net.minecraft.world.World; * @author Betweenlands */ public class ItemSpawnEgg extends ItemMonsterPlacer { - private static final Map eggTypes = - new LinkedHashMap(); + private static final Map eggTypes = new LinkedHashMap(); public static void registerSpawnEgg( - Class entity, String entityName, - int id, int eggBackgroundColor, int eggForegroundColor) { - eggTypes.put((short) id, new EggData(id, entityName, entity, - eggBackgroundColor, eggForegroundColor)); + Class entity, + String entityName, int id, int eggBackgroundColor, + int eggForegroundColor) { + eggTypes.put((short) id, + new EggData(id, entityName, entity, + eggBackgroundColor, + eggForegroundColor)); } private static EggData getEggData(ItemStack is) { @@ -49,22 +51,23 @@ public class ItemSpawnEgg extends ItemMonsterPlacer { @Override public String getItemStackDisplayName(ItemStack is) { - String s = StatCollector - .translateToLocal(getUnlocalizedName() + ".name").trim(); + String s = StatCollector.translateToLocal( + getUnlocalizedName() + ".name").trim(); String mob = ""; EggData egg = getEggData(is); if (egg != null) mob = StatCollector.translateToLocal("entity." - + Variables.MODID + "." + egg.entityName + ".name"); + + Variables.MODID + "." + + egg.entityName + ".name"); return String.format(s, mob); } @Override public boolean onItemUse(ItemStack is, EntityPlayer player, - World world, int x, int y, int z, int side, float hitX, - float hitY, float hitZ) { + World world, int x, int y, int z, int side, + float hitX, float hitY, float hitZ) { if (world.isRemote) return true; @@ -75,9 +78,11 @@ public class ItemSpawnEgg extends ItemMonsterPlacer { EggData egg = getEggData(is); if (egg != null) { - egg.spawnMob(world, x + 0.5D, - y + (side == 1 && block != null - && block.getRenderType() == 11 ? 0.5D : 0D), + egg.spawnMob(world, x + 0.5D, y + (side == 1 + && block != null + && block.getRenderType() == 11 + ? 0.5D + : 0D), z + 0.5D, is); if (!player.capabilities.isCreativeMode) @@ -93,17 +98,19 @@ public class ItemSpawnEgg extends ItemMonsterPlacer { if (world.isRemote) return is; - MovingObjectPosition mop = - getMovingObjectPositionFromPlayer(world, player, true); + MovingObjectPosition mop = getMovingObjectPositionFromPlayer( + world, player, true); if (mop != null && mop.typeOfHit == MovingObjectType.BLOCK) { int x = mop.blockX, y = mop.blockY, z = mop.blockZ; if (!world.canMineBlock(player, x, y, z) - || !player.canPlayerEdit(x, y, z, mop.sideHit, is)) + || !player.canPlayerEdit(x, y, z, + mop.sideHit, is)) return is; - if (world.getBlock(x, y, z).getMaterial() == Material.water) { + if (world.getBlock(x, y, z) + .getMaterial() == Material.water) { EggData egg = getEggData(is); if (egg != null) { egg.spawnMob(world, x, y, z, is); @@ -117,8 +124,8 @@ public class ItemSpawnEgg extends ItemMonsterPlacer { return is; } - public static EntityLiving getEntity(World world, double x, double y, - double z, ItemStack is) { + public static EntityLiving getEntity(World world, double x, + double y, double z, ItemStack is) { EggData egg = getEggData(is); return egg.spawnMob(world, x, y, z, is); } @@ -128,7 +135,8 @@ public class ItemSpawnEgg extends ItemMonsterPlacer { public int getColorFromItemStack(ItemStack is, int pass) { EggData egg = getEggData(is); return egg != null - ? pass == 0 ? egg.primaryColor : egg.secondaryColor + ? pass == 0 ? egg.primaryColor + : egg.secondaryColor : 16777215; } @@ -140,19 +148,22 @@ public class ItemSpawnEgg extends ItemMonsterPlacer { } static class EggData { - private final short id; - String entityName; + private final short id; + String entityName; private final Class entityClass; - int primaryColor; - int secondaryColor; + int primaryColor; + int secondaryColor; EggData(int id, String entityName, Class entityClass, - int[] rgbPrimaryColor, int[] rgbSecondaryColor) { + int[] rgbPrimaryColor, + int[] rgbSecondaryColor) { this(id, entityName, entityClass, - rgbPrimaryColor[0] << 16 | rgbPrimaryColor[1] << 8 + rgbPrimaryColor[0] << 16 + | rgbPrimaryColor[1] << 8 | rgbPrimaryColor[2], - rgbSecondaryColor[0] << 16 | rgbSecondaryColor[1] << 8 + rgbSecondaryColor[0] << 16 + | rgbSecondaryColor[1] << 8 | rgbSecondaryColor[2]); } @@ -166,8 +177,8 @@ public class ItemSpawnEgg extends ItemMonsterPlacer { this.secondaryColor = secondaryColor; } - public EntityLiving spawnMob(World world, double x, double y, - double z, ItemStack is) { + public EntityLiving spawnMob(World world, double x, + double y, double z, ItemStack is) { EntityLiving e = null; try { @@ -198,7 +209,9 @@ public class ItemSpawnEgg extends ItemMonsterPlacer { ((EntityHeart) e).setType("Red"); } e.setLocationAndAngles(x, y, z, MathHelper - .wrapAngleTo180_float(world.rand.nextFloat() * 360F), + .wrapAngleTo180_float(world.rand + .nextFloat() + * 360F), 0F); e.rotationYawHead = e.rotationYaw; e.renderYawOffset = e.rotationYaw; -- cgit v1.2.3