From 7c00af18febf6c0b833c7633b4fb60a9a1bb93af Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Sat, 16 Oct 2021 15:50:41 -0400 Subject: Code Clean Up (#2) * intellij code clean up * optimize imports * format * intellij suggestions * fix empty catch issues --- .../miscfeatures/CustomItemEffects.java | 457 ++++++++++----------- 1 file changed, 224 insertions(+), 233 deletions(-) (limited to 'src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java index d7d27f99..e592a503 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java @@ -5,12 +5,9 @@ import io.github.moulberry.notenoughupdates.util.SBInfo; import io.github.moulberry.notenoughupdates.util.SpecialColour; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.block.Block; -import net.minecraft.block.BlockCrops; -import net.minecraft.block.BlockPackedIce; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; -import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.multiplayer.WorldClient; @@ -19,9 +16,6 @@ import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.texture.TextureUtil; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.resources.model.IBakedModel; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.item.EntityArmorStand; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; @@ -31,7 +25,6 @@ import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.util.*; -import net.minecraft.world.World; import net.minecraftforge.client.event.DrawBlockHighlightEvent; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; @@ -43,8 +36,8 @@ import org.lwjgl.util.vector.Vector3f; import java.awt.*; import java.io.ByteArrayInputStream; -import java.util.*; import java.util.List; +import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -54,7 +47,7 @@ public class CustomItemEffects { private static final int MAX_BUILDERS_BLOCKS = 241; - private HashSet zapperBlocks = new HashSet<>(); + private final HashSet zapperBlocks = new HashSet<>(); private boolean zapperDirty = false; public long aoteUseMillis = 0; @@ -73,48 +66,48 @@ public class CustomItemEffects { public long lastMillis = 0; public Vector3f getCurrentPosition() { - if(aoteTeleportationMillis <= 0) return null; + if (aoteTeleportationMillis <= 0) return null; return aoteTeleportationCurr; } @SubscribeEvent public void onTick(TickEvent.RenderTickEvent event) { - if(Minecraft.getMinecraft().thePlayer == null) return; + if (Minecraft.getMinecraft().thePlayer == null) return; zapperDirty = true; long currentTime = System.currentTimeMillis(); - int delta = (int)(currentTime - lastMillis); + int delta = (int) (currentTime - lastMillis); lastMillis = currentTime; - if(delta <= 0) return; + if (delta <= 0) return; - if(aoteTeleportationMillis > tpTime*2) { - aoteTeleportationMillis = tpTime*2; + if (aoteTeleportationMillis > tpTime * 2) { + aoteTeleportationMillis = tpTime * 2; } - if(aoteTeleportationMillis < 0) aoteTeleportationMillis = 0; + if (aoteTeleportationMillis < 0) aoteTeleportationMillis = 0; - if(currentTime - aoteUseMillis > 1000 && aoteTeleportationMillis <= 0) { + if (currentTime - aoteUseMillis > 1000 && aoteTeleportationMillis <= 0) { aoteTeleportationCurr = null; } - if(aoteTeleportationCurr != null) { - if(aoteTeleportationMillis > 0) { + if (aoteTeleportationCurr != null) { + if (aoteTeleportationMillis > 0) { int deltaMin = Math.min(delta, aoteTeleportationMillis); - float factor = deltaMin/(float)aoteTeleportationMillis; + float factor = deltaMin / (float) aoteTeleportationMillis; - float dX = aoteTeleportationCurr.x - (float)Minecraft.getMinecraft().thePlayer.posX; - float dY = aoteTeleportationCurr.y - (float)Minecraft.getMinecraft().thePlayer.posY; - float dZ = aoteTeleportationCurr.z - (float)Minecraft.getMinecraft().thePlayer.posZ; + float dX = aoteTeleportationCurr.x - (float) Minecraft.getMinecraft().thePlayer.posX; + float dY = aoteTeleportationCurr.y - (float) Minecraft.getMinecraft().thePlayer.posY; + float dZ = aoteTeleportationCurr.z - (float) Minecraft.getMinecraft().thePlayer.posZ; - aoteTeleportationCurr.x -= dX*factor; - aoteTeleportationCurr.y -= dY*factor; - aoteTeleportationCurr.z -= dZ*factor; + aoteTeleportationCurr.x -= dX * factor; + aoteTeleportationCurr.y -= dY * factor; + aoteTeleportationCurr.z -= dZ * factor; - if(Minecraft.getMinecraft().theWorld.getBlockState(new BlockPos(aoteTeleportationCurr.x, + if (Minecraft.getMinecraft().theWorld.getBlockState(new BlockPos(aoteTeleportationCurr.x, aoteTeleportationCurr.y, aoteTeleportationCurr.z)).getBlock().getMaterial() != Material.air) { - aoteTeleportationCurr.y = (float)Math.ceil(aoteTeleportationCurr.y); + aoteTeleportationCurr.y = (float) Math.ceil(aoteTeleportationCurr.y); } aoteTeleportationMillis -= deltaMin; @@ -131,21 +124,21 @@ public class CustomItemEffects { @SubscribeEvent public void onPlayerInteract(PlayerInteractEvent event) { - if(event.action == PlayerInteractEvent.Action.RIGHT_CLICK_AIR || event.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) { + if (event.action == PlayerInteractEvent.Action.RIGHT_CLICK_AIR || event.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) { ItemStack held = Minecraft.getMinecraft().thePlayer.getHeldItem(); String internal = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(held); - if(internal != null) { + if (internal != null) { boolean shadowWarp = false; - if(internal.equals("HYPERION") || internal.equals("VALKYRIE") || internal.equals("SCYLLA") || internal.equals("ASTRAEA")) { + if (internal.equals("HYPERION") || internal.equals("VALKYRIE") || internal.equals("SCYLLA") || internal.equals("ASTRAEA")) { NBTTagCompound tag = held.getTagCompound(); - if(tag != null && tag.hasKey("ExtraAttributes", 10)) { + if (tag != null && tag.hasKey("ExtraAttributes", 10)) { NBTTagCompound ea = tag.getCompoundTag("ExtraAttributes"); - if(ea != null && ea.hasKey("ability_scroll", 9)) { + if (ea != null && ea.hasKey("ability_scroll", 9)) { NBTTagList list = ea.getTagList("ability_scroll", 8); - for(int i=0; i 0) { + if (!usingEtherwarp && wasUsingEtherwarp) { + if (Minecraft.getMinecraft().thePlayer.rotationYaw > 0) { Minecraft.getMinecraft().thePlayer.rotationYaw -= 0.000001; } else { Minecraft.getMinecraft().thePlayer.rotationYaw += 0.000001; @@ -194,8 +187,7 @@ public class CustomItemEffects { wasUsingEtherwarp = usingEtherwarp; tick++; - if(tick > Integer.MAX_VALUE/2) tick = 0; - + if (tick > Integer.MAX_VALUE / 2) tick = 0; } @@ -209,32 +201,32 @@ public class CustomItemEffects { private float targetSensMult = 1; public float getSensMultiplier() { - if(targetSensMult < 0) { + if (targetSensMult < 0) { currentSensMult = 1; } else { float deltaSens = targetSensMult - currentSensMult; - currentSensMult += deltaSens*lastPartialDelta*0.1;// (0.05 * ); - if(currentSensMult < 0.25f) currentSensMult = 0.25f; - if(currentSensMult > 1) currentSensMult = 1; + currentSensMult += deltaSens * lastPartialDelta * 0.1;// (0.05 * ); + if (currentSensMult < 0.25f) currentSensMult = 0.25f; + if (currentSensMult > 1) currentSensMult = 1; } return currentSensMult; } public float getFovMultiplier(float partialTicks) { - float partialDelta = partialTicks+tick - lastPartialTicks; - if(partialDelta < 0) partialDelta++; + float partialDelta = partialTicks + tick - lastPartialTicks; + if (partialDelta < 0) partialDelta++; - if(partialDelta > 0) lastPartialDelta = partialDelta; + if (partialDelta > 0) lastPartialDelta = partialDelta; - if(targetFOVMult < 0) { + if (targetFOVMult < 0) { currentFOVMult = 1; } else { float deltaFOV = targetFOVMult - currentFOVMult; - currentFOVMult += deltaFOV*lastPartialDelta*0.2; - if(currentFOVMult < 0.15f) currentFOVMult = 0.15f; - if(currentFOVMult > 1) currentFOVMult = 1; + currentFOVMult += deltaFOV * lastPartialDelta * 0.2; + if (currentFOVMult < 0.15f) currentFOVMult = 0.15f; + if (currentFOVMult > 1) currentFOVMult = 1; } lastPartialTicks = partialTicks + tick; return currentFOVMult; @@ -247,25 +239,25 @@ public class CustomItemEffects { @SubscribeEvent public void onOverlayDrawn(RenderGameOverlayEvent.Post event) { - if(((event.type == null && Loader.isModLoaded("labymod")) || + if (((event.type == null && Loader.isModLoaded("labymod")) || event.type == RenderGameOverlayEvent.ElementType.CROSSHAIRS)) { ItemStack held = Minecraft.getMinecraft().thePlayer.getHeldItem(); String heldInternal = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(held); - if(usingEtherwarp && NotEnoughUpdates.INSTANCE.config.itemOverlays.enableEtherwarpHelperOverlay) { + if (usingEtherwarp && NotEnoughUpdates.INSTANCE.config.itemOverlays.enableEtherwarpHelperOverlay) { String denyTpReason = null; - if(etherwarpRaycast == null) { + if (etherwarpRaycast == null) { denyTpReason = "Too far!"; } else { BlockPos pos = etherwarpRaycast.pos; - if(!etherwarpRaycast.state.getBlock().isCollidable() || + if (!etherwarpRaycast.state.getBlock().isCollidable() || etherwarpRaycast.state.getBlock().getCollisionBoundingBox(Minecraft.getMinecraft().theWorld, etherwarpRaycast.pos, etherwarpRaycast.state) == null) { denyTpReason = "Not solid!"; } else { WorldClient world = Minecraft.getMinecraft().theWorld; Block above = world.getBlockState(pos.add(0, 1, 0)).getBlock(); - if(above != Blocks.air && above.isCollidable() && + if (above != Blocks.air && above.isCollidable() && above.getCollisionBoundingBox(Minecraft.getMinecraft().theWorld, pos.add(0, 1, 0), world.getBlockState(pos.add(0, 1, 0))) != null || world.getBlockState(pos.add(0, 2, 0)).getBlock() != Blocks.air) { @@ -274,28 +266,27 @@ public class CustomItemEffects { } } - if(denyTpReason != null) { + if (denyTpReason != null) { ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - Utils.drawStringCentered(EnumChatFormatting.RED+"Can't TP: " + denyTpReason, + Utils.drawStringCentered(EnumChatFormatting.RED + "Can't TP: " + denyTpReason, Minecraft.getMinecraft().fontRendererObj, - scaledResolution.getScaledWidth()/2f, scaledResolution.getScaledHeight()/2f+10, true, 0); + scaledResolution.getScaledWidth() / 2f, scaledResolution.getScaledHeight() / 2f + 10, true, 0); GlStateManager.color(1, 1, 1, 1); } } boolean onPrivateIsland = SBInfo.getInstance().getLocation() == null || SBInfo.getInstance().getLocation().equals("dynamic"); - - if(NotEnoughUpdates.INSTANCE.config.itemOverlays.enableWandOverlay && + if (NotEnoughUpdates.INSTANCE.config.itemOverlays.enableWandOverlay && Minecraft.getMinecraft().objectMouseOver != null && Minecraft.getMinecraft().objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK && onPrivateIsland) { IBlockState hover = Minecraft.getMinecraft().theWorld.getBlockState( Minecraft.getMinecraft().objectMouseOver.getBlockPos().offset( Minecraft.getMinecraft().objectMouseOver.sideHit, 1)); - if(hover.getBlock() == Blocks.air) { + if (hover.getBlock() == Blocks.air) { - if(heldInternal != null && heldInternal.equals("BUILDERS_WAND")) { + if (heldInternal != null && heldInternal.equals("BUILDERS_WAND")) { ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); HashSet candidatesOld = new HashSet<>(); @@ -303,53 +294,53 @@ public class CustomItemEffects { IBlockState match = Minecraft.getMinecraft().theWorld.getBlockState(Minecraft.getMinecraft().objectMouseOver.getBlockPos()); Item matchItem = Item.getItemFromBlock(match.getBlock()); - if(matchItem != null) { - ItemStack matchStack = new ItemStack(matchItem, 1, + if (matchItem != null) { + ItemStack matchStack = new ItemStack(matchItem, 1, match.getBlock().getDamageValue(Minecraft.getMinecraft().theWorld, Minecraft.getMinecraft().objectMouseOver.getBlockPos())); getBuildersWandCandidates(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().objectMouseOver, event.partialTicks, - candidatesOld, candidatesOldSorted, 999-MAX_BUILDERS_BLOCKS); + candidatesOld, candidatesOldSorted, 999 - MAX_BUILDERS_BLOCKS); boolean usingDirtWand = false; int itemCount; - if(match.getBlock() == Blocks.dirt && matchStack.getItemDamage() == 0 && hasDirtWand()) { + if (match.getBlock() == Blocks.dirt && matchStack.getItemDamage() == 0 && hasDirtWand()) { itemCount = candidatesOld.size(); usingDirtWand = true; } else { itemCount = countItemsInInventoryAndStorage(matchStack); } - if(candidatesOld.size() > MAX_BUILDERS_BLOCKS) { - Utils.drawStringCentered(EnumChatFormatting.RED.toString()+candidatesOld.size()+"/"+MAX_BUILDERS_BLOCKS, + if (candidatesOld.size() > MAX_BUILDERS_BLOCKS) { + Utils.drawStringCentered(EnumChatFormatting.RED.toString() + candidatesOld.size() + "/" + MAX_BUILDERS_BLOCKS, Minecraft.getMinecraft().fontRendererObj, - scaledResolution.getScaledWidth()/2f, scaledResolution.getScaledHeight()/2f+10, true, 0); + scaledResolution.getScaledWidth() / 2f, scaledResolution.getScaledHeight() / 2f + 10, true, 0); } else { String pre = EnumChatFormatting.GREEN.toString(); - if(itemCount < candidatesOld.size()) { + if (itemCount < candidatesOld.size()) { pre = EnumChatFormatting.RED.toString(); } - Utils.drawStringCentered(pre+Math.min(candidatesOld.size(), itemCount)+"/"+ + Utils.drawStringCentered(pre + Math.min(candidatesOld.size(), itemCount) + "/" + Math.min(candidatesOld.size(), MAX_BUILDERS_BLOCKS), Minecraft.getMinecraft().fontRendererObj, - scaledResolution.getScaledWidth()/2f, scaledResolution.getScaledHeight()/2f+10, true, 0); + scaledResolution.getScaledWidth() / 2f, scaledResolution.getScaledHeight() / 2f + 10, true, 0); } - String itemCountS = EnumChatFormatting.DARK_GRAY+"x"+EnumChatFormatting.RESET+itemCount; + String itemCountS = EnumChatFormatting.DARK_GRAY + "x" + EnumChatFormatting.RESET + itemCount; int itemCountLen = Minecraft.getMinecraft().fontRendererObj.getStringWidth(itemCountS); - if(NotEnoughUpdates.INSTANCE.config.itemOverlays.wandBlockCount) { - if(usingDirtWand) { - Utils.drawItemStack(new ItemStack(Items.gold_nugget), scaledResolution.getScaledWidth()/2 - (itemCountLen+16)/2, - scaledResolution.getScaledHeight()/2+10+4); + if (NotEnoughUpdates.INSTANCE.config.itemOverlays.wandBlockCount) { + if (usingDirtWand) { + Utils.drawItemStack(new ItemStack(Items.gold_nugget), scaledResolution.getScaledWidth() / 2 - (itemCountLen + 16) / 2, + scaledResolution.getScaledHeight() / 2 + 10 + 4); Minecraft.getMinecraft().fontRendererObj.drawString(itemCountS, - scaledResolution.getScaledWidth()/2f - (itemCountLen+16)/2f+11, scaledResolution.getScaledHeight()/2f+10+8, + scaledResolution.getScaledWidth() / 2f - (itemCountLen + 16) / 2f + 11, scaledResolution.getScaledHeight() / 2f + 10 + 8, -1, true); } else { - Utils.drawItemStack(matchStack, scaledResolution.getScaledWidth()/2 - (itemCountLen+16)/2, - scaledResolution.getScaledHeight()/2+10+4); + Utils.drawItemStack(matchStack, scaledResolution.getScaledWidth() / 2 - (itemCountLen + 16) / 2, + scaledResolution.getScaledHeight() / 2 + 10 + 4); Minecraft.getMinecraft().fontRendererObj.drawString(itemCountS, - scaledResolution.getScaledWidth()/2f - (itemCountLen+16)/2f+16, scaledResolution.getScaledHeight()/2f+10+8, + scaledResolution.getScaledWidth() / 2f - (itemCountLen + 16) / 2f + 16, scaledResolution.getScaledHeight() / 2f + 10 + 8, -1, true); } @@ -366,7 +357,7 @@ public class CustomItemEffects { } //ethermerge - private class RaycastResult { + private static class RaycastResult { IBlockState state; BlockPos pos; @@ -377,34 +368,34 @@ public class CustomItemEffects { } private RaycastResult raycast(EntityPlayerSP player, float partialTicks, float dist, float step) { - Vector3f pos = new Vector3f((float)player.posX, (float)player.posY+player.getEyeHeight(), (float)player.posZ); + Vector3f pos = new Vector3f((float) player.posX, (float) player.posY + player.getEyeHeight(), (float) player.posZ); Vec3 lookVec3 = player.getLook(partialTicks); - Vector3f look = new Vector3f((float)lookVec3.xCoord, (float)lookVec3.yCoord, (float)lookVec3.zCoord); + Vector3f look = new Vector3f((float) lookVec3.xCoord, (float) lookVec3.yCoord, (float) lookVec3.zCoord); look.scale(step / look.length()); - int stepCount = (int)Math.ceil(dist/step); + int stepCount = (int) Math.ceil(dist / step); - for(int i=0; i 0) { - if(buildersItem.getInteger("id") == Item.getIdFromItem(match.getItem()) && + if (buildersItem.getKeySet().size() > 0) { + if (buildersItem.getInteger("id") == Item.getIdFromItem(match.getItem()) && buildersItem.getInteger("Damage") == match.getItemDamage()) { count += items.getCompoundTagAt(j).getByte("Count"); } } } - } catch(Exception e) { + } catch (Exception e) { return count; } } @@ -454,9 +445,9 @@ public class CustomItemEffects { } public boolean hasDirtWand() { - for(ItemStack stack : Minecraft.getMinecraft().thePlayer.inventory.mainInventory) { + for (ItemStack stack : Minecraft.getMinecraft().thePlayer.inventory.mainInventory) { String internalname = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(stack); - if(internalname != null && internalname.equals("INFINIDIRT_WAND")) { + if (internalname != null && internalname.equals("INFINIDIRT_WAND")) { return true; } } @@ -464,24 +455,23 @@ public class CustomItemEffects { ItemStack held = Minecraft.getMinecraft().thePlayer.getHeldItem(); String heldInternal = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(held); - if(heldInternal != null && heldInternal.equals("BUILDERS_WAND")) { - if(held.hasTagCompound() && held.getTagCompound().hasKey("ExtraAttributes", 10) && + if (heldInternal != null && heldInternal.equals("BUILDERS_WAND")) { + if (held.hasTagCompound() && held.getTagCompound().hasKey("ExtraAttributes", 10) && held.getTagCompound().getCompoundTag("ExtraAttributes").hasKey("builder's_wand_data", 7)) { byte[] bytes = held.getTagCompound().getCompoundTag("ExtraAttributes").getByteArray("builder's_wand_data"); try { NBTTagCompound contents_nbt = CompressedStreamTools.readCompressed(new ByteArrayInputStream(bytes)); NBTTagList items = contents_nbt.getTagList("i", 10); - for(int j=0; j 0) { + if (buildersItem.getKeySet().size() > 0) { String internalname = NotEnoughUpdates.INSTANCE.manager.getInternalnameFromNBT(buildersItem.getCompoundTag("tag")); - if(internalname != null && internalname.equals("INFINIDIRT_WAND")) { + if (internalname != null && internalname.equals("INFINIDIRT_WAND")) { return true; } } } - } catch(Exception e) { - } + } catch (Exception ignored) {} } } @@ -489,6 +479,7 @@ public class CustomItemEffects { } private static final List zapperOffsets = new ArrayList<>(); + static { zapperOffsets.add(new BlockPos(0, 0, -1)); zapperOffsets.add(new BlockPos(0, 0, 1)); @@ -497,8 +488,10 @@ public class CustomItemEffects { zapperOffsets.add(new BlockPos(0, 1, 0)); zapperOffsets.add(new BlockPos(0, -1, 0)); } + private static final HashSet cropBlocksZapper = new HashSet<>(); private static final HashSet otherBannedBlocksZapper = new HashSet<>(); + static { cropBlocksZapper.add(Blocks.wheat); cropBlocksZapper.add(Blocks.carrots); @@ -518,7 +511,7 @@ public class CustomItemEffects { @SubscribeEvent public void renderBlockOverlay(DrawBlockHighlightEvent event) { - if(aoteTeleportationCurr != null && aoteTeleportationMillis > 0) { + if (aoteTeleportationCurr != null && aoteTeleportationMillis > 0) { event.setCanceled(true); } usingEtherwarp = false; @@ -529,28 +522,28 @@ public class CustomItemEffects { ItemStack held = Minecraft.getMinecraft().thePlayer.getHeldItem(); String heldInternal = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(held); - if(heldInternal != null) { + if (heldInternal != null) { boolean onPrivateIsland = SBInfo.getInstance().getLocation() == null || SBInfo.getInstance().getLocation().equals("dynamic"); EntityPlayer player = event.player; - double d0 = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double)event.partialTicks; - double d1 = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double)event.partialTicks; - double d2 = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double)event.partialTicks; + double d0 = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double) event.partialTicks; + double d1 = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double) event.partialTicks; + double d2 = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double) event.partialTicks; - if(tick - lastEtherwarpUse > 10) { + if (tick - lastEtherwarpUse > 10) { boolean aotv = Minecraft.getMinecraft().thePlayer.isSneaking() && (heldInternal.equals("ASPECT_OF_THE_VOID") || heldInternal.equals("ASPECT_OF_THE_END")); - if(aotv || heldInternal.equals("ETHERWARP_CONDUIT")) { + if (aotv || heldInternal.equals("ETHERWARP_CONDUIT")) { usingEtherwarp = !aotv; - if(aotv) { + if (aotv) { NBTTagCompound tag = held.getTagCompound(); - if(tag != null && tag.hasKey("ExtraAttributes", 10)) { + if (tag != null && tag.hasKey("ExtraAttributes", 10)) { NBTTagCompound ea = tag.getCompoundTag("ExtraAttributes"); usingEtherwarp = ea.hasKey("ethermerge"); } } - if(usingEtherwarp) { + if (usingEtherwarp) { int dist = 0; for (String line : NotEnoughUpdates.INSTANCE.manager.getLoreFromNBT(held.getTagCompound())) { String cleaned = Utils.cleanColour(line); @@ -594,14 +587,14 @@ public class CustomItemEffects { } } - if(heldInternal.equals("BLOCK_ZAPPER")) { + if (heldInternal.equals("BLOCK_ZAPPER")) { if (!onPrivateIsland || !NotEnoughUpdates.INSTANCE.config.itemOverlays.enableZapperOverlay || event.target.typeOfHit != MovingObjectPosition.MovingObjectType.BLOCK) { zapperBlocks.clear(); return; } - if(zapperDirty) { + if (zapperDirty) { zapperDirty = false; zapperBlocks.clear(); @@ -615,36 +608,36 @@ public class CustomItemEffects { BlockPos above = pos.add(0, 1, 0); Block aboveBlock = Minecraft.getMinecraft().theWorld.getBlockState(above).getBlock(); - if(!cropBlocksZapper.contains(aboveBlock) && !cropBlocksZapper.contains(block) && + if (!cropBlocksZapper.contains(aboveBlock) && !cropBlocksZapper.contains(block) && !otherBannedBlocksZapper.contains(block) && !block.hasTileEntity(firstBlockState) && block.getBlockHardness(Minecraft.getMinecraft().theWorld, pos) >= 0) { - for(int i=0; i<164; i++) { + for (int i = 0; i < 164; i++) { zapperBlocks.add(pos); returnablePositions.remove(pos); List availableNeighbors = new ArrayList<>(); - for(BlockPos offset : zapperOffsets) { + for (BlockPos offset : zapperOffsets) { BlockPos newPos = pos.add(offset); - if(zapperBlocks.contains(newPos)) continue; + if (zapperBlocks.contains(newPos)) continue; IBlockState state = Minecraft.getMinecraft().theWorld.getBlockState(newPos); - if(state != null && state.getBlock() == block) { + if (state != null && state.getBlock() == block) { above = newPos.add(0, 1, 0); aboveBlock = Minecraft.getMinecraft().theWorld.getBlockState(above).getBlock(); - if(!cropBlocksZapper.contains(aboveBlock)) { + if (!cropBlocksZapper.contains(aboveBlock)) { availableNeighbors.add(newPos); } } } - if(availableNeighbors.size() >= 2) { + if (availableNeighbors.size() >= 2) { returnablePositions.add(pos); pos = availableNeighbors.get(0); - } else if(availableNeighbors.size() == 1) { + } else if (availableNeighbors.size() == 1) { pos = availableNeighbors.get(0); - } else if(returnablePositions.isEmpty()) { + } else if (returnablePositions.isEmpty()) { break; } else { i--; @@ -653,7 +646,7 @@ public class CustomItemEffects { } } } - for(BlockPos pos : zapperBlocks) { + for (BlockPos pos : zapperBlocks) { Block block = Minecraft.getMinecraft().theWorld.getBlockState(pos).getBlock(); drawFilledBoundingBox(block.getSelectedBoundingBox(Minecraft.getMinecraft().theWorld, pos) .expand(0.001D, 0.001D, 0.001D).offset(-d0, -d1, -d2), @@ -662,10 +655,10 @@ public class CustomItemEffects { GlStateManager.depthMask(true); GlStateManager.enableTexture2D(); GlStateManager.disableBlend(); - } else if(NotEnoughUpdates.INSTANCE.config.itemOverlays.enableTreecapOverlay && + } else if (NotEnoughUpdates.INSTANCE.config.itemOverlays.enableTreecapOverlay && (heldInternal.equals("JUNGLE_AXE") || heldInternal.equals("TREECAPITATOR_AXE"))) { int maxWood = 10; - if(heldInternal.equals("TREECAPITATOR_AXE")) maxWood = 35; + if (heldInternal.equals("TREECAPITATOR_AXE")) maxWood = 35; if (event.target.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { GlStateManager.enableBlend(); @@ -674,7 +667,7 @@ public class CustomItemEffects { GlStateManager.disableTexture2D(); GlStateManager.depthMask(false); - if(Minecraft.getMinecraft().theWorld.getBlockState(event.target.getBlockPos()).getBlock() == Blocks.log || + if (Minecraft.getMinecraft().theWorld.getBlockState(event.target.getBlockPos()).getBlock() == Blocks.log || Minecraft.getMinecraft().theWorld.getBlockState(event.target.getBlockPos()).getBlock() == Blocks.log2) { int woods = 0; @@ -685,8 +678,8 @@ public class CustomItemEffects { candidatesNew.add(event.target.getBlockPos()); - while(woods < maxWood) { - if(candidatesNew.isEmpty()) { + while (woods < maxWood) { + if (candidatesNew.isEmpty()) { break; } @@ -696,20 +689,20 @@ public class CustomItemEffects { woods += candidates.size(); boolean random = woods > maxWood; - while(!candidates.isEmpty()) { + while (!candidates.isEmpty()) { BlockPos candidate = candidates.pop(); Block block = Minecraft.getMinecraft().theWorld.getBlockState(candidate).getBlock(); candidatesOld.add(candidate); - for(int x = -1; x <= 1; x++) { - for(int y = -1; y <= 1; y++) { - for(int z = -1; z <= 1; z++) { - if(x != 0 || y != 0 || z != 0) { + for (int x = -1; x <= 1; x++) { + for (int y = -1; y <= 1; y++) { + for (int z = -1; z <= 1; z++) { + if (x != 0 || y != 0 || z != 0) { BlockPos posNew = candidate.add(x, y, z); - if(!candidatesOld.contains(posNew) && !candidates.contains(posNew) && !candidatesNew.contains(posNew)) { + if (!candidatesOld.contains(posNew) && !candidates.contains(posNew) && !candidatesNew.contains(posNew)) { Block blockNew = Minecraft.getMinecraft().theWorld.getBlockState(posNew).getBlock(); - if(blockNew == Blocks.log || blockNew == Blocks.log2) { + if (blockNew == Blocks.log || blockNew == Blocks.log2) { candidatesNew.add(posNew); } } @@ -721,7 +714,7 @@ public class CustomItemEffects { block.setBlockBoundsBasedOnState(Minecraft.getMinecraft().theWorld, candidate); drawFilledBoundingBox(block.getSelectedBoundingBox(Minecraft.getMinecraft().theWorld, candidate) - .expand(0.001D, 0.001D, 0.001D).offset(-d0, -d1, -d2), + .expand(0.001D, 0.001D, 0.001D).offset(-d0, -d1, -d2), random ? 0.5f : 1f, NotEnoughUpdates.INSTANCE.config.itemOverlays.treecapOverlayColour); } } @@ -731,15 +724,15 @@ public class CustomItemEffects { GlStateManager.enableTexture2D(); GlStateManager.disableBlend(); } - } else if(NotEnoughUpdates.INSTANCE.config.itemOverlays.enableWandOverlay) { - if(heldInternal.equals("BUILDERS_WAND") && onPrivateIsland) { + } else if (NotEnoughUpdates.INSTANCE.config.itemOverlays.enableWandOverlay) { + if (heldInternal.equals("BUILDERS_WAND") && onPrivateIsland) { int maxBlocks = MAX_BUILDERS_BLOCKS; if (event.target.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { IBlockState hover = Minecraft.getMinecraft().theWorld.getBlockState(event.target.getBlockPos().offset(event.target.sideHit, 1)); - if(hover.getBlock() == Blocks.air) { + if (hover.getBlock() == Blocks.air) { IBlockState match = Minecraft.getMinecraft().theWorld.getBlockState(event.target.getBlockPos()); Item matchItem = Item.getItemFromBlock(match.getBlock()); - if(matchItem != null) { + if (matchItem != null) { GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); GlStateManager.disableTexture2D(); @@ -750,10 +743,10 @@ public class CustomItemEffects { getBuildersWandCandidates(player, event.target, event.partialTicks, candidatesOld, candidatesOldSorted, 10); - ItemStack matchStack = new ItemStack(matchItem, 1, + ItemStack matchStack = new ItemStack(matchItem, 1, match.getBlock().getDamageValue(Minecraft.getMinecraft().theWorld, event.target.getBlockPos())); int itemCount; - if(match.getBlock() == Blocks.dirt && matchStack.getItemDamage() == 0 && hasDirtWand()) { + if (match.getBlock() == Blocks.dirt && matchStack.getItemDamage() == 0 && hasDirtWand()) { itemCount = candidatesOld.size(); } else { itemCount = countItemsInInventoryAndStorage(matchStack); @@ -762,19 +755,19 @@ public class CustomItemEffects { String special = (candidatesOld.size() <= itemCount) ? NotEnoughUpdates.INSTANCE.config.itemOverlays.wandOverlayColour : "0:255:255:0:0"; - if(candidatesOld.size() <= maxBlocks) { - for(Set candidatesSorted : candidatesOldSorted.values()) { - for(BlockPos candidate : candidatesSorted) { + if (candidatesOld.size() <= maxBlocks) { + for (Set candidatesSorted : candidatesOldSorted.values()) { + for (BlockPos candidate : candidatesSorted) { match.getBlock().setBlockBoundsBasedOnState(Minecraft.getMinecraft().theWorld, candidate); AxisAlignedBB bb = match.getBlock().getSelectedBoundingBox(Minecraft.getMinecraft().theWorld, candidate) .offset(event.target.sideHit.getFrontOffsetX(), event.target.sideHit.getFrontOffsetY(), event.target.sideHit.getFrontOffsetZ()); - drawBlock((int)bb.minX, (int)bb.minY, (int)bb.minZ+1, match, event.partialTicks, 0.75f); + drawBlock((int) bb.minX, (int) bb.minY, (int) bb.minZ + 1, match, event.partialTicks, 0.75f); } } - for(BlockPos candidate : candidatesOld) { + for (BlockPos candidate : candidatesOld) { match.getBlock().setBlockBoundsBasedOnState(Minecraft.getMinecraft().theWorld, candidate); AxisAlignedBB bb = match.getBlock().getSelectedBoundingBox(Minecraft.getMinecraft().theWorld, candidate) .expand(0.001D, 0.001D, 0.001D).offset(-d0, -d1, -d2) @@ -791,10 +784,10 @@ public class CustomItemEffects { } } } - } else if(heldInternal.equals("INFINIDIRT_WAND") && event.target.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { + } else if (heldInternal.equals("INFINIDIRT_WAND") && event.target.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { BlockPos hover = event.target.getBlockPos().offset(event.target.sideHit, 1); IBlockState hoverState = Minecraft.getMinecraft().theWorld.getBlockState(event.target.getBlockPos().offset(event.target.sideHit, 1)); - if(hoverState.getBlock() == Blocks.air) { + if (hoverState.getBlock() == Blocks.air) { GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); GlStateManager.disableTexture2D(); @@ -803,7 +796,7 @@ public class CustomItemEffects { String special = NotEnoughUpdates.INSTANCE.config.itemOverlays.wandOverlayColour; AxisAlignedBB bb = Blocks.dirt.getSelectedBoundingBox(Minecraft.getMinecraft().theWorld, hover); - drawBlock((int)bb.minX, (int)bb.minY, (int)bb.minZ+1, Blocks.dirt.getDefaultState(), + drawBlock((int) bb.minX, (int) bb.minY, (int) bb.minZ + 1, Blocks.dirt.getDefaultState(), event.partialTicks, 0.75f); AxisAlignedBB bbExpanded = Blocks.dirt.getSelectedBoundingBox(Minecraft.getMinecraft().theWorld, hover) @@ -814,60 +807,60 @@ public class CustomItemEffects { GlStateManager.enableTexture2D(); GlStateManager.disableBlend(); } - } else if((heldInternal.equals("WATER_BUCKET") || heldInternal.equals("MAGICAL_WATER_BUCKET") && NotEnoughUpdates.INSTANCE.config.itemOverlays.enablePrismapumpOverlay && onPrivateIsland) && + } else if ((heldInternal.equals("WATER_BUCKET") || heldInternal.equals("MAGICAL_WATER_BUCKET") && NotEnoughUpdates.INSTANCE.config.itemOverlays.enablePrismapumpOverlay && onPrivateIsland) && event.target.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { BlockPos hover = event.target.getBlockPos().offset(event.target.sideHit, 1); HashSet verticalSources = new HashSet<>(); TreeMap> watersSorted = new TreeMap<>(); - for(int xOff=-1; xOff<=1; xOff++) { - for(int yOff=0; yOff<=1; yOff++) { - for(int zOff=-1; zOff<=1; zOff++) { - if((xOff == 0 && yOff == 0) || - (xOff == 0 && zOff == 0) || - (zOff == 0 && yOff == 0)) { + for (int xOff = -1; xOff <= 1; xOff++) { + for (int yOff = 0; yOff <= 1; yOff++) { + for (int zOff = -1; zOff <= 1; zOff++) { + if ((xOff == 0 && yOff == 0) || + (xOff == 0 && zOff == 0) || + (zOff == 0 && yOff == 0)) { BlockPos checkPos = hover.add(-xOff, -yOff, -zOff); IBlockState check = Minecraft.getMinecraft().theWorld.getBlockState(checkPos); - if(check.getBlock() == Blocks.prismarine && check.getBlock().getMetaFromState(check) == 2) { - for(int i=0; i<300; i++) { - BlockPos renderPos = hover.add(xOff*i, yOff*i, zOff*i); + if (check.getBlock() == Blocks.prismarine && check.getBlock().getMetaFromState(check) == 2) { + for (int i = 0; i < 300; i++) { + BlockPos renderPos = hover.add(xOff * i, yOff * i, zOff * i); - if(Math.abs(renderPos.getX()) > 128) { + if (Math.abs(renderPos.getX()) > 128) { break; } - if(Math.abs(renderPos.getY()) > 255) { + if (Math.abs(renderPos.getY()) > 255) { break; } - if(Math.abs(renderPos.getZ()) > 128) { + if (Math.abs(renderPos.getZ()) > 128) { break; } IBlockState renderState = Minecraft.getMinecraft().theWorld.getBlockState(renderPos); - if(renderState.getBlock() != Blocks.air && renderState.getBlock() != Blocks.water && - renderState.getBlock() != Blocks.flowing_water) { + if (renderState.getBlock() != Blocks.air && renderState.getBlock() != Blocks.water && + renderState.getBlock() != Blocks.flowing_water) { break; } - if(yOff != 0) { + if (yOff != 0) { verticalSources.add(renderPos); } else { IBlockState belowState = Minecraft.getMinecraft().theWorld.getBlockState(renderPos.add(0, -1, 0)); - if(belowState.getBlock() == Blocks.air) { + if (belowState.getBlock() == Blocks.air) { break; } } - for(EnumFacing facing : EnumFacing.values()) { - float xDist = (float)(renderPos.getX()+0.5f+0.5f*facing.getFrontOffsetX()-d0); - float yDist = (float)(renderPos.getY()+0.5f+0.5f*facing.getFrontOffsetY()-d1-player.getEyeHeight()); - float zDist = (float)(renderPos.getZ()+0.5f+0.5f*facing.getFrontOffsetZ()-d2); + for (EnumFacing facing : EnumFacing.values()) { + float xDist = (float) (renderPos.getX() + 0.5f + 0.5f * facing.getFrontOffsetX() - d0); + float yDist = (float) (renderPos.getY() + 0.5f + 0.5f * facing.getFrontOffsetY() - d1 - player.getEyeHeight()); + float zDist = (float) (renderPos.getZ() + 0.5f + 0.5f * facing.getFrontOffsetZ() - d2); - float distSq = xDist*xDist + yDist*yDist + zDist*zDist; + float distSq = xDist * xDist + yDist * yDist + zDist * zDist; - watersSorted.computeIfAbsent(distSq, k->new HashMap<>()).put(renderPos, facing); + watersSorted.computeIfAbsent(distSq, k -> new HashMap<>()).put(renderPos, facing); } } @@ -883,12 +876,12 @@ public class CustomItemEffects { GlStateManager.disableTexture2D(); GlStateManager.depthMask(true); - for(HashMap blockPoses : watersSorted.values()) { - for(Map.Entry entry : blockPoses.entrySet()) { + for (HashMap blockPoses : watersSorted.values()) { + for (Map.Entry entry : blockPoses.entrySet()) { boolean vertical = verticalSources.contains(entry.getKey()); AxisAlignedBB bbExpanded = Blocks.water.getSelectedBoundingBox(Minecraft.getMinecraft().theWorld, entry.getKey()) - .expand(-0.001D, -0.001D-(vertical?0:0.0625D), -0.001D) - .offset(-d0, -d1-(vertical?0:0.0625), -d2); + .expand(-0.001D, -0.001D - (vertical ? 0 : 0.0625D), -0.001D) + .offset(-d0, -d1 - (vertical ? 0 : 0.0625), -d2); drawFilledBoundingBoxSide(bbExpanded, entry.getValue(), 1f, "0:100:20:50:160"); } } @@ -896,25 +889,25 @@ public class CustomItemEffects { GlStateManager.depthMask(true); GlStateManager.enableTexture2D(); GlStateManager.disableBlend(); - } else if((heldInternal.equals("HOE_OF_GREAT_TILLING") || heldInternal.equals("HOE_OF_GREATER_TILLING") && onPrivateIsland) && + } else if ((heldInternal.equals("HOE_OF_GREAT_TILLING") || heldInternal.equals("HOE_OF_GREATER_TILLING") && onPrivateIsland) && event.target.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { BlockPos target = event.target.getBlockPos(); IBlockState targetState = Minecraft.getMinecraft().theWorld.getBlockState(target); int radius = heldInternal.equals("HOE_OF_GREAT_TILLING") ? 1 : 2; - if(targetState.getBlock() == Blocks.dirt || targetState.getBlock() == Blocks.grass) { + if (targetState.getBlock() == Blocks.dirt || targetState.getBlock() == Blocks.grass) { GlStateManager.enableDepth(); GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); GlStateManager.disableTexture2D(); GlStateManager.depthMask(true); - for(int xOff=-radius; xOff<=radius; xOff++) { - for(int zOff=-radius; zOff<=radius; zOff++) { + for (int xOff = -radius; xOff <= radius; xOff++) { + for (int zOff = -radius; zOff <= radius; zOff++) { BlockPos renderPos = target.add(xOff, 0, zOff); IBlockState renderState = Minecraft.getMinecraft().theWorld.getBlockState(renderPos); - if(renderState.getBlock() == Blocks.dirt || renderState.getBlock() == Blocks.grass) { + if (renderState.getBlock() == Blocks.dirt || renderState.getBlock() == Blocks.grass) { AxisAlignedBB bbExpanded = Blocks.dirt.getSelectedBoundingBox(Minecraft.getMinecraft().theWorld, renderPos) .expand(0.001D, 0.001D, 0.001D) .offset(-d0, -d1, -d2); @@ -943,45 +936,45 @@ public class CustomItemEffects { candidatesNew.add(target.getBlockPos()); - double d0 = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double)partialTicks; - double d1 = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double)partialTicks; - double d2 = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double)partialTicks; + double d0 = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double) partialTicks; + double d1 = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double) partialTicks; + double d2 = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double) partialTicks; - while(candidatesOld.size() <= MAX_BUILDERS_BLOCKS+extraMax) { - if(candidatesNew.isEmpty()) { + while (candidatesOld.size() <= MAX_BUILDERS_BLOCKS + extraMax) { + if (candidatesNew.isEmpty()) { break; } candidates.addAll(candidatesNew); candidatesNew.clear(); - while(!candidates.isEmpty()) { - if(candidatesOld.size() > MAX_BUILDERS_BLOCKS+extraMax) break; + while (!candidates.isEmpty()) { + if (candidatesOld.size() > MAX_BUILDERS_BLOCKS + extraMax) break; BlockPos candidate = candidates.pop(); - float distSq = (float)((candidate.getX()+0.5f-d0)*(candidate.getX()+0.5f-d0) + - (candidate.getY()+0.5f-d1-player.getEyeHeight())*(candidate.getY()+0.5f-d1-player.getEyeHeight()) + - (candidate.getZ()+0.5f-d2)*(candidate.getZ()+0.5f-d2)); - candidatesOldSorted.computeIfAbsent(distSq, k->new HashSet<>()).add(candidate); + float distSq = (float) ((candidate.getX() + 0.5f - d0) * (candidate.getX() + 0.5f - d0) + + (candidate.getY() + 0.5f - d1 - player.getEyeHeight()) * (candidate.getY() + 0.5f - d1 - player.getEyeHeight()) + + (candidate.getZ() + 0.5f - d2) * (candidate.getZ() + 0.5f - d2)); + candidatesOldSorted.computeIfAbsent(distSq, k -> new HashSet<>()).add(candidate); candidatesOld.add(candidate); - for(int x = -1; x <= 1; x++) { - for(int y = -1; y <= 1; y++) { - for(int z = -1; z <= 1; z++) { - if(x*x+y*y+z*z == 1) { - if(((x == 0) && (target.sideHit.getAxis() == EnumFacing.Axis.X)) || + for (int x = -1; x <= 1; x++) { + for (int y = -1; y <= 1; y++) { + for (int z = -1; z <= 1; z++) { + if (x * x + y * y + z * z == 1) { + if (((x == 0) && (target.sideHit.getAxis() == EnumFacing.Axis.X)) || ((y == 0) && (target.sideHit.getAxis() == EnumFacing.Axis.Y)) || ((z == 0) && (target.sideHit.getAxis() == EnumFacing.Axis.Z))) { - if(Minecraft.getMinecraft().theWorld.getBlockState(candidate.add( - x+target.sideHit.getFrontOffsetX(), - y+target.sideHit.getFrontOffsetY(), - z+target.sideHit.getFrontOffsetZ())).getBlock() == Blocks.air) { + if (Minecraft.getMinecraft().theWorld.getBlockState(candidate.add( + x + target.sideHit.getFrontOffsetX(), + y + target.sideHit.getFrontOffsetY(), + z + target.sideHit.getFrontOffsetZ())).getBlock() == Blocks.air) { BlockPos posNew = candidate.add(x, y, z); - if(!candidatesOld.contains(posNew) && !candidates.contains(posNew) && !candidatesNew.contains(posNew)) { + if (!candidatesOld.contains(posNew) && !candidates.contains(posNew) && !candidatesNew.contains(posNew)) { IBlockState blockNew = Minecraft.getMinecraft().theWorld.getBlockState(posNew); - if(blockNew == match) { + if (blockNew == match) { candidatesNew.add(posNew); } } @@ -997,9 +990,9 @@ public class CustomItemEffects { public static void drawBlock(int x, int y, int z, IBlockState state, float partialTicks, float brightness) { EntityPlayerSP player = Minecraft.getMinecraft().thePlayer; - double d0 = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double)partialTicks; - double d1 = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double)partialTicks; - double d2 = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double)partialTicks; + double d0 = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double) partialTicks; + double d1 = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double) partialTicks; + double d2 = p