mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-03 16:35:50 +00:00
cleanup
This commit is contained in:
parent
ad9cc1afcb
commit
6ea11de2fd
@ -21,6 +21,6 @@ public class BufferedEntity implements BufferedItem {
|
||||
@Override
|
||||
public void paste(Vector3 origin, World world) {
|
||||
Entity entity = world.spawnEntity(origin.clone().add(0.5, 0, 0.5), type);
|
||||
main.getEventManager().callEvent(new EntitySpawnEvent(entity.world().getGenerator().getConfigPack(), entity));
|
||||
main.getEventManager().callEvent(new EntitySpawnEvent(entity.world().getConfig().getPack(), entity));
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ public class BufferedLootApplication implements BufferedItem {
|
||||
}
|
||||
Container container = (Container) data;
|
||||
|
||||
LootPopulateEvent event = new LootPopulateEvent(container, table, world.getGenerator().getConfigPack(), structure);
|
||||
LootPopulateEvent event = new LootPopulateEvent(container, table, world.getConfig().getPack(), structure);
|
||||
main.getEventManager().callEvent(event);
|
||||
if(event.isCancelled()) return;
|
||||
|
||||
|
@ -16,6 +16,8 @@ public interface WorldConfig {
|
||||
|
||||
BiomeProvider getProvider();
|
||||
|
||||
ConfigPack getPack();
|
||||
|
||||
int elevationBlend();
|
||||
|
||||
boolean disableTrees();
|
||||
|
@ -9,6 +9,7 @@ import com.dfsek.terra.api.vector.Vector3;
|
||||
import com.dfsek.terra.api.world.Chunk;
|
||||
import com.dfsek.terra.api.world.World;
|
||||
import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
|
||||
import com.dfsek.terra.api.world.generator.TerraChunkGenerator;
|
||||
|
||||
public class DummyWorld implements World {
|
||||
@Override
|
||||
@ -56,6 +57,11 @@ public class DummyWorld implements World {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TerraChunkGenerator getGenerator() {
|
||||
throw new UnsupportedOperationException("Cannot get generator of DummyWorld");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BiomeProvider getBiomeProvider() {
|
||||
throw new UnsupportedOperationException("Cannot get biome provider of DummyWorld");
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.dfsek.terra.config.pack;
|
||||
|
||||
import com.dfsek.terra.api.TerraPlugin;
|
||||
import com.dfsek.terra.api.config.ConfigPack;
|
||||
import com.dfsek.terra.api.config.WorldConfig;
|
||||
import com.dfsek.terra.api.registry.Registry;
|
||||
import com.dfsek.terra.api.world.World;
|
||||
@ -54,6 +55,11 @@ public class WorldConfigImpl implements WorldConfig {
|
||||
return provider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigPack getPack() {
|
||||
return pack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int elevationBlend() {
|
||||
return pack.getTemplate().getElevationBlend();
|
||||
|
@ -51,15 +51,9 @@ public abstract class ChunkRegionMixin {
|
||||
@Final
|
||||
private long seed;
|
||||
|
||||
@Shadow
|
||||
public abstract boolean setBlockState(BlockPos pos, net.minecraft.block.BlockState state, int flags, int maxUpdateDepth);
|
||||
|
||||
@Shadow
|
||||
public abstract TickScheduler<Fluid> getFluidTickScheduler();
|
||||
|
||||
@Shadow
|
||||
public abstract ChunkManager getChunkManager();
|
||||
|
||||
public int terraWorld$getMaxHeight() {
|
||||
return (((ChunkRegion) (Object) this).getBottomY()) + ((ChunkRegion) (Object) this).getHeight();
|
||||
}
|
||||
@ -69,11 +63,6 @@ public abstract class ChunkRegionMixin {
|
||||
this.config = ((World) world).getConfig();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public ChunkGenerator terraWorld$getGenerator() {
|
||||
return (ChunkGenerator) ((ChunkRegion) (Object) this).toServerWorld().getChunkManager().getChunkGenerator();
|
||||
}
|
||||
|
||||
public Chunk terraWorld$getChunkAt(int x, int z) {
|
||||
return (Chunk) ((ChunkRegion) (Object) this).getChunk(x, z);
|
||||
}
|
||||
@ -119,7 +108,7 @@ public abstract class ChunkRegionMixin {
|
||||
return this;
|
||||
}
|
||||
|
||||
public TerraChunkGenerator terraWorld$getTerraGenerator() {
|
||||
public TerraChunkGenerator terraWorld$getGenerator() {
|
||||
return ((FabricChunkGeneratorWrapper) world.getChunkManager().getChunkGenerator()).getHandle();
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@ import com.dfsek.terra.fabric.generation.TerraBiomeSource;
|
||||
import com.dfsek.terra.fabric.util.FabricUtil;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.WorldGenerationProgressListener;
|
||||
import net.minecraft.server.world.ServerChunkManager;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.registry.RegistryKey;
|
||||
@ -28,6 +29,7 @@ import net.minecraft.world.dimension.DimensionType;
|
||||
import net.minecraft.world.gen.Spawner;
|
||||
import net.minecraft.world.level.ServerWorldProperties;
|
||||
import net.minecraft.world.level.storage.LevelStorage;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Implements;
|
||||
import org.spongepowered.asm.mixin.Interface;
|
||||
import org.spongepowered.asm.mixin.Intrinsic;
|
||||
@ -47,6 +49,10 @@ public abstract class ServerWorldMixin {
|
||||
@Shadow
|
||||
public abstract long getSeed();
|
||||
|
||||
@Shadow
|
||||
@Final
|
||||
private ServerChunkManager chunkManager;
|
||||
|
||||
@Inject(at = @At("RETURN"), method = "<init>(Lnet/minecraft/server/MinecraftServer;Ljava/util/concurrent/Executor;Lnet/minecraft/world/level/storage/LevelStorage$Session;Lnet/minecraft/world/level/ServerWorldProperties;Lnet/minecraft/util/registry/RegistryKey;Lnet/minecraft/world/dimension/DimensionType;Lnet/minecraft/server/WorldGenerationProgressListener;Lnet/minecraft/world/gen/chunk/ChunkGenerator;ZJLjava/util/List;Z)V")
|
||||
public void injectConstructor(MinecraftServer server, Executor workerExecutor, LevelStorage.Session session, ServerWorldProperties properties, RegistryKey<net.minecraft.world.World> worldKey, DimensionType dimensionType, WorldGenerationProgressListener worldGenerationProgressListener, net.minecraft.world.gen.chunk.ChunkGenerator chunkGenerator, boolean debugWorld, long seed, List<Spawner> spawners, boolean shouldTickTime, CallbackInfo ci) {
|
||||
if(chunkGenerator instanceof FabricChunkGeneratorWrapper) {
|
||||
@ -58,10 +64,6 @@ public abstract class ServerWorldMixin {
|
||||
return (((ServerWorld) (Object) this).getBottomY()) + ((ServerWorld) (Object) this).getHeight();
|
||||
}
|
||||
|
||||
public ChunkGenerator terra$getGenerator() {
|
||||
return (ChunkGenerator) ((ServerWorld) (Object) this).getChunkManager().getChunkGenerator();
|
||||
}
|
||||
|
||||
public Chunk terra$getChunkAt(int x, int z) {
|
||||
return (Chunk) ((ServerWorld) (Object) this).getChunk(x, z);
|
||||
}
|
||||
@ -100,8 +102,8 @@ public abstract class ServerWorldMixin {
|
||||
return this;
|
||||
}
|
||||
|
||||
public TerraChunkGenerator terra$getTerraGenerator() {
|
||||
return ((FabricChunkGeneratorWrapper) terra$getGenerator()).getHandle();
|
||||
public TerraChunkGenerator terra$getGenerator() {
|
||||
return ((FabricChunkGeneratorWrapper) chunkManager.getChunkGenerator()).getHandle();
|
||||
}
|
||||
|
||||
public BiomeProvider terra$getBiomeProvider() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user