From ac918c1a81487b81a6aa6c7a57f9dea56f664ddd Mon Sep 17 00:00:00 2001 From: Anuken Date: Sun, 28 Oct 2018 18:34:18 -0400 Subject: [PATCH] Warning fix --- build.gradle | 8 +-- .../io/anuke/mindustry/ai/BlockIndexer.java | 6 ++- .../io/anuke/mindustry/entities/Units.java | 49 +++++-------------- 3 files changed, 18 insertions(+), 45 deletions(-) diff --git a/build.gradle b/build.gradle index 7d52470ed2..fcce837e52 100644 --- a/build.gradle +++ b/build.gradle @@ -160,7 +160,6 @@ project(":core") { } dependencies { - compileOnly project(":annotations") build.finalizedBy(finish) def comp = System.properties["release"] == null || System.properties["release"] == "false" @@ -179,13 +178,9 @@ project(":core") { compile "com.badlogicgames.gdx:gdx:$gdxVersion" compile "com.badlogicgames.gdx:gdx-controllers:$gdxVersion" + compileOnly project(":annotations") annotationProcessor project(":annotations") } - - /* - compileJava.options.compilerArgs = [ - "-processor", "io.anuke.annotations.RemoteMethodAnnotationProcessor,io.anuke.annotations.SerializeAnnotationProcessor" - ]*/ } project(":server") { @@ -198,7 +193,6 @@ project(":server") { } dependencies { - compileOnly project(":annotations") compile project(":core") compile project(":kryonet") diff --git a/core/src/io/anuke/mindustry/ai/BlockIndexer.java b/core/src/io/anuke/mindustry/ai/BlockIndexer.java index 07ec34b2e9..7fdd7ada51 100644 --- a/core/src/io/anuke/mindustry/ai/BlockIndexer.java +++ b/core/src/io/anuke/mindustry/ai/BlockIndexer.java @@ -128,7 +128,11 @@ public class BlockIndexer{ for(int ty = ry * structQuadrantSize; ty < (ry + 1) * structQuadrantSize && ty < world.height(); ty++){ Tile other = world.tile(tx, ty); - if(other == null || other.entity == null || other.getTeam() != team || !pred.test(other) || !other.block().targetable) continue; + if(other == null) continue; + + other = other.target(); + + if(other.entity == null || other.getTeam() != team || !pred.test(other) || !other.block().targetable) continue; TileEntity e = other.entity; diff --git a/core/src/io/anuke/mindustry/entities/Units.java b/core/src/io/anuke/mindustry/entities/Units.java index a67974fce0..f8e271fc5b 100644 --- a/core/src/io/anuke/mindustry/entities/Units.java +++ b/core/src/io/anuke/mindustry/entities/Units.java @@ -41,16 +41,12 @@ public class Units{ return target == null || (range != Float.MAX_VALUE && target.distanceTo(x, y) > range) || target.getTeam() == team || !target.isValid(); } - /** - * See {@link #invalidateTarget(TargetTrait, Team, float, float, float)} - */ + /**See {@link #invalidateTarget(TargetTrait, Team, float, float, float)}*/ public static boolean invalidateTarget(TargetTrait target, Team team, float x, float y){ return invalidateTarget(target, team, x, y, Float.MAX_VALUE); } - /** - * See {@link #invalidateTarget(TargetTrait, Team, float, float, float)} - */ + /**See {@link #invalidateTarget(TargetTrait, Team, float, float, float)}*/ public static boolean invalidateTarget(TargetTrait target, Unit targeter){ return invalidateTarget(target, targeter.team, targeter.x, targeter.y, targeter.getWeapon().getAmmo().getRange()); } @@ -129,16 +125,12 @@ public class Units{ return value[0]; } - /** - * Returns the neareset ally tile in a range. - */ + /**Returns the neareset ally tile in a range.*/ public static TileEntity findAllyTile(Team team, float x, float y, float range, Predicate pred){ return world.indexer.findTile(team, x, y, range, pred); } - /** - * Returns the neareset enemy tile in a range. - */ + /**Returns the neareset enemy tile in a range.*/ public static TileEntity findEnemyTile(Team team, float x, float y, float range, Predicate pred){ for(Team enemy : state.teams.enemiesOf(team)){ TileEntity entity = world.indexer.findTile(enemy, x, y, range, pred); @@ -149,9 +141,7 @@ public class Units{ return null; } - /** - * Iterates over all units on all teams, including players. - */ + /**Iterates over all units on all teams, including players.*/ public static void allUnits(Consumer cons){ //check all unit groups first for(EntityGroup group : unitGroups){ @@ -183,9 +173,7 @@ public class Units{ } } - /** - * Returns the closest enemy of this team. Filter by predicate. - */ + /**Returns the closest enemy of this team. Filter by predicate.*/ public static Unit getClosestEnemy(Team team, float x, float y, float range, Predicate predicate){ result = null; cdist = 0f; @@ -208,9 +196,7 @@ public class Units{ return result; } - /** - * Returns the closest ally of this team. Filter by predicate. - */ + /**Returns the closest ally of this team. Filter by predicate.*/ public static Unit getClosest(Team team, float x, float y, float range, Predicate predicate){ result = null; cdist = 0f; @@ -233,9 +219,7 @@ public class Units{ return result; } - /** - * Iterates over all units in a rectangle. - */ + /**Iterates over all units in a rectangle.*/ public static void getNearby(Team team, Rectangle rect, Consumer cons){ EntityGroup group = unitGroups[team.ordinal()]; @@ -249,9 +233,7 @@ public class Units{ }); } - /** - * Iterates over all units in a circle around this position. - */ + /**Iterates over all units in a circle around this position.*/ public static void getNearby(Team team, float x, float y, float radius, Consumer cons){ rect.setSize(radius * 2).setCenter(x, y); @@ -272,9 +254,7 @@ public class Units{ }); } - /** - * Iterates over all units in a rectangle. - */ + /**Iterates over all units in a rectangle.*/ public static void getNearby(Rectangle rect, Consumer cons){ for(Team team : Team.all){ @@ -288,9 +268,7 @@ public class Units{ EntityQuery.getNearby(playerGroup, rect, player -> cons.accept((Unit) player)); } - /** - * Iterates over all units that are enemies of this team. - */ + /**Iterates over all units that are enemies of this team.*/ public static void getNearbyEnemies(Team team, Rectangle rect, Consumer cons){ EnumSet targets = state.teams.enemiesOf(team); @@ -309,9 +287,7 @@ public class Units{ }); } - /** - * Iterates over all units. - */ + /**Iterates over all units.*/ public static void getAllUnits(Consumer cons){ for(Team team : Team.all){ @@ -327,5 +303,4 @@ public class Units{ } } - }