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