mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-04 00:45:57 +00:00
remove World#getGenerator
This commit is contained in:
parent
2517b74951
commit
ec14666c6d
@ -17,8 +17,6 @@ public interface World extends Handle {
|
|||||||
|
|
||||||
int getMaxHeight();
|
int getMaxHeight();
|
||||||
|
|
||||||
ChunkGenerator getGenerator();
|
|
||||||
|
|
||||||
Chunk getChunkAt(int x, int z);
|
Chunk getChunkAt(int x, int z);
|
||||||
|
|
||||||
default Chunk getChunkAt(Vector3 location) {
|
default Chunk getChunkAt(Vector3 location) {
|
||||||
@ -55,9 +53,7 @@ public interface World extends Handle {
|
|||||||
|
|
||||||
int getMinHeight();
|
int getMinHeight();
|
||||||
|
|
||||||
default TerraChunkGenerator getTerraGenerator() {
|
TerraChunkGenerator getTerraGenerator();
|
||||||
return ((GeneratorWrapper) getGenerator().getHandle()).getHandle();
|
|
||||||
}
|
|
||||||
|
|
||||||
BiomeProvider getBiomeProvider();
|
BiomeProvider getBiomeProvider();
|
||||||
|
|
||||||
|
@ -9,8 +9,6 @@ import com.dfsek.terra.api.vector.Vector3;
|
|||||||
import com.dfsek.terra.api.world.Chunk;
|
import com.dfsek.terra.api.world.Chunk;
|
||||||
import com.dfsek.terra.api.world.World;
|
import com.dfsek.terra.api.world.World;
|
||||||
import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
|
import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
|
||||||
import com.dfsek.terra.api.world.generator.ChunkGenerator;
|
|
||||||
import com.dfsek.terra.api.world.generator.GeneratorWrapper;
|
|
||||||
|
|
||||||
public class DummyWorld implements World {
|
public class DummyWorld implements World {
|
||||||
@Override
|
@Override
|
||||||
@ -28,11 +26,6 @@ public class DummyWorld implements World {
|
|||||||
return 255;
|
return 255;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ChunkGenerator getGenerator() {
|
|
||||||
return () -> (GeneratorWrapper) () -> null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Chunk getChunkAt(int x, int z) {
|
public Chunk getChunkAt(int x, int z) {
|
||||||
throw new UnsupportedOperationException("Cannot get chunk in DummyWorld");
|
throw new UnsupportedOperationException("Cannot get chunk in DummyWorld");
|
||||||
|
@ -7,9 +7,7 @@ import com.dfsek.terra.api.entity.EntityType;
|
|||||||
import com.dfsek.terra.api.vector.Vector3;
|
import com.dfsek.terra.api.vector.Vector3;
|
||||||
import com.dfsek.terra.api.world.Chunk;
|
import com.dfsek.terra.api.world.Chunk;
|
||||||
import com.dfsek.terra.api.world.World;
|
import com.dfsek.terra.api.world.World;
|
||||||
import com.dfsek.terra.api.world.generator.ChunkGenerator;
|
|
||||||
import com.dfsek.terra.bukkit.BukkitEntity;
|
import com.dfsek.terra.bukkit.BukkitEntity;
|
||||||
import com.dfsek.terra.bukkit.generator.BukkitChunkGenerator;
|
|
||||||
import com.dfsek.terra.bukkit.world.block.state.BukkitBlockEntity;
|
import com.dfsek.terra.bukkit.world.block.state.BukkitBlockEntity;
|
||||||
import com.dfsek.terra.bukkit.world.entity.BukkitEntityType;
|
import com.dfsek.terra.bukkit.world.entity.BukkitEntityType;
|
||||||
|
|
||||||
@ -33,11 +31,6 @@ public class BukkitWorld implements World {
|
|||||||
return delegate.getMaxHeight();
|
return delegate.getMaxHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ChunkGenerator getGenerator() {
|
|
||||||
return new BukkitChunkGenerator(delegate.getGenerator());
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return delegate.getName();
|
return delegate.getName();
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,9 @@ import com.dfsek.terra.api.world.World;
|
|||||||
import com.dfsek.terra.fabric.TerraFabricPlugin;
|
import com.dfsek.terra.fabric.TerraFabricPlugin;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.registry.BuiltinRegistries;
|
import net.minecraft.util.registry.BuiltinRegistries;
|
||||||
|
import net.minecraft.world.ServerWorldAccess;
|
||||||
import net.minecraft.world.StructureWorldAccess;
|
import net.minecraft.world.StructureWorldAccess;
|
||||||
|
import net.minecraft.world.WorldAccess;
|
||||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||||
import net.minecraft.world.gen.feature.ConfiguredFeature;
|
import net.minecraft.world.gen.feature.ConfiguredFeature;
|
||||||
import org.spongepowered.asm.mixin.Implements;
|
import org.spongepowered.asm.mixin.Implements;
|
||||||
@ -32,7 +34,7 @@ public abstract class ConfiguredFeatureMixin {
|
|||||||
String id = BuiltinRegistries.CONFIGURED_FEATURE.getId((ConfiguredFeature<?, ?>) (Object) this).toString();
|
String id = BuiltinRegistries.CONFIGURED_FEATURE.getId((ConfiguredFeature<?, ?>) (Object) this).toString();
|
||||||
try(ProfileFrame ignore = TerraFabricPlugin.getInstance().getProfiler().profile("fabric_tree:" + id.toLowerCase(Locale.ROOT))) {
|
try(ProfileFrame ignore = TerraFabricPlugin.getInstance().getProfiler().profile("fabric_tree:" + id.toLowerCase(Locale.ROOT))) {
|
||||||
StructureWorldAccess fabricWorldAccess = ((StructureWorldAccess) world);
|
StructureWorldAccess fabricWorldAccess = ((StructureWorldAccess) world);
|
||||||
ChunkGenerator generatorWrapper = (ChunkGenerator) world.getGenerator();
|
ChunkGenerator generatorWrapper = ((ServerWorldAccess) world).toServerWorld().getChunkManager().getChunkGenerator();
|
||||||
return generate(fabricWorldAccess, generatorWrapper, r, new BlockPos(l.getBlockX(), l.getBlockY(), l.getBlockZ()));
|
return generate(fabricWorldAccess, generatorWrapper, r, new BlockPos(l.getBlockX(), l.getBlockY(), l.getBlockZ()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ import net.minecraft.world.ChunkRegion;
|
|||||||
import net.minecraft.world.ServerWorldAccess;
|
import net.minecraft.world.ServerWorldAccess;
|
||||||
import net.minecraft.world.TickScheduler;
|
import net.minecraft.world.TickScheduler;
|
||||||
import net.minecraft.world.WorldAccess;
|
import net.minecraft.world.WorldAccess;
|
||||||
|
import net.minecraft.world.chunk.ChunkManager;
|
||||||
import net.minecraft.world.chunk.ChunkStatus;
|
import net.minecraft.world.chunk.ChunkStatus;
|
||||||
import org.spongepowered.asm.mixin.Final;
|
import org.spongepowered.asm.mixin.Final;
|
||||||
import org.spongepowered.asm.mixin.Implements;
|
import org.spongepowered.asm.mixin.Implements;
|
||||||
@ -56,6 +57,9 @@ public abstract class ChunkRegionMixin {
|
|||||||
@Shadow
|
@Shadow
|
||||||
public abstract TickScheduler<Fluid> getFluidTickScheduler();
|
public abstract TickScheduler<Fluid> getFluidTickScheduler();
|
||||||
|
|
||||||
|
@Shadow
|
||||||
|
public abstract ChunkManager getChunkManager();
|
||||||
|
|
||||||
public int terraWorld$getMaxHeight() {
|
public int terraWorld$getMaxHeight() {
|
||||||
return (((ChunkRegion) (Object) this).getBottomY()) + ((ChunkRegion) (Object) this).getHeight();
|
return (((ChunkRegion) (Object) this).getBottomY()) + ((ChunkRegion) (Object) this).getHeight();
|
||||||
}
|
}
|
||||||
@ -116,7 +120,7 @@ public abstract class ChunkRegionMixin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public TerraChunkGenerator terraWorld$getTerraGenerator() {
|
public TerraChunkGenerator terraWorld$getTerraGenerator() {
|
||||||
return ((FabricChunkGeneratorWrapper) terraWorld$getGenerator()).getHandle();
|
return ((FabricChunkGeneratorWrapper) world.getChunkManager().getChunkGenerator()).getHandle();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
|
@ -8,7 +8,6 @@ import com.dfsek.terra.api.entity.EntityType;
|
|||||||
import com.dfsek.terra.api.vector.Vector3;
|
import com.dfsek.terra.api.vector.Vector3;
|
||||||
import com.dfsek.terra.api.world.Chunk;
|
import com.dfsek.terra.api.world.Chunk;
|
||||||
import com.dfsek.terra.api.world.World;
|
import com.dfsek.terra.api.world.World;
|
||||||
import com.dfsek.terra.api.world.generator.ChunkGenerator;
|
|
||||||
import net.jafama.FastMath;
|
import net.jafama.FastMath;
|
||||||
import net.querz.mca.MCAFile;
|
import net.querz.mca.MCAFile;
|
||||||
import net.querz.mca.MCAUtil;
|
import net.querz.mca.MCAUtil;
|
||||||
@ -40,11 +39,6 @@ public class DirectWorld implements World {
|
|||||||
return 255;
|
return 255;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ChunkGenerator getGenerator() {
|
|
||||||
return generator;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Chunk getChunkAt(int x, int z) {
|
public Chunk getChunkAt(int x, int z) {
|
||||||
MCAFile file = compute(x, z);
|
MCAFile file = compute(x, z);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user