mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-03 00:15:35 +00:00
cursed #equals
This commit is contained in:
parent
5c0482e972
commit
3c56813d6b
@ -18,13 +18,18 @@ public class BufferedLootApplication implements BufferedItem {
|
||||
|
||||
@Override
|
||||
public void paste(Location origin) {
|
||||
BlockState data = origin.getBlock().getState();
|
||||
if(!(data instanceof Container)) {
|
||||
main.logger().severe("Failed to place loot at " + origin + "; block " + data + " is not container.");
|
||||
return;
|
||||
try {
|
||||
BlockState data = origin.getBlock().getState();
|
||||
if(!(data instanceof Container)) {
|
||||
main.logger().severe("Failed to place loot at " + origin + "; block " + data + " is not container.");
|
||||
return;
|
||||
}
|
||||
Container container = (Container) data;
|
||||
table.fillInventory(container.getInventory(), new FastRandom(origin.hashCode()));
|
||||
data.update(false);
|
||||
} catch(Exception e) {
|
||||
main.logger().warning("Could not apply loot at " + origin + ": " + e.getMessage());
|
||||
main.getDebugLogger().stack(e);
|
||||
}
|
||||
Container container = (Container) data;
|
||||
table.fillInventory(container.getInventory(), new FastRandom(origin.hashCode()));
|
||||
data.update(false);
|
||||
}
|
||||
}
|
||||
|
@ -15,8 +15,8 @@ public class BufferedStateManipulator implements BufferedItem {
|
||||
|
||||
@Override
|
||||
public void paste(Location origin) {
|
||||
BlockState state = origin.getBlock().getState();
|
||||
try {
|
||||
BlockState state = origin.getBlock().getState();
|
||||
state.applyState(data);
|
||||
state.update(false);
|
||||
} catch(Exception e) {
|
||||
|
@ -43,6 +43,7 @@ public class StructurePopulator implements TerraBlockPopulator {
|
||||
continue;
|
||||
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)));
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import com.dfsek.terra.fabric.world.generator.FabricChunkGenerator;
|
||||
import com.dfsek.terra.fabric.world.generator.FabricChunkGeneratorWrapper;
|
||||
import com.dfsek.terra.fabric.world.handles.FabricWorld;
|
||||
import com.dfsek.terra.fabric.world.handles.chunk.FabricChunkWorldAccess;
|
||||
import com.dfsek.terra.fabric.world.handles.world.FabricSeededWorldAccess;
|
||||
import com.dfsek.terra.fabric.world.handles.world.FabricWorldAccess;
|
||||
import com.mojang.serialization.Codec;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
@ -27,8 +27,8 @@ public class PopulatorFeature extends Feature<DefaultFeatureConfig> {
|
||||
FabricChunkGeneratorWrapper gen = (FabricChunkGeneratorWrapper) chunkGenerator;
|
||||
FabricChunkWorldAccess chunk = new FabricChunkWorldAccess(world, pos.getX() >> 4, pos.getZ() >> 4);
|
||||
FabricWorld world1 = new FabricWorld(world.toServerWorld(), new FabricChunkGenerator(chunkGenerator));
|
||||
gen.getCavePopulator().populate(new FabricSeededWorldAccess(world, world.getSeed(), chunkGenerator), chunk);
|
||||
gen.getStructurePopulator().populate(new FabricSeededWorldAccess(world, world.getSeed(), chunkGenerator), chunk);
|
||||
gen.getCavePopulator().populate(new FabricWorldAccess(world), chunk);
|
||||
gen.getStructurePopulator().populate(new FabricWorldAccess(world), chunk);
|
||||
gen.getOrePopulator().populate(world1, chunk);
|
||||
gen.getTreePopulator().populate(world1, chunk);
|
||||
gen.getFloraPopulator().populate(world1, chunk);
|
||||
|
@ -80,7 +80,7 @@ public class FabricWorld implements World, FabricWorldHandle {
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if(!(obj instanceof FabricWorld)) return false;
|
||||
return ((ServerWorldAccess) ((FabricWorld) obj).delegate.world).toServerWorld().equals(((ServerWorldAccess) delegate.world).toServerWorld());
|
||||
return ((ServerWorldAccess) ((FabricWorld) obj).delegate.world).toServerWorld().equals(((ServerWorldAccess) delegate.world).toServerWorld()); // FIXME this method is cursed.
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -78,7 +78,7 @@ public class FabricWorldChunkRegion implements World, FabricWorldHandle {
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if(!(obj instanceof FabricWorldChunkRegion)) return false;
|
||||
return super.equals(obj);
|
||||
return delegate.chunk.equals(((FabricWorldChunkRegion) obj).delegate.chunk);
|
||||
//return ((ServerWorldAccess) ((FabricWorldChunkRegion) obj).delegate.chunk).toServerWorld().equals(((ServerWorldAccess) delegate.chunk).toServerWorld());
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user