Implement MiWG7PlotRegion

Implement WS230PlotRegion
This commit is contained in:
2026-03-21 20:51:34 +01:00
parent 9683bb9e93
commit fa5897fa25
2 changed files with 30 additions and 31 deletions
@@ -19,15 +19,14 @@
package de.steamwar.bausystem.region.dynamic.modes.microwargear_7;
import de.steamwar.bausystem.region.RegionBackups;
import de.steamwar.bausystem.region.RegionData;
import de.steamwar.bausystem.region.RegionHistory;
import de.steamwar.bausystem.region.RegionType;
import de.steamwar.bausystem.region.*;
import de.steamwar.bausystem.region.dynamic.*;
import de.steamwar.bausystem.region.dynamic.modes.AreaBlock;
import de.steamwar.bausystem.region.dynamic.modes.AreaTile;
import de.steamwar.bausystem.region.dynamic.modes.PlotRegionBackups;
import de.steamwar.bausystem.region.dynamic.modes.PlotRegionData;
import de.steamwar.bausystem.region.flags.Flag;
import de.steamwar.bausystem.shared.Pair;
import de.steamwar.sql.GameModeConfig;
import lombok.NonNull;
import org.bukkit.Bukkit;
@@ -45,8 +44,7 @@ import java.util.UUID;
)
public class MiWG7PlotRegion extends DynamicRegion {
// TODO: X +/- 1
protected static final int TILE_X = 2;
protected static final int TILE_X = 3;
protected static final int TILE_Z = 5;
private static final File DIRECTORY = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "sections/microwargear_7/plot");
@@ -55,8 +53,8 @@ public class MiWG7PlotRegion extends DynamicRegion {
private static final VariantSelector WIREFRAME = VariantSelector.Get(new File(DIRECTORY, "wireframe"));
private final AreaTile area;
private final Area northArea;
private final Area southArea;
private final AreaBlock northArea;
private final AreaBlock southArea;
private final RegionHistory history;
private final RegionBackups backups;
@@ -64,10 +62,11 @@ public class MiWG7PlotRegion extends DynamicRegion {
super(id, minX, minZ);
Tile tile = Tile.fromXZ(minX, minZ).orElseThrow();
area = new AreaTile(tile, TILE_X, TILE_Z, this, REGION);
// northArea = new AreaBlock();
// southArea = new AreaBlock();
northArea = Area.EMPTY; // TODO: Replace!
southArea = Area.EMPTY; // TODO: Replace!
Pair<AreaBlock, AreaBlock> pair = AreaBlock.create(this, 36, new Point(7, 7, 7), new Point(7, 0, 7), new Point(7, 7, 7), AreaBlock.CopyLocation.CENTER, 50);
northArea = pair.getKey();
southArea = pair.getValue();
regionData = new PlotRegionData(this);
history = new RegionHistory.Impl(10);
backups = new PlotRegionBackups(this, PlotRegionData::new);
@@ -88,8 +87,8 @@ public class MiWG7PlotRegion extends DynamicRegion {
public @NonNull Area getBuildArea() {
return switch (regionData.get(Flag.TESTBLOCK).getWithDefault()) {
case NO_VALUE -> Area.EMPTY;
case NORTH -> northArea;//.withSelector(WIREFRAME);
case SOUTH -> southArea;//.withSelector(WIREFRAME);
case NORTH -> southArea.withSelector(WIREFRAME);
case SOUTH -> northArea.withSelector(WIREFRAME);
};
}
@@ -97,8 +96,8 @@ public class MiWG7PlotRegion extends DynamicRegion {
public @NonNull Area getTestblockArea() {
return switch (regionData.get(Flag.TESTBLOCK).getWithDefault()) {
case NO_VALUE -> Area.EMPTY;
case NORTH -> southArea;//.withSelector(TESTBLOCK);
case SOUTH -> northArea;//.withSelector(TESTBLOCK);
case NORTH -> northArea.withSelector(TESTBLOCK);
case SOUTH -> southArea.withSelector(TESTBLOCK);
};
}
@@ -19,15 +19,14 @@
package de.steamwar.bausystem.region.dynamic.modes.warship_230;
import de.steamwar.bausystem.region.RegionBackups;
import de.steamwar.bausystem.region.RegionData;
import de.steamwar.bausystem.region.RegionHistory;
import de.steamwar.bausystem.region.RegionType;
import de.steamwar.bausystem.region.*;
import de.steamwar.bausystem.region.dynamic.*;
import de.steamwar.bausystem.region.dynamic.modes.AreaBlock;
import de.steamwar.bausystem.region.dynamic.modes.AreaTile;
import de.steamwar.bausystem.region.dynamic.modes.PlotRegionBackups;
import de.steamwar.bausystem.region.dynamic.modes.PlotRegionData;
import de.steamwar.bausystem.region.flags.Flag;
import de.steamwar.bausystem.shared.Pair;
import de.steamwar.sql.GameModeConfig;
import lombok.NonNull;
import org.bukkit.Bukkit;
@@ -46,7 +45,7 @@ import java.util.UUID;
public class WS230PlotRegion extends DynamicRegion {
protected static final int TILE_X = 13;
protected static final int TILE_Z = 9;
protected static final int TILE_Z = 10;
private static final File DIRECTORY = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "sections/warship_230/plot");
private static final VariantSelector REGION = VariantSelector.Get(new File(DIRECTORY, "region"));
@@ -54,8 +53,8 @@ public class WS230PlotRegion extends DynamicRegion {
private static final VariantSelector WIREFRAME = VariantSelector.Get(new File(DIRECTORY, "wireframe"));
private final AreaTile area;
private final Area northArea;
private final Area southArea;
private final AreaBlock northArea;
private final AreaBlock southArea;
private final RegionHistory history;
private final RegionBackups backups;
@@ -63,10 +62,11 @@ public class WS230PlotRegion extends DynamicRegion {
super(id, minX, minZ);
Tile tile = Tile.fromXZ(minX, minZ).orElseThrow();
area = new AreaTile(tile, TILE_X, TILE_Z, this, REGION);
// northArea = new AreaBlock();
// southArea = new AreaBlock();
northArea = Area.EMPTY; // TODO: Replace!
southArea = Area.EMPTY; // TODO: Replace!
Pair<AreaBlock, AreaBlock> pair = AreaBlock.create(this, 36, new Point(230, 58, 43), new Point(12, 0, 8), new Point(12, 0, 8), AreaBlock.CopyLocation.SIDE, 136);
northArea = pair.getKey();
southArea = pair.getValue();
regionData = new PlotRegionData(this);
history = new RegionHistory.Impl(10);
backups = new PlotRegionBackups(this, PlotRegionData::new);
@@ -87,8 +87,8 @@ public class WS230PlotRegion extends DynamicRegion {
public @NonNull Area getBuildArea() {
return switch (regionData.get(Flag.TESTBLOCK).getWithDefault()) {
case NO_VALUE -> Area.EMPTY;
case NORTH -> northArea;//.withSelector(WIREFRAME);
case SOUTH -> southArea;//.withSelector(WIREFRAME);
case NORTH -> southArea.withSelector(WIREFRAME);
case SOUTH -> northArea.withSelector(WIREFRAME);
};
}
@@ -96,8 +96,8 @@ public class WS230PlotRegion extends DynamicRegion {
public @NonNull Area getTestblockArea() {
return switch (regionData.get(Flag.TESTBLOCK).getWithDefault()) {
case NO_VALUE -> Area.EMPTY;
case NORTH -> southArea;//.withSelector(TESTBLOCK);
case SOUTH -> northArea;//.withSelector(TESTBLOCK);
case NORTH -> northArea.withSelector(TESTBLOCK);
case SOUTH -> southArea.withSelector(TESTBLOCK);
};
}