From 7b7e803011568dbc9f18a75bf194d39b92d72d45 Mon Sep 17 00:00:00 2001 From: Anuken Date: Mon, 22 Jun 2020 23:08:59 -0400 Subject: [PATCH] Cleanup --- core/src/mindustry/core/Control.java | 5 +++-- core/src/mindustry/game/Schematic.java | 2 +- core/src/mindustry/game/Tutorial.java | 2 +- core/src/mindustry/ui/dialogs/PlanetDialog.java | 8 +++++--- core/src/mindustry/ui/fragments/HudFragment.java | 5 ++--- core/src/mindustry/world/blocks/production/Drill.java | 2 +- gradle.properties | 2 +- 7 files changed, 14 insertions(+), 12 deletions(-) diff --git a/core/src/mindustry/core/Control.java b/core/src/mindustry/core/Control.java index e628a04159..8671e58a67 100644 --- a/core/src/mindustry/core/Control.java +++ b/core/src/mindustry/core/Control.java @@ -25,6 +25,7 @@ import mindustry.maps.Map; import mindustry.type.*; import mindustry.ui.dialogs.*; import mindustry.world.*; +import mindustry.world.blocks.storage.CoreBlock.*; import java.io.*; import java.text.*; @@ -241,7 +242,7 @@ public class Control implements ApplicationListener, Loadable{ } //TODO move - public void handleLaunch(Tilec tile){ + public void handleLaunch(CoreEntity tile){ LaunchCorec ent = LaunchCoreEntity.create(); ent.set(tile); ent.block(Blocks.coreShard); @@ -249,7 +250,7 @@ public class Control implements ApplicationListener, Loadable{ ent.add(); //remove launch requirements from core - player.team().core().items.remove(player.team().core().block.requirements); + tile.items.remove(tile.block.requirements); } public void playSector(Sector sector){ diff --git a/core/src/mindustry/game/Schematic.java b/core/src/mindustry/game/Schematic.java index b6f178a223..a650d0e01e 100644 --- a/core/src/mindustry/game/Schematic.java +++ b/core/src/mindustry/game/Schematic.java @@ -36,7 +36,7 @@ public class Schematic implements Publishable, Comparable{ if(t.block.buildVisibility == BuildVisibility.hidden) return; for(ItemStack stack : t.block.requirements){ - amounts.inc(stack.item.id, stack.amount); + amounts.increment(stack.item.id, stack.amount); } }); Seq stacks = new Seq<>(); diff --git a/core/src/mindustry/game/Tutorial.java b/core/src/mindustry/game/Tutorial.java index d9f91623da..590793a377 100644 --- a/core/src/mindustry/game/Tutorial.java +++ b/core/src/mindustry/game/Tutorial.java @@ -31,7 +31,7 @@ public class Tutorial{ public Tutorial(){ Events.on(BlockBuildEndEvent.class, event -> { if(!event.breaking){ - blocksPlaced.getAndIncrement(event.tile.block(), 0, 1); + blocksPlaced.increment(event.tile.block(), 1); } }); diff --git a/core/src/mindustry/ui/dialogs/PlanetDialog.java b/core/src/mindustry/ui/dialogs/PlanetDialog.java index 2749c6234d..23c9eea5bd 100644 --- a/core/src/mindustry/ui/dialogs/PlanetDialog.java +++ b/core/src/mindustry/ui/dialogs/PlanetDialog.java @@ -22,6 +22,8 @@ import mindustry.graphics.g3d.PlanetRenderer.*; import mindustry.type.*; import mindustry.type.Sector.*; import mindustry.ui.*; +import mindustry.world.blocks.storage.*; +import mindustry.world.blocks.storage.CoreBlock.*; import static mindustry.Vars.*; import static mindustry.graphics.g3d.PlanetRenderer.*; @@ -35,7 +37,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{ private int launchRange; private float zoom = 1f, selectAlpha = 1f; private @Nullable Sector selected, hovered, launchSector; - private Tilec launcher; + private CoreEntity launcher; private Mode mode = look; public PlanetDialog(){ @@ -97,7 +99,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{ return super.show(); } - public void show(Sector sector, int range, Tilec launcher){ + public void show(Sector sector, CoreEntity launcher){ this.launcher = launcher; selected = null; hovered = null; @@ -107,7 +109,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{ zoom = 1f; planets.zoom = 2f; selectAlpha = 0f; - launchRange = range; + launchRange = ((CoreBlock)launcher.block).launchRange; launchSector = sector; mode = launch; diff --git a/core/src/mindustry/ui/fragments/HudFragment.java b/core/src/mindustry/ui/fragments/HudFragment.java index 9c86c9c944..8d818950a0 100644 --- a/core/src/mindustry/ui/fragments/HudFragment.java +++ b/core/src/mindustry/ui/fragments/HudFragment.java @@ -24,7 +24,6 @@ import mindustry.net.Packets.*; import mindustry.type.*; import mindustry.ui.*; import mindustry.ui.dialogs.*; -import mindustry.world.blocks.storage.*; import static mindustry.Vars.*; @@ -365,9 +364,9 @@ public class HudFragment extends Fragment{ t.bottom().visible(() -> state.isCampaign() && player.team().core() != null); t.button("test launch", Icon.warning, () -> { - ui.planet.show(state.getSector(), ((CoreBlock)player.team().core().block).launchRange, player.team().core()); + ui.planet.show(state.getSector(), player.team().core()); }).width(150f) - .disabled(!player.team().core().items.has(player.team().core().block.requirements)); //disable core when missing resources for launch + .disabled(b -> player.team().core() == null || !player.team().core().items.has(player.team().core().block.requirements)); //disable core when missing resources for launch }); blockfrag.build(parent); diff --git a/core/src/mindustry/world/blocks/production/Drill.java b/core/src/mindustry/world/blocks/production/Drill.java index 31a469da45..264f0fa96b 100644 --- a/core/src/mindustry/world/blocks/production/Drill.java +++ b/core/src/mindustry/world/blocks/production/Drill.java @@ -175,7 +175,7 @@ public class Drill extends Block{ for(Tile other : tile.getLinkedTilesAs(this, tempTiles)){ if(canMine(other)){ - oreCount.getAndIncrement(getDrop(other), 0, 1); + oreCount.increment(getDrop(other), 0, 1); } } diff --git a/gradle.properties b/gradle.properties index 5cc5f35899..263bc79c46 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ org.gradle.daemon=true org.gradle.jvmargs=-Xms256m -Xmx1024m -archash=23b2fc721fa7ebb52e2edb0ce72b87731050e76e +archash=639a3f2e3b5657c44b21f74a00ebf93be5892c12