From 8244329e9be9217e166046dd9102fb4f10632351 Mon Sep 17 00:00:00 2001 From: Phoube <> Date: Sat, 24 Oct 2020 16:33:52 -0400 Subject: [PATCH 1/8] added Frozen Scythe Projectile Feature and class --- .../biscuit/skyblockaddons/core/Feature.java | 8 +-- .../features/FrozenScytheProjectile.java | 62 +++++++++++++++++++ .../listeners/PlayerListener.java | 33 +++++++++- 3 files changed, 98 insertions(+), 5 deletions(-) create mode 100644 src/main/java/codes/biscuit/skyblockaddons/features/FrozenScytheProjectile.java diff --git a/src/main/java/codes/biscuit/skyblockaddons/core/Feature.java b/src/main/java/codes/biscuit/skyblockaddons/core/Feature.java index a0d63550a8..c4b42175cf 100644 --- a/src/main/java/codes/biscuit/skyblockaddons/core/Feature.java +++ b/src/main/java/codes/biscuit/skyblockaddons/core/Feature.java @@ -176,11 +176,11 @@ public enum Feature { SHOW_SKILL_XP_GAINED(145, null, false), SHOW_SALVAGE_ESSENCES_COUNTER(146, null, false), - DISABLE_MORT_MESSAGES(146, "settings.disableMortMessages", null, false), - DISABLE_BOSS_MESSAGES(147, "settings.disableBossMessages", null, false), + DISABLE_MORT_MESSAGES(147, "settings.disableMortMessages", null, false), + DISABLE_BOSS_MESSAGES(148, "settings.disableBossMessages", null, false), - HIDE_OTHER_PLAYERS_PRESENTS(141, "settings.hideOtherPlayersPresents", null,false), - EASIER_PRESENT_OPENING(142, "settings.easierPresentOpening", null,false), + HIDE_OTHER_PLAYERS_PRESENTS(149, "settings.hideOtherPlayersPresents", null,false), + EASIER_PRESENT_OPENING(150, "settings.easierPresentOpening", null,false), WARNING_TIME(-1, Message.SETTING_WARNING_DURATION, false), diff --git a/src/main/java/codes/biscuit/skyblockaddons/features/FrozenScytheProjectile.java b/src/main/java/codes/biscuit/skyblockaddons/features/FrozenScytheProjectile.java new file mode 100644 index 0000000000..dca94cf570 --- /dev/null +++ b/src/main/java/codes/biscuit/skyblockaddons/features/FrozenScytheProjectile.java @@ -0,0 +1,62 @@ +package codes.biscuit.skyblockaddons.features; + +import codes.biscuit.skyblockaddons.core.EntityAggregate; +import codes.biscuit.skyblockaddons.utils.ItemUtils; +import codes.biscuit.skyblockaddons.utils.TextUtils; +import lombok.Getter; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityArmorStand; +import net.minecraft.util.AxisAlignedBB; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.regex.Matcher; + +public class FrozenScytheProjectile extends EntityAggregate { + + @Getter + private static Map frozenScytheProjectiles = new HashMap<>(); + + + /** + * Returns an instance of FrozenScytheProjectile if this entity is in fact part of a frozen + * scythe projectile, or null if not. + */ + public static FrozenScytheProjectile getFrozenScytheProjectile(Entity targetEntity) { + if (!(targetEntity instanceof EntityArmorStand) || !targetEntity.isInvisible()) { + return null; + } + + // Check if the projectile already exists... + for (FrozenScytheProjectile projectile : frozenScytheProjectiles.values()) { + if (projectile.getEntities().contains(targetEntity.getUniqueID())) { + return projectile; + } + } + + // Check a small range around... + List stands = Minecraft.getMinecraft().theWorld.getEntitiesWithinAABB(EntityArmorStand.class, + new AxisAlignedBB(targetEntity.posX - 0.1, targetEntity.posY - 2, targetEntity.posZ - 0.1, + targetEntity.posX + 0.1, targetEntity.posY + 2, targetEntity.posZ + 0.1)); + + EntityArmorStand ice1 = null, ice2 = null, ice3 = null, ice4 = null; + for (EntityArmorStand stand : stands) { + if (!stand.isInvisible()) { + continue; + } + // Check if the foot has ice or packed ice on it + } + // Verify that we've found all parts, and that the positions make sense + /* + if (present == null || fromLine == null || toLine == null || present.posY > fromLine.posY || fromLine.posY > toLine.posY) { + return null; + } + */ + // Rotation is the same as the player + return null; + //return new FrozenScytheProjectile(present.getUniqueID(), fromLine.getUniqueID(), toLine.getUniqueID(), presentColor, fromYou, forYou); + } +} diff --git a/src/main/java/codes/biscuit/skyblockaddons/listeners/PlayerListener.java b/src/main/java/codes/biscuit/skyblockaddons/listeners/PlayerListener.java index 59644d70c0..d5b815994d 100644 --- a/src/main/java/codes/biscuit/skyblockaddons/listeners/PlayerListener.java +++ b/src/main/java/codes/biscuit/skyblockaddons/listeners/PlayerListener.java @@ -25,14 +25,22 @@ import com.google.common.collect.Sets; import lombok.Getter; import lombok.Setter; +import net.minecraft.block.Block; +import net.minecraft.block.BlockIce; +import net.minecraft.block.BlockPackedIce; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityOtherPlayerMP; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.inventory.GuiChest; +import net.minecraft.client.renderer.ItemRenderer; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms; +import net.minecraft.client.resources.model.ModelManager; +import net.minecraft.client.resources.model.SimpleBakedModel; import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityArmorStand; +import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.monster.EntityBlaze; import net.minecraft.entity.monster.EntityEnderman; import net.minecraft.entity.monster.EntityMagmaCube; @@ -44,6 +52,7 @@ import net.minecraft.inventory.Container; import net.minecraft.inventory.ContainerChest; import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.AxisAlignedBB; @@ -68,8 +77,10 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.InputEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; +import net.minecraftforge.fml.relauncher.ReflectionHelper; import org.lwjgl.input.Keyboard; +import java.lang.reflect.Field; import java.util.*; import java.util.concurrent.ThreadLocalRandom; import java.util.regex.Matcher; @@ -139,6 +150,7 @@ public class PlayerListener { @Getter @Setter private int recentBlazes = 0; @Getter private TreeMap explosiveBowExplosions = new TreeMap<>(); + private HashSet froz = new HashSet<>(); private final SkyblockAddons main = SkyblockAddons.getInstance(); private final ActionBarParser actionBarParser = new ActionBarParser(); @@ -149,7 +161,6 @@ public class PlayerListener { @SubscribeEvent() public void onWorldJoin(EntityJoinWorldEvent e) { Entity entity = e.entity; - if (entity == Minecraft.getMinecraft().thePlayer) { lastWorldJoin = System.currentTimeMillis(); lastBoss = -1; @@ -548,6 +559,19 @@ public void onEntityEvent(LivingEvent.LivingUpdateEvent e) { } } + if (entity instanceof EntityArmorStand && entity.isInvisible() && entity.getDistanceToEntity(Minecraft.getMinecraft().thePlayer) < 5) { + ItemStack item = ((EntityArmorStand)entity).getEquipmentInSlot(0); + if (item != null && item.getItem() instanceof ItemBlock) { + Block block = ((ItemBlock)item.getItem()).getBlock(); + if (block instanceof BlockPackedIce || block instanceof BlockIce) { + //entity.setInvisible(false); + froz.add((EntityArmorStand)entity); + //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(entity.getUniqueID() + " " + String.format("(%5.2f, %5.2f, %5.2f)", entity.posX, entity.posY, entity.posZ))); + } + } + } + + if (entity instanceof EntityOtherPlayerMP && main.getConfigValues().isEnabled(Feature.HIDE_PLAYERS_NEAR_NPCS)) { float health = ((EntityOtherPlayerMP) entity).getHealth(); @@ -647,6 +671,13 @@ public void onDeath(LivingDeathEvent e) { } } } + for (EntityArmorStand f : froz) { + // Get the frozen scythe ice position + //double x = f.posX + if (e.entity.getDistance(f.posX, e.entity.posY, f.posZ) < 3) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(String.format("%6.3f, %6.3f, %6.3f", e.entity.posX - f.posX, e.entity.posY - f.posY, e.entity.posZ - f.posZ))); + } + } NPCUtils.getNpcLocations().remove(e.entity.getUniqueID()); } From 119b5555c54ceda8d65b4005973f969249d4da29 Mon Sep 17 00:00:00 2001 From: Phoube <> Date: Sat, 24 Oct 2020 17:00:15 -0400 Subject: [PATCH 2/8] merging issues 2.0 --- src/main/java/codes/biscuit/skyblockaddons/core/Feature.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/codes/biscuit/skyblockaddons/core/Feature.java b/src/main/java/codes/biscuit/skyblockaddons/core/Feature.java index c4b42175cf..bead460b98 100644 --- a/src/main/java/codes/biscuit/skyblockaddons/core/Feature.java +++ b/src/main/java/codes/biscuit/skyblockaddons/core/Feature.java @@ -178,9 +178,10 @@ public enum Feature { DISABLE_MORT_MESSAGES(147, "settings.disableMortMessages", null, false), DISABLE_BOSS_MESSAGES(148, "settings.disableBossMessages", null, false), + SHOW_SWORD_KILLS(149, "settings.showSwordKills", new GuiFeatureData(ColorCode.RED, true), false), - HIDE_OTHER_PLAYERS_PRESENTS(149, "settings.hideOtherPlayersPresents", null,false), - EASIER_PRESENT_OPENING(150, "settings.easierPresentOpening", null,false), + HIDE_OTHER_PLAYERS_PRESENTS(150, "settings.hideOtherPlayersPresents", null,false), + EASIER_PRESENT_OPENING(151, "settings.easierPresentOpening", null,false), WARNING_TIME(-1, Message.SETTING_WARNING_DURATION, false), From 037e9e5d694dbd2a3e419b52da1f6506bb3cd62c Mon Sep 17 00:00:00 2001 From: Phoube <> Date: Thu, 29 Oct 2020 11:38:41 -0400 Subject: [PATCH 3/8] Working prototype --- .../features/FrozenScytheProjectile.java | 296 ++++++++++++++++-- .../listeners/PlayerListener.java | 166 +++++++--- 2 files changed, 392 insertions(+), 70 deletions(-) diff --git a/src/main/java/codes/biscuit/skyblockaddons/features/FrozenScytheProjectile.java b/src/main/java/codes/biscuit/skyblockaddons/features/FrozenScytheProjectile.java index dca94cf570..60e0dbd76d 100644 --- a/src/main/java/codes/biscuit/skyblockaddons/features/FrozenScytheProjectile.java +++ b/src/main/java/codes/biscuit/skyblockaddons/features/FrozenScytheProjectile.java @@ -1,62 +1,300 @@ package codes.biscuit.skyblockaddons.features; import codes.biscuit.skyblockaddons.core.EntityAggregate; -import codes.biscuit.skyblockaddons.utils.ItemUtils; -import codes.biscuit.skyblockaddons.utils.TextUtils; import lombok.Getter; +import lombok.Setter; +import net.minecraft.block.Block; +import net.minecraft.block.BlockIce; +import net.minecraft.block.BlockPackedIce; import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityArmorStand; -import net.minecraft.util.AxisAlignedBB; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.monster.EntityEnderman; +import net.minecraft.entity.monster.EntityMob; +import net.minecraft.item.ItemBlock; +import net.minecraft.util.*; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import java.util.regex.Matcher; +import javax.vecmath.Matrix4f; +import java.awt.*; +import java.util.*; -public class FrozenScytheProjectile extends EntityAggregate { +public class FrozenScytheProjectile { @Getter private static Map frozenScytheProjectiles = new HashMap<>(); + @Setter + private static Vec3 lastRightClickLookVec = null; + @Setter + private static Vec3 lastRightClickEyePos = null; + @Setter + private static long lastRightClickTime = 0; + private Vec3 projectileLocation; + @Getter + private EntityArmorStand projectileStand; + private int ticksMotionless = 0; + @Getter + private Map potentialHitEntities = new HashMap<>(); + + public FrozenScytheProjectile(EntityArmorStand stand, Vec3 relativeProjectileLoc) { + projectileStand = stand; + projectileLocation = relativeProjectileLoc; + } + + /* + Returns the true position of the center of the ice block on the armorstand + Turns out it's not entirely useful since hypixel seems to register hits based on the armorstand + With the notable exception of the height of the projectile + */ + public Vec3 getProjectilePosition() { + return projectileStand.getPositionVector().add(projectileLocation); + } + + // Normal in flight scythe speed is about 1.8 blocks per tick + public boolean isDead() { + return projectileStand.isDead || (projectileStand.ticksExisted > 5 && ticksMotionless > 5); + } + + /* + Called every tick + */ + public void onUpdate() { + if (getMotion() < .01) { + ticksMotionless++; + + //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText((projectileStand.isCollided ? "true" : "false"))); + } + else { + ticksMotionless = 0; + } + //long currTime = System.currentTimeMillis(); + // Keep track of only recently intercepted entities + /* + for (Map.Entry entry : potentialHitEntities.entrySet()) { + if (currTime - entry.getValue() > 150) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("Rem: " + entry.getKey().toString())); + } + } + potentialHitEntities.values().removeIf((hitTime) -> currTime - hitTime > 150); + //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("Middle: " + potentialHitEntities.size())); + List list = Minecraft.getMinecraft().theWorld.getEntitiesWithinAABB(EntityEnderman.class, getBoundingBox()); + for (EntityEnderman enderman : list) { + potentialHitEntities.put(enderman.getUniqueID(), currTime); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("Add: " + enderman.getUniqueID().toString())); + //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(String.format("Hit1 %5.3f, %5.3f, %5.3f | %5.3f, %5.3f, %5.3f", enderman.posX - projectileStand.posX, enderman.posY - projectileStand.posY, enderman.posZ - projectileStand.posZ, + // enderman.posX - getProjectilePosition().xCoord, enderman.posY - getProjectilePosition().yCoord, enderman.posZ - getProjectilePosition().zCoord))); + } + */ + //for (UUID id : potentialHitEntities.keySet()) { + // Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(id.toString())); + //} + + } + + public double getMotion() { + return projectileStand.getDistance(projectileStand.prevPosX, projectileStand.prevPosY, projectileStand.prevPosZ); + } + + public AxisAlignedBB getBoundingBox() { + return new AxisAlignedBB(projectileStand.posX - 1.35, getProjectilePosition().yCoord - .1, projectileStand.posZ - 1.35, + projectileStand.posX + 1.35, getProjectilePosition().yCoord + .1, projectileStand.posZ + 1.35); + } /** * Returns an instance of FrozenScytheProjectile if this entity is in fact part of a frozen * scythe projectile, or null if not. */ - public static FrozenScytheProjectile getFrozenScytheProjectile(Entity targetEntity) { - if (!(targetEntity instanceof EntityArmorStand) || !targetEntity.isInvisible()) { + public static FrozenScytheProjectile checkAndReturnFrozenScytheProjectile(Entity targetEntity) { + // Check if target entity is an armorstand close to the player, and that the player has right clicked w/ frozen scythe + Minecraft mc = Minecraft.getMinecraft(); + if (mc.thePlayer == null || lastRightClickLookVec == null || lastRightClickEyePos == null || + System.currentTimeMillis() - lastRightClickTime > 1000 || + !(targetEntity instanceof EntityArmorStand) || + !mc.thePlayer.getEntityBoundingBox().expand(2,2,2).intersectsWith(targetEntity.getEntityBoundingBox())) { return null; } - - // Check if the projectile already exists... - for (FrozenScytheProjectile projectile : frozenScytheProjectiles.values()) { - if (projectile.getEntities().contains(targetEntity.getUniqueID())) { - return projectile; - } + EntityArmorStand stand = (EntityArmorStand)targetEntity; + // Check if it's a small, invisible armorstand holding a block + if (!stand.isInvisible() || !stand.isSmall() || stand.getHeldItem() == null || + !(stand.getHeldItem().getItem() instanceof ItemBlock)) { + return null; + } + // Check that the held block is ice or packed ice + Block heldBlock = ((ItemBlock)stand.getHeldItem().getItem()).getBlock(); + if (!(heldBlock instanceof BlockIce) && !(heldBlock instanceof BlockPackedIce)) { + return null; + } + // Get the block's location relative to the armorstand + Vec3 blockPos = getHeldBlockRelativeCenter(stand); + //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(String.format("%5.4f, %5.4f, %5.4f", blockPos.xCoord, blockPos.yCoord, blockPos.zCoord))); + Vec3 lookVec = lastRightClickLookVec; + Vec3 projVec = new Vec3(stand.posX, stand.posY + .37, stand.posZ); + projVec = projVec.subtract(lastRightClickEyePos); + // Check if the player is within 2.5 blocks and looking within 20 degrees of the stand + if (projVec.lengthVector() > 2.5 || + lookVec.dotProduct(projVec.normalize()) < MathHelper.cos((float) (20 / 180.0 * Math.PI))) { + return null; } - // Check a small range around... + return new FrozenScytheProjectile(stand, blockPos); + /* + // Check a small range around the player List stands = Minecraft.getMinecraft().theWorld.getEntitiesWithinAABB(EntityArmorStand.class, - new AxisAlignedBB(targetEntity.posX - 0.1, targetEntity.posY - 2, targetEntity.posZ - 0.1, - targetEntity.posX + 0.1, targetEntity.posY + 2, targetEntity.posZ + 0.1)); + mc.thePlayer.getEntityBoundingBox().expand(2, 2, 2)); + + ArrayList projectiles = new ArrayList<>(); + EntityArmorStand farthestProjectile = null; + double farthestProjectileDistance = 0; - EntityArmorStand ice1 = null, ice2 = null, ice3 = null, ice4 = null; for (EntityArmorStand stand : stands) { - if (!stand.isInvisible()) { + + // Check if it's a recently spawned, small, invisible armorstand holding a block + if (stand.ticksExisted >= 5 || !stand.isInvisible() || !stand.isSmall() || stand.getHeldItem() == null || + !(stand.getHeldItem().getItem() instanceof ItemBlock)) { + continue; + } + // Check that the held block is ice or packed ice + Block heldBlock = ((ItemBlock)stand.getHeldItem().getItem()).getBlock(); + if (!(heldBlock instanceof BlockIce) && !(heldBlock instanceof BlockPackedIce)) { + continue; + } + Vec3 lookVec = lastRightClickLookVec; + Vec3 projectileVec = new Vec3(stand.posX, stand.posY + .37, stand.posZ); + projectileVec = projectileVec.subtract(lastRightClickEyePos); + // Check if the player is within 2.5 blocks and is looking within 20 degrees of the stand + if (projectileVec.lengthVector() > 2.5 || + lookVec.dotProduct(projectileVec.normalize()) < MathHelper.cos((float) (20 / 180.0 * Math.PI))) { continue; } - // Check if the foot has ice or packed ice on it + projectiles.add(stand.getUniqueID()); + // Track the "first" projectile only + if (projectileVec.lengthVector() > farthestProjectileDistance) { + farthestProjectile = stand; + farthestProjectileDistance = projectileVec.lengthVector(); + } } - // Verify that we've found all parts, and that the positions make sense - /* - if (present == null || fromLine == null || toLine == null || present.posY > fromLine.posY || fromLine.posY > toLine.posY) { + // Frozen scythe projectiles have 5 stands + if (projectiles.size() < 5) { return null; } - */ - // Rotation is the same as the player + // Insert the farthest projectile a thte f + projectiles.remove(farthestProjectile); + + + Vec3 blockPos = getHeldBlockRelativeCenter(farthestProjectile); + + return new FrozenScytheProjectile(farthestProjectile, blockPos, projectiles); + */ + } + + + + /* + Was the given enderman recently in contact with one of the frozen scythe projectiles? + Return the projectile if so, null if not + */ + /* + public static FrozenScytheProjectile checkProjectileRecentlyNearEnderman(UUID endermanID) { + // + for (FrozenScytheProjectile f : frozenScytheProjectiles.values()) { + if (f.potentialHitEntities.containsKey(endermanID) && + System.currentTimeMillis() - f.potentialHitEntities.get(endermanID) <= 150) { + return f; + } + } + return null; - //return new FrozenScytheProjectile(present.getUniqueID(), fromLine.getUniqueID(), toLine.getUniqueID(), presentColor, fromYou, forYou); + } + */ + + + // t2 matrix translates to arm height and inverts x/y direction + private static final float[] t2v = { -1, 0, 0, 0, + 0,-1, 0, 1.5078125f, + 0, 0, 1, 0, + 0, 0, 0, 1}; + private static final Matrix4f t2 = new Matrix4f(t2v); + + // The child matrix translates/rotates appropriately for a smaller armorstand + private static final float[] childv = { .5f, 0, 0, 0, + 0,.4698463f, -0.17101f, .625f, + 0,.17101f, .4698463f, 0, + 0, 0, 0, 1}; + private static final Matrix4f child = new Matrix4f(childv); + + // The sneak matrix translates everything down .2 + private static final float[] sneakv = { 1, 0, 0, 0, + 0, 1, 0, .203125f, + 0, 0, 1, 0, + 0, 0, 0, 1}; + private static final Matrix4f sneak = new Matrix4f(sneakv); + + // t3 matrix translates from body center of mass to the shoulder + private static final float[] t3v = {1, 0, 0, -.3125f, + 0, 1, 0, .125f, + 0, 0, 1, 0, + 0, 0, 0, 1}; + private static final Matrix4f t3 = new Matrix4f(t3v); + + // t4 matrix translates from the shoulder to the wrist, and then from the wrist to the center of the held object + private static final float[] t4v = {-1, 0, 0, -.0625f, + 0, .9659258f, .2588190f, .6498155f, + 0, .2588190f, -.9659258f,-.2759259f, + 0, 0, 0, 1}; + private static final Matrix4f t4 = new Matrix4f(t4v); + + + /* + Gets the center of a block held by an armorstand, relative to armorstand position + Can pass in any armorstand, but the result is only relevant if the armorstand is actually holding a block + Note that it does not check if the armorstand is named dinnerbone, so ignores a flip in orientation + */ + public static Vec3 getHeldBlockRelativeCenter(EntityArmorStand e) { + if (e == null) { + return null; + } + + double entityRot = e.rotationYaw; + Rotations armRot = e.getRightArmRotation(); + //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(armRot.to)) + + Matrix4f ret = new Matrix4f(); + ret.setIdentity(); + + Matrix4f tmp = new Matrix4f(); + + // Rotate to the entity's rotation + tmp.rotY((float)((180-entityRot) / 180.0F * Math.PI)); + ret.mul(tmp); + + // Translate to the body's neck and invert axes + ret.mul(t2); + + // Scale if it's a child + if (e.isSmall()) { + ret.mul(child); + } + + // Translate to the shoulder + ret.mul(t3); + + // Rotate to the arm's rotation + tmp.rotZ((float) (armRot.getZ() / 180F * Math.PI)); + ret.mul(tmp); + tmp.rotY((float) (armRot.getY() / 180F * Math.PI)); + ret.mul(tmp); + tmp.rotX((float) (armRot.getX() / 180F * Math.PI)); + ret.mul(tmp); + + // Translate appropriately if sneaking + if (e.isSneaking()) { + ret.mul(sneak); + } + + // Translate down the arm and then out to the item center + ret.mul(t4); + // Return the translation + return new Vec3(ret.m03, ret.m13, ret.m23); } } diff --git a/src/main/java/codes/biscuit/skyblockaddons/listeners/PlayerListener.java b/src/main/java/codes/biscuit/skyblockaddons/listeners/PlayerListener.java index 98c78f4efd..d8d9960349 100644 --- a/src/main/java/codes/biscuit/skyblockaddons/listeners/PlayerListener.java +++ b/src/main/java/codes/biscuit/skyblockaddons/listeners/PlayerListener.java @@ -8,6 +8,7 @@ import codes.biscuit.skyblockaddons.events.SkyblockPlayerDeathEvent; import codes.biscuit.skyblockaddons.features.BaitManager; import codes.biscuit.skyblockaddons.features.EndstoneProtectorManager; +import codes.biscuit.skyblockaddons.features.FrozenScytheProjectile; import codes.biscuit.skyblockaddons.features.JerryPresent; import codes.biscuit.skyblockaddons.features.backpacks.BackpackManager; import codes.biscuit.skyblockaddons.features.backpacks.ContainerPreview; @@ -23,24 +24,17 @@ import codes.biscuit.skyblockaddons.utils.*; import codes.biscuit.skyblockaddons.utils.objects.IntPair; import com.google.common.collect.Sets; +import javafx.scene.chart.Axis; import lombok.Getter; import lombok.Setter; -import net.minecraft.block.Block; -import net.minecraft.block.BlockIce; -import net.minecraft.block.BlockPackedIce; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityOtherPlayerMP; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.inventory.GuiChest; -import net.minecraft.client.renderer.ItemRenderer; -import net.minecraft.client.renderer.block.model.ItemCameraTransforms; -import net.minecraft.client.resources.model.ModelManager; -import net.minecraft.client.resources.model.SimpleBakedModel; import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityArmorStand; -import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.monster.EntityBlaze; import net.minecraft.entity.monster.EntityEnderman; import net.minecraft.entity.monster.EntityMagmaCube; @@ -52,13 +46,9 @@ import net.minecraft.inventory.Container; import net.minecraft.inventory.ContainerChest; import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.Vec3; +import net.minecraft.util.*; import net.minecraftforge.client.event.ClientChatReceivedEvent; import net.minecraftforge.client.event.GuiOpenEvent; import net.minecraftforge.client.event.GuiScreenEvent; @@ -77,10 +67,8 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.InputEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; -import net.minecraftforge.fml.relauncher.ReflectionHelper; import org.lwjgl.input.Keyboard; -import java.lang.reflect.Field; import java.util.*; import java.util.concurrent.ThreadLocalRandom; import java.util.regex.Matcher; @@ -140,7 +128,12 @@ public class PlayerListener { private double oldBobberPosY = 0; @Getter private Set countedEndermen = new HashSet<>(); - @Getter private TreeMap> recentlyKilledZealots = new TreeMap<>(); + // @Biscuit there's gotta be a better way to standardize these names... "countedEnderman" is super vague and doesn't apply to all enderman, just those killed with a sword. + // All of these maps could be merged into one map of EntityDeathInfo if we added some fields to the EntityDeathInfo class + @Getter private HashMap countedEndermenFrozScythe = new HashMap<>(); + + // Changed to use a more informative datatype (Needed for frozen scythe support). + @Getter private TreeMap> recentlyKilledZealots = new TreeMap<>(); @Getter private Set recentlyLoadedChunks = new HashSet<>(); @@ -150,11 +143,24 @@ public class PlayerListener { @Getter @Setter private int recentBlazes = 0; @Getter private TreeMap explosiveBowExplosions = new TreeMap<>(); - private HashSet froz = new HashSet<>(); private final SkyblockAddons main = SkyblockAddons.getInstance(); private final ActionBarParser actionBarParser = new ActionBarParser(); + @Getter + private class EntityDeathInfo { + private UUID entityID; + private Vec3 location; + private AxisAlignedBB lastBB; + + public EntityDeathInfo(Entity e) { + entityID = e.getUniqueID(); + location = e.getPositionVector(); + lastBB = new AxisAlignedBB(e.getEntityBoundingBox().minX, e.getEntityBoundingBox().minY, e.getEntityBoundingBox().minZ, + e.getEntityBoundingBox().maxX, e.getEntityBoundingBox().maxY, e.getEntityBoundingBox().maxZ); + } + } + /** * Reset all the timers and stuff when joining a new world. */ @@ -179,6 +185,8 @@ public void onWorldJoin(EntityJoinWorldEvent e) { NPCUtils.getNpcLocations().clear(); JerryPresent.getJerryPresents().clear(); + FrozenScytheProjectile.getFrozenScytheProjectiles().clear(); + recentlyKilledZealots.clear(); } } @@ -457,6 +465,13 @@ public void onInteract(PlayerInteractEvent e) { && itemId != null && itemId.equals("EMBER_ROD")) { e.setCanceled(true); } + } else if (heldItem.getItem().equals(Items.iron_hoe)) { + String itemId = ItemUtils.getSkyBlockItemID(heldItem); + if (itemId != null && itemId.equals("FROZEN_SCYTHE")) { + FrozenScytheProjectile.setLastRightClickLookVec(mc.thePlayer.getLookVec()); + FrozenScytheProjectile.setLastRightClickEyePos(mc.thePlayer.getPositionEyes(1f)); + FrozenScytheProjectile.setLastRightClickTime(System.currentTimeMillis()); + } } if (main.getConfigValues().isEnabled(Feature.AVOID_PLACING_ENCHANTED_ITEMS)) { @@ -497,6 +512,41 @@ public void onTick(TickEvent.ClientTickEvent e) { main.getUtils().playLoudSound("random.successful_hit", 0.8); } + // This is duplicated in the scheduled task for explosive bow...@Biscuit please refactor the code for abstraction. + // IMO recentlykilledzealots should be fitered (kept up to date) every tick regardless of whether there is an arrow spawned + Long currTime = System.currentTimeMillis(); + // It takes 0-350 (and sometimes even 500) ms before the projecctile reaches the dead entity + // May cause some false positives if a kill is contested by another player + recentlyKilledZealots.keySet().removeIf((killedTime) -> currTime - killedTime > 350); + + // New frozen scythe logic + // Remove counted enderman after 1s (arbitrary, but should give enough time for deletion) + countedEndermenFrozScythe.values().removeIf((countedTime) -> currTime - countedTime > 1000); + + // Update all frozen scythe projectiles and check for recent enderman deaths near them + for (FrozenScytheProjectile projectile : FrozenScytheProjectile.getFrozenScytheProjectiles().values()) { + // Update + projectile.onUpdate(); + // Check recent zealot deaths and determine whether they occured close to projectiles + AxisAlignedBB bb = projectile.getBoundingBox(); + for (Map.Entry> entry : recentlyKilledZealots.entrySet()) { + Set deaths = entry.getValue(); + for (EntityDeathInfo info : deaths) { + if (!countedEndermenFrozScythe.containsKey(info.getEntityID()) && bb.intersectsWith(info.getLastBB())) { + countedEndermenFrozScythe.put(info.getEntityID(), currTime); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("Frozen scythe near dead zealot " + (currTime - entry.getKey()))); + main.getPersistentValuesManager().getPersistentValues().setKills(main.getPersistentValuesManager().getPersistentValues().getKills() + 1); + main.getPersistentValuesManager().saveValues(); + EndstoneProtectorManager.onKill(); + } + } + } + Vec3 pos = projectile.getProjectilePosition(); + mc.renderGlobal.spawnParticle(EnumParticleTypes.VILLAGER_HAPPY.getParticleID(), true, pos.xCoord, pos.yCoord, pos.zCoord, 0, 0, 0); + } + // Remove dead projectiles + FrozenScytheProjectile.getFrozenScytheProjectiles().values().removeIf((projectile) -> projectile.isDead()); + if (timerTick == 20) { // Add natural mana every second (increase is based on your max mana). if (main.getRenderListener().isPredictMana()) { changeMana(getAttribute(Attribute.MAX_MANA) / 50); @@ -559,19 +609,14 @@ public void onEntityEvent(LivingEvent.LivingUpdateEvent e) { } } - if (entity instanceof EntityArmorStand && entity.isInvisible() && entity.getDistanceToEntity(Minecraft.getMinecraft().thePlayer) < 5) { - ItemStack item = ((EntityArmorStand)entity).getEquipmentInSlot(0); - if (item != null && item.getItem() instanceof ItemBlock) { - Block block = ((ItemBlock)item.getItem()).getBlock(); - if (block instanceof BlockPackedIce || block instanceof BlockIce) { - //entity.setInvisible(false); - froz.add((EntityArmorStand)entity); - //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(entity.getUniqueID() + " " + String.format("(%5.2f, %5.2f, %5.2f)", entity.posX, entity.posY, entity.posZ))); - } + if (!FrozenScytheProjectile.getFrozenScytheProjectiles().containsKey(entity.getUniqueID())) { + FrozenScytheProjectile projectile = FrozenScytheProjectile.checkAndReturnFrozenScytheProjectile(entity); + if (projectile != null) { + FrozenScytheProjectile.getFrozenScytheProjectiles().put(entity.getUniqueID(), projectile); } + //entity.setInvisible(false); } - if (entity instanceof EntityOtherPlayerMP && main.getConfigValues().isEnabled(Feature.HIDE_PLAYERS_NEAR_NPCS)) { float health = ((EntityOtherPlayerMP) entity).getHealth(); @@ -625,6 +670,7 @@ public void onAttack(AttackEntityEvent e) { if (e.target instanceof EntityEnderman) { if (isZealot(e.target)) { countedEndermen.add(e.target.getUniqueID()); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("Zealot attacked")); } } } @@ -638,13 +684,25 @@ public void onDeath(LivingDeathEvent e) { EndstoneProtectorManager.onKill(); } else if (main.getUtils().isOnSkyblock() && main.getConfigValues().isEnabled(Feature.ZEALOT_COUNTER_EXPLOSIVE_BOW_SUPPORT)) { if (isZealot(e.entity)) { + //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("Killed " + e.entity.getUniqueID())); long now = System.currentTimeMillis(); if (recentlyKilledZealots.containsKey(now)) { - recentlyKilledZealots.get(now).add(e.entity.getPositionVector()); + recentlyKilledZealots.get(now).add(new EntityDeathInfo(e.entity)); } else { - recentlyKilledZealots.put(now, Sets.newHashSet(e.entity.getPositionVector())); + recentlyKilledZealots.put(now, Sets.newHashSet(new EntityDeathInfo(e.entity))); } - + /* + if (!countedEndermenFrozScythe.containsKey(e.entity.getUniqueID())) { + FrozenScytheProjectile f = FrozenScytheProjectile.checkProjectileRecentlyNearEnderman(e.entity.getUniqueID()); + if (f != null) { + countedEndermenFrozScythe.put(e.entity.getUniqueID(), System.currentTimeMillis()); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("Zealot killed near recent frozen scythe")); + main.getPersistentValuesManager().getPersistentValues().setKills(main.getPersistentValuesManager().getPersistentValues().getKills() + 1); + main.getPersistentValuesManager().saveValues(); + EndstoneProtectorManager.onKill(); + } + } + */ explosiveBowExplosions.keySet().removeIf((explosionTime) -> now - explosionTime > 150); Map.Entry latestExplosion = explosiveBowExplosions.lastEntry(); if (latestExplosion == null) return; @@ -670,14 +728,36 @@ public void onDeath(LivingDeathEvent e) { // System.out.println((originalPossibleZealotsKilled-possibleZealotsKilled)+" zealots were actually killed..."); } } + /* + if (main.getUtils().isOnSkyblock() && !countedEndermenFrozScythe.containsKey(e.entity.getUniqueID())) { + //if (isZealot(e.entity)) { + long now = System.currentTimeMillis(); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(e.entity.getUniqueID() + " died")); + FrozenScytheProjectile f = FrozenScytheProjectile.checkProjectileRecentlyNearEnderman(e.entity.getUniqueID()); + if (f != null) { + countedEndermenFrozScythe.put(e.entity.getUniqueID(), System.currentTimeMillis()); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("Zealot killed near recent frozen scythe")); + main.getPersistentValuesManager().getPersistentValues().setKills(main.getPersistentValuesManager().getPersistentValues().getKills() + 1); + main.getPersistentValuesManager().saveValues(); + EndstoneProtectorManager.onKill(); + } + //} + } + */ } - for (EntityArmorStand f : froz) { + //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(FrozenScytheProjectile.getFrozenScytheProjectiles().size() + " dies " + e.entity.getName())); + /* + for (FrozenScytheProjectile f : FrozenScytheProjectile.getFrozenScytheProjectiles().values()) { // Get the frozen scythe ice position //double x = f.posX - if (e.entity.getDistance(f.posX, e.entity.posY, f.posZ) < 3) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(String.format("%6.3f, %6.3f, %6.3f", e.entity.posX - f.posX, e.entity.posY - f.posY, e.entity.posZ - f.posZ))); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(String.format("H %5.3f, %5.3f, %5.3f", e.entity.posX - f.getProjectileStand().posX, e.entity.posY - f.getProjectileStand().posY, e.entity.posZ - f.getProjectileStand().posZ))); + + if (f.getProjectileStand().getEntityBoundingBox().expand(4,0,4).intersectsWith(e.entity.getEntityBoundingBox())) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(String.format("Hit %5.3f, %5.3f, %5.3f | %5.3f, %5.3f, %5.3f", e.entity.posX - f.getProjectileStand().posX, e.entity.posY - f.getProjectileStand().posY, e.entity.posZ - f.getProjectileStand().posZ, + e.entity.posX - f.getProjectilePosition().xCoord, e.entity.posY - f.getProjectilePosition().yCoord, e.entity.posZ - f.getProjectilePosition().zCoord))); } } + */ NPCUtils.getNpcLocations().remove(e.entity.getUniqueID()); } @@ -775,13 +855,17 @@ public void run() { cancel(); // System.out.println("Arrow is done, added an explosion!"); + Long now = System.currentTimeMillis(); Vec3 explosionLocation = new Vec3(arrow.posX, arrow.posY, arrow.posZ); - explosiveBowExplosions.put(System.currentTimeMillis(), explosionLocation); - - recentlyKilledZealots.keySet().removeIf((killedTime) -> System.currentTimeMillis() - killedTime > 150); - Set filteredRecentlyKilledZealots = new HashSet<>(); - for (Map.Entry> recentlyKilledZealotEntry : recentlyKilledZealots.entrySet()) { - filteredRecentlyKilledZealots.addAll(recentlyKilledZealotEntry.getValue()); + explosiveBowExplosions.put(now, explosionLocation); + + // commented here since we need 350ms for frozen scythe...instead use filter to get 150ms + //recentlyKilledZealots.keySet().removeIf((killedTime) -> System.currentTimeMillis() - killedTime > 150); + Set filteredRecentlyKilledZealots = new HashSet<>(); + for (Map.Entry> recentlyKilledZealotEntry : recentlyKilledZealots.entrySet()) { + if (now - recentlyKilledZealotEntry.getKey() <= 150) { + filteredRecentlyKilledZealots.addAll(recentlyKilledZealotEntry.getValue()); + } } if (filteredRecentlyKilledZealots.isEmpty()) return; @@ -789,8 +873,8 @@ public void run() { // System.out.println("This means "+possibleZealotsKilled+" may have been killed..."); // int originalPossibleZealotsKilled = possibleZealotsKilled; - for (Vec3 zealotDeathLocation : filteredRecentlyKilledZealots) { - double distance = explosionLocation.distanceTo(zealotDeathLocation); + for (EntityDeathInfo zealotDeathInfo : filteredRecentlyKilledZealots) { + double distance = explosionLocation.distanceTo(zealotDeathInfo.getLocation()); // System.out.println("Distance was "+distance+"!"); if (distance < 4.6) { // possibleZealotsKilled--; From 266ee2304eb5a8f76dc61b6061386a95041f5d0d Mon Sep 17 00:00:00 2001 From: Phoube <> Date: Thu, 29 Oct 2020 11:45:07 -0400 Subject: [PATCH 4/8] Added feature to the list of features --- src/main/java/codes/biscuit/skyblockaddons/core/Feature.java | 2 ++ src/main/java/codes/biscuit/skyblockaddons/core/Message.java | 1 + .../biscuit/skyblockaddons/listeners/PlayerListener.java | 4 ++-- .../java/codes/biscuit/skyblockaddons/utils/EnumUtils.java | 2 +- src/main/resources/lang/en_us.json | 3 ++- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/codes/biscuit/skyblockaddons/core/Feature.java b/src/main/java/codes/biscuit/skyblockaddons/core/Feature.java index bead460b98..765155a06a 100644 --- a/src/main/java/codes/biscuit/skyblockaddons/core/Feature.java +++ b/src/main/java/codes/biscuit/skyblockaddons/core/Feature.java @@ -183,6 +183,8 @@ public enum Feature { HIDE_OTHER_PLAYERS_PRESENTS(150, "settings.hideOtherPlayersPresents", null,false), EASIER_PRESENT_OPENING(151, "settings.easierPresentOpening", null,false), + ZEALOT_COUNTER_FORZEN_SCYTHE_SUPPORT(94, Message.SETTING_ZEALOT_COUNTER_FROZEN_SCYTHE_SUPPORT, true), + WARNING_TIME(-1, Message.SETTING_WARNING_DURATION, false), WARP_ADVANCED_MODE(-1, Message.SETTING_ADVANCED_MODE, true), diff --git a/src/main/java/codes/biscuit/skyblockaddons/core/Message.java b/src/main/java/codes/biscuit/skyblockaddons/core/Message.java index d28d8db65e..225303526e 100644 --- a/src/main/java/codes/biscuit/skyblockaddons/core/Message.java +++ b/src/main/java/codes/biscuit/skyblockaddons/core/Message.java @@ -162,6 +162,7 @@ public enum Message { SETTING_DISABLE_BOSS_MESSAGES(MessageObject.SETTING, "disableBossMessages"), SETTING_HIDE_OTHER_PLAYERS_PRESENTS(MessageObject.SETTING, "hideOtherPlayersPresents"), SETTING_EASIER_PRESENT_OPENING(MessageObject.SETTING, "easierPresentOpening"), + SETTING_ZEALOT_COUNTER_FROZEN_SCYTHE_SUPPORT(MessageObject.SETTING, "zealotCounterFrozenScythe"), BACKPACK_STYLE_REGULAR(MessageObject.BACKPACK_STYLE, "regular"), BACKPACK_STYLE_COMPACT(MessageObject.BACKPACK_STYLE, "compact"), diff --git a/src/main/java/codes/biscuit/skyblockaddons/listeners/PlayerListener.java b/src/main/java/codes/biscuit/skyblockaddons/listeners/PlayerListener.java index d8d9960349..e37f621bf3 100644 --- a/src/main/java/codes/biscuit/skyblockaddons/listeners/PlayerListener.java +++ b/src/main/java/codes/biscuit/skyblockaddons/listeners/PlayerListener.java @@ -677,12 +677,12 @@ public void onAttack(AttackEntityEvent e) { @SubscribeEvent public void onDeath(LivingDeathEvent e) { - if (e.entity instanceof EntityEnderman) { + if (e.entity instanceof EntityEnderman && main.getUtils().isOnSkyblock()) { if (countedEndermen.remove(e.entity.getUniqueID())) { main.getPersistentValuesManager().getPersistentValues().setKills(main.getPersistentValuesManager().getPersistentValues().getKills() + 1); main.getPersistentValuesManager().saveValues(); EndstoneProtectorManager.onKill(); - } else if (main.getUtils().isOnSkyblock() && main.getConfigValues().isEnabled(Feature.ZEALOT_COUNTER_EXPLOSIVE_BOW_SUPPORT)) { + } else if (main.getConfigValues().isEnabled(Feature.ZEALOT_COUNTER_EXPLOSIVE_BOW_SUPPORT)) { if (isZealot(e.entity)) { //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("Killed " + e.entity.getUniqueID())); long now = System.currentTimeMillis(); diff --git a/src/main/java/codes/biscuit/skyblockaddons/utils/EnumUtils.java b/src/main/java/codes/biscuit/skyblockaddons/utils/EnumUtils.java index 0f3c017ec7..7130bf2efd 100644 --- a/src/main/java/codes/biscuit/skyblockaddons/utils/EnumUtils.java +++ b/src/main/java/codes/biscuit/skyblockaddons/utils/EnumUtils.java @@ -289,7 +289,7 @@ public enum FeatureCredit { Feature.DUNGEONS_SECRETS_DISPLAY, Feature.SHOW_SALVAGE_ESSENCES_COUNTER, Feature.SHOW_SWORD_KILLS), TIRELESS_TRAVELER("TirelessTraveler", "github.com/ILikePlayingGames", Feature.DUNGEON_DEATH_COUNTER), KAASBROODJU("kaasbroodju", "github.com/kaasbroodju", Feature.SKILL_PROGRESS_BAR, Feature.SHOW_SKILL_PERCENTAGE_INSTEAD_OF_XP, Feature.SHOW_SKILL_XP_GAINED), - PHOUBE("Phoube", "github.com/Phoube", Feature.HIDE_OTHER_PLAYERS_PRESENTS, Feature.EASIER_PRESENT_OPENING); + PHOUBE("Phoube", "github.com/Phoube", Feature.HIDE_OTHER_PLAYERS_PRESENTS, Feature.EASIER_PRESENT_OPENING, Feature.ZEALOT_COUNTER_FORZEN_SCYTHE_SUPPORT); private Set features; private String author; diff --git a/src/main/resources/lang/en_us.json b/src/main/resources/lang/en_us.json index 8552d17327..3fe290f673 100644 --- a/src/main/resources/lang/en_us.json +++ b/src/main/resources/lang/en_us.json @@ -172,7 +172,8 @@ "disableBossMessages": "Disable Boss Messages", "hideOtherPlayersPresents": "Hide Other Player's Presents", "easierPresentOpening": "Open Presents Easier", - "showSwordKills": "Show Sword Kills" + "showSwordKills": "Show Sword Kills", + "zealotCounterFrozenScythe": "Zealot Counter Frozen Scythe Support" }, "messages": { "enchants": "Enchants", From 0d5c2ae2b5a0b87255fb7971108d9c4ec8c081ed Mon Sep 17 00:00:00 2001 From: Phoube <> Date: Thu, 29 Oct 2020 12:05:23 -0400 Subject: [PATCH 5/8] Refactored and commented code --- .../biscuit/skyblockaddons/core/Feature.java | 2 +- .../features/FrozenScytheProjectile.java | 137 +++++------------- .../listeners/PlayerListener.java | 94 +++--------- 3 files changed, 57 insertions(+), 176 deletions(-) diff --git a/src/main/java/codes/biscuit/skyblockaddons/core/Feature.java b/src/main/java/codes/biscuit/skyblockaddons/core/Feature.java index 765155a06a..5fb0a64e13 100644 --- a/src/main/java/codes/biscuit/skyblockaddons/core/Feature.java +++ b/src/main/java/codes/biscuit/skyblockaddons/core/Feature.java @@ -183,7 +183,7 @@ public enum Feature { HIDE_OTHER_PLAYERS_PRESENTS(150, "settings.hideOtherPlayersPresents", null,false), EASIER_PRESENT_OPENING(151, "settings.easierPresentOpening", null,false), - ZEALOT_COUNTER_FORZEN_SCYTHE_SUPPORT(94, Message.SETTING_ZEALOT_COUNTER_FROZEN_SCYTHE_SUPPORT, true), + ZEALOT_COUNTER_FORZEN_SCYTHE_SUPPORT(152, Message.SETTING_ZEALOT_COUNTER_FROZEN_SCYTHE_SUPPORT, true), WARNING_TIME(-1, Message.SETTING_WARNING_DURATION, false), diff --git a/src/main/java/codes/biscuit/skyblockaddons/features/FrozenScytheProjectile.java b/src/main/java/codes/biscuit/skyblockaddons/features/FrozenScytheProjectile.java index 60e0dbd76d..35b8842384 100644 --- a/src/main/java/codes/biscuit/skyblockaddons/features/FrozenScytheProjectile.java +++ b/src/main/java/codes/biscuit/skyblockaddons/features/FrozenScytheProjectile.java @@ -21,14 +21,13 @@ public class FrozenScytheProjectile { - @Getter - private static Map frozenScytheProjectiles = new HashMap<>(); - @Setter - private static Vec3 lastRightClickLookVec = null; - @Setter - private static Vec3 lastRightClickEyePos = null; - @Setter - private static long lastRightClickTime = 0; + // A list of projectiles spawned in the world from the player's position + @Getter private static Map frozenScytheProjectiles = new HashMap<>(); + // A set of right click information from the last time the player right clicked with the frozen scythe + @Setter private static Vec3 lastRightClickLookVec = null; + @Setter private static Vec3 lastRightClickEyePos = null; + @Setter private static long lastRightClickTime = 0; + private Vec3 projectileLocation; @Getter @@ -37,70 +36,69 @@ public class FrozenScytheProjectile { @Getter private Map potentialHitEntities = new HashMap<>(); + + public FrozenScytheProjectile(EntityArmorStand stand, Vec3 relativeProjectileLoc) { projectileStand = stand; projectileLocation = relativeProjectileLoc; } + /* - Returns the true position of the center of the ice block on the armorstand - Turns out it's not entirely useful since hypixel seems to register hits based on the armorstand - With the notable exception of the height of the projectile + Returns the true position of the center of the ice/packed ice block on the armorstand + Turns out it's not entirely useful since hypixel seems to register hits based on the armorstand's bb/position + With the notable exception of the height of the ice block making a big difference */ public Vec3 getProjectilePosition() { return projectileStand.getPositionVector().add(projectileLocation); } - // Normal in flight scythe speed is about 1.8 blocks per tick + + + /* + The projectile is dead when it is truly dead, or when it's been motionless for some time + Motion seems to be the best way of figuring out whether the projectile is "active" + */ public boolean isDead() { return projectileStand.isDead || (projectileStand.ticksExisted > 5 && ticksMotionless > 5); } + + /* Called every tick */ public void onUpdate() { if (getMotion() < .01) { ticksMotionless++; - - //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText((projectileStand.isCollided ? "true" : "false"))); } else { ticksMotionless = 0; } - //long currTime = System.currentTimeMillis(); - // Keep track of only recently intercepted entities - /* - for (Map.Entry entry : potentialHitEntities.entrySet()) { - if (currTime - entry.getValue() > 150) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("Rem: " + entry.getKey().toString())); - } - } - potentialHitEntities.values().removeIf((hitTime) -> currTime - hitTime > 150); - //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("Middle: " + potentialHitEntities.size())); - List list = Minecraft.getMinecraft().theWorld.getEntitiesWithinAABB(EntityEnderman.class, getBoundingBox()); - for (EntityEnderman enderman : list) { - potentialHitEntities.put(enderman.getUniqueID(), currTime); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("Add: " + enderman.getUniqueID().toString())); - //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(String.format("Hit1 %5.3f, %5.3f, %5.3f | %5.3f, %5.3f, %5.3f", enderman.posX - projectileStand.posX, enderman.posY - projectileStand.posY, enderman.posZ - projectileStand.posZ, - // enderman.posX - getProjectilePosition().xCoord, enderman.posY - getProjectilePosition().yCoord, enderman.posZ - getProjectilePosition().zCoord))); - } - */ - //for (UUID id : potentialHitEntities.keySet()) { - // Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(id.toString())); - //} - } + + + /* + Get the projectile motion in the last tick + */ public double getMotion() { return projectileStand.getDistance(projectileStand.prevPosX, projectileStand.prevPosY, projectileStand.prevPosZ); } + + /* + Get the (albeit weird) bounding box of the projectile. + Does not work perfectly, but should intercept with the bb of an entity that is killed with the projectile + May only work with enderman bounding boxes cause I didn't test on anything else...idk why it wouldn't work though. + */ public AxisAlignedBB getBoundingBox() { return new AxisAlignedBB(projectileStand.posX - 1.35, getProjectilePosition().yCoord - .1, projectileStand.posZ - 1.35, projectileStand.posX + 1.35, getProjectilePosition().yCoord + .1, projectileStand.posZ + 1.35); } + + /** * Returns an instance of FrozenScytheProjectile if this entity is in fact part of a frozen * scythe projectile, or null if not. @@ -138,77 +136,10 @@ public static FrozenScytheProjectile checkAndReturnFrozenScytheProjectile(Entity } return new FrozenScytheProjectile(stand, blockPos); - /* - // Check a small range around the player - List stands = Minecraft.getMinecraft().theWorld.getEntitiesWithinAABB(EntityArmorStand.class, - mc.thePlayer.getEntityBoundingBox().expand(2, 2, 2)); - - ArrayList projectiles = new ArrayList<>(); - EntityArmorStand farthestProjectile = null; - double farthestProjectileDistance = 0; - - for (EntityArmorStand stand : stands) { - - // Check if it's a recently spawned, small, invisible armorstand holding a block - if (stand.ticksExisted >= 5 || !stand.isInvisible() || !stand.isSmall() || stand.getHeldItem() == null || - !(stand.getHeldItem().getItem() instanceof ItemBlock)) { - continue; - } - // Check that the held block is ice or packed ice - Block heldBlock = ((ItemBlock)stand.getHeldItem().getItem()).getBlock(); - if (!(heldBlock instanceof BlockIce) && !(heldBlock instanceof BlockPackedIce)) { - continue; - } - Vec3 lookVec = lastRightClickLookVec; - Vec3 projectileVec = new Vec3(stand.posX, stand.posY + .37, stand.posZ); - projectileVec = projectileVec.subtract(lastRightClickEyePos); - // Check if the player is within 2.5 blocks and is looking within 20 degrees of the stand - if (projectileVec.lengthVector() > 2.5 || - lookVec.dotProduct(projectileVec.normalize()) < MathHelper.cos((float) (20 / 180.0 * Math.PI))) { - continue; - } - projectiles.add(stand.getUniqueID()); - // Track the "first" projectile only - if (projectileVec.lengthVector() > farthestProjectileDistance) { - farthestProjectile = stand; - farthestProjectileDistance = projectileVec.lengthVector(); - } - } - // Frozen scythe projectiles have 5 stands - if (projectiles.size() < 5) { - return null; - } - // Insert the farthest projectile a thte f - projectiles.remove(farthestProjectile); - - - Vec3 blockPos = getHeldBlockRelativeCenter(farthestProjectile); - - return new FrozenScytheProjectile(farthestProjectile, blockPos, projectiles); - */ } - /* - Was the given enderman recently in contact with one of the frozen scythe projectiles? - Return the projectile if so, null if not - */ - /* - public static FrozenScytheProjectile checkProjectileRecentlyNearEnderman(UUID endermanID) { - // - for (FrozenScytheProjectile f : frozenScytheProjectiles.values()) { - if (f.potentialHitEntities.containsKey(endermanID) && - System.currentTimeMillis() - f.potentialHitEntities.get(endermanID) <= 150) { - return f; - } - } - - return null; - } - */ - - // t2 matrix translates to arm height and inverts x/y direction private static final float[] t2v = { -1, 0, 0, 0, 0,-1, 0, 1.5078125f, diff --git a/src/main/java/codes/biscuit/skyblockaddons/listeners/PlayerListener.java b/src/main/java/codes/biscuit/skyblockaddons/listeners/PlayerListener.java index e37f621bf3..937568710a 100644 --- a/src/main/java/codes/biscuit/skyblockaddons/listeners/PlayerListener.java +++ b/src/main/java/codes/biscuit/skyblockaddons/listeners/PlayerListener.java @@ -512,37 +512,36 @@ public void onTick(TickEvent.ClientTickEvent e) { main.getUtils().playLoudSound("random.successful_hit", 0.8); } - // This is duplicated in the scheduled task for explosive bow...@Biscuit please refactor the code for abstraction. - // IMO recentlykilledzealots should be fitered (kept up to date) every tick regardless of whether there is an arrow spawned - Long currTime = System.currentTimeMillis(); + // @Biscuit consider refactoring to use the scheduler instead of the ontick method...seems a bit messy/not universally used at all to me at the moment though. // It takes 0-350 (and sometimes even 500) ms before the projecctile reaches the dead entity - // May cause some false positives if a kill is contested by another player + // May cause some false positives if a kill is contested by another player...aka we give "ties" to client player + Long currTime = System.currentTimeMillis(); recentlyKilledZealots.keySet().removeIf((killedTime) -> currTime - killedTime > 350); - // New frozen scythe logic - // Remove counted enderman after 1s (arbitrary, but should give enough time for deletion) + // Remove counted enderman after 1s (arbitrary, but should give enough time for it not to be counted multiple times) countedEndermenFrozScythe.values().removeIf((countedTime) -> currTime - countedTime > 1000); // Update all frozen scythe projectiles and check for recent enderman deaths near them for (FrozenScytheProjectile projectile : FrozenScytheProjectile.getFrozenScytheProjectiles().values()) { // Update projectile.onUpdate(); - // Check recent zealot deaths and determine whether they occured close to projectiles + // Check recent zealot deaths and determine whether they occurred close to projectiles AxisAlignedBB bb = projectile.getBoundingBox(); for (Map.Entry> entry : recentlyKilledZealots.entrySet()) { Set deaths = entry.getValue(); for (EntityDeathInfo info : deaths) { if (!countedEndermenFrozScythe.containsKey(info.getEntityID()) && bb.intersectsWith(info.getLastBB())) { countedEndermenFrozScythe.put(info.getEntityID(), currTime); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("Frozen scythe near dead zealot " + (currTime - entry.getKey()))); + //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("Frozen scythe near dead zealot " + (currTime - entry.getKey()))); main.getPersistentValuesManager().getPersistentValues().setKills(main.getPersistentValuesManager().getPersistentValues().getKills() + 1); main.getPersistentValuesManager().saveValues(); EndstoneProtectorManager.onKill(); } } } - Vec3 pos = projectile.getProjectilePosition(); - mc.renderGlobal.spawnParticle(EnumParticleTypes.VILLAGER_HAPPY.getParticleID(), true, pos.xCoord, pos.yCoord, pos.zCoord, 0, 0, 0); + // Uncomment if you'd like to see the projectile position overlaid with another particle + //Vec3 pos = projectile.getProjectilePosition(); + //mc.renderGlobal.spawnParticle(EnumParticleTypes.VILLAGER_HAPPY.getParticleID(), true, pos.xCoord, pos.yCoord, pos.zCoord, 0, 0, 0); } // Remove dead projectiles FrozenScytheProjectile.getFrozenScytheProjectiles().values().removeIf((projectile) -> projectile.isDead()); @@ -682,83 +681,34 @@ public void onDeath(LivingDeathEvent e) { main.getPersistentValuesManager().getPersistentValues().setKills(main.getPersistentValuesManager().getPersistentValues().getKills() + 1); main.getPersistentValuesManager().saveValues(); EndstoneProtectorManager.onKill(); - } else if (main.getConfigValues().isEnabled(Feature.ZEALOT_COUNTER_EXPLOSIVE_BOW_SUPPORT)) { - if (isZealot(e.entity)) { - //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("Killed " + e.entity.getUniqueID())); - long now = System.currentTimeMillis(); - if (recentlyKilledZealots.containsKey(now)) { - recentlyKilledZealots.get(now).add(new EntityDeathInfo(e.entity)); - } else { - recentlyKilledZealots.put(now, Sets.newHashSet(new EntityDeathInfo(e.entity))); - } - /* - if (!countedEndermenFrozScythe.containsKey(e.entity.getUniqueID())) { - FrozenScytheProjectile f = FrozenScytheProjectile.checkProjectileRecentlyNearEnderman(e.entity.getUniqueID()); - if (f != null) { - countedEndermenFrozScythe.put(e.entity.getUniqueID(), System.currentTimeMillis()); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("Zealot killed near recent frozen scythe")); - main.getPersistentValuesManager().getPersistentValues().setKills(main.getPersistentValuesManager().getPersistentValues().getKills() + 1); - main.getPersistentValuesManager().saveValues(); - EndstoneProtectorManager.onKill(); - } - } - */ + } else if (main.getConfigValues().isEnabled(Feature.ZEALOT_COUNTER_EXPLOSIVE_BOW_SUPPORT) || + main.getConfigValues().isEnabled(Feature.ZEALOT_COUNTER_FORZEN_SCYTHE_SUPPORT) && isZealot(e.entity)) { + + // Track recently killed zealots for explosive bow and frozen scythe + long now = System.currentTimeMillis(); + if (recentlyKilledZealots.containsKey(now)) { + recentlyKilledZealots.get(now).add(new EntityDeathInfo(e.entity)); + } else { + recentlyKilledZealots.put(now, Sets.newHashSet(new EntityDeathInfo(e.entity))); + } + + if (main.getConfigValues().isEnabled(Feature.ZEALOT_COUNTER_EXPLOSIVE_BOW_SUPPORT)) { + explosiveBowExplosions.keySet().removeIf((explosionTime) -> now - explosionTime > 150); Map.Entry latestExplosion = explosiveBowExplosions.lastEntry(); if (latestExplosion == null) return; Vec3 explosionLocation = latestExplosion.getValue(); - -// int possibleZealotsKilled = 1; -// System.out.println("This means "+possibleZealotsKilled+" may have been killed..."); -// int originalPossibleZealotsKilled = possibleZealotsKilled; - Vec3 deathLocation = e.entity.getPositionVector(); - double distance = explosionLocation.distanceTo(deathLocation); -// System.out.println("Distance was "+distance+"!"); if (explosionLocation.distanceTo(deathLocation) < 4.6) { -// possibleZealotsKilled--; - main.getPersistentValuesManager().getPersistentValues().setKills(main.getPersistentValuesManager().getPersistentValues().getKills() + 1); main.getPersistentValuesManager().saveValues(); EndstoneProtectorManager.onKill(); } - -// System.out.println((originalPossibleZealotsKilled-possibleZealotsKilled)+" zealots were actually killed..."); } } - /* - if (main.getUtils().isOnSkyblock() && !countedEndermenFrozScythe.containsKey(e.entity.getUniqueID())) { - //if (isZealot(e.entity)) { - long now = System.currentTimeMillis(); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(e.entity.getUniqueID() + " died")); - FrozenScytheProjectile f = FrozenScytheProjectile.checkProjectileRecentlyNearEnderman(e.entity.getUniqueID()); - if (f != null) { - countedEndermenFrozScythe.put(e.entity.getUniqueID(), System.currentTimeMillis()); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("Zealot killed near recent frozen scythe")); - main.getPersistentValuesManager().getPersistentValues().setKills(main.getPersistentValuesManager().getPersistentValues().getKills() + 1); - main.getPersistentValuesManager().saveValues(); - EndstoneProtectorManager.onKill(); - } - //} - } - */ } - //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(FrozenScytheProjectile.getFrozenScytheProjectiles().size() + " dies " + e.entity.getName())); - /* - for (FrozenScytheProjectile f : FrozenScytheProjectile.getFrozenScytheProjectiles().values()) { - // Get the frozen scythe ice position - //double x = f.posX - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(String.format("H %5.3f, %5.3f, %5.3f", e.entity.posX - f.getProjectileStand().posX, e.entity.posY - f.getProjectileStand().posY, e.entity.posZ - f.getProjectileStand().posZ))); - - if (f.getProjectileStand().getEntityBoundingBox().expand(4,0,4).intersectsWith(e.entity.getEntityBoundingBox())) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(String.format("Hit %5.3f, %5.3f, %5.3f | %5.3f, %5.3f, %5.3f", e.entity.posX - f.getProjectileStand().posX, e.entity.posY - f.getProjectileStand().posY, e.entity.posZ - f.getProjectileStand().posZ, - e.entity.posX - f.getProjectilePosition().xCoord, e.entity.posY - f.getProjectilePosition().yCoord, e.entity.posZ - f.getProjectilePosition().zCoord))); - } - } - */ - NPCUtils.getNpcLocations().remove(e.entity.getUniqueID()); } From ce4975670675866096e8ebeb3504293f34e0e0c1 Mon Sep 17 00:00:00 2001 From: Phoube <> Date: Thu, 29 Oct 2020 12:44:41 -0400 Subject: [PATCH 6/8] Everything seems to be working --- .../listeners/PlayerListener.java | 56 ++++++++++--------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/src/main/java/codes/biscuit/skyblockaddons/listeners/PlayerListener.java b/src/main/java/codes/biscuit/skyblockaddons/listeners/PlayerListener.java index 937568710a..a951b95502 100644 --- a/src/main/java/codes/biscuit/skyblockaddons/listeners/PlayerListener.java +++ b/src/main/java/codes/biscuit/skyblockaddons/listeners/PlayerListener.java @@ -520,31 +520,34 @@ public void onTick(TickEvent.ClientTickEvent e) { // Remove counted enderman after 1s (arbitrary, but should give enough time for it not to be counted multiple times) countedEndermenFrozScythe.values().removeIf((countedTime) -> currTime - countedTime > 1000); + // Remove dead projectiles + FrozenScytheProjectile.getFrozenScytheProjectiles().values().removeIf((projectile) -> projectile.isDead()); // Update all frozen scythe projectiles and check for recent enderman deaths near them - for (FrozenScytheProjectile projectile : FrozenScytheProjectile.getFrozenScytheProjectiles().values()) { - // Update - projectile.onUpdate(); - // Check recent zealot deaths and determine whether they occurred close to projectiles - AxisAlignedBB bb = projectile.getBoundingBox(); - for (Map.Entry> entry : recentlyKilledZealots.entrySet()) { - Set deaths = entry.getValue(); - for (EntityDeathInfo info : deaths) { - if (!countedEndermenFrozScythe.containsKey(info.getEntityID()) && bb.intersectsWith(info.getLastBB())) { - countedEndermenFrozScythe.put(info.getEntityID(), currTime); - //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("Frozen scythe near dead zealot " + (currTime - entry.getKey()))); - main.getPersistentValuesManager().getPersistentValues().setKills(main.getPersistentValuesManager().getPersistentValues().getKills() + 1); - main.getPersistentValuesManager().saveValues(); - EndstoneProtectorManager.onKill(); + if (main.getConfigValues().isEnabled(Feature.ZEALOT_COUNTER_FORZEN_SCYTHE_SUPPORT)) { + for (FrozenScytheProjectile projectile : FrozenScytheProjectile.getFrozenScytheProjectiles().values()) { + // Update + projectile.onUpdate(); + // Check recent zealot deaths and determine whether they occurred close to projectiles + AxisAlignedBB bb = projectile.getBoundingBox(); + for (Map.Entry> entry : recentlyKilledZealots.entrySet()) { + Set deaths = entry.getValue(); + for (EntityDeathInfo info : deaths) { + if (!countedEndermenFrozScythe.containsKey(info.getEntityID()) && bb.intersectsWith(info.getLastBB())) { + countedEndermenFrozScythe.put(info.getEntityID(), currTime); + //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("Frozen scythe near dead zealot " + (currTime - entry.getKey()))); + main.getPersistentValuesManager().getPersistentValues().setKills(main.getPersistentValuesManager().getPersistentValues().getKills() + 1); + main.getPersistentValuesManager().saveValues(); + EndstoneProtectorManager.onKill(); + } } } + // Uncomment if you'd like to see the projectile position overlaid with another particle + //Vec3 pos = projectile.getProjectilePosition(); + //mc.renderGlobal.spawnParticle(EnumParticleTypes.VILLAGER_HAPPY.getParticleID(), true, pos.xCoord, pos.yCoord, pos.zCoord, 0, 0, 0); } - // Uncomment if you'd like to see the projectile position overlaid with another particle - //Vec3 pos = projectile.getProjectilePosition(); - //mc.renderGlobal.spawnParticle(EnumParticleTypes.VILLAGER_HAPPY.getParticleID(), true, pos.xCoord, pos.yCoord, pos.zCoord, 0, 0, 0); } - // Remove dead projectiles - FrozenScytheProjectile.getFrozenScytheProjectiles().values().removeIf((projectile) -> projectile.isDead()); + if (timerTick == 20) { // Add natural mana every second (increase is based on your max mana). if (main.getRenderListener().isPredictMana()) { @@ -696,15 +699,16 @@ public void onDeath(LivingDeathEvent e) { explosiveBowExplosions.keySet().removeIf((explosionTime) -> now - explosionTime > 150); Map.Entry latestExplosion = explosiveBowExplosions.lastEntry(); - if (latestExplosion == null) return; + if (latestExplosion != null) { - Vec3 explosionLocation = latestExplosion.getValue(); - Vec3 deathLocation = e.entity.getPositionVector(); + Vec3 explosionLocation = latestExplosion.getValue(); + Vec3 deathLocation = e.entity.getPositionVector(); - if (explosionLocation.distanceTo(deathLocation) < 4.6) { - main.getPersistentValuesManager().getPersistentValues().setKills(main.getPersistentValuesManager().getPersistentValues().getKills() + 1); - main.getPersistentValuesManager().saveValues(); - EndstoneProtectorManager.onKill(); + if (explosionLocation.distanceTo(deathLocation) < 4.6) { + main.getPersistentValuesManager().getPersistentValues().setKills(main.getPersistentValuesManager().getPersistentValues().getKills() + 1); + main.getPersistentValuesManager().saveValues(); + EndstoneProtectorManager.onKill(); + } } } } From c2bdc83366373a946325b97323c1d8a4c1a2b93b Mon Sep 17 00:00:00 2001 From: Phoube <> Date: Thu, 29 Oct 2020 13:05:16 -0400 Subject: [PATCH 7/8] weird unused import causing build issue. Removed + removed other unused imports --- .../skyblockaddons/features/FrozenScytheProjectile.java | 5 ----- .../biscuit/skyblockaddons/listeners/PlayerListener.java | 1 - 2 files changed, 6 deletions(-) diff --git a/src/main/java/codes/biscuit/skyblockaddons/features/FrozenScytheProjectile.java b/src/main/java/codes/biscuit/skyblockaddons/features/FrozenScytheProjectile.java index 35b8842384..ecb2ee4c14 100644 --- a/src/main/java/codes/biscuit/skyblockaddons/features/FrozenScytheProjectile.java +++ b/src/main/java/codes/biscuit/skyblockaddons/features/FrozenScytheProjectile.java @@ -1,6 +1,5 @@ package codes.biscuit.skyblockaddons.features; -import codes.biscuit.skyblockaddons.core.EntityAggregate; import lombok.Getter; import lombok.Setter; import net.minecraft.block.Block; @@ -9,14 +8,10 @@ import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityArmorStand; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.monster.EntityEnderman; -import net.minecraft.entity.monster.EntityMob; import net.minecraft.item.ItemBlock; import net.minecraft.util.*; import javax.vecmath.Matrix4f; -import java.awt.*; import java.util.*; public class FrozenScytheProjectile { diff --git a/src/main/java/codes/biscuit/skyblockaddons/listeners/PlayerListener.java b/src/main/java/codes/biscuit/skyblockaddons/listeners/PlayerListener.java index a951b95502..800c17f0c8 100644 --- a/src/main/java/codes/biscuit/skyblockaddons/listeners/PlayerListener.java +++ b/src/main/java/codes/biscuit/skyblockaddons/listeners/PlayerListener.java @@ -24,7 +24,6 @@ import codes.biscuit.skyblockaddons.utils.*; import codes.biscuit.skyblockaddons.utils.objects.IntPair; import com.google.common.collect.Sets; -import javafx.scene.chart.Axis; import lombok.Getter; import lombok.Setter; import net.minecraft.client.Minecraft; From 328834ebe856220521efc902965f9464dbc9e77c Mon Sep 17 00:00:00 2001 From: Phoube <11449309+Phoube@users.noreply.github.com> Date: Mon, 2 Nov 2020 17:38:39 -0500 Subject: [PATCH 8/8] Update docs --- .../skyblockaddons/features/FrozenScytheProjectile.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/codes/biscuit/skyblockaddons/features/FrozenScytheProjectile.java b/src/main/java/codes/biscuit/skyblockaddons/features/FrozenScytheProjectile.java index ecb2ee4c14..24133a1451 100644 --- a/src/main/java/codes/biscuit/skyblockaddons/features/FrozenScytheProjectile.java +++ b/src/main/java/codes/biscuit/skyblockaddons/features/FrozenScytheProjectile.java @@ -14,6 +14,12 @@ import javax.vecmath.Matrix4f; import java.util.*; + +/** + * This class identifies and stores a frozen scythe projectile (a single armorstand with ice or packed ice) + * + * @author Phoube + */ public class FrozenScytheProjectile { // A list of projectiles spawned in the world from the player's position