Implement WG45PlotRegion

Implement WS175PlotRegion
This commit is contained in:
2026-03-21 18:05:47 +01:00
parent 3961938b8e
commit 7b22c9af63
4 changed files with 30 additions and 31 deletions
@@ -155,7 +155,7 @@ public class DynamicRegionSystem implements RegionSystem {
} }
public @NonNull Stream<Region> getRegionsByType(RegionType type) { public @NonNull Stream<Region> getRegionsByType(RegionType type) {
return regionTypeMap.get(type).stream(); return regionTypeMap.getOrDefault(type, Collections.emptySet()).stream();
} }
private Stream<Pair<Region, NeighbourDirection>> getNeighbours(Region region, boolean noCorners, boolean fastCache, Collection<Region> regions) { private Stream<Pair<Region, NeighbourDirection>> getNeighbours(Region region, boolean noCorners, boolean fastCache, Collection<Region> regions) {
@@ -58,7 +58,7 @@ public class AreaBlock implements Region.Area {
int tempSizeZ = switch (copyLocation) { int tempSizeZ = switch (copyLocation) {
case CENTER -> size.getZ() * 2 + distance; case CENTER -> size.getZ() * 2 + distance;
case SIDE -> size.getZ() + distance; case SIDE -> size.getZ() + distance - 1;
}; };
// Calculate Offset Region to North // Calculate Offset Region to North
@@ -19,17 +19,16 @@
package de.steamwar.bausystem.region.dynamic.modes.wargear_45; package de.steamwar.bausystem.region.dynamic.modes.wargear_45;
import de.steamwar.bausystem.region.RegionBackups; import de.steamwar.bausystem.region.*;
import de.steamwar.bausystem.region.RegionData;
import de.steamwar.bausystem.region.RegionHistory;
import de.steamwar.bausystem.region.RegionType;
import de.steamwar.bausystem.region.dynamic.*; 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.AreaTile;
import de.steamwar.bausystem.region.dynamic.modes.PlotRegionBackups; import de.steamwar.bausystem.region.dynamic.modes.PlotRegionBackups;
import de.steamwar.bausystem.region.dynamic.modes.PlotRegionData; import de.steamwar.bausystem.region.dynamic.modes.PlotRegionData;
import de.steamwar.bausystem.region.dynamic.modes.miniwargear.MWGUtils; import de.steamwar.bausystem.region.dynamic.modes.miniwargear.MWGUtils;
import de.steamwar.bausystem.region.dynamic.modes.warship_230.WS230Utils; import de.steamwar.bausystem.region.dynamic.modes.warship_230.WS230Utils;
import de.steamwar.bausystem.region.flags.Flag; import de.steamwar.bausystem.region.flags.Flag;
import de.steamwar.bausystem.shared.Pair;
import de.steamwar.sql.GameModeConfig; import de.steamwar.sql.GameModeConfig;
import lombok.NonNull; import lombok.NonNull;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@@ -56,8 +55,8 @@ public class WG45PlotRegion extends DynamicRegion {
private static final VariantSelector WIREFRAME = VariantSelector.Get(new File(DIRECTORY, "wireframe")); private static final VariantSelector WIREFRAME = VariantSelector.Get(new File(DIRECTORY, "wireframe"));
private final AreaTile area; private final AreaTile area;
private final Area northArea; private final AreaBlock northArea;
private final Area southArea; private final AreaBlock southArea;
private final RegionHistory history; private final RegionHistory history;
private final RegionBackups backups; private final RegionBackups backups;
@@ -65,10 +64,11 @@ public class WG45PlotRegion extends DynamicRegion {
super(id, minX, minZ); super(id, minX, minZ);
Tile tile = Tile.fromXZ(minX, minZ).orElseThrow(); Tile tile = Tile.fromXZ(minX, minZ).orElseThrow();
area = new AreaTile(tile, TILE_X, TILE_Z, this, REGION); area = new AreaTile(tile, TILE_X, TILE_Z, this, REGION);
// northArea = new AreaBlock();
// southArea = new AreaBlock(); Pair<AreaBlock, AreaBlock> pair = AreaBlock.create(this, 36, new Point(67, 41, 47), new Point(16, 0, 16), new Point(16, 16, 16), AreaBlock.CopyLocation.CENTER, 50);
northArea = Area.EMPTY; // TODO: Replace! northArea = pair.getKey();
southArea = Area.EMPTY; // TODO: Replace! southArea = pair.getValue();
regionData = new PlotRegionData(this); regionData = new PlotRegionData(this);
history = new RegionHistory.Impl(10); history = new RegionHistory.Impl(10);
backups = new PlotRegionBackups(this, PlotRegionData::new); backups = new PlotRegionBackups(this, PlotRegionData::new);
@@ -89,8 +89,8 @@ public class WG45PlotRegion extends DynamicRegion {
public @NonNull Area getBuildArea() { public @NonNull Area getBuildArea() {
return switch (regionData.get(Flag.TESTBLOCK).getWithDefault()) { return switch (regionData.get(Flag.TESTBLOCK).getWithDefault()) {
case NO_VALUE -> Area.EMPTY; case NO_VALUE -> Area.EMPTY;
case NORTH -> northArea;//.withSelector(WIREFRAME); case NORTH -> southArea.withSelector(WIREFRAME);
case SOUTH -> southArea;//.withSelector(WIREFRAME); case SOUTH -> northArea.withSelector(WIREFRAME);
}; };
} }
@@ -98,8 +98,8 @@ public class WG45PlotRegion extends DynamicRegion {
public @NonNull Area getTestblockArea() { public @NonNull Area getTestblockArea() {
return switch (regionData.get(Flag.TESTBLOCK).getWithDefault()) { return switch (regionData.get(Flag.TESTBLOCK).getWithDefault()) {
case NO_VALUE -> Area.EMPTY; case NO_VALUE -> Area.EMPTY;
case NORTH -> southArea;//.withSelector(TESTBLOCK); case NORTH -> northArea.withSelector(TESTBLOCK);
case SOUTH -> northArea;//.withSelector(TESTBLOCK); case SOUTH -> southArea.withSelector(TESTBLOCK);
}; };
} }
@@ -19,16 +19,14 @@
package de.steamwar.bausystem.region.dynamic.modes.warship_175; package de.steamwar.bausystem.region.dynamic.modes.warship_175;
import de.steamwar.bausystem.region.RegionBackups; import de.steamwar.bausystem.region.*;
import de.steamwar.bausystem.region.RegionData;
import de.steamwar.bausystem.region.RegionHistory;
import de.steamwar.bausystem.region.RegionType;
import de.steamwar.bausystem.region.dynamic.*; 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.AreaTile;
import de.steamwar.bausystem.region.dynamic.modes.PlotRegionBackups; import de.steamwar.bausystem.region.dynamic.modes.PlotRegionBackups;
import de.steamwar.bausystem.region.dynamic.modes.PlotRegionData; import de.steamwar.bausystem.region.dynamic.modes.PlotRegionData;
import de.steamwar.bausystem.region.dynamic.modes.miniwargear.MWGUtils;
import de.steamwar.bausystem.region.flags.Flag; import de.steamwar.bausystem.region.flags.Flag;
import de.steamwar.bausystem.shared.Pair;
import de.steamwar.sql.GameModeConfig; import de.steamwar.sql.GameModeConfig;
import lombok.NonNull; import lombok.NonNull;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@@ -55,8 +53,8 @@ public class WS175PlotRegion extends DynamicRegion {
private static final VariantSelector WIREFRAME = VariantSelector.Get(new File(DIRECTORY, "wireframe")); private static final VariantSelector WIREFRAME = VariantSelector.Get(new File(DIRECTORY, "wireframe"));
private final AreaTile area; private final AreaTile area;
private final Area northArea; private final AreaBlock northArea;
private final Area southArea; private final AreaBlock southArea;
private final RegionHistory history; private final RegionHistory history;
private final RegionBackups backups; private final RegionBackups backups;
@@ -64,10 +62,11 @@ public class WS175PlotRegion extends DynamicRegion {
super(id, minX, minZ); super(id, minX, minZ);
Tile tile = Tile.fromXZ(minX, minZ).orElseThrow(); Tile tile = Tile.fromXZ(minX, minZ).orElseThrow();
area = new AreaTile(tile, TILE_X, TILE_Z, this, REGION); area = new AreaTile(tile, TILE_X, TILE_Z, this, REGION);
// northArea = new AreaBlock();
// southArea = new AreaBlock(); Pair<AreaBlock, AreaBlock> pair = AreaBlock.create(this, 36, new Point(175, 58, 39), new Point(0, 0, 0), new Point(0, 0, 0), AreaBlock.CopyLocation.SIDE, 132);
northArea = Area.EMPTY; // TODO: Replace! northArea = pair.getKey();
southArea = Area.EMPTY; // TODO: Replace! southArea = pair.getValue();
regionData = new PlotRegionData(this); regionData = new PlotRegionData(this);
history = new RegionHistory.Impl(10); history = new RegionHistory.Impl(10);
backups = new PlotRegionBackups(this, PlotRegionData::new); backups = new PlotRegionBackups(this, PlotRegionData::new);
@@ -88,8 +87,8 @@ public class WS175PlotRegion extends DynamicRegion {
public @NonNull Area getBuildArea() { public @NonNull Area getBuildArea() {
return switch (regionData.get(Flag.TESTBLOCK).getWithDefault()) { return switch (regionData.get(Flag.TESTBLOCK).getWithDefault()) {
case NO_VALUE -> Area.EMPTY; case NO_VALUE -> Area.EMPTY;
case NORTH -> northArea;//.withSelector(WIREFRAME); case NORTH -> southArea.withSelector(WIREFRAME);
case SOUTH -> southArea;//.withSelector(WIREFRAME); case SOUTH -> northArea.withSelector(WIREFRAME);
}; };
} }
@@ -97,8 +96,8 @@ public class WS175PlotRegion extends DynamicRegion {
public @NonNull Area getTestblockArea() { public @NonNull Area getTestblockArea() {
return switch (regionData.get(Flag.TESTBLOCK).getWithDefault()) { return switch (regionData.get(Flag.TESTBLOCK).getWithDefault()) {
case NO_VALUE -> Area.EMPTY; case NO_VALUE -> Area.EMPTY;
case NORTH -> southArea;//.withSelector(TESTBLOCK); case NORTH -> northArea.withSelector(TESTBLOCK);
case SOUTH -> northArea;//.withSelector(TESTBLOCK); case SOUTH -> southArea.withSelector(TESTBLOCK);
}; };
} }