diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/combat/CrystalAuraModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/combat/CrystalAuraModule.java index f45e5e8..65328d0 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/combat/CrystalAuraModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/combat/CrystalAuraModule.java @@ -1,5 +1,6 @@ package me.rigamortis.seppuku.impl.module.combat; +import com.google.common.collect.Lists; import com.google.common.collect.Maps; import me.rigamortis.seppuku.Seppuku; import me.rigamortis.seppuku.api.event.EventStageable; @@ -37,7 +38,6 @@ import team.stiff.pomelo.impl.annotated.handler.annotation.Listener; import java.util.List; import java.util.Map; -import java.util.concurrent.CopyOnWriteArrayList; /** * @author noil @@ -52,11 +52,11 @@ public final class CrystalAuraModule extends Module { public final Value attackMaxDistance = new Value("AttackMaxDistance", new String[]{"AMaxRange", "MaxAttackRange", "AMaxRadius", "AMD", "AMR"}, "Range around the enemy crystals will be attacked", 8.0f, 1.0f, 20.0f, 1.0f); public final Value place = new Value("Place", new String[]{"AutoPlace"}, "Automatically place crystals", true); public final Value placeRapid = new Value("PlaceRapid", new String[]{"RapidPlace"}, "Remove place delay", true); - public final Value placeSpread = new Value("PlaceSpread", new String[]{"SpreadPlace"}, "Spread crystals around target by swapping place positions each time. (toggle on if target is running)", false); + public final Value placeSpread = new Value("PlaceSpread", new String[]{"SpreadPlace"}, "Spread crystals around target by swapping place positions each time (toggle on if target is running)", false); public final Value placeSpreadDistance = new Value("PlaceSpreadDistance", new String[]{"SpreadPlaceDistance", "SpreadDistance"}, "Distance (in blocks) to spread the crystals around the target", 1.0f, 0.0f, 3.0f, 0.1f); public final Value placeDelay = new Value("PlaceDelay", new String[]{"PlaceDelay", "PlaceDel"}, "The delay to place crystals", 15.0f, 0.0f, 500.0f, 1.0f); public final Value placeRadius = new Value("PlaceRadius", new String[]{"Radius", "PR", "PlaceRange", "Range"}, "The radius in blocks around the player to attempt placing in", 5.5f, 1.0f, 7.0f, 0.5f); - public final Value placeMaxDistance = new Value("PlaceMaxDistance", new String[]{"BlockDistance", "MaxBlockDistance", "PMBD", "MBD", "PBD", "BD"}, "Range around the enemy crystals will be placed", 1.5f, 1.0f, 20.0f, 1.0f); + public final Value placeMaxDistance = new Value("PlaceMaxDistance", new String[]{"BlockDistance", "MaxBlockDistance", "PMBD", "MBD", "PBD", "BD"}, "Range around the enemy crystals will be placed (1.1 - 1.6 for feet place)", 1.5f, 1.1f, 16.0f, 1.0f); public final Value placeLocalDistance = new Value("PlaceLocalDistance", new String[]{"LocalDistance", "PLD", "LD"}, "Enemy must be within this range to start placing", 8.0f, 1.0f, 20.0f, 0.5f); public final Value minDamage = new Value("MinDamage", new String[]{"MinDamage", "Min", "MinDmg"}, "The minimum explosion damage calculated to place down a crystal", 1.5f, 0.0f, 20.0f, 0.5f); public final Value offHand = new Value("Offhand", new String[]{"Hand", "otherhand", "off"}, "Use crystals in the off-hand instead of holding them with the main-hand", false); @@ -73,7 +73,7 @@ public final class CrystalAuraModule extends Module { private final Timer placeTimer = new Timer(); private final Map predictedCrystals = Maps.newConcurrentMap(); - private final List placeLocations = new CopyOnWriteArrayList<>(); + private final List placeLocations = Lists.newArrayList(); private final RotationTask placeRotationTask = new RotationTask("CrystalAuraPlaceTask", 6); private final RotationTask attackRotationTask = new RotationTask("CrystalAuraAttackTask", 7); @@ -250,7 +250,8 @@ public final class CrystalAuraModule extends Module { if (event.getPacket() instanceof SPacketSpawnObject) { final SPacketSpawnObject packetSpawnObject = (SPacketSpawnObject) event.getPacket(); if (packetSpawnObject.getType() == 51) { - for (PlaceLocation placeLocation : this.placeLocations) { + for (int i = this.placeLocations.size() - 1; i >= 0; i--) { + final PlaceLocation placeLocation = this.placeLocations.get(i); if (placeLocation.getDistance((int) packetSpawnObject.getX(), (int) packetSpawnObject.getY() - 1, (int) packetSpawnObject.getZ()) <= 1) { placeLocation.placed = true; } @@ -289,7 +290,8 @@ public final class CrystalAuraModule extends Module { final Minecraft mc = Minecraft.getMinecraft(); RenderUtil.begin3D(); - for (PlaceLocation placeLocation : this.placeLocations) { + for (int i = this.placeLocations.size() - 1; i >= 0; i--) { + final PlaceLocation placeLocation = this.placeLocations.get(i); if (placeLocation.alpha <= 0) { this.placeLocations.remove(placeLocation); continue;