From d6412bf19c68904ec0fae0f5380984e6e758f21b Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 9 May 2020 22:25:19 -0400 Subject: [PATCH] Static cleanup --- core/src/mindustry/game/Schematics.java | 44 +++++++++---------- .../maps/planet/TODOPlanetGenerator.java | 3 +- 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/core/src/mindustry/game/Schematics.java b/core/src/mindustry/game/Schematics.java index f428181431..43d9d96e35 100644 --- a/core/src/mindustry/game/Schematics.java +++ b/core/src/mindustry/game/Schematics.java @@ -275,28 +275,6 @@ public class Schematics implements Loadable{ .removeAll(s -> !s.block.isVisible() || !s.block.unlockedCur()); } - public void placeLoadout(Schematic schem, int x, int y){ - Stile coreTile = schem.tiles.find(s -> s.block instanceof CoreBlock); - if(coreTile == null) throw new IllegalArgumentException("Schematic has no core tile. Exiting."); - int ox = x - coreTile.x, oy = y - coreTile.y; - schem.tiles.each(st -> { - Tile tile = world.tile(st.x + ox, st.y + oy); - if(tile == null) return; - - tile.setBlock(st.block, state.rules.defaultTeam, 0); - tile.rotation(st.rotation); - - Object config = st.config; - if(tile.entity != null){ - tile.entity.configureAny(config); - } - - if(st.block instanceof Drill){ - tile.getLinkedTiles(t -> t.setOverlay(Blocks.oreCopper)); - } - }); - } - /** Adds a schematic to the list, also copying it into the files.*/ public void add(Schematic schematic){ all.add(schematic); @@ -394,6 +372,28 @@ public class Schematics implements Loadable{ } } + public static void placeLoadout(Schematic schem, int x, int y){ + Stile coreTile = schem.tiles.find(s -> s.block instanceof CoreBlock); + if(coreTile == null) throw new IllegalArgumentException("Schematic has no core tile. Exiting."); + int ox = x - coreTile.x, oy = y - coreTile.y; + schem.tiles.each(st -> { + Tile tile = world.tile(st.x + ox, st.y + oy); + if(tile == null) return; + + tile.setBlock(st.block, state.rules.defaultTeam, 0); + tile.rotation(st.rotation); + + Object config = st.config; + if(tile.entity != null){ + tile.entity.configureAny(config); + } + + if(st.block instanceof Drill){ + tile.getLinkedTiles(t -> t.setOverlay(Blocks.oreCopper)); + } + }); + } + //region IO methods /** Loads a schematic from base64. May throw an exception. */ diff --git a/core/src/mindustry/maps/planet/TODOPlanetGenerator.java b/core/src/mindustry/maps/planet/TODOPlanetGenerator.java index 4221d70647..7198afee5f 100644 --- a/core/src/mindustry/maps/planet/TODOPlanetGenerator.java +++ b/core/src/mindustry/maps/planet/TODOPlanetGenerator.java @@ -7,6 +7,7 @@ import arc.struct.*; import arc.util.*; import arc.util.noise.*; import mindustry.content.*; +import mindustry.game.*; import mindustry.maps.generators.*; import mindustry.world.*; @@ -259,7 +260,7 @@ public class TODOPlanetGenerator extends PlanetGenerator{ } }); - schematics.placeLoadout(Loadouts.advancedShard, spawn.x, spawn.y); + Schematics.placeLoadout(Loadouts.advancedShard, spawn.x, spawn.y); state.rules.waves = true; }