From c918a1b6d8008773e9beebb48ba1a770405aee20 Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Thu, 22 Aug 2019 19:54:41 -0400 Subject: Bulk update back to sanity --- .../fyresmodjam/tileentities/TileEntityTrap.java | 97 ++++++---------------- 1 file changed, 26 insertions(+), 71 deletions(-) (limited to 'YWD/src/main/java/fyresmodjam/tileentities/TileEntityTrap.java') diff --git a/YWD/src/main/java/fyresmodjam/tileentities/TileEntityTrap.java b/YWD/src/main/java/fyresmodjam/tileentities/TileEntityTrap.java index 2353adb..9122f38 100755 --- a/YWD/src/main/java/fyresmodjam/tileentities/TileEntityTrap.java +++ b/YWD/src/main/java/fyresmodjam/tileentities/TileEntityTrap.java @@ -17,15 +17,11 @@ import net.minecraft.util.AxisAlignedBB; public class TileEntityTrap extends TileEntity { - public static String[] settings = { - "invisible to and damages all but player", - "visible to all and damages all but player", - "visible to all and only damages mobs", - "decorative" - }; + public static String[] settings = { "invisible to and damages all but player", + "visible to all and damages all but player", "visible to all and only damages mobs", "decorative" }; - public String placedBy = null; - public int setting = 0; + public String placedBy = null; + public int setting = 0; public TileEntityTrap() { } @@ -46,8 +42,7 @@ public class TileEntityTrap extends TileEntity { if (placedBy != null) { par1NBTTagCompound.setString("PlacedBy", placedBy); } - par1NBTTagCompound.setInteger("Setting", - setting % settings.length); + par1NBTTagCompound.setInteger("Setting", setting % settings.length); } @Override @@ -55,15 +50,13 @@ public class TileEntityTrap extends TileEntity { super.readFromNBT(par1NBTTagCompound); if (par1NBTTagCompound.hasKey("PlacedBy")) { - placedBy = par1NBTTagCompound - .getString("PlacedBy"); + placedBy = par1NBTTagCompound.getString("PlacedBy"); } else { placedBy = null; } if (par1NBTTagCompound.hasKey("Setting")) { - setting = par1NBTTagCompound.getInteger("Setting") - % settings.length; + setting = par1NBTTagCompound.getInteger("Setting") % settings.length; } } @@ -71,13 +64,11 @@ public class TileEntityTrap extends TileEntity { public Packet getDescriptionPacket() { NBTTagCompound tag = new NBTTagCompound(); writeToNBT(tag); - return new S35PacketUpdateTileEntity(xCoord, yCoord, - zCoord, 1, tag); + return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, tag); } @Override - public void onDataPacket(NetworkManager net, - S35PacketUpdateTileEntity pkt) { + public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { readFromNBT(pkt.func_148857_g()); } @@ -91,70 +82,34 @@ public class TileEntityTrap extends TileEntity { @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { EntityPlayer player = Minecraft.getMinecraft().thePlayer; - return (player != null && (player.getCommandSenderName() - .equals(placedBy) || setting != 0)) - ? 4096.0F - : 36.0F; + return (player != null && (player.getCommandSenderName().equals(placedBy) || setting != 0)) ? 4096.0F : 36.0F; } @SideOnly(Side.CLIENT) public void spawnParticles() { EntityPlayer player = Minecraft.getMinecraft().thePlayer; - int type = worldObj.getBlockMetadata(xCoord, yCoord, - zCoord); - - if (player != null - && (!NewPacketHandler.trapsDisabled - || placedBy != null) - && (player.getCommandSenderName() - .equals(placedBy) - || player.isSneaking() - || setting != 0 - || (BlessingUtils - .hasBlessing(player, - "MarkScouting"))) - && getDistanceFrom( - TileEntityRendererDispatcher.staticPlayerX, + int type = worldObj.getBlockMetadata(xCoord, yCoord, zCoord); + + if (player != null && (!NewPacketHandler.trapsDisabled || placedBy != null) + && (player.getCommandSenderName().equals(placedBy) || player.isSneaking() || setting != 0 + || (BlessingUtils.hasBlessing(player, "MarkScouting"))) + && getDistanceFrom(TileEntityRendererDispatcher.staticPlayerX, TileEntityRendererDispatcher.staticPlayerY, - TileEntityRendererDispatcher.staticPlayerZ) < (player - .getCommandSenderName() - .equals(placedBy) - ? 4096 - : 36.0F)) { + TileEntityRendererDispatcher.staticPlayerZ) < (player.getCommandSenderName().equals(placedBy) + ? 4096 + : 36.0F)) { if (type == 1) { if (ModjamMod.r.nextInt(5) == 0) { - worldObj.spawnParticle("smoke", - xCoord + 0.5F, - yCoord + 0.175F, - zCoord + 0.5F, - (ModjamMod.r.nextFloat() - - 0.5F) - / 16, - ModjamMod.r.nextFloat() - / 16, - (ModjamMod.r.nextFloat() - - 0.5F) - / 16); + worldObj.spawnParticle("smoke", xCoord + 0.5F, yCoord + 0.175F, zCoord + 0.5F, + (ModjamMod.r.nextFloat() - 0.5F) / 16, ModjamMod.r.nextFloat() / 16, + (ModjamMod.r.nextFloat() - 0.5F) / 16); } - worldObj.spawnParticle("flame", - xCoord + 0.5F, - yCoord + 0.175F, - zCoord + 0.5F, 0.0F, 0.0F, - 0.0F); + worldObj.spawnParticle("flame", xCoord + 0.5F, yCoord + 0.175F, zCoord + 0.5F, 0.0F, 0.0F, 0.0F); } else if (type == 2) { for (int i = 0; i < 3; i++) { - worldObj.spawnParticle("smoke", - xCoord + 0.5F, - yCoord + 0.175F, - zCoord + 0.5F, - (ModjamMod.r.nextFloat() - - 0.5F) - / 16, - ModjamMod.r.nextFloat() - / 16, - (ModjamMod.r.nextFloat() - - 0.5F) - / 16); + worldObj.spawnParticle("smoke", xCoord + 0.5F, yCoord + 0.175F, zCoord + 0.5F, + (ModjamMod.r.nextFloat() - 0.5F) / 16, ModjamMod.r.nextFloat() / 16, + (ModjamMod.r.nextFloat() - 0.5F) / 16); } } } -- cgit v1.2.3