Skip to content

Commit

Permalink
chore: ok
Browse files Browse the repository at this point in the history
  • Loading branch information
phinner committed Dec 9, 2023
1 parent 09dd365 commit 3f24e54
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 133 deletions.
2 changes: 2 additions & 0 deletions src/main/java/com/xpdustry/hexed/HexedPluginReloaded.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.xpdustry.hexed.api.generation.ImmutableSchematic;
import com.xpdustry.hexed.api.generation.MapGenerator;
import com.xpdustry.hexed.api.generation.MapLoader;
import com.xpdustry.hexed.api.generation.RouterFestHexedGenerator;
import com.xpdustry.hexed.api.generation.SimpleHexedMapContext;
import fr.xpdustry.distributor.api.plugin.AbstractMindustryPlugin;
import java.io.IOException;
Expand Down Expand Up @@ -114,6 +115,7 @@ public void onInit() {
}

this.generators.put("anuke", new AnukeHexedGenerator());
this.generators.put("router-fest", new RouterFestHexedGenerator());
this.state = new SimpleHexedState(this.defaultBase, Collections.emptyList());

this.addListener(new HexedLogic(this));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,20 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.xpdustry.hexed.generation;
package com.xpdustry.hexed.api.generation;

import com.xpdustry.hexed.model.Hex;
import com.xpdustry.hexed.model.SquareHex;
import com.xpdustry.hexed.api.model.Hex;
import com.xpdustry.hexed.api.model.Square;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import mindustry.Vars;
import mindustry.content.Blocks;
import mindustry.game.Schematic;
import mindustry.game.Schematics;
import mindustry.world.blocks.environment.Floor;

public final class RouterFestHexedGenerator implements MapGenerator<HexedMapContext> {

private static final RouterFestHexedGenerator INSTANCE = new RouterFestHexedGenerator();
public class RouterFestHexedGenerator implements MapGenerator<HexedMapContext> {

private static final int HEX_MAP_SIZE = 8;
private static final int HEX_SIZE = 49;
Expand All @@ -48,12 +45,6 @@ public final class RouterFestHexedGenerator implements MapGenerator<HexedMapCont
private static final Floor HEX_BORDER_FLOOR = Blocks.darkPanel1.asFloor();
private static final Floor HEX_FLOOR = Blocks.darksand.asFloor();

public static RouterFestHexedGenerator getInstance() {
return INSTANCE;
}

private RouterFestHexedGenerator() {}

@Override
public HexedMapContext generate() {
final var context = new SimpleHexedMapContext();
Expand All @@ -73,7 +64,7 @@ public HexedMapContext generate() {
final var cx = x + (HEX_TOTAL_SIZE / 2);
final var cy = y + (HEX_TOTAL_SIZE / 2);

hexes.add(new SquareHex(j + (i * HEX_MAP_SIZE), cx, cy, HEX_DIAMETER));
hexes.add(new Square(j + (i * HEX_MAP_SIZE), cx, cy, HEX_DIAMETER));

context.forEachTile(x, y, HEX_TOTAL_SIZE, HEX_TOTAL_SIZE, (tx, ty, tile) -> {
tile.setBlock(Blocks.air);
Expand Down Expand Up @@ -151,9 +142,9 @@ public HexedMapContext generate() {
return context;
}

private Schematic getRouterBase() {
private ImmutableSchematic getRouterBase() {
try (final var stream = this.getClass().getResourceAsStream("/router.msch")) {
return Schematics.read(Objects.requireNonNull(stream));
return new ImmutableSchematic(Schematics.read(Objects.requireNonNull(stream)));
} catch (final IOException e) {
throw new RuntimeException("Failed to load the router base schematic.", e);
}
Expand Down
117 changes: 0 additions & 117 deletions src/main/java/com/xpdustry/hexed/commands/HexedStartCommand.java

This file was deleted.

0 comments on commit 3f24e54

Please sign in to comment.