mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-04 00:45:57 +00:00
fix structure buffer weirdness
This commit is contained in:
parent
3c56813d6b
commit
bb6dcb3880
@ -123,7 +123,6 @@ public class StructureScript {
|
|||||||
private StructureBuffer computeBuffer(Location location, Random random, Rotation rotation) {
|
private StructureBuffer computeBuffer(Location location, Random random, Rotation rotation) {
|
||||||
try {
|
try {
|
||||||
return cache.get(location, () -> {
|
return cache.get(location, () -> {
|
||||||
System.out.println("{" + FastMath.floorDiv(location.getBlockX(), 16) + ", " + FastMath.floorDiv(location.getBlockZ(), 16) + "} : " + cache.size() + " : " + location.hashCode());
|
|
||||||
StructureBuffer buf = new StructureBuffer(location);
|
StructureBuffer buf = new StructureBuffer(location);
|
||||||
buf.setSucceeded(applyBlock(new TerraImplementationArguments(buf, rotation, random, 0)));
|
buf.setSucceeded(applyBlock(new TerraImplementationArguments(buf, rotation, random, 0)));
|
||||||
return buf;
|
return buf;
|
||||||
|
@ -26,7 +26,7 @@ public class StructureBuffer implements Buffer {
|
|||||||
Location current = origin.clone().add(location);
|
Location current = origin.clone().add(location);
|
||||||
if(FastMath.floorDiv(current.getBlockX(), 16) != chunk.getX() || FastMath.floorDiv(current.getBlockZ(), 16) != chunk.getZ())
|
if(FastMath.floorDiv(current.getBlockX(), 16) != chunk.getX() || FastMath.floorDiv(current.getBlockZ(), 16) != chunk.getZ())
|
||||||
return;
|
return;
|
||||||
item.paste(current);
|
item.paste(chunk, current);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,13 @@
|
|||||||
package com.dfsek.terra.api.structures.structure.buffer.items;
|
package com.dfsek.terra.api.structures.structure.buffer.items;
|
||||||
|
|
||||||
import com.dfsek.terra.api.math.vector.Location;
|
import com.dfsek.terra.api.math.vector.Location;
|
||||||
|
import com.dfsek.terra.api.platform.world.Chunk;
|
||||||
|
|
||||||
public interface BufferedItem {
|
public interface BufferedItem {
|
||||||
void paste(Location origin);
|
void paste(Location origin);
|
||||||
|
|
||||||
|
default void paste(Chunk chunk, Location origin) {
|
||||||
|
origin.setWorld(chunk.getWorld()); // Fabric weirdness
|
||||||
|
paste(origin);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,8 +42,6 @@ public class StructurePopulator implements TerraBlockPopulator {
|
|||||||
if(!((UserDefinedBiome) provider.getBiome(spawn)).getConfig().getStructures().contains(conf))
|
if(!((UserDefinedBiome) provider.getBiome(spawn)).getConfig().getStructures().contains(conf))
|
||||||
continue;
|
continue;
|
||||||
Random random = new FastRandom(MathUtil.getCarverChunkSeed(FastMath.floorDiv(spawn.getBlockX(), 16), FastMath.floorDiv(spawn.getBlockZ(), 16), world.getSeed()));
|
Random random = new FastRandom(MathUtil.getCarverChunkSeed(FastMath.floorDiv(spawn.getBlockX(), 16), FastMath.floorDiv(spawn.getBlockZ(), 16), world.getSeed()));
|
||||||
System.out.println("chunk: {" + chunk.getX() + ", " + chunk.getZ() + "}");
|
|
||||||
System.out.println(world.getBlockAt(cx, 255, cz).getBlockData());
|
|
||||||
conf.getStructure().get(random).execute(spawn.setY(conf.getSpawnStart().get(random)), chunk, random, Rotation.fromDegrees(90 * random.nextInt(4)));
|
conf.getStructure().get(random).execute(spawn.setY(conf.getSpawnStart().get(random)), chunk, random, Rotation.fromDegrees(90 * random.nextInt(4)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ public class FabricWorld implements World, FabricWorldHandle {
|
|||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if(!(obj instanceof FabricWorld)) return false;
|
if(!(obj instanceof FabricWorld)) return false;
|
||||||
return ((ServerWorldAccess) ((FabricWorld) obj).delegate.world).toServerWorld().equals(((ServerWorldAccess) delegate.world).toServerWorld()); // FIXME this method is cursed.
|
return ((ServerWorldAccess) ((FabricWorld) obj).delegate.world).toServerWorld().equals(((ServerWorldAccess) delegate.world).toServerWorld());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -78,8 +78,7 @@ public class FabricWorldChunkRegion implements World, FabricWorldHandle {
|
|||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if(!(obj instanceof FabricWorldChunkRegion)) return false;
|
if(!(obj instanceof FabricWorldChunkRegion)) return false;
|
||||||
return delegate.chunk.equals(((FabricWorldChunkRegion) obj).delegate.chunk);
|
return ((ServerWorldAccess) ((FabricWorldChunkRegion) obj).delegate.chunk).toServerWorld().equals(((ServerWorldAccess) delegate.chunk).toServerWorld());
|
||||||
//return ((ServerWorldAccess) ((FabricWorldChunkRegion) obj).delegate.chunk).toServerWorld().equals(((ServerWorldAccess) delegate.chunk).toServerWorld());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user