mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +01:00
Fix my stupid mistake of using lamdas not creating nested classes when creating schematics. "this" doesn't work like that. Cheers Java.
This commit is contained in:
parent
9c3d2cfb02
commit
02f3c3ef50
@ -130,8 +130,7 @@ public abstract class SchematicHandler {
|
|||||||
name =
|
name =
|
||||||
plot.getId().x + ";" + plot.getId().y + ',' + plot.getArea() + ',' + owner;
|
plot.getId().x + ";" + plot.getId().y + ',' + plot.getArea() + ',' + owner;
|
||||||
} else {
|
} else {
|
||||||
name = namingScheme
|
name = namingScheme.replaceAll("%id%", plot.getId().toString())
|
||||||
.replaceAll("%id%", plot.getId().toString())
|
|
||||||
.replaceAll("%idx%", plot.getId().x + "")
|
.replaceAll("%idx%", plot.getId().x + "")
|
||||||
.replaceAll("%idy%", plot.getId().y + "")
|
.replaceAll("%idy%", plot.getId().y + "")
|
||||||
.replaceAll("%world%", plot.getArea().toString());
|
.replaceAll("%world%", plot.getArea().toString());
|
||||||
@ -566,34 +565,42 @@ public abstract class SchematicHandler {
|
|||||||
final int p2z = pos2.getZ();
|
final int p2z = pos2.getZ();
|
||||||
final int ey = pos2.getY();
|
final int ey = pos2.getY();
|
||||||
Iterator<Integer> yiter = IntStream.range(sy, ey + 1).iterator();
|
Iterator<Integer> yiter = IntStream.range(sy, ey + 1).iterator();
|
||||||
final Runnable yTask = () -> {
|
final Runnable yTask = new Runnable() {
|
||||||
|
@Override public void run() {
|
||||||
long ystart = System.currentTimeMillis();
|
long ystart = System.currentTimeMillis();
|
||||||
while (yiter.hasNext() && System.currentTimeMillis() - ystart < 20) {
|
while (yiter.hasNext() && System.currentTimeMillis() - ystart < 20) {
|
||||||
final int y = yiter.next();
|
final int y = yiter.next();
|
||||||
Iterator<Integer> ziter = IntStream.range(p1z, p2z + 1).iterator();
|
Iterator<Integer> ziter = IntStream.range(p1z, p2z + 1).iterator();
|
||||||
final Runnable zTask = () -> {
|
final Runnable zTask = new Runnable() {
|
||||||
|
@Override public void run() {
|
||||||
long zstart = System.currentTimeMillis();
|
long zstart = System.currentTimeMillis();
|
||||||
while (ziter.hasNext()
|
while (ziter.hasNext()
|
||||||
&& System.currentTimeMillis() - zstart < 20) {
|
&& System.currentTimeMillis() - zstart < 20) {
|
||||||
final int z = ziter.next();
|
final int z = ziter.next();
|
||||||
Iterator<Integer> xiter =
|
Iterator<Integer> xiter =
|
||||||
IntStream.range(p1x, p2x + 1).iterator();
|
IntStream.range(p1x, p2x + 1).iterator();
|
||||||
final Runnable xTask = () -> {
|
final Runnable xTask = new Runnable() {
|
||||||
|
@Override public void run() {
|
||||||
long xstart = System.currentTimeMillis();
|
long xstart = System.currentTimeMillis();
|
||||||
final int ry = y - sy;
|
final int ry = y - sy;
|
||||||
final int rz = z - p1z;
|
final int rz = z - p1z;
|
||||||
while (xiter.hasNext()
|
while (xiter.hasNext()
|
||||||
&& System.currentTimeMillis() - xstart < 20) {
|
&& System.currentTimeMillis() - xstart
|
||||||
|
< 20) {
|
||||||
final int x = xiter.next();
|
final int x = xiter.next();
|
||||||
final int rx = x - p1x;
|
final int rx = x - p1x;
|
||||||
BlockVector3 point = BlockVector3.at(x, y, z);
|
BlockVector3 point =
|
||||||
BaseBlock block =
|
BlockVector3.at(x, y, z);
|
||||||
cuboidRegion.getWorld().getFullBlock(point);
|
BaseBlock block = cuboidRegion.getWorld()
|
||||||
|
.getFullBlock(point);
|
||||||
if (block.getNbtData() != null) {
|
if (block.getNbtData() != null) {
|
||||||
Map<String, Tag> values = new HashMap<>();
|
Map<String, Tag> values =
|
||||||
|
new HashMap<>();
|
||||||
for (Map.Entry<String, Tag> entry : block
|
for (Map.Entry<String, Tag> entry : block
|
||||||
.getNbtData().getValue().entrySet()) {
|
.getNbtData().getValue()
|
||||||
values.put(entry.getKey(), entry.getValue());
|
.entrySet()) {
|
||||||
|
values.put(entry.getKey(),
|
||||||
|
entry.getValue());
|
||||||
}
|
}
|
||||||
// Remove 'id' if it exists. We want 'Id'
|
// Remove 'id' if it exists. We want 'Id'
|
||||||
values.remove("id");
|
values.remove("id");
|
||||||
@ -603,11 +610,13 @@ public abstract class SchematicHandler {
|
|||||||
values.remove("y");
|
values.remove("y");
|
||||||
values.remove("z");
|
values.remove("z");
|
||||||
|
|
||||||
values.put("Id", new StringTag(block.getNbtId()));
|
values.put("Id",
|
||||||
values.put("Pos",
|
new StringTag(block.getNbtId()));
|
||||||
new IntArrayTag(new int[] {rx, ry, rz}));
|
values.put("Pos", new IntArrayTag(
|
||||||
|
new int[] {rx, ry, rz}));
|
||||||
|
|
||||||
tileEntities.add(new CompoundTag(values));
|
tileEntities
|
||||||
|
.add(new CompoundTag(values));
|
||||||
}
|
}
|
||||||
String blockKey =
|
String blockKey =
|
||||||
block.toImmutableState().getAsString();
|
block.toImmutableState().getAsString();
|
||||||
@ -629,7 +638,8 @@ public abstract class SchematicHandler {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
BlockVector2 pt = BlockVector2.at(x, z);
|
BlockVector2 pt = BlockVector2.at(x, z);
|
||||||
BiomeType biome = cuboidRegion.getWorld().getBiome(pt);
|
BiomeType biome =
|
||||||
|
cuboidRegion.getWorld().getBiome(pt);
|
||||||
String biomeStr = biome.getId();
|
String biomeStr = biome.getId();
|
||||||
int biomeId;
|
int biomeId;
|
||||||
if (biomePalette.containsKey(biomeStr)) {
|
if (biomePalette.containsKey(biomeStr)) {
|
||||||
@ -647,12 +657,14 @@ public abstract class SchematicHandler {
|
|||||||
if (xiter.hasNext()) {
|
if (xiter.hasNext()) {
|
||||||
this.run();
|
this.run();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
xTask.run();
|
xTask.run();
|
||||||
}
|
}
|
||||||
if (ziter.hasNext()) {
|
if (ziter.hasNext()) {
|
||||||
this.run();
|
this.run();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
zTask.run();
|
zTask.run();
|
||||||
}
|
}
|
||||||
@ -661,6 +673,7 @@ public abstract class SchematicHandler {
|
|||||||
} else {
|
} else {
|
||||||
regionTask.run();
|
regionTask.run();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
yTask.run();
|
yTask.run();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user