mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-04 00:45:57 +00:00
Merge branch 'master' into ver/6.6.0
This commit is contained in:
commit
053ec39b7b
@ -42,18 +42,13 @@ public class NMSInjectListener implements Listener {
|
|||||||
NMSBiomeProvider provider = new NMSBiomeProvider(pack.getBiomeProvider(), craftWorld.getSeed());
|
NMSBiomeProvider provider = new NMSBiomeProvider(pack.getBiomeProvider(), craftWorld.getSeed());
|
||||||
ChunkMap chunkMap = serverWorld.getChunkSource().chunkMap;
|
ChunkMap chunkMap = serverWorld.getChunkSource().chunkMap;
|
||||||
WorldGenContext worldGenContext = chunkMap.worldGenContext;
|
WorldGenContext worldGenContext = chunkMap.worldGenContext;
|
||||||
|
Reflection.CHUNKMAP.setWorldGenContext(chunkMap, new WorldGenContext(
|
||||||
try {
|
|
||||||
ReflectionUtil.setFinalField(chunkMap, "worldGenContext", new WorldGenContext(
|
|
||||||
worldGenContext.level(),
|
worldGenContext.level(),
|
||||||
new NMSChunkGeneratorDelegate(vanilla, pack, provider, craftWorld.getSeed()),
|
new NMSChunkGeneratorDelegate(vanilla, pack, provider, craftWorld.getSeed()),
|
||||||
worldGenContext.structureManager(),
|
worldGenContext.structureManager(),
|
||||||
worldGenContext.lightEngine(),
|
worldGenContext.lightEngine(),
|
||||||
worldGenContext.mainThreadMailBox()
|
worldGenContext.mainThreadMailBox()
|
||||||
));
|
));
|
||||||
} catch(NoSuchFieldException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
LOGGER.info("Successfully injected into world.");
|
LOGGER.info("Successfully injected into world.");
|
||||||
|
|
||||||
|
@ -3,8 +3,10 @@ package com.dfsek.terra.bukkit.nms.v1_21;
|
|||||||
import net.minecraft.core.Holder;
|
import net.minecraft.core.Holder;
|
||||||
import net.minecraft.core.Holder.Reference;
|
import net.minecraft.core.Holder.Reference;
|
||||||
import net.minecraft.core.MappedRegistry;
|
import net.minecraft.core.MappedRegistry;
|
||||||
|
import net.minecraft.server.level.ChunkMap;
|
||||||
import net.minecraft.world.level.LevelAccessor;
|
import net.minecraft.world.level.LevelAccessor;
|
||||||
import net.minecraft.world.level.StructureManager;
|
import net.minecraft.world.level.StructureManager;
|
||||||
|
import net.minecraft.world.level.chunk.status.WorldGenContext;
|
||||||
import xyz.jpenilla.reflectionremapper.ReflectionRemapper;
|
import xyz.jpenilla.reflectionremapper.ReflectionRemapper;
|
||||||
import xyz.jpenilla.reflectionremapper.proxy.ReflectionProxyFactory;
|
import xyz.jpenilla.reflectionremapper.proxy.ReflectionProxyFactory;
|
||||||
import xyz.jpenilla.reflectionremapper.proxy.annotation.FieldGetter;
|
import xyz.jpenilla.reflectionremapper.proxy.annotation.FieldGetter;
|
||||||
@ -19,6 +21,8 @@ public class Reflection {
|
|||||||
|
|
||||||
public static final ReferenceProxy REFERENCE;
|
public static final ReferenceProxy REFERENCE;
|
||||||
|
|
||||||
|
public static final ChunkMapProxy CHUNKMAP;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
ReflectionRemapper reflectionRemapper = ReflectionRemapper.forReobfMappingsInPaperJar();
|
ReflectionRemapper reflectionRemapper = ReflectionRemapper.forReobfMappingsInPaperJar();
|
||||||
ReflectionProxyFactory reflectionProxyFactory = ReflectionProxyFactory.create(reflectionRemapper,
|
ReflectionProxyFactory reflectionProxyFactory = ReflectionProxyFactory.create(reflectionRemapper,
|
||||||
@ -27,6 +31,7 @@ public class Reflection {
|
|||||||
MAPPED_REGISTRY = reflectionProxyFactory.reflectionProxy(MappedRegistryProxy.class);
|
MAPPED_REGISTRY = reflectionProxyFactory.reflectionProxy(MappedRegistryProxy.class);
|
||||||
STRUCTURE_MANAGER = reflectionProxyFactory.reflectionProxy(StructureManagerProxy.class);
|
STRUCTURE_MANAGER = reflectionProxyFactory.reflectionProxy(StructureManagerProxy.class);
|
||||||
REFERENCE = reflectionProxyFactory.reflectionProxy(ReferenceProxy.class);
|
REFERENCE = reflectionProxyFactory.reflectionProxy(ReferenceProxy.class);
|
||||||
|
CHUNKMAP = reflectionProxyFactory.reflectionProxy(ChunkMapProxy.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -49,4 +54,10 @@ public class Reflection {
|
|||||||
@MethodName("bindValue")
|
@MethodName("bindValue")
|
||||||
<T> void invokeBindValue(Reference<T> instance, T value);
|
<T> void invokeBindValue(Reference<T> instance, T value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Proxies(ChunkMap.class)
|
||||||
|
public interface ChunkMapProxy {
|
||||||
|
@FieldSetter("worldGenContext")
|
||||||
|
void setWorldGenContext(ChunkMap instance, WorldGenContext worldGenContext);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user