diff --git a/.gitignore b/.gitignore index bf62c89a..3a114d14 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .idea/* !.idea/codeStyles/ +!.idea/inspectionProfiles # eclipse bin *.launch diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 00000000..0b370176 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/build.gradle b/build.gradle index bd219215..0fc6e700 100644 --- a/build.gradle +++ b/build.gradle @@ -261,7 +261,7 @@ dependencies { targetConfiguration = "testArchivesOutput" } - libraries("io.github.notstirred:dasm:2.3.1") { + libraries("io.github.notstirred:dasm:2.5.2") { transitive = false } libraries("io.github.opencubicchunks:regionlib:0.63.0-SNAPSHOT") diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/client/renderer/cube/RenderRegionCacheCubeInfo.java b/src/main/java/io/github/opencubicchunks/cubicchunks/client/renderer/cube/RenderRegionCacheCubeInfo.java index 71a91e1f..cd19b1f7 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/client/renderer/cube/RenderRegionCacheCubeInfo.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/client/renderer/cube/RenderRegionCacheCubeInfo.java @@ -16,9 +16,9 @@ public RenderRegionCacheCubeInfo(LevelCube cube) { throw new DasmFailedToApply(); } - @AddMethodToSets(owner = @Ref(string = "net.minecraft.client.renderer.chunk.RenderRegionCache$ChunkInfo"), sets = ChunkToCubeSet.class, method = @MethodSig("chunk()Lnet/minecraft/world/level/chunk/LevelChunk;")) + @AddMethodToSets(containers = ChunkToCubeSet.RenderRegionCache$ChunkInfo_to_RenderRegionCacheCubeInfo_redirects.class, method = @MethodSig("chunk()Lnet/minecraft/world/level/chunk/LevelChunk;")) public native LevelCube cube(); - @AddMethodToSets(owner = @Ref(string = "net.minecraft.client.renderer.chunk.RenderRegionCache$ChunkInfo"), sets = ChunkToCubeSet.class, method = @MethodSig("renderChunk()Lnet/minecraft/client/renderer/chunk/RenderChunk;")) + @AddMethodToSets(containers = ChunkToCubeSet.RenderRegionCache$ChunkInfo_to_RenderRegionCacheCubeInfo_redirects.class, method = @MethodSig("renderChunk()Lnet/minecraft/client/renderer/chunk/RenderChunk;")) public native RenderCube renderCube(); } diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/ASMConfigPlugin.java b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/ASMConfigPlugin.java index b637eba7..4475c92b 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/ASMConfigPlugin.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/ASMConfigPlugin.java @@ -20,19 +20,24 @@ import javax.annotation.Nullable; +import com.mojang.datafixers.util.Either; import io.github.notstirred.dasm.annotation.AnnotationParser; import io.github.notstirred.dasm.api.annotations.transform.ApplicationStage; import io.github.notstirred.dasm.api.provider.MappingsProvider; import io.github.notstirred.dasm.exception.DasmException; +import io.github.notstirred.dasm.notify.Notification; import io.github.notstirred.dasm.transformer.Transformer; import io.github.notstirred.dasm.transformer.data.ClassTransform; import io.github.notstirred.dasm.transformer.data.MethodTransform; import io.github.notstirred.dasm.util.CachingClassProvider; -import io.github.notstirred.dasm.util.ClassNodeProvider; -import io.github.notstirred.dasm.util.Either; +import io.github.notstirred.dasm.util.NotifyStack; +import io.github.notstirred.dasm.util.Pair; import io.github.opencubicchunks.cc_core.annotation.Public; import io.github.opencubicchunks.cubicchunks.CubicChunks; +import net.minecraft.Util; import net.neoforged.fml.loading.FMLEnvironment; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.objectweb.asm.ClassWriter; import org.objectweb.asm.tree.AnnotationNode; import org.objectweb.asm.tree.ClassNode; @@ -50,6 +55,8 @@ public class ASMConfigPlugin implements IMixinConfigPlugin { private final Map>> preApplyTargets = new HashMap<>(); private final Map>> postApplyTargets = new HashMap<>(); + private final Logger logger = LogManager.getLogger("dasm"); + public ASMConfigPlugin() { boolean developmentEnvironment = false; try { @@ -59,7 +66,7 @@ public ASMConfigPlugin() { MappingsProvider mappings = MappingsProvider.IDENTITY; // TODO: breaks on fabric (remapped at runtime) - ClassNodeProvider classProvider = new CachingClassProvider(s -> { + var classProvider = new CachingClassProvider(s -> { try (var classStream = ASMConfigPlugin.class.getClassLoader().getResourceAsStream(s.replace(".", "/") + ".class")) { return Optional.ofNullable(classStream.readAllBytes()); } catch (IOException e) { @@ -81,15 +88,14 @@ public ASMConfigPlugin() { try { ClassNode targetClass = MixinService.getService().getBytecodeProvider().getClassNode(targetClassName); ClassNode mixinClass = MixinService.getService().getBytecodeProvider().getClassNode(mixinClassName); - // rename the mixin class to get dasm to generate owners correctly mixinClass.name = targetClass.name; // PRE_APPLY - this.annotationParser.findRedirectSets(mixinClass); - var methodTransformsMixin = this.annotationParser.buildMethodTargets(mixinClass, "cc_dasm$"); - this.annotationParser.findRedirectSets(targetClass); - var classTransform = this.annotationParser.buildClassTarget(targetClass); - var methodTransformsTarget = this.annotationParser.buildMethodTargets(targetClass, "cc_dasm$"); + handleError(this.annotationParser.findDasmAnnotations(mixinClass)); + var methodTransformsMixin = handleError(this.annotationParser.buildContext().buildMethodTargets(mixinClass, "cc_dasm$")); + handleError(this.annotationParser.findDasmAnnotations(targetClass)); + var classTransform = handleError(this.annotationParser.buildContext().buildClassTarget(targetClass)); + var methodTransformsTarget = handleError(this.annotationParser.buildContext().buildMethodTargets(targetClass, "cc_dasm$")); var methodTransforms = Stream.of(methodTransformsTarget, methodTransformsMixin) .filter(Optional::isPresent).map(Optional::get) @@ -116,7 +122,11 @@ public ASMConfigPlugin() { } }); } - } catch (ClassNotFoundException | IOException | DasmException e) { + } catch (DasmException e) { + throw new RuntimeException(e); + } catch (ClassNotFoundException e) { + throw new RuntimeException(e); + } catch (IOException e) { throw new RuntimeException(e); } return true; @@ -245,7 +255,7 @@ private boolean transformClass(String targetClassName, ClassNode targetClass, St return false; } - if (target.isLeft()) { + if (target.left().isPresent()) { this.transformer.transform(targetClass, target.left().get()); } else { this.transformer.transform(targetClass, target.right().get()); @@ -262,4 +272,31 @@ private boolean transformClass(String targetClassName, ClassNode targetClass, St return true; } + + private T handleError(Pair> result) { + handleError(result.second()); + return result.first(); + } + + private void handleError(NotifyStack notifyStack) { + handleError(notifyStack.notifications()); + } + + private void handleError(List notifications) { + for (var notification : notifications) { + switch (notification.kind) { + case INFO: + logger.info(notification.message); + break; + case WARNING: + logger.warn(notification.message); + break; + case ERROR: + logger.error(notification.message); + break; + } + } + if (notifications.stream().anyMatch(n -> n.kind == Notification.Kind.ERROR)) + throw Util.pauseInIde(new RuntimeException("DASM Failure, please see log output")); + } } \ No newline at end of file diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/client/multiplayer/MixinClientChunkCache.java b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/client/multiplayer/MixinClientChunkCache.java index 10668521..d8946799 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/client/multiplayer/MixinClientChunkCache.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/client/multiplayer/MixinClientChunkCache.java @@ -44,7 +44,7 @@ @Dasm(ChunkToCubeSet.class) @Mixin(ClientChunkCache.class) public abstract class MixinClientChunkCache extends MixinChunkSource implements ClientCubeCache { - @AddFieldToSets(sets = ChunkToCubeSet.class, owner = @Ref(ClientChunkCache.class), + @AddFieldToSets(containers = ChunkToCubeSet.ClientChunkCache_redirects.class, field = @FieldSig(type = @Ref(ClientChunkCache.Storage.class), name = "storage")) volatile ClientCubeCache.Storage cc_cubeStorage; diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/client/renderer/MixinLevelRenderer.java b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/client/renderer/MixinLevelRenderer.java index 36cd3b65..223e4fd2 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/client/renderer/MixinLevelRenderer.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/client/renderer/MixinLevelRenderer.java @@ -13,6 +13,6 @@ @Dasm(ChunkToCubeSet.class) @Mixin(LevelRenderer.class) public abstract class MixinLevelRenderer implements CubicLevelRenderer { - @AddTransformToSets(ChunkToCubeSet.class) @TransformFromMethod(@MethodSig("onChunkReadyToRender(Lnet/minecraft/world/level/ChunkPos;)V")) + @AddTransformToSets(ChunkToCubeSet.LevelRenderer_redirects.class) @TransformFromMethod(@MethodSig("onChunkReadyToRender(Lnet/minecraft/world/level/ChunkPos;)V")) public native void cc_onCubeReadyToRender(CubePos cubePos); } diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/client/renderer/MixinSectionOcclusionGraph.java b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/client/renderer/MixinSectionOcclusionGraph.java index 6268f312..906d48d6 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/client/renderer/MixinSectionOcclusionGraph.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/client/renderer/MixinSectionOcclusionGraph.java @@ -43,10 +43,10 @@ private void cc_onWaitAndReset(@Nullable ViewArea viewArea, CallbackInfo ci) { cc_isCubic = viewArea != null && ((CanBeCubic) viewArea.getLevelHeightAccessor()).cc_isCubic(); } - @AddTransformToSets(ChunkToCubeSet.class) @TransformFromMethod(@MethodSig("onChunkReadyToRender(Lnet/minecraft/world/level/ChunkPos;)V")) + @AddTransformToSets(ChunkToCubeSet.SectionOcclusionGraph_redirects.class) @TransformFromMethod(@MethodSig("onChunkReadyToRender(Lnet/minecraft/world/level/ChunkPos;)V")) public native void cc_onCubeReadyToRender(CubePos cubePos); - @AddMethodToSets(sets = ChunkToCubeSet.class, owner = @Ref(SectionOcclusionGraph.class), method = @MethodSig("addNeighbors(Lnet/minecraft/client/renderer/SectionOcclusionGraph$GraphEvents;Lnet/minecraft/world/level/ChunkPos;)V")) + @AddMethodToSets(containers = ChunkToCubeSet.SectionOcclusionGraph_redirects.class, method = @MethodSig("addNeighbors(Lnet/minecraft/client/renderer/SectionOcclusionGraph$GraphEvents;Lnet/minecraft/world/level/ChunkPos;)V")) private void cc_addNeighbors(SectionOcclusionGraph.GraphEvents graphEvents, CubePos cubePos) { var access = ((SectionOcclusionGraph$GraphEventsAccess) (Object) graphEvents); int cubeX = cubePos.getX(); diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/movetoforgesourcesetlater/MixinGenerationChunkHolder_Forge.java b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/movetoforgesourcesetlater/MixinGenerationChunkHolder_Forge.java index d19d51d5..73bc8122 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/movetoforgesourcesetlater/MixinGenerationChunkHolder_Forge.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/movetoforgesourcesetlater/MixinGenerationChunkHolder_Forge.java @@ -21,7 +21,7 @@ public class MixinGenerationChunkHolder_Forge { @Shadow public LevelChunk currentlyLoading; // Corresponds to field added by Forge - @AddFieldToSets(sets = ChunkToCubeSet.class, owner = @Ref(GenerationChunkHolder.class), field = @FieldSig(name = "currentlyLoading", type = @Ref(LevelChunk.class))) + @AddFieldToSets(containers = ChunkToCubeSet.GenerationChunkHolder_Forge_Jank_redirects.class, field = @FieldSig(name = "currentlyLoading", type = @Ref(LevelChunk.class))) public LevelCube cc_currentlyLoadingCube; public LevelClo cc_getCurrentlyLoading() { diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinChunkGenerationTask.java b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinChunkGenerationTask.java index 46a51362..620b88ac 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinChunkGenerationTask.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinChunkGenerationTask.java @@ -55,12 +55,12 @@ public abstract class MixinChunkGenerationTask implements CloGenerationTask { @Shadow @Final public ChunkStatus targetStatus; @Shadow private volatile boolean markedForCancellation; @Shadow @Final private StaticCache2D cache; - @AddFieldToSets(sets = ChunkToCubeSet.class, owner = @Ref(ChunkGenerationTask.class), field = @FieldSig(type = @Ref(ChunkPos.class), name = "pos")) + @AddFieldToSets(containers = ChunkToCubeSet.ChunkGenerationTask_redirects.class, field = @FieldSig(type = @Ref(ChunkPos.class), name = "pos")) private CubePos cc_cubePos; // scheduledChunkStatus must be one status higher than the scheduled status for cubes until the target status is reached, to ensure load order invariants are preserved // we use the vanilla field for cube status, since that is the status of the actual cube that is being generated @Nullable public ChunkStatus cc_scheduledChunkStatus; - @AddFieldToSets(sets = ChunkToCubeSet.class, owner = @Ref(ChunkGenerationTask.class), field = @FieldSig(type = @Ref(StaticCache2D.class), name = "cache")) + @AddFieldToSets(containers = ChunkToCubeSet.ChunkGenerationTask_redirects.class, field = @FieldSig(type = @Ref(StaticCache2D.class), name = "cache")) private StaticCache3D cc_cubeCache; private GeneratingCubeMap cc_getGeneratingCubeMap() { @@ -77,7 +77,7 @@ private GeneratingCubeMap cc_getGeneratingCubeMap() { /** * Factory method to create a {@code ChunkGenerationTask} for a cube. */ - @AddMethodToSets(sets = ChunkToCubeSet.class, owner = @Ref(ChunkGenerationTask.class), method = @MethodSig("create(Lnet/minecraft/server/level/GeneratingChunkMap;Lnet/minecraft/world/level/chunk/status/ChunkStatus;Lnet/minecraft/world/level/ChunkPos;)Lnet/minecraft/server/level/ChunkGenerationTask;")) + @AddMethodToSets(containers = ChunkToCubeSet.ChunkGenerationTask_redirects.class, method = @MethodSig("create(Lnet/minecraft/server/level/GeneratingChunkMap;Lnet/minecraft/world/level/chunk/status/ChunkStatus;Lnet/minecraft/world/level/ChunkPos;)Lnet/minecraft/server/level/ChunkGenerationTask;")) @Public private static ChunkGenerationTask cc_createCubeGenerationTask(GeneratingChunkMap chunkMap, ChunkStatus targetStatus, CubePos pos) { int cubeRadius = CubePyramid.CC_GENERATION_PYRAMID_CUBES.getStepTo(targetStatus).getAccumulatedRadiusOf(ChunkStatus.EMPTY); int cubeDiameter = cubeRadius * 2 + 1; @@ -94,7 +94,7 @@ private GeneratingCubeMap cc_getGeneratingCubeMap() { return chunkGenerationTask; } - @AddMethodToSets(sets = ChunkToCloSet.class, owner = @Ref(ChunkGenerationTask.class), method = @MethodSig("create(Lnet/minecraft/server/level/GeneratingChunkMap;Lnet/minecraft/world/level/chunk/status/ChunkStatus;Lnet/minecraft/world/level/ChunkPos;)Lnet/minecraft/server/level/ChunkGenerationTask;")) + @AddMethodToSets(containers = ChunkToCloSet.ChunkGenerationTask_redirects.class, method = @MethodSig("create(Lnet/minecraft/server/level/GeneratingChunkMap;Lnet/minecraft/world/level/chunk/status/ChunkStatus;Lnet/minecraft/world/level/ChunkPos;)Lnet/minecraft/server/level/ChunkGenerationTask;")) @Public private static ChunkGenerationTask cc_createCubeGenerationTask(GeneratingChunkMap chunkMap, ChunkStatus targetStatus, CloPos pos) { if (pos.isCube()) { return cc_createCubeGenerationTask(chunkMap, targetStatus, pos.cubePos()); diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinChunkHolder.java b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinChunkHolder.java index 2203082c..534a4069 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinChunkHolder.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinChunkHolder.java @@ -17,16 +17,13 @@ import io.github.notstirred.dasm.api.annotations.transform.TransformFromMethod; import io.github.opencubicchunks.cc_core.api.CubePos; import io.github.opencubicchunks.cc_core.utils.Coords; -import io.github.opencubicchunks.cc_core.world.level.CloPos; import io.github.opencubicchunks.cubicchunks.exception.DasmFailedToApply; import io.github.opencubicchunks.cubicchunks.mixin.dasmsets.ChunkToCloSet; import io.github.opencubicchunks.cubicchunks.mixin.dasmsets.ChunkToCubeSet; import io.github.opencubicchunks.cubicchunks.server.level.CloHolder; import io.github.opencubicchunks.cubicchunks.server.level.CubeHolder; import io.github.opencubicchunks.cubicchunks.server.level.CubicChunkMap; -import io.github.opencubicchunks.cubicchunks.world.level.chunklike.CloAccess; import io.github.opencubicchunks.cubicchunks.world.level.chunklike.LevelClo; -import io.github.opencubicchunks.cubicchunks.world.level.cube.CubeAccess; import io.github.opencubicchunks.cubicchunks.world.level.cube.LevelCube; import it.unimi.dsi.fastutil.shorts.ShortSet; import net.minecraft.core.BlockPos; @@ -39,7 +36,6 @@ import net.minecraft.world.level.LevelHeightAccessor; import net.minecraft.world.level.LightLayer; import net.minecraft.world.level.chunk.LevelChunk; -import net.minecraft.world.level.chunk.status.ChunkStatus; import org.spongepowered.asm.mixin.Dynamic; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; @@ -59,23 +55,23 @@ public abstract class MixinChunkHolder extends MixinGenerationChunkHolder implem @Shadow private boolean hasChangedSections; @Shadow @Final private ShortSet[] changedBlocksPerSection; - @AddFieldToSets(sets = ChunkToCubeSet.class, owner = @Ref(ChunkHolder.class), field = @FieldSig(type = @Ref(ChunkHolder.LevelChangeListener.class), name = "onLevelChange")) + @AddFieldToSets(containers = ChunkToCubeSet.ChunkHolder_redirects.class, field = @FieldSig(type = @Ref(ChunkHolder.LevelChangeListener.class), name = "onLevelChange")) private final LevelChangeListener cc_onLevelChange; - @AddFieldToSets(sets = ChunkToCubeSet.class, owner = @Ref(ChunkHolder.class), field = @FieldSig(type = @Ref(ChunkHolder.PlayerProvider.class), name = "playerProvider")) + @AddFieldToSets(containers = ChunkToCubeSet.ChunkHolder_redirects.class, field = @FieldSig(type = @Ref(ChunkHolder.PlayerProvider.class), name = "playerProvider")) private final PlayerProvider cc_playerProvider; - @AddTransformToSets(ChunkToCubeSet.class) @TransformFromMethod(owner = @Ref(ChunkHolder.class), value = @MethodSig("(Lnet/minecraft/world/level/ChunkPos;ILnet/minecraft/world/level/LevelHeightAccessor;Lnet/minecraft/world/level/lighting/LevelLightEngine;Lnet/minecraft/server/level/ChunkHolder$LevelChangeListener;Lnet/minecraft/server/level/ChunkHolder$PlayerProvider;)V")) + @AddTransformToSets(ChunkToCubeSet.ChunkHolder_redirects.class) @TransformFromMethod(owner = @Ref(ChunkHolder.class), value = @MethodSig("(Lnet/minecraft/world/level/ChunkPos;ILnet/minecraft/world/level/LevelHeightAccessor;Lnet/minecraft/world/level/lighting/LevelLightEngine;Lnet/minecraft/server/level/ChunkHolder$LevelChangeListener;Lnet/minecraft/server/level/ChunkHolder$PlayerProvider;)V")) public MixinChunkHolder() { throw new DasmFailedToApply(); } @Shadow @Nullable public abstract LevelChunk getTickingChunk(); - @AddTransformToSets(ChunkToCubeSet.class) @TransformFromMethod(owner = @Ref(ChunkHolder.class), value = @MethodSig("getTickingChunk()Lnet/minecraft/world/level/chunk/LevelChunk;")) + @AddTransformToSets(ChunkToCubeSet.ChunkHolder_redirects.class) @TransformFromMethod(owner = @Ref(ChunkHolder.class), value = @MethodSig("getTickingChunk()Lnet/minecraft/world/level/chunk/LevelChunk;")) @Nullable public native LevelCube cc_getTickingCube(); - @AddMethodToSets(sets = ChunkToCloSet.class, owner = @Ref(ChunkHolder.class), method = @MethodSig("getTickingChunk()Lnet/minecraft/world/level/chunk/LevelChunk;")) + @AddMethodToSets(containers = ChunkToCloSet.ChunkHolder_redirects.class, method = @MethodSig("getTickingChunk()Lnet/minecraft/world/level/chunk/LevelChunk;")) @Nullable public LevelClo cc_getTickingClo() { if (cc_cubePos != null) { return cc_getTickingCube(); @@ -85,10 +81,10 @@ public MixinChunkHolder() { @Shadow @Nullable public abstract LevelChunk getChunkToSend(); - @AddTransformToSets(ChunkToCubeSet.class) @TransformFromMethod(owner = @Ref(ChunkHolder.class), value = @MethodSig("getChunkToSend()Lnet/minecraft/world/level/chunk/LevelChunk;")) + @AddTransformToSets(ChunkToCubeSet.ChunkHolder_redirects.class) @TransformFromMethod(owner = @Ref(ChunkHolder.class), value = @MethodSig("getChunkToSend()Lnet/minecraft/world/level/chunk/LevelChunk;")) @Nullable public native LevelCube cc_getCubeToSend(); - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(owner = @Ref(ChunkHolder.class), value = @MethodSig("getChunkToSend()Lnet/minecraft/world/level/chunk/LevelChunk;")) + @AddTransformToSets(ChunkToCloSet.ChunkHolder_redirects.class) @TransformFromMethod(owner = @Ref(ChunkHolder.class), value = @MethodSig("getChunkToSend()Lnet/minecraft/world/level/chunk/LevelChunk;")) @Nullable public LevelClo cc_getCloToSend() { if (cc_cubePos != null) { return cc_getCubeToSend(); @@ -123,7 +119,7 @@ public void cc_onSectionLightChanged(LightLayer lightLayer, int sectionY, Callba @Shadow public abstract void broadcastChanges(LevelChunk chunk); // region [cc_broadcastCubeChanges dasm + mixin] - @AddTransformToSets(ChunkToCubeSet.class) @TransformFromMethod(owner = @Ref(ChunkHolder.class), value = @MethodSig("broadcastChanges(Lnet/minecraft/world/level/chunk/LevelChunk;)V")) + @AddTransformToSets(ChunkToCubeSet.ChunkHolder_redirects.class) @TransformFromMethod(owner = @Ref(ChunkHolder.class), value = @MethodSig("broadcastChanges(Lnet/minecraft/world/level/chunk/LevelChunk;)V")) public native void cc_broadcastCubeChanges(LevelCube cube); // TODO (P2) lighting - ClientboundLightUpdatePacket branch is currently never reached; once we have lighting it will have to be a CC packet, and this.broadcast will need to redirect to a CC method @@ -141,7 +137,7 @@ private SectionPos cc_onBroadcastCubeChanges_sectionPos(CubePos cubePos, int sec } // endregion - @AddMethodToSets(sets = ChunkToCloSet.class, owner = @Ref(ChunkHolder.class), method = @MethodSig("broadcastChanges(Lnet/minecraft/world/level/chunk/LevelChunk;)V")) + @AddMethodToSets(containers = ChunkToCloSet.ChunkHolder_redirects.class, method = @MethodSig("broadcastChanges(Lnet/minecraft/world/level/chunk/LevelChunk;)V")) public void cc_broadcastCloChanges(LevelClo clo) { if (cc_cubePos != null) { cc_broadcastCubeChanges((LevelCube) clo); @@ -163,30 +159,9 @@ private void cc_onCallChunkMapOnFullChunkStatusChange(ChunkMap instance, ChunkPo protected void cc_onUpdateFutures_onCallOnLevelChange(ChunkHolder.LevelChangeListener instance, ChunkPos chunkPos, IntSupplier intSupplier, int i, IntConsumer intConsumer, Operation original) { if (cc_cubePos != null) { - cc_onLevelChange.onLevelChange(cc_cubePos, intSupplier, i, intConsumer); + cc_onLevelChange.cc_onLevelChange(cc_cubePos, intSupplier, i, intConsumer); } else { original.call(instance, chunkPos, intSupplier, i, intConsumer); } } - - // TODO dasm inheritance - @AddMethodToSets(sets = ChunkToCubeSet.class, owner = @Ref(ChunkHolder.class), method = @MethodSig("getLatestChunk()Lnet/minecraft/world/level/chunk/ChunkAccess;")) - @Nullable public CubeAccess cc_getLatestCube() { - return super.cc_getLatestCube(); - } - - @AddMethodToSets(sets = ChunkToCloSet.class, owner = @Ref(ChunkHolder.class), method = @MethodSig("getLatestChunk()Lnet/minecraft/world/level/chunk/ChunkAccess;")) - @Nullable public CloAccess cc_getLatestClo() { - return super.cc_getLatestClo(); - } - - @AddMethodToSets(sets = ChunkToCloSet.class, owner = @Ref(ChunkHolder.class), method = @MethodSig("getPos()Lnet/minecraft/world/level/ChunkPos;")) - @Override public CloPos cc_getCloPos() { - return super.cc_getCloPos(); - } - - @AddMethodToSets(sets = ChunkToCubeSet.class, owner = @Ref(ChunkHolder.class), method = @MethodSig("getChunkIfPresent(Lnet/minecraft/world/level/chunk/status/ChunkStatus;)Lnet/minecraft/world/level/chunk/ChunkAccess;")) - @Nullable public CubeAccess cc_getCubeIfPresent(ChunkStatus status) { - return super.cc_getCubeIfPresent(status); - } } diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinChunkMap$TrackedEntity.java b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinChunkMap$TrackedEntity.java index 6560dc9d..54317e95 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinChunkMap$TrackedEntity.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinChunkMap$TrackedEntity.java @@ -21,7 +21,7 @@ public abstract class MixinChunkMap$TrackedEntity { @Shadow @Final Entity entity; //region [cc_updatePlayer dasm + mixin] - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(@MethodSig("updatePlayer(Lnet/minecraft/server/level/ServerPlayer;)V")) + @AddTransformToSets(ChunkToCloSet.ChunkMap$TrackedEntity_redirects.class) @TransformFromMethod(@MethodSig("updatePlayer(Lnet/minecraft/server/level/ServerPlayer;)V")) public native void cc_updatePlayer(ServerPlayer player); @Dynamic @Redirect(method = "cc_dasm$cc_updatePlayer", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/level/ChunkMap;isChunkTracked(Lnet/minecraft/server/level/ServerPlayer;II)Z")) diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinChunkMap.java b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinChunkMap.java index 5827c3cc..b9f51edf 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinChunkMap.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinChunkMap.java @@ -112,9 +112,9 @@ public abstract class MixinChunkMap extends MixinChunkStorage implements Generat } // TODO this one being on GlobalSet is a bit jank - @AddFieldToSets(sets = GlobalSet.class, owner = @Ref(ChunkMap.class), field = @FieldSig(type = @Ref(ChunkProgressListener.class), name = "progressListener")) + @AddFieldToSets(containers = GlobalSet.ChunkMap_redirects.class, field = @FieldSig(type = @Ref(ChunkProgressListener.class), name = "progressListener")) private CloProgressListener cc_progressListener; - @AddFieldToSets(sets = ChunkToCloSet.class, owner = @Ref(ChunkMap.class), field = @FieldSig(type = @Ref(ChunkStatusUpdateListener.class), name = "chunkStatusListener")) + @AddFieldToSets(containers = ChunkToCloSet.ChunkMap_redirects.class, field = @FieldSig(type = @Ref(ChunkStatusUpdateListener.class), name = "chunkStatusListener")) private CloStatusUpdateListener cc_cloStatusListener; // TODO once we can target non-return locations in constructors, do this when the vanilla field is set @@ -130,13 +130,13 @@ private void cc_onInit(ServerLevel level, LevelStorageSource.LevelStorageAccess } } - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(@MethodSig("setChunkUnsaved(Lnet/minecraft/world/level/ChunkPos;)V")) + @AddTransformToSets(ChunkToCloSet.ChunkMap_redirects.class) @TransformFromMethod(@MethodSig("setChunkUnsaved(Lnet/minecraft/world/level/ChunkPos;)V")) private native void cc_setCloUnsaved(CloPos cloPos); /** * Returns the squared distance to the center of the cube. */ - @AddMethodToSets(sets = ChunkToCloSet.class, owner = @Ref(ChunkMap.class), method = @MethodSig("euclideanDistanceSquared(Lnet/minecraft/world/level/ChunkPos;Lnet/minecraft/world/phys/Vec3;)D")) + @AddMethodToSets(containers = ChunkToCloSet.ChunkMap_redirects.class, method = @MethodSig("euclideanDistanceSquared(Lnet/minecraft/world/level/ChunkPos;Lnet/minecraft/world/phys/Vec3;)D")) private static double cc_euclideanDistanceSquared(CloPos cloPos, Vec3 vec3) { if (cloPos.isChunk()) { // FIXME we shouldn't be getting euclidean distance for chunks, as this doesn't make sense in context @@ -180,7 +180,7 @@ private boolean cc_isChunkOnTrackedBorder(ServerPlayer player, int x, int y, int // TODO getChunkDebugData - low prio //region [cc_getChunkRangeFuture dasm + mixin] - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(@MethodSig("getChunkRangeFuture(Lnet/minecraft/server/level/ChunkHolder;ILjava/util/function/IntFunction;)Ljava/util/concurrent/CompletableFuture;")) + @AddTransformToSets(ChunkToCloSet.ChunkMap_redirects.class) @TransformFromMethod(@MethodSig("getChunkRangeFuture(Lnet/minecraft/server/level/ChunkHolder;ILjava/util/function/IntFunction;)Ljava/util/concurrent/CompletableFuture;")) private native CompletableFuture>> cc_getChunkRangeFuture(ChunkHolder cloHolder, int radius, IntFunction statusByRadius); @@ -257,7 +257,7 @@ private void cc_onGetChunkRangeFuture(ChunkHolder cloHolder, int radius, IntFunc //endregion //region [cc_updateCubeScheduling dasm + mixin] - @AddTransformToSets(ChunkToCubeSet.class) @TransformFromMethod(useRedirectSets = ChunkToCubeSet.class, value = @MethodSig("updateChunkScheduling(JILnet/minecraft/server/level/ChunkHolder;I)Lnet/minecraft/server/level/ChunkHolder;")) + @AddTransformToSets(ChunkToCubeSet.ChunkMap_redirects.class) @TransformFromMethod(useRedirectSets = ChunkToCubeSet.class, value = @MethodSig("updateChunkScheduling(JILnet/minecraft/server/level/ChunkHolder;I)Lnet/minecraft/server/level/ChunkHolder;")) @Nullable public native ChunkHolder cc_updateCubeScheduling(long cubePos, int newLevel, @Nullable ChunkHolder holder, int oldLevel); @Inject(method = "updateChunkScheduling", at = @At("HEAD"), cancellable = true) @@ -268,15 +268,15 @@ private void cc_onUpdateChunkScheduling(long cloPos, int newLevel, ChunkHolder h } //endregion - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(@MethodSig("onLevelChange(Lnet/minecraft/world/level/ChunkPos;Ljava/util/function/IntSupplier;ILjava/util/function/IntConsumer;)V")) + @AddTransformToSets(ChunkToCloSet.ChunkMap_redirects.class) @TransformFromMethod(@MethodSig("onLevelChange(Lnet/minecraft/world/level/ChunkPos;Ljava/util/function/IntSupplier;ILjava/util/function/IntConsumer;)V")) private native void cc_onLevelChange(CloPos cloPos, IntSupplier intsupplier, int i, IntConsumer intconsumer); - @AddMethodToSets(sets = ChunkToCubeSet.class, owner = @Ref(ChunkMap.class), method = @MethodSig("onLevelChange(Lnet/minecraft/world/level/ChunkPos;Ljava/util/function/IntSupplier;ILjava/util/function/IntConsumer;)V")) + @AddMethodToSets(containers = ChunkToCubeSet.ChunkMap_redirects.class, method = @MethodSig("onLevelChange(Lnet/minecraft/world/level/ChunkPos;Ljava/util/function/IntSupplier;ILjava/util/function/IntConsumer;)V")) public void cc_onCubeLevelChange(CubePos cubePos, IntSupplier queueLevelGetter, int ticketLevel, IntConsumer queueLevelSetter) { cc_onLevelChange(CloPos.cube(cubePos), queueLevelGetter, ticketLevel, queueLevelSetter); } - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(@MethodSig("saveAllChunks(Z)V")) + @AddTransformToSets(ChunkToCloSet.ChunkMap_redirects.class) @TransformFromMethod(@MethodSig("saveAllChunks(Z)V")) public native void cc_saveAllChunks(boolean flush); @Inject(method = "saveAllChunks", at = @At("HEAD"), cancellable = true) @@ -287,19 +287,19 @@ private void cc_onSaveAllChunks(boolean flush, CallbackInfo ci) { } } - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(@MethodSig("saveChunksEagerly(Ljava/util/function/BooleanSupplier;)V")) + @AddTransformToSets(ChunkToCloSet.ChunkMap_redirects.class) @TransformFromMethod(@MethodSig("saveChunksEagerly(Ljava/util/function/BooleanSupplier;)V")) private native void cc_saveClosEagerly(BooleanSupplier hasMoreTime); - @AddMethodToSets(sets = ChunkToCloSet.class, owner = @Ref(ChunkMap.class), method = @MethodSig("scheduleUnload(JLnet/minecraft/server/level/ChunkHolder;)V")) + @AddMethodToSets(containers = ChunkToCloSet.ChunkMap_redirects.class, method = @MethodSig("scheduleUnload(JLnet/minecraft/server/level/ChunkHolder;)V")) private void cc_scheduleUnload(long chunkPos, ChunkHolder chunkHolder) { // TODO (P2) save/load } //region [cc_scheduleChunkLoad dasm + mixin] - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(@MethodSig("scheduleChunkLoad(Lnet/minecraft/world/level/ChunkPos;)Ljava/util/concurrent/CompletableFuture;")) + @AddTransformToSets(ChunkToCloSet.ChunkMap_redirects.class) @TransformFromMethod(@MethodSig("scheduleChunkLoad(Lnet/minecraft/world/level/ChunkPos;)Ljava/util/concurrent/CompletableFuture;")) private native CompletableFuture cc_scheduleChunkLoad(CloPos cloPos); - @AddMethodToSets(sets = ChunkToCubeSet.class, owner = @Ref(ChunkMap.class), method = @MethodSig("scheduleChunkLoad(Lnet/minecraft/world/level/ChunkPos;)Ljava/util/concurrent/CompletableFuture;")) + @AddMethodToSets(containers = ChunkToCubeSet.ChunkMap_redirects.class, method = @MethodSig("scheduleChunkLoad(Lnet/minecraft/world/level/ChunkPos;)Ljava/util/concurrent/CompletableFuture;")) private CompletableFuture cc_scheduleChunkLoad(CubePos cubePos) { return cc_scheduleChunkLoad(CloPos.cube(cubePos)); } @@ -311,21 +311,21 @@ private CompletableFuture cc_onScheduleChunkLoad_poiManagerPreFetch(PoiManage } //endregion - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(@MethodSig("handleChunkLoadFailure(Ljava/lang/Throwable;Lnet/minecraft/world/level/ChunkPos;)Lnet/minecraft/world/level/chunk/ChunkAccess;")) + @AddTransformToSets(ChunkToCloSet.ChunkMap_redirects.class) @TransformFromMethod(@MethodSig("handleChunkLoadFailure(Ljava/lang/Throwable;Lnet/minecraft/world/level/ChunkPos;)Lnet/minecraft/world/level/chunk/ChunkAccess;")) private native ChunkResult cc_handleChunkLoadFailure(Throwable exception, CloPos cloPos); - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod( + @AddTransformToSets(ChunkToCloSet.ChunkMap_redirects.class) @TransformFromMethod( value = @MethodSig("createEmptyChunk(Lnet/minecraft/world/level/ChunkPos;)Lnet/minecraft/world/level/chunk/ChunkAccess;")) private native CloAccess cc_createEmptyChunk(CloPos cloPos); - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(@MethodSig("markPositionReplaceable(Lnet/minecraft/world/level/ChunkPos;)V")) + @AddTransformToSets(ChunkToCloSet.ChunkMap_redirects.class) @TransformFromMethod(@MethodSig("markPositionReplaceable(Lnet/minecraft/world/level/ChunkPos;)V")) private native void cc_markPositionReplaceable(CloPos cloPos); - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(@MethodSig("markPosition(Lnet/minecraft/world/level/ChunkPos;Lnet/minecraft/world/level/chunk/status/ChunkType;)B")) + @AddTransformToSets(ChunkToCloSet.ChunkMap_redirects.class) @TransformFromMethod(@MethodSig("markPosition(Lnet/minecraft/world/level/ChunkPos;Lnet/minecraft/world/level/chunk/status/ChunkType;)B")) private native byte cc_markPosition(CloPos cloPos, ChunkType chunkType); //region [cc_applyCubeStep dasm + mixin] - @AddTransformToSets(ChunkToCubeSet.class) @TransformFromMethod(useRedirectSets = ChunkToCubeSet.class, value = @MethodSig("applyStep(Lnet/minecraft/server/level/GenerationChunkHolder;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;)Ljava/util/concurrent/CompletableFuture;")) + @AddTransformToSets(ChunkToCubeSet.ChunkMap_redirects.class) @TransformFromMethod(useRedirectSets = ChunkToCubeSet.class, value = @MethodSig("applyStep(Lnet/minecraft/server/level/GenerationChunkHolder;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;)Ljava/util/concurrent/CompletableFuture;")) public native CompletableFuture cc_applyCubeStep( GenerationChunkHolder generationchunkholder, CubeStep chunkstep, StaticCache3D cache ); @@ -336,16 +336,16 @@ private Object cc_onApplyCubeStep_staticCacheGet(StaticCache3D instance, int x, } //endregion - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(@MethodSig("scheduleGenerationTask(Lnet/minecraft/world/level/chunk/status/ChunkStatus;Lnet/minecraft/world/level/ChunkPos;)Lnet/minecraft/server/level/ChunkGenerationTask;")) + @AddTransformToSets(ChunkToCloSet.ChunkMap_redirects.class) @TransformFromMethod(@MethodSig("scheduleGenerationTask(Lnet/minecraft/world/level/chunk/status/ChunkStatus;Lnet/minecraft/world/level/ChunkPos;)Lnet/minecraft/server/level/ChunkGenerationTask;")) public native ChunkGenerationTask cc_scheduleGenerationTask(ChunkStatus chunkstatus, CloPos cloPos); - @AddMethodToSets(sets = ChunkToCubeSet.class, owner = @Ref(ChunkMap.class), method = @MethodSig("scheduleGenerationTask(Lnet/minecraft/world/level/chunk/status/ChunkStatus;Lnet/minecraft/world/level/ChunkPos;)Lnet/minecraft/server/level/ChunkGenerationTask;")) + @AddMethodToSets(containers = ChunkToCubeSet.ChunkMap_redirects.class, method = @MethodSig("scheduleGenerationTask(Lnet/minecraft/world/level/chunk/status/ChunkStatus;Lnet/minecraft/world/level/ChunkPos;)Lnet/minecraft/server/level/ChunkGenerationTask;")) public ChunkGenerationTask cc_scheduleGenerationTask(ChunkStatus chunkstatus, CubePos cubePos) { return cc_scheduleGenerationTask(chunkstatus, CloPos.cube(cubePos)); } //region [cc_runGenerationTask dasm + mixin] - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(@MethodSig("runGenerationTask(Lnet/minecraft/server/level/ChunkGenerationTask;)V")) + @AddTransformToSets(ChunkToCloSet.ChunkMap_redirects.class) @TransformFromMethod(@MethodSig("runGenerationTask(Lnet/minecraft/server/level/ChunkGenerationTask;)V")) private native void cc_runGenerationTask(ChunkGenerationTask chunkgenerationtask); // Delegate to the cube method for cubes @@ -358,7 +358,7 @@ private void cc_onVanillaRunGenerationTask(ChunkGenerationTask task, CallbackInf } //endregion - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(@MethodSig("prepareEntityTickingChunk(Lnet/minecraft/server/level/ChunkHolder;)Ljava/util/concurrent/CompletableFuture;")) + @AddTransformToSets(ChunkToCloSet.ChunkMap_redirects.class) @TransformFromMethod(@MethodSig("prepareEntityTickingChunk(Lnet/minecraft/server/level/ChunkHolder;)Ljava/util/concurrent/CompletableFuture;")) public native CompletableFuture> cc_prepareEntityTickingChunk(ChunkHolder holder); @Inject(method = "prepareEntityTickingChunk", at = @At("HEAD"), cancellable = true) @@ -368,7 +368,7 @@ private void cc_onVanillaPrepareEntityTickingChunk(ChunkHolder chunk, CallbackIn } } - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(@MethodSig("prepareTickingChunk(Lnet/minecraft/server/level/ChunkHolder;)Ljava/util/concurrent/CompletableFuture;")) + @AddTransformToSets(ChunkToCloSet.ChunkMap_redirects.class) @TransformFromMethod(@MethodSig("prepareTickingChunk(Lnet/minecraft/server/level/ChunkHolder;)Ljava/util/concurrent/CompletableFuture;")) public native CompletableFuture> cc_prepareTickingChunk(ChunkHolder holder); @Inject(method = "prepareTickingChunk", at = @At("HEAD"), cancellable = true) @@ -378,10 +378,10 @@ private void cc_onVanillaPrepareTickingChunk(ChunkHolder chunk, CallbackInfoRetu } } - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(@MethodSig("onChunkReadyToSend(Lnet/minecraft/server/level/ChunkHolder;Lnet/minecraft/world/level/chunk/LevelChunk;)V")) + @AddTransformToSets(ChunkToCloSet.ChunkMap_redirects.class) @TransformFromMethod(@MethodSig("onChunkReadyToSend(Lnet/minecraft/server/level/ChunkHolder;Lnet/minecraft/world/level/chunk/LevelChunk;)V")) private native void cc_onChunkReadyToSend(ChunkHolder chunkholder, LevelClo cloPos); - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(@MethodSig("prepareAccessibleChunk(Lnet/minecraft/server/level/ChunkHolder;)Ljava/util/concurrent/CompletableFuture;")) + @AddTransformToSets(ChunkToCloSet.ChunkMap_redirects.class) @TransformFromMethod(@MethodSig("prepareAccessibleChunk(Lnet/minecraft/server/level/ChunkHolder;)Ljava/util/concurrent/CompletableFuture;")) public native CompletableFuture> cc_prepareAccessibleChunk(ChunkHolder holder); @Inject(method = "prepareAccessibleChunk", at = @At("HEAD"), cancellable = true) @@ -391,17 +391,17 @@ private void cc_onVanillaPrepareAccessibleChunk(ChunkHolder chunk, CallbackInfoR } } - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(@MethodSig("saveChunkIfNeeded(Lnet/minecraft/server/level/ChunkHolder;J)Z")) + @AddTransformToSets(ChunkToCloSet.ChunkMap_redirects.class) @TransformFromMethod(@MethodSig("saveChunkIfNeeded(Lnet/minecraft/server/level/ChunkHolder;J)Z")) private native boolean cc_saveChunkIfNeeded(ChunkHolder holder, long gameTime); // TODO (P2): for now we just don't save (requires more things to be CC-ified to not crash) - @AddMethodToSets(sets = ChunkToCloSet.class, owner = @Ref(ChunkMap.class), method = @MethodSig("save(Lnet/minecraft/world/level/chunk/ChunkAccess;)Z")) + @AddMethodToSets(containers = ChunkToCloSet.ChunkMap_redirects.class, method = @MethodSig("save(Lnet/minecraft/world/level/chunk/ChunkAccess;)Z")) private boolean cc_save(CloAccess cloAccess) { return false; } // //region [cc_save dasm + mixin] -// @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(@MethodSig("save(Lnet/minecraft/world/level/chunk/ChunkAccess;)Z")) +// @AddTransformToSets(ChunkToCloSet.ChunkMap_redirects.class) @TransformFromMethod(@MethodSig("save(Lnet/minecraft/world/level/chunk/ChunkAccess;)Z")) // private native boolean cc_save(CloAccess cloAccess); // // /** @@ -415,19 +415,19 @@ private boolean cc_save(CloAccess cloAccess) { // //endregion // This calls ChunkSerializer.getChunkTypeFromTag, which could be an issue? - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(@MethodSig("isExistingChunkFull(Lnet/minecraft/world/level/ChunkPos;)Z")) + @AddTransformToSets(ChunkToCloSet.ChunkMap_redirects.class) @TransformFromMethod(@MethodSig("isExistingChunkFull(Lnet/minecraft/world/level/ChunkPos;)Z")) private native boolean cc_isExistingChunkFull(CloPos cloPos); - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(@MethodSig("markChunkPendingToSend(Lnet/minecraft/server/level/ServerPlayer;Lnet/minecraft/world/level/ChunkPos;)V")) + @AddTransformToSets(ChunkToCloSet.ChunkMap_redirects.class) @TransformFromMethod(@MethodSig("markChunkPendingToSend(Lnet/minecraft/server/level/ServerPlayer;Lnet/minecraft/world/level/ChunkPos;)V")) private native void cc_markChunkPendingToSend(ServerPlayer player, CloPos cloPos); - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(@MethodSig("markChunkPendingToSend(Lnet/minecraft/server/level/ServerPlayer;Lnet/minecraft/world/level/chunk/LevelChunk;)V")) + @AddTransformToSets(ChunkToCloSet.ChunkMap_redirects.class) @TransformFromMethod(@MethodSig("markChunkPendingToSend(Lnet/minecraft/server/level/ServerPlayer;Lnet/minecraft/world/level/chunk/LevelChunk;)V")) private static native void cc_markChunkPendingToSend(ServerPlayer player, LevelClo clo); - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(@MethodSig("dropChunk(Lnet/minecraft/server/level/ServerPlayer;Lnet/minecraft/world/level/ChunkPos;)V")) + @AddTransformToSets(ChunkToCloSet.ChunkMap_redirects.class) @TransformFromMethod(@MethodSig("dropChunk(Lnet/minecraft/server/level/ServerPlayer;Lnet/minecraft/world/level/ChunkPos;)V")) private static native void cc_dropChunk(ServerPlayer player, CloPos cloPos); - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(@MethodSig("getChunkToSend(J)Lnet/minecraft/world/level/chunk/LevelChunk;")) + @AddTransformToSets(ChunkToCloSet.ChunkMap_redirects.class) @TransformFromMethod(@MethodSig("getChunkToSend(J)Lnet/minecraft/world/level/chunk/LevelChunk;")) public native LevelClo cc_getChunkToSend(long cloPos); // dumpChunks (low prio) @@ -436,35 +436,35 @@ private boolean cc_save(CloAccess cloAccess) { // TODO (P2) readChunk: this.upgradeChunkTag might need a dasm redirect? - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(@MethodSig("readChunk(Lnet/minecraft/world/level/ChunkPos;)Ljava/util/concurrent/CompletableFuture;")) + @AddTransformToSets(ChunkToCloSet.ChunkMap_redirects.class) @TransformFromMethod(@MethodSig("readChunk(Lnet/minecraft/world/level/ChunkPos;)Ljava/util/concurrent/CompletableFuture;")) private native CompletableFuture> cc_readChunk(CloPos cloPos); - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(@MethodSig("collectSpawningChunks(Ljava/util/List;)V")) + @AddTransformToSets(ChunkToCloSet.ChunkMap_redirects.class) @TransformFromMethod(@MethodSig("collectSpawningChunks(Ljava/util/List;)V")) native void cc_collectSpawningClos(List list); - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(@MethodSig("forEachBlockTickingChunk(Ljava/util/function/Consumer;)V")) + @AddTransformToSets(ChunkToCloSet.ChunkMap_redirects.class) @TransformFromMethod(@MethodSig("forEachBlockTickingChunk(Ljava/util/function/Consumer;)V")) native void cc_forEachBlockTickingClo(Consumer consumer); - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(@MethodSig("anyPlayerCloseEnoughForSpawning(Lnet/minecraft/world/level/ChunkPos;)Z")) + @AddTransformToSets(ChunkToCloSet.ChunkMap_redirects.class) @TransformFromMethod(@MethodSig("anyPlayerCloseEnoughForSpawning(Lnet/minecraft/world/level/ChunkPos;)Z")) public native boolean cc_anyPlayerCloseEnoughForSpawning(CloPos cloPos); - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(@MethodSig("anyPlayerCloseEnoughForSpawningInternal(Lnet/minecraft/world/level/ChunkPos;)Z")) + @AddTransformToSets(ChunkToCloSet.ChunkMap_redirects.class) @TransformFromMethod(@MethodSig("anyPlayerCloseEnoughForSpawningInternal(Lnet/minecraft/world/level/ChunkPos;)Z")) private native boolean cc_anyPlayerCloseEnoughForSpawningInternal(CloPos cloPos); - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(@MethodSig("getPlayersCloseForSpawning(Lnet/minecraft/world/level/ChunkPos;)Ljava/util/List;")) + @AddTransformToSets(ChunkToCloSet.ChunkMap_redirects.class) @TransformFromMethod(@MethodSig("getPlayersCloseForSpawning(Lnet/minecraft/world/level/ChunkPos;)Ljava/util/List;")) public native List cc_getPlayersCloseForSpawning(CloPos cloPos); - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(@MethodSig("playerIsCloseEnoughForSpawning(Lnet/minecraft/server/level/ServerPlayer;Lnet/minecraft/world/level/ChunkPos;)Z")) + @AddTransformToSets(ChunkToCloSet.ChunkMap_redirects.class) @TransformFromMethod(@MethodSig("playerIsCloseEnoughForSpawning(Lnet/minecraft/server/level/ServerPlayer;Lnet/minecraft/world/level/ChunkPos;)Z")) private native boolean cc_playerIsCloseEnoughForSpawning(ServerPlayer player, CloPos cloPos); - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(@MethodSig("updatePlayerStatus(Lnet/minecraft/server/level/ServerPlayer;Z)V")) + @AddTransformToSets(ChunkToCloSet.ChunkMap_redirects.class) @TransformFromMethod(@MethodSig("updatePlayerStatus(Lnet/minecraft/server/level/ServerPlayer;Z)V")) public native void cc_updatePlayerStatus(ServerPlayer player, boolean track); - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(@MethodSig("move(Lnet/minecraft/server/level/ServerPlayer;)V")) + @AddTransformToSets(ChunkToCloSet.ChunkMap_redirects.class) @TransformFromMethod(@MethodSig("move(Lnet/minecraft/server/level/ServerPlayer;)V")) public native void cc_move(ServerPlayer player); //region [cc_updateChunkTracking dasm + mixin] - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(@MethodSig("updateChunkTracking(Lnet/minecraft/server/level/ServerPlayer;)V")) + @AddTransformToSets(ChunkToCloSet.ChunkMap_redirects.class) @TransformFromMethod(@MethodSig("updateChunkTracking(Lnet/minecraft/server/level/ServerPlayer;)V")) private native void cc_updateChunkTracking(ServerPlayer player); @Dynamic @WrapOperation(method = "cc_dasm$cc_updateChunkTracking", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/level/ChunkMap;getPlayerViewDistance(Lnet/minecraft/server/level/ServerPlayer;)I")) @@ -474,7 +474,7 @@ private int cc_onUpdateChunkTracking_getViewDistance(ChunkMap instance, ServerPl //endregion //region [cc_applyChunkTrackingView dasm + mixin] - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(@MethodSig("applyChunkTrackingView(Lnet/minecraft/server/level/ServerPlayer;Lnet/minecraft/server/level/ChunkTrackingView;)V")) + @AddTransformToSets(ChunkToCloSet.ChunkMap_redirects.class) @TransformFromMethod(@MethodSig("applyChunkTrackingView(Lnet/minecraft/server/level/ServerPlayer;Lnet/minecraft/server/level/ChunkTrackingView;)V")) private native void cc_applyChunkTrackingView(ServerPlayer player, CloTrackingView chunkTrackingView); @Dynamic @Redirect(method = "cc_dasm$cc_applyChunkTrackingView", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/network/ServerGamePacketListenerImpl;send(Lnet/minecraft/network/protocol/Packet;)V")) @@ -484,7 +484,7 @@ private void cc_onApplyChunkTrackingView_setChunkCacheCenterPacket(ServerGamePac //endregion //region [cc_getPlayers dasm + mixin] - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(@MethodSig("getPlayers(Lnet/minecraft/world/level/ChunkPos;Z)Ljava/util/List;")) + @AddTransformToSets(ChunkToCloSet.ChunkMap_redirects.class) @TransformFromMethod(@MethodSig("getPlayers(Lnet/minecraft/world/level/ChunkPos;Z)Ljava/util/List;")) public native List cc_getPlayers(CloPos pos, boolean boundaryOnly); @Dynamic @Redirect(method = "cc_dasm$cc_getPlayers", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/level/ChunkMap;isChunkOnTrackedBorder(Lnet/minecraft/server/level/ServerPlayer;II)Z")) @@ -498,50 +498,31 @@ private boolean cc_getPlayers_isChunkTracked(ChunkMap instance, ServerPlayer pla } //endregion - @AddMethodToSets(sets = ChunkToCubeSet.class, owner = @Ref(ChunkMap.class), method = @MethodSig("getPlayers(Lnet/minecraft/world/level/ChunkPos;Z)Ljava/util/List;")) + @AddMethodToSets(containers = ChunkToCubeSet.ChunkMap_redirects.class, method = @MethodSig("getPlayers(Lnet/minecraft/world/level/ChunkPos;Z)Ljava/util/List;")) @Override public List cc_getPlayers(CubePos pos, boolean boundaryOnly) { return cc_getPlayers(CloPos.cube(pos), boundaryOnly); } // Replace `SectionPos.chunk()` with `SectionPos.cc_cube()` unconditionally here - @AddTransformToSets(GlobalSet.class) @TransformFromMethod(value = @MethodSig("tick(Ljava/util/function/BooleanSupplier;)V"), useRedirectSets = { ChunkToCloSet.class, SectionPosToCubeSet.class }) + @AddTransformToSets(GlobalSet.ChunkMap_redirects.class) @TransformFromMethod(value = @MethodSig("tick(Ljava/util/function/BooleanSupplier;)V"), useRedirectSets = { ChunkToCloSet.class, SectionPosToCubeSet.class }) protected native void cc_tick(BooleanSupplier hasMoreTime); - @AddTransformToSets(GlobalSet.class) @TransformFromMethod(value = @MethodSig("tick()V"), useRedirectSets = { ChunkToCloSet.class, SectionPosToCubeSet.class }) + @AddTransformToSets(GlobalSet.ChunkMap_redirects.class) @TransformFromMethod(value = @MethodSig("tick()V"), useRedirectSets = { ChunkToCloSet.class, SectionPosToCubeSet.class }) public native void cc_tick(); - @AddTransformToSets(GlobalSet.class) @TransformFromMethod(value = @MethodSig("processUnloads(Ljava/util/function/BooleanSupplier;)V")) + @AddTransformToSets(GlobalSet.ChunkMap_redirects.class) @TransformFromMethod(value = @MethodSig("processUnloads(Ljava/util/function/BooleanSupplier;)V")) private native void cc_processUnloads(BooleanSupplier hasMoreTime); // TODO resendBiomesForChunks - only used for FillBiomeCommand - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(@MethodSig("onFullChunkStatusChange(Lnet/minecraft/world/level/ChunkPos;Lnet/minecraft/server/level/FullChunkStatus;)V")) + @AddTransformToSets(ChunkToCloSet.ChunkMap_redirects.class) @TransformFromMethod(@MethodSig("onFullChunkStatusChange(Lnet/minecraft/world/level/ChunkPos;Lnet/minecraft/server/level/FullChunkStatus;)V")) public native void cc_onFullChunkStatusChange(CloPos cloPos, FullChunkStatus fullChunkStatus); - @AddMethodToSets(sets = ChunkToCubeSet.class, owner = @Ref(ChunkMap.class), method = @MethodSig("onFullChunkStatusChange(Lnet/minecraft/world/level/ChunkPos;Lnet/minecraft/server/level/FullChunkStatus;)V")) + @AddMethodToSets(containers = ChunkToCubeSet.ChunkMap_redirects.class, method = @MethodSig("onFullChunkStatusChange(Lnet/minecraft/world/level/ChunkPos;Lnet/minecraft/server/level/FullChunkStatus;)V")) public void cc_onFullChunkStatusChange(CubePos cubePos, FullChunkStatus fullChunkStatus) { cc_onFullChunkStatusChange(CloPos.cube(cubePos), fullChunkStatus); } - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(@MethodSig("waitForLightBeforeSending(Lnet/minecraft/world/level/ChunkPos;I)V")) + @AddTransformToSets(ChunkToCloSet.ChunkMap_redirects.class) @TransformFromMethod(@MethodSig("waitForLightBeforeSending(Lnet/minecraft/world/level/ChunkPos;I)V")) public native void cc_waitForLightBeforeSending(CloPos cloPos, int p_301130_); - - // TODO these three are temporary - needs dasm subclass method redirect inheritance for non-overriden methods - @AddMethodToSets(sets = ChunkToCloSet.class, owner = @Ref(ChunkMap.class), - method = @MethodSig("isOldChunkAround(Lnet/minecraft/world/level/ChunkPos;I)Z")) - public boolean cc_isOldChunkAround(CloPos pos, int radius) { - return super.cc_isOldChunkAround(pos, radius); - } - - @AddMethodToSets(sets = ChunkToCloSet.class, owner = @Ref(ChunkMap.class), - method = @MethodSig("read(Lnet/minecraft/world/level/ChunkPos;)Ljava/util/concurrent/CompletableFuture;")) - public CompletableFuture> cc_read(CloPos cloPos) { - return super.cc_read(cloPos); - } - - @AddMethodToSets(sets = ChunkToCloSet.class, owner = @Ref(ChunkMap.class), - method = @MethodSig("write(Lnet/minecraft/world/level/ChunkPos;Lnet/minecraft/nbt/CompoundTag;)V")) - public void cc_write(CloPos cloPos, CompoundTag chunkData) { - super.cc_write(cloPos, chunkData); - } } diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinChunkTaskDispatcher.java b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinChunkTaskDispatcher.java index 1cec2ed0..b4b8c397 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinChunkTaskDispatcher.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinChunkTaskDispatcher.java @@ -19,10 +19,10 @@ @Dasm(ChunkToCloSet.class) @Mixin(ChunkTaskDispatcher.class) public class MixinChunkTaskDispatcher implements CubeHolder.LevelChangeListener, CloTaskDispatcher { - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(owner = @Ref(ChunkTaskDispatcher.class), value = @MethodSig("onLevelChange(Lnet/minecraft/world/level/ChunkPos;Ljava/util/function/IntSupplier;ILjava/util/function/IntConsumer;)V")) + @AddTransformToSets(ChunkToCloSet.ChunkTaskDispatcher_redirects.class) @TransformFromMethod(owner = @Ref(ChunkTaskDispatcher.class), value = @MethodSig("onLevelChange(Lnet/minecraft/world/level/ChunkPos;Ljava/util/function/IntSupplier;ILjava/util/function/IntConsumer;)V")) @Override public native void cc_onLevelChange(CloPos cloPos, IntSupplier queueLevelGetter, int ticketLevel, IntConsumer queueLevelSetter); - public void onLevelChange(CubePos cubePos, IntSupplier queueLevelGetter, int ticketLevel, IntConsumer queueLevelSetter) { + public void cc_onLevelChange(CubePos cubePos, IntSupplier queueLevelGetter, int ticketLevel, IntConsumer queueLevelSetter) { cc_onLevelChange(CloPos.cube(cubePos), queueLevelGetter, ticketLevel, queueLevelSetter); } } diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinChunkTaskPriorityQueue.java b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinChunkTaskPriorityQueue.java index f4b7cd9d..cb4405cc 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinChunkTaskPriorityQueue.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinChunkTaskPriorityQueue.java @@ -34,6 +34,6 @@ private void cc_onResortChunkTasks(int queueLevel, ChunkPos chunkPos, int ticket } @UsedFromASM - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(@MethodSig("resortChunkTasks(ILnet/minecraft/world/level/ChunkPos;I)V")) + @AddTransformToSets(ChunkToCloSet.ChunkTaskPriorityQueue_redirects.class) @TransformFromMethod(@MethodSig("resortChunkTasks(ILnet/minecraft/world/level/ChunkPos;I)V")) public native void cc_resortCubicTasks(int queueLevel, CloPos cloPos, int ticketLevel); } diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinGenerationChunkHolder.java b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinGenerationChunkHolder.java index f2293880..a44d53ce 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinGenerationChunkHolder.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinGenerationChunkHolder.java @@ -54,10 +54,10 @@ public abstract class MixinGenerationChunkHolder implements GenerationCloHolder @Shadow @Final private AtomicReferenceArray>> futures; @Shadow @Final private static ChunkResult NOT_DONE_YET; - @AddFieldToSets(sets = ChunkToCubeSet.class, owner = @Ref(GenerationChunkHolder.class), field = @FieldSig(name = "pos", type = @Ref(ChunkPos.class))) + @AddFieldToSets(containers = ChunkToCubeSet.GenerationChunkHolder_redirects.class, field = @FieldSig(name = "pos", type = @Ref(ChunkPos.class))) protected CubePos cc_cubePos; - @AddMethodToSets(sets = ChunkToCloSet.class, owner = @Ref(GenerationChunkHolder.class), method = @MethodSig("getPos()Lnet/minecraft/world/level/ChunkPos;")) + @AddMethodToSets(containers = ChunkToCloSet.GenerationChunkHolder_redirects.class, method = @MethodSig("getPos()Lnet/minecraft/world/level/ChunkPos;")) @Override public CloPos cc_getCloPos() { if (cc_cubePos != null) { return CloPos.cube(cc_cubePos); @@ -65,12 +65,12 @@ public abstract class MixinGenerationChunkHolder implements GenerationCloHolder return CloPos.chunk(pos); } - @AddTransformToSets(ChunkToCubeSet.class) @TransformFromMethod(owner = @Ref(GenerationChunkHolder.class), value = @MethodSig("(Lnet/minecraft/world/level/ChunkPos;)V")) + @AddTransformToSets(ChunkToCubeSet.GenerationChunkHolder_redirects.class) @TransformFromMethod(owner = @Ref(GenerationChunkHolder.class), value = @MethodSig("(Lnet/minecraft/world/level/ChunkPos;)V")) public MixinGenerationChunkHolder() { throw new DasmFailedToApply(); } - @AddTransformToSets(ChunkToCubeSet.class) @TransformFromMethod(owner = @Ref(GenerationChunkHolder.class), value = @MethodSig("applyStep(Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/server/level/GeneratingChunkMap;Lnet/minecraft/util/StaticCache2D;)Ljava/util/concurrent/CompletableFuture;")) + @AddTransformToSets(ChunkToCubeSet.GenerationChunkHolder_redirects.class) @TransformFromMethod(owner = @Ref(GenerationChunkHolder.class), value = @MethodSig("applyStep(Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/server/level/GeneratingChunkMap;Lnet/minecraft/util/StaticCache2D;)Ljava/util/concurrent/CompletableFuture;")) native CompletableFuture> cc_applyCubeStep(CubeStep step, GeneratingChunkMap chunkMap, StaticCache3D cache); @WrapOperation(method = "updateHighestAllowedStatus", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/level/ChunkLevel;generationStatus(I)Lnet/minecraft/world/level/chunk/status/ChunkStatus;")) @@ -81,7 +81,7 @@ public MixinGenerationChunkHolder() { return original.call(level); } - @AddTransformToSets(ChunkToCubeSet.class) @TransformFromMethod(owner = @Ref(GenerationChunkHolder.class), value = @MethodSig("replaceProtoChunk(Lnet/minecraft/world/level/chunk/ImposterProtoChunk;)V")) + @AddTransformToSets(ChunkToCubeSet.GenerationChunkHolder_redirects.class) @TransformFromMethod(owner = @Ref(GenerationChunkHolder.class), value = @MethodSig("replaceProtoChunk(Lnet/minecraft/world/level/chunk/ImposterProtoChunk;)V")) public native void cc_replaceProtoCube(ImposterProtoCube cube); @WrapOperation(method = "rescheduleChunkTask", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/level/ChunkMap;scheduleGenerationTask(Lnet/minecraft/world/level/chunk/status/ChunkStatus;Lnet/minecraft/world/level/ChunkPos;)Lnet/minecraft/server/level/ChunkGenerationTask;")) @@ -92,21 +92,21 @@ private ChunkGenerationTask cc_onRescheduleChunkTask_scheduleGenerationTask(Chun return original.call(instance, status, chunkPos); } - @AddTransformToSets(ChunkToCubeSet.class) @TransformFromMethod(owner = @Ref(GenerationChunkHolder.class), value = @MethodSig("completeFuture(Lnet/minecraft/world/level/chunk/status/ChunkStatus;Lnet/minecraft/world/level/chunk/ChunkAccess;)V")) + @AddTransformToSets(ChunkToCubeSet.GenerationChunkHolder_redirects.class) @TransformFromMethod(owner = @Ref(GenerationChunkHolder.class), value = @MethodSig("completeFuture(Lnet/minecraft/world/level/chunk/status/ChunkStatus;Lnet/minecraft/world/level/chunk/ChunkAccess;)V")) private native void cc_completeFuture(ChunkStatus targetStatus, CubeAccess cubeAccess); - @AddTransformToSets(ChunkToCubeSet.class) @TransformFromMethod(owner = @Ref(GenerationChunkHolder.class), value = @MethodSig("getChunkIfPresentUnchecked(Lnet/minecraft/world/level/chunk/status/ChunkStatus;)Lnet/minecraft/world/level/chunk/ChunkAccess;")) + @AddTransformToSets(ChunkToCubeSet.GenerationChunkHolder_redirects.class) @TransformFromMethod(owner = @Ref(GenerationChunkHolder.class), value = @MethodSig("getChunkIfPresentUnchecked(Lnet/minecraft/world/level/chunk/status/ChunkStatus;)Lnet/minecraft/world/level/chunk/ChunkAccess;")) @Nullable public native CubeAccess cc_getCubeIfPresentUnchecked(ChunkStatus status); - @AddTransformToSets(ChunkToCubeSet.class) @TransformFromMethod(owner = @Ref(GenerationChunkHolder.class), value = @MethodSig("getChunkIfPresent(Lnet/minecraft/world/level/chunk/status/ChunkStatus;)Lnet/minecraft/world/level/chunk/ChunkAccess;")) + @AddTransformToSets(ChunkToCubeSet.GenerationChunkHolder_redirects.class) @TransformFromMethod(owner = @Ref(GenerationChunkHolder.class), value = @MethodSig("getChunkIfPresent(Lnet/minecraft/world/level/chunk/status/ChunkStatus;)Lnet/minecraft/world/level/chunk/ChunkAccess;")) @Nullable public native CubeAccess cc_getCubeIfPresent(ChunkStatus status); @Shadow @Nullable public abstract ChunkAccess getLatestChunk(); - @AddTransformToSets(ChunkToCubeSet.class) @TransformFromMethod(owner = @Ref(GenerationChunkHolder.class), value = @MethodSig("getLatestChunk()Lnet/minecraft/world/level/chunk/ChunkAccess;")) + @AddTransformToSets(ChunkToCubeSet.GenerationChunkHolder_redirects.class) @TransformFromMethod(owner = @Ref(GenerationChunkHolder.class), value = @MethodSig("getLatestChunk()Lnet/minecraft/world/level/chunk/ChunkAccess;")) @Nullable public native CubeAccess cc_getLatestCube(); - @AddMethodToSets(sets = ChunkToCloSet.class, owner = @Ref(GenerationChunkHolder.class), method = @MethodSig("getLatestChunk()Lnet/minecraft/world/level/chunk/ChunkAccess;")) + @AddMethodToSets(containers = ChunkToCloSet.GenerationChunkHolder_redirects.class, method = @MethodSig("getLatestChunk()Lnet/minecraft/world/level/chunk/ChunkAccess;")) @Nullable public CloAccess cc_getLatestClo() { if (cc_cubePos != null) { return cc_getLatestCube(); @@ -123,7 +123,7 @@ public void cc_onGetPersistedStatus(CallbackInfoReturnable cir) { } } - @AddTransformToSets(ChunkToCubeSet.class) @TransformFromMethod(owner = @Ref(GenerationChunkHolder.class), value = @MethodSig("getPos()Lnet/minecraft/world/level/ChunkPos;")) + @AddTransformToSets(ChunkToCubeSet.GenerationChunkHolder_redirects.class) @TransformFromMethod(owner = @Ref(GenerationChunkHolder.class), value = @MethodSig("getPos()Lnet/minecraft/world/level/ChunkPos;")) public native CubePos cc_getCubePos(); // TODO getLatestStatus - only used for vanilla debug code diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinServerChunkCache.java b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinServerChunkCache.java index ed6424f5..f910fd08 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinServerChunkCache.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinServerChunkCache.java @@ -76,16 +76,16 @@ public abstract class MixinServerChunkCache extends MixinChunkSource implements // Cube equivalents for cached chunks @Shadow @Final private static int CACHE_SIZE; - @AddFieldToSets(sets = ChunkToCubeSet.class, owner = @Ref(ServerChunkCache.class), field = @FieldSig(type = @Ref(long[].class), name = "lastChunkPos")) + @AddFieldToSets(containers = ChunkToCubeSet.ServerChunkCache_redirects.class, field = @FieldSig(type = @Ref(long[].class), name = "lastChunkPos")) private final long[] cc_lastCubePos = new long[CACHE_SIZE]; - @AddFieldToSets(sets = ChunkToCubeSet.class, owner = @Ref(ServerChunkCache.class), field = @FieldSig(type = @Ref(ChunkStatus[].class), name = "lastChunkStatus")) + @AddFieldToSets(containers = ChunkToCubeSet.ServerChunkCache_redirects.class, field = @FieldSig(type = @Ref(ChunkStatus[].class), name = "lastChunkStatus")) private final ChunkStatus[] cc_lastCubeStatus = new ChunkStatus[CACHE_SIZE]; - @AddFieldToSets(sets = ChunkToCubeSet.class, owner = @Ref(ServerChunkCache.class), field = @FieldSig(type = @Ref(CloAccess[].class), name = "lastChunk")) + @AddFieldToSets(containers = ChunkToCubeSet.ServerChunkCache_redirects.class, field = @FieldSig(type = @Ref(CloAccess[].class), name = "lastChunk")) private final CubeAccess[] cc_lastCube = new CubeAccess[CACHE_SIZE]; - @AddFieldToSets(sets = ChunkToCubeSet.class, owner = @Ref(ServerChunkCache.class), field = @FieldSig(type = @Ref(List.class), name = "spawningChunks")) + @AddFieldToSets(containers = ChunkToCubeSet.ServerChunkCache_redirects.class, field = @FieldSig(type = @Ref(List.class), name = "spawningChunks")) private final List cc_spawningCubes = new ObjectArrayList<>(); @Shadow @Final public ServerLevel level; @@ -117,7 +117,7 @@ private void cc_onInit(ServerLevel level, LevelStorageSource.LevelStorageAccess } } - @AddTransformToSets(ChunkToCubeSet.class) @TransformFromMethod(@MethodSig("storeInCache(JLnet/minecraft/world/level/chunk/ChunkAccess;Lnet/minecraft/world/level/chunk/status/ChunkStatus;)V")) + @AddTransformToSets(ChunkToCubeSet.ServerChunkCache_redirects.class) @TransformFromMethod(@MethodSig("storeInCache(JLnet/minecraft/world/level/chunk/ChunkAccess;Lnet/minecraft/world/level/chunk/status/ChunkStatus;)V")) private native void cc_storeInCache(long pChunkPos, CubeAccess pChunk, ChunkStatus pChunkStatus); @TransformFromMethod(@MethodSig("getChunk(IILnet/minecraft/world/level/chunk/status/ChunkStatus;Z)Lnet/minecraft/world/level/chunk/ChunkAccess;")) @@ -216,10 +216,10 @@ private void cc_onTick(BooleanSupplier hasTimeLeft, boolean tickChunks, Callback } } - @AddTransformToSets(GlobalSet.class) @TransformFromMethod(@MethodSig("tick(Ljava/util/function/BooleanSupplier;Z)V")) + @AddTransformToSets(GlobalSet.ServerChunkCache_redirects.class) @TransformFromMethod(@MethodSig("tick(Ljava/util/function/BooleanSupplier;Z)V")) public native void cc_tick(BooleanSupplier hasTimeLeft, boolean tickChunks); - @AddTransformToSets(GlobalSet.class) @TransformFromMethod(useRedirectSets = ChunkToCloSet.class, value = @MethodSig("broadcastChangedChunks(Lnet/minecraft/util/profiling/ProfilerFiller;)V")) + @AddTransformToSets(GlobalSet.ServerChunkCache_redirects.class) @TransformFromMethod(useRedirectSets = ChunkToCloSet.class, value = @MethodSig("broadcastChangedChunks(Lnet/minecraft/util/profiling/ProfilerFiller;)V")) private native void cc_broadcastChangedClos(ProfilerFiller profiler); @Inject(method = "broadcastChangedChunks", at = @At("HEAD"), cancellable = true) @@ -230,7 +230,7 @@ private void cc_onVanillaBroadcastChangedChunks(ProfilerFiller profiler, Callbac } } - @AddTransformToSets(GlobalSet.class) @TransformFromMethod(useRedirectSets = ChunkToCloSet.class, value = @MethodSig("tickChunks(Lnet/minecraft/util/profiling/ProfilerFiller;J)V")) + @AddTransformToSets(GlobalSet.ServerChunkCache_redirects.class) @TransformFromMethod(useRedirectSets = ChunkToCloSet.class, value = @MethodSig("tickChunks(Lnet/minecraft/util/profiling/ProfilerFiller;J)V")) private native void cc_tickClos(ProfilerFiller profiler, long timeInhabited); @Inject(method = "tickChunks(Lnet/minecraft/util/profiling/ProfilerFiller;J)V", at = @At("HEAD"), cancellable = true) @@ -241,7 +241,7 @@ private void cc_onVanillaTickChunks(ProfilerFiller profiler, long timeInhabited, } } - @AddMethodToSets(sets = ChunkToCloSet.class, owner = @Ref(ServerChunkCache.class), method = @MethodSig("tickSpawningChunk(Lnet/minecraft/world/level/chunk/LevelChunk;JLjava/util/List;Lnet/minecraft/world/level/NaturalSpawner$SpawnState;)V")) + @AddMethodToSets(containers = ChunkToCloSet.ServerChunkCache_redirects.class, method = @MethodSig("tickSpawningChunk(Lnet/minecraft/world/level/chunk/LevelChunk;JLjava/util/List;Lnet/minecraft/world/level/NaturalSpawner$SpawnState;)V")) private void cc_tickSpawningClo(LevelClo levelClo, long timeInhabited, List spawnCategories, NaturalSpawner.SpawnState spawnState) { // TODO (P2) } @@ -270,45 +270,45 @@ private void cc_onVanillaOnLightUpdate(LightLayer type, SectionPos pos, Callback } @Override - @AddMethodToSets(sets = GlobalSet.class, owner = @Ref(ServerChunkCache.class), method = @MethodSig("onLightUpdate(Lnet/minecraft/world/level/LightLayer;Lnet/minecraft/core/SectionPos;)V")) + @AddMethodToSets(containers = GlobalSet.ServerChunkCache_redirects.class, method = @MethodSig("onLightUpdate(Lnet/minecraft/world/level/LightLayer;Lnet/minecraft/core/SectionPos;)V")) public void cc_onLightUpdate(LightLayer pType, SectionPos pPos) { // TODO (P2) lighting } - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(useRedirectSets = ChunkToCloSet.class, value = @MethodSig("addTicket(Lnet/minecraft/server/level/Ticket;Lnet/minecraft/world/level/ChunkPos;)V")) + @AddTransformToSets(ChunkToCloSet.ServerChunkCache_redirects.class) @TransformFromMethod(useRedirectSets = ChunkToCloSet.class, value = @MethodSig("addTicket(Lnet/minecraft/server/level/Ticket;Lnet/minecraft/world/level/ChunkPos;)V")) public native void cc_addTicket(Ticket ticket, CloPos cloPos); - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(useRedirectSets = ChunkToCloSet.class, value = @MethodSig("addTicketWithRadius(Lnet/minecraft/server/level/TicketType;Lnet/minecraft/world/level/ChunkPos;I)V")) + @AddTransformToSets(ChunkToCloSet.ServerChunkCache_redirects.class) @TransformFromMethod(useRedirectSets = ChunkToCloSet.class, value = @MethodSig("addTicketWithRadius(Lnet/minecraft/server/level/TicketType;Lnet/minecraft/world/level/ChunkPos;I)V")) public native void cc_addTicketWithRadius(TicketType ticket, CloPos cloPos, int radius); - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(useRedirectSets = ChunkToCloSet.class, value = @MethodSig("removeTicketWithRadius(Lnet/minecraft/server/level/TicketType;Lnet/minecraft/world/level/ChunkPos;I)V")) + @AddTransformToSets(ChunkToCloSet.ServerChunkCache_redirects.class) @TransformFromMethod(useRedirectSets = ChunkToCloSet.class, value = @MethodSig("removeTicketWithRadius(Lnet/minecraft/server/level/TicketType;Lnet/minecraft/world/level/ChunkPos;I)V")) public native void cc_removeTicketWithRadius(TicketType ticket, CloPos cloPos, int radius); - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(useRedirectSets = ChunkToCloSet.class, value = @MethodSig("updateChunkForced(Lnet/minecraft/world/level/ChunkPos;Z)Z")) + @AddTransformToSets(ChunkToCloSet.ServerChunkCache_redirects.class) @TransformFromMethod(useRedirectSets = ChunkToCloSet.class, value = @MethodSig("updateChunkForced(Lnet/minecraft/world/level/ChunkPos;Z)Z")) public native boolean cc_updateCloForced(CloPos pPos, boolean pAdd); // Cube-specific methods that delegate to the corresponding Clo methods - @AddMethodToSets(sets = ChunkToCubeSet.class, owner = @Ref(ServerChunkCache.class), method = @MethodSig("addTicket(Lnet/minecraft/server/level/Ticket;Lnet/minecraft/world/level/ChunkPos;)V")) + @AddMethodToSets(containers = ChunkToCubeSet.ServerChunkCache_redirects.class, method = @MethodSig("addTicket(Lnet/minecraft/server/level/Ticket;Lnet/minecraft/world/level/ChunkPos;)V")) public void cc_addTicket(Ticket ticket, CubePos cubePos) { cc_addTicket(ticket, CloPos.cube(cubePos)); } - @AddMethodToSets(sets = ChunkToCubeSet.class, owner = @Ref(ServerChunkCache.class), method = @MethodSig("addTicketWithRadius(Lnet/minecraft/server/level/TicketType;Lnet/minecraft/world/level/ChunkPos;I)V")) + @AddMethodToSets(containers = ChunkToCubeSet.ServerChunkCache_redirects.class, method = @MethodSig("addTicketWithRadius(Lnet/minecraft/server/level/TicketType;Lnet/minecraft/world/level/ChunkPos;I)V")) public void cc_addTicketWithRadius(TicketType ticket, CubePos cubePos, int radius) { cc_addTicketWithRadius(ticket, CloPos.cube(cubePos), radius); } - @AddMethodToSets(sets = ChunkToCubeSet.class, owner = @Ref(ServerChunkCache.class), method = @MethodSig("removeTicketWithRadius(Lnet/minecraft/server/level/TicketType;Lnet/minecraft/world/level/ChunkPos;I)V")) + @AddMethodToSets(containers = ChunkToCubeSet.ServerChunkCache_redirects.class, method = @MethodSig("removeTicketWithRadius(Lnet/minecraft/server/level/TicketType;Lnet/minecraft/world/level/ChunkPos;I)V")) public void cc_removeTicketWithRadius(TicketType ticket, CubePos cubePos, int radius) { cc_removeTicketWithRadius(ticket, CloPos.cube(cubePos), radius); } - @AddMethodToSets(sets = ChunkToCubeSet.class, owner = @Ref(ServerChunkCache.class), method = @MethodSig("updateChunkForced(Lnet/minecraft/world/level/ChunkPos;Z)Z\"")) + @AddMethodToSets(containers = ChunkToCubeSet.ServerChunkCache_redirects.class, method = @MethodSig("updateChunkForced(Lnet/minecraft/world/level/ChunkPos;Z)Z\"")) @Override public boolean cc_updateCubeForced(CubePos cubePos, boolean forced) { return cc_updateCloForced(CloPos.cube(cubePos), forced); } // TODO should probably be implemented properly, but is low priority (debug) - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(@MethodSig("getChunkDebugData(Lnet/minecraft/world/level/ChunkPos;)Ljava/lang/String;")) + @AddTransformToSets(ChunkToCloSet.ServerChunkCache_redirects.class) @TransformFromMethod(@MethodSig("getChunkDebugData(Lnet/minecraft/world/level/ChunkPos;)Ljava/lang/String;")) public native String cc_getChunkDebugData(CloPos pChunkPos); } diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinServerLevel.java b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinServerLevel.java index 58b9a415..4e7bd7f5 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinServerLevel.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinServerLevel.java @@ -55,7 +55,7 @@ private void cc_onInit(MinecraftServer server, Executor dispatcher, LevelStorage return ((ServerCubeCache) this.chunkSource); } - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(@MethodSig("startTickingChunk(Lnet/minecraft/world/level/chunk/LevelChunk;)V")) + @AddTransformToSets(ChunkToCloSet.ServerLevel_redirects.class) @TransformFromMethod(@MethodSig("startTickingChunk(Lnet/minecraft/world/level/chunk/LevelChunk;)V")) public native void cc_startTickingClo(LevelClo chunk); @WrapOperation(method = "setDefaultSpawnPos", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/level/ServerChunkCache;removeTicketWithRadius(Lnet/minecraft/server/level/TicketType;Lnet/minecraft/world/level/ChunkPos;I)V")) @@ -76,7 +76,7 @@ private void cc_onSetDefaultSpawnPos_addicketWithRadius(ServerChunkCache instanc } } - @AddMethodToSets(sets = ChunkToCloSet.class, owner = @Ref(ServerLevel.class), method = @MethodSig("tickChunk(Lnet/minecraft/world/level/chunk/LevelChunk;I)V")) + @AddMethodToSets(containers = ChunkToCloSet.ServerLevel_redirects.class, method = @MethodSig("tickChunk(Lnet/minecraft/world/level/chunk/LevelChunk;I)V")) public void cc_tickClo(LevelClo levelClo, int randomTickSpeed) { if (levelClo instanceof LevelCube levelCube) { cc_tickCube(levelCube, randomTickSpeed); @@ -85,7 +85,7 @@ public void cc_tickClo(LevelClo levelClo, int randomTickSpeed) { } } - @AddMethodToSets(sets = ChunkToCubeSet.class, owner = @Ref(ServerLevel.class), method = @MethodSig("tickChunk(Lnet/minecraft/world/level/chunk/LevelChunk;I)V")) + @AddMethodToSets(containers = ChunkToCubeSet.ServerLevel_redirects.class, method = @MethodSig("tickChunk(Lnet/minecraft/world/level/chunk/LevelChunk;I)V")) public void cc_tickCube(LevelCube levelCube, int randomTickSpeed) { // TODO (P2) cube ticking } diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinServerPlayer.java b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinServerPlayer.java index 931d672e..a21755f5 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinServerPlayer.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinServerPlayer.java @@ -1,55 +1,30 @@ package io.github.opencubicchunks.cubicchunks.mixin.core.common.server.level; -import com.llamalad7.mixinextras.injector.v2.WrapWithCondition; -import com.llamalad7.mixinextras.sugar.Local; import io.github.notstirred.dasm.api.annotations.Dasm; import io.github.notstirred.dasm.api.annotations.redirect.redirects.AddFieldToSets; -import io.github.notstirred.dasm.api.annotations.redirect.redirects.AddMethodToSets; import io.github.notstirred.dasm.api.annotations.redirect.redirects.AddTransformToSets; import io.github.notstirred.dasm.api.annotations.selector.FieldSig; import io.github.notstirred.dasm.api.annotations.selector.MethodSig; import io.github.notstirred.dasm.api.annotations.selector.Ref; import io.github.notstirred.dasm.api.annotations.transform.TransformFromMethod; -import io.github.opencubicchunks.cc_core.api.CubePos; -import io.github.opencubicchunks.cc_core.world.level.CloPos; -import io.github.opencubicchunks.cubicchunks.CanBeCubic; import io.github.opencubicchunks.cubicchunks.mixin.core.common.world.entity.MixinEntity; import io.github.opencubicchunks.cubicchunks.mixin.dasmsets.ChunkToCloSet; -import io.github.opencubicchunks.cubicchunks.mixin.dasmsets.ChunkToCubeSet; import io.github.opencubicchunks.cubicchunks.server.level.CCServerPlayer; import io.github.opencubicchunks.cubicchunks.server.level.CloTrackingView; -import io.github.opencubicchunks.cubicchunks.server.level.ServerCubeCache; -import net.minecraft.core.BlockPos; import net.minecraft.server.level.ChunkTrackingView; -import net.minecraft.server.level.ServerChunkCache; import net.minecraft.server.level.ServerPlayer; -import net.minecraft.server.level.TicketType; -import net.minecraft.world.level.ChunkPos; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; @Dasm(ChunkToCloSet.class) @Mixin(ServerPlayer.class) public abstract class MixinServerPlayer extends MixinEntity implements CCServerPlayer { - @AddFieldToSets(sets = ChunkToCloSet.class, owner = @Ref(ServerPlayer.class), field = @FieldSig(type = @Ref(ChunkTrackingView.class), name = "chunkTrackingView")) + @AddFieldToSets(containers = ChunkToCloSet.ServerPlayer_redirects.class, field = @FieldSig(type = @Ref(ChunkTrackingView.class), name = "chunkTrackingView")) private CloTrackingView cc_cloTrackingView = CloTrackingView.EMPTY; - // TODO unnecessary once we have DASM redirect inheritance - @AddMethodToSets(sets = ChunkToCubeSet.class, owner = @Ref(ServerPlayer.class), method = @MethodSig("chunkPosition()Lnet/minecraft/world/level/ChunkPos;")) - public CubePos cc_cubePosition() { - return super.cc_cubePosition(); - } - - // TODO unnecessary once we have DASM redirect inheritance - @AddMethodToSets(sets = ChunkToCloSet.class, owner = @Ref(ServerPlayer.class), method = @MethodSig("chunkPosition()Lnet/minecraft/world/level/ChunkPos;")) - public CloPos cc_cubePositionAsClo() { - return super.cc_cubePositionAsClo(); - } - - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(@MethodSig("getChunkTrackingView()Lnet/minecraft/server/level/ChunkTrackingView;")) + @AddTransformToSets(ChunkToCloSet.ServerPlayer_redirects.class) @TransformFromMethod(@MethodSig("getChunkTrackingView()Lnet/minecraft/server/level/ChunkTrackingView;")) public native CloTrackingView cc_getCloTrackingView(); - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(@MethodSig("setChunkTrackingView(Lnet/minecraft/server/level/ChunkTrackingView;)V")) + @AddTransformToSets(ChunkToCloSet.ServerPlayer_redirects.class) @TransformFromMethod(@MethodSig("setChunkTrackingView(Lnet/minecraft/server/level/ChunkTrackingView;)V")) public native void cc_setCloTrackingView(CloTrackingView chunkTrackingView); // TODO P3 :: findDimensionEntryPoint diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinSimulationChunkTracker.java b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinSimulationChunkTracker.java index dd1c17d5..21a856b1 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinSimulationChunkTracker.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/MixinSimulationChunkTracker.java @@ -17,7 +17,7 @@ @Dasm(ChunkToCloSet.class) @Mixin(SimulationChunkTracker.class) public abstract class MixinSimulationChunkTracker extends MixinChunkTracker implements SimulationCloTracker { - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(owner = @Ref(SimulationChunkTracker.class), value = @MethodSig("getLevel(Lnet/minecraft/world/level/ChunkPos;)I")) + @AddTransformToSets(ChunkToCloSet.SimulationChunkTracker_redirects.class) @TransformFromMethod(owner = @Ref(SimulationChunkTracker.class), value = @MethodSig("getLevel(Lnet/minecraft/world/level/ChunkPos;)I")) public native int cc_getLevel(CloPos cloPos); @Inject(method = "setLevel", at = @At("HEAD")) diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/progress/MixinLoggerChunkProgressListener.java b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/progress/MixinLoggerChunkProgressListener.java index 9b8bf765..e11586a1 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/progress/MixinLoggerChunkProgressListener.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/progress/MixinLoggerChunkProgressListener.java @@ -15,9 +15,9 @@ @Dasm(ChunkToCloSet.class) @Mixin(LoggerChunkProgressListener.class) public abstract class MixinLoggerChunkProgressListener implements CloProgressListener { - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(@MethodSig("updateSpawnPos(Lnet/minecraft/world/level/ChunkPos;)V")) + @AddTransformToSets(ChunkToCloSet.LoggerChunkProgressListener_redirects.class) @TransformFromMethod(@MethodSig("updateSpawnPos(Lnet/minecraft/world/level/ChunkPos;)V")) @Override public native void cc_updateSpawnPos(CloPos center); - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(@MethodSig("onStatusChange(Lnet/minecraft/world/level/ChunkPos;Lnet/minecraft/world/level/chunk/status/ChunkStatus;)V")) + @AddTransformToSets(ChunkToCloSet.LoggerChunkProgressListener_redirects.class) @TransformFromMethod(@MethodSig("onStatusChange(Lnet/minecraft/world/level/ChunkPos;Lnet/minecraft/world/level/chunk/status/ChunkStatus;)V")) @Override public native void cc_onStatusChange(CloPos chunkPosition, @Nullable ChunkStatus newStatus); } diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/progress/MixinProcessorChunkProgressListener.java b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/progress/MixinProcessorChunkProgressListener.java index ab2edbbf..a92d6a69 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/progress/MixinProcessorChunkProgressListener.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/progress/MixinProcessorChunkProgressListener.java @@ -26,7 +26,7 @@ @Mixin(ProcessorChunkProgressListener.class) public abstract class MixinProcessorChunkProgressListener implements CloProgressListener { // We need a field referencing the delegate as a CloProgressListener, otherwise we end up trying to access a field of the wrong type - @AddFieldToSets(sets = ChunkToCloSet.class, owner = @Ref(ProcessorChunkProgressListener.class), field = @FieldSig(type = @Ref(ChunkProgressListener.class), name = "delegate")) + @AddFieldToSets(containers = ChunkToCloSet.ProcessorChunkProgressListener_redirects.class, field = @FieldSig(type = @Ref(ChunkProgressListener.class), name = "delegate")) private CloProgressListener cc_delegate; @Inject(method = "", at = @At("RETURN")) @@ -34,9 +34,9 @@ private void cc_onInit(ChunkProgressListener delegate, Executor dispatcher, Call cc_delegate = ((CloProgressListener) delegate); } - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(@MethodSig("updateSpawnPos(Lnet/minecraft/world/level/ChunkPos;)V")) + @AddTransformToSets(ChunkToCloSet.ProcessorChunkProgressListener_redirects.class) @TransformFromMethod(@MethodSig("updateSpawnPos(Lnet/minecraft/world/level/ChunkPos;)V")) @Override public native void cc_updateSpawnPos(CloPos center); - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(@MethodSig("onStatusChange(Lnet/minecraft/world/level/ChunkPos;Lnet/minecraft/world/level/chunk/status/ChunkStatus;)V")) + @AddTransformToSets(ChunkToCloSet.ProcessorChunkProgressListener_redirects.class) @TransformFromMethod(@MethodSig("onStatusChange(Lnet/minecraft/world/level/ChunkPos;Lnet/minecraft/world/level/chunk/status/ChunkStatus;)V")) @Override public native void cc_onStatusChange(CloPos chunkPosition, @Nullable ChunkStatus newStatus); } diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/progress/MixinStoringChunkProgressListener.java b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/progress/MixinStoringChunkProgressListener.java index 27797bde..dcf28e25 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/progress/MixinStoringChunkProgressListener.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/level/progress/MixinStoringChunkProgressListener.java @@ -21,12 +21,12 @@ @Dasm(ChunkToCloSet.class) @Mixin(StoringChunkProgressListener.class) public abstract class MixinStoringChunkProgressListener implements CloProgressListener { - @AddFieldToSets(sets = GlobalSet.class, owner = @Ref(StoringChunkProgressListener.class), field = @FieldSig(type = @Ref(ChunkPos.class), name = "spawnPos")) + @AddFieldToSets(containers = GlobalSet.StoringChunkProgressListener_redirects.class, field = @FieldSig(type = @Ref(ChunkPos.class), name = "spawnPos")) private CloPos cc_spawnPos; - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(@MethodSig("updateSpawnPos(Lnet/minecraft/world/level/ChunkPos;)V")) + @AddTransformToSets(ChunkToCloSet.StoringChunkProgressListener_redirects.class) @TransformFromMethod(@MethodSig("updateSpawnPos(Lnet/minecraft/world/level/ChunkPos;)V")) @Override public native void cc_updateSpawnPos(CloPos center); - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(@MethodSig("onStatusChange(Lnet/minecraft/world/level/ChunkPos;Lnet/minecraft/world/level/chunk/status/ChunkStatus;)V")) + @AddTransformToSets(ChunkToCloSet.StoringChunkProgressListener_redirects.class) @TransformFromMethod(@MethodSig("onStatusChange(Lnet/minecraft/world/level/ChunkPos;Lnet/minecraft/world/level/chunk/status/ChunkStatus;)V")) @Override public native void cc_onStatusChange(CloPos chunkPosition, @Nullable ChunkStatus newStatus); } diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/network/MixinPlayerChunkSender.java b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/network/MixinPlayerChunkSender.java index f2b08f2d..1d36ea50 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/network/MixinPlayerChunkSender.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/server/network/MixinPlayerChunkSender.java @@ -52,10 +52,10 @@ public class MixinPlayerChunkSender { @Shadow @Final private LongSet pendingChunks; - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(value = @MethodSig("markChunkPendingToSend(Lnet/minecraft/world/level/chunk/LevelChunk;)V")) + @AddTransformToSets(ChunkToCloSet.PlayerChunkSender_redirects.class) @TransformFromMethod(value = @MethodSig("markChunkPendingToSend(Lnet/minecraft/world/level/chunk/LevelChunk;)V")) public native void cc_markCloPendingToSend(LevelClo clo); - @AddMethodToSets(sets = ChunkToCloSet.class, owner = @Ref(PlayerChunkSender.class), method = @MethodSig("dropChunk(Lnet/minecraft/server/level/ServerPlayer;Lnet/minecraft/world/level/ChunkPos;)V")) + @AddMethodToSets(containers = ChunkToCloSet.PlayerChunkSender_redirects.class, method = @MethodSig("dropChunk(Lnet/minecraft/server/level/ServerPlayer;Lnet/minecraft/world/level/ChunkPos;)V")) public void cc_dropClo(ServerPlayer player, CloPos cloPos) { if (!this.pendingChunks.remove(cloPos.toLong()) && player.isAlive()) { PacketDistributor.sendToPlayer(player, new CCClientboundForgetLevelCloPacket(cloPos)); diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/world/entity/MixinEntity.java b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/world/entity/MixinEntity.java index 5fbdee43..6a05bdce 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/world/entity/MixinEntity.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/world/entity/MixinEntity.java @@ -44,13 +44,13 @@ public abstract class MixinEntity implements EntityCubePosGetter { @Shadow public abstract AABB getBoundingBox(); @Shadow public abstract int getId(); - @AddFieldToSets(sets = ChunkToCubeSet.class, owner = @Ref(Entity.class), field = @FieldSig(type = @Ref(ChunkPos.class), name = "chunkPosition")) + @AddFieldToSets(containers = ChunkToCubeSet.Entity_redirects.class, field = @FieldSig(type = @Ref(ChunkPos.class), name = "chunkPosition")) private CubePos cc_cubePosition = CubePos.of(0, 0, 0); - @AddTransformToSets(ChunkToCubeSet.class) @TransformFromMethod(@MethodSig("chunkPosition()Lnet/minecraft/world/level/ChunkPos;")) + @AddTransformToSets(ChunkToCubeSet.Entity_redirects.class) @TransformFromMethod(@MethodSig("chunkPosition()Lnet/minecraft/world/level/ChunkPos;")) public native CubePos cc_cubePosition(); - @AddMethodToSets(sets = ChunkToCloSet.class, owner = @Ref(Entity.class), method = @MethodSig("chunkPosition()Lnet/minecraft/world/level/ChunkPos;")) + @AddMethodToSets(containers = ChunkToCloSet.Entity_redirects.class, method = @MethodSig("chunkPosition()Lnet/minecraft/world/level/ChunkPos;")) public CloPos cc_cubePositionAsClo() { return CloPos.cube(cc_cubePosition()); } diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/world/level/MixinLevel.java b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/world/level/MixinLevel.java index 7c027271..6aa8c52e 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/world/level/MixinLevel.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/world/level/MixinLevel.java @@ -122,7 +122,7 @@ private boolean cc_replaceLevelChunkInMarkAndNotifyBlock(Level level, BlockPos b return true; } - @AddTransformToSets(ChunkToCubeSet.class) @TransformFromMethod(useRedirectSets = { ChunkToCubeSet.class }, value = @MethodSig("markAndNotifyBlock(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/chunk/LevelChunk;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/block/state/BlockState;II)V")) + @AddTransformToSets(ChunkToCubeSet.Level_redirects.class) @TransformFromMethod(useRedirectSets = { ChunkToCubeSet.class }, value = @MethodSig("markAndNotifyBlock(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/chunk/LevelChunk;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/block/state/BlockState;II)V")) public native void cc_markAndNotifyBlock(BlockPos blockPos, @Nullable LevelCube levelCube, BlockState blockStatePrev, BlockState blockStateNew, int flags, int p_46608_); // getBlockState diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/world/level/MixinTicketStorage.java b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/world/level/MixinTicketStorage.java index db378ac2..a7d173e5 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/world/level/MixinTicketStorage.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/world/level/MixinTicketStorage.java @@ -19,22 +19,22 @@ public class MixinTicketStorage implements CubicTicketStorage { // TODO (P2) codec nonsense for save/load - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(owner = @Ref(TicketStorage.class), value = @MethodSig("addTicketWithRadius(Lnet/minecraft/server/level/TicketType;Lnet/minecraft/world/level/ChunkPos;I)V")) + @AddTransformToSets(ChunkToCloSet.TicketStorage_redirects.class) @TransformFromMethod(owner = @Ref(TicketStorage.class), value = @MethodSig("addTicketWithRadius(Lnet/minecraft/server/level/TicketType;Lnet/minecraft/world/level/ChunkPos;I)V")) public native void cc_addTicketWithRadius(TicketType ticketType, CloPos cloPos, int radius); - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(owner = @Ref(TicketStorage.class), value = @MethodSig("addTicket(Lnet/minecraft/server/level/Ticket;Lnet/minecraft/world/level/ChunkPos;)V")) + @AddTransformToSets(ChunkToCloSet.TicketStorage_redirects.class) @TransformFromMethod(owner = @Ref(TicketStorage.class), value = @MethodSig("addTicket(Lnet/minecraft/server/level/Ticket;Lnet/minecraft/world/level/ChunkPos;)V")) public native void cc_addTicket(Ticket ticket, CloPos cloPos); - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(owner = @Ref(TicketStorage.class), value = @MethodSig("removeTicketWithRadius(Lnet/minecraft/server/level/TicketType;Lnet/minecraft/world/level/ChunkPos;I)V")) + @AddTransformToSets(ChunkToCloSet.TicketStorage_redirects.class) @TransformFromMethod(owner = @Ref(TicketStorage.class), value = @MethodSig("removeTicketWithRadius(Lnet/minecraft/server/level/TicketType;Lnet/minecraft/world/level/ChunkPos;I)V")) public native void cc_removeTicketWithRadius(TicketType ticketType, CloPos cloPos, int radius); - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(owner = @Ref(TicketStorage.class), value = @MethodSig("removeTicket(Lnet/minecraft/server/level/Ticket;Lnet/minecraft/world/level/ChunkPos;)V")) + @AddTransformToSets(ChunkToCloSet.TicketStorage_redirects.class) @TransformFromMethod(owner = @Ref(TicketStorage.class), value = @MethodSig("removeTicket(Lnet/minecraft/server/level/Ticket;Lnet/minecraft/world/level/ChunkPos;)V")) public native void cc_removeTicket(Ticket ticket, CloPos cloPos); - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(owner = @Ref(TicketStorage.class), value = @MethodSig("updateChunkForced(Lnet/minecraft/world/level/ChunkPos;Z)Z")) + @AddTransformToSets(ChunkToCloSet.TicketStorage_redirects.class) @TransformFromMethod(owner = @Ref(TicketStorage.class), value = @MethodSig("updateChunkForced(Lnet/minecraft/world/level/ChunkPos;Z)Z")) public native boolean cc_updateChunkForced(CloPos cloPos, boolean add); // TODO move to neoforge-specific mixin - @AddTransformToSets(ChunkToCloSet.class) @TransformFromMethod(owner = @Ref(TicketStorage.class), value = @MethodSig("shouldForceNaturalSpawning(Lnet/minecraft/world/level/ChunkPos;)Z")) + @AddTransformToSets(ChunkToCloSet.TicketStorage_redirects.class) @TransformFromMethod(owner = @Ref(TicketStorage.class), value = @MethodSig("shouldForceNaturalSpawning(Lnet/minecraft/world/level/ChunkPos;)Z")) public native boolean cc_shouldForceNaturalSpawning(CloPos cloPos); } diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/world/level/chunk/storage/MixinChunkStorage.java b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/world/level/chunk/storage/MixinChunkStorage.java index 1af73700..d5422dee 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/world/level/chunk/storage/MixinChunkStorage.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/world/level/chunk/storage/MixinChunkStorage.java @@ -16,20 +16,20 @@ @Dasm(ChunkToCloSet.class) @Mixin(ChunkStorage.class) public abstract class MixinChunkStorage { - @AddMethodToSets(sets = ChunkToCloSet.class, owner = @Ref(ChunkStorage.class), + @AddMethodToSets(containers = ChunkToCloSet.ChunkStorage_redirects.class, method = @MethodSig("isOldChunkAround(Lnet/minecraft/world/level/ChunkPos;I)Z")) public boolean cc_isOldChunkAround(CloPos pos, int radius) { return false; // TODO (P2) should be dasm'd once IOWorker is done } - @AddMethodToSets(sets = ChunkToCloSet.class, owner = @Ref(ChunkStorage.class), + @AddMethodToSets(containers = ChunkToCloSet.ChunkStorage_redirects.class, method = @MethodSig("read(Lnet/minecraft/world/level/ChunkPos;)Ljava/util/concurrent/CompletableFuture;")) public CompletableFuture> cc_read(CloPos cloPos) { // TODO (P2) loading - this method should be dasm'd return CompletableFuture.completedFuture(Optional.empty()); } - @AddMethodToSets(sets = ChunkToCloSet.class, owner = @Ref(ChunkStorage.class), + @AddMethodToSets(containers = ChunkToCloSet.ChunkStorage_redirects.class, method = @MethodSig("write(Lnet/minecraft/world/level/ChunkPos;Lnet/minecraft/nbt/CompoundTag;)V")) public void cc_write(CloPos cloPos, CompoundTag chunkData) { // TODO (P2) loading/unloading diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/dasmsets/ChunkInCubicContextSet.java b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/dasmsets/ChunkInCubicContextSet.java index 24c6c7ba..29412e38 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/dasmsets/ChunkInCubicContextSet.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/dasmsets/ChunkInCubicContextSet.java @@ -1,7 +1,14 @@ package io.github.opencubicchunks.cubicchunks.mixin.dasmsets; +import io.github.notstirred.dasm.api.annotations.redirect.sets.InterOwnerContainer; import io.github.notstirred.dasm.api.annotations.redirect.sets.RedirectSet; +import io.github.notstirred.dasm.api.annotations.selector.Ref; +import io.github.opencubicchunks.cubicchunks.world.level.chunk.status.CCChunkStatusTasks; +import net.minecraft.world.level.chunk.status.ChunkStatusTasks; @RedirectSet public interface ChunkInCubicContextSet extends GlobalSet { + @InterOwnerContainer(from = @Ref(ChunkStatusTasks.class), to = @Ref(CCChunkStatusTasks.class)) + class ChunkStatusTasks_to_CCChunkStatusTasks_redirects { + } } diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/dasmsets/ChunkToCloSet.java b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/dasmsets/ChunkToCloSet.java index f2a49ea3..11e8fe4c 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/dasmsets/ChunkToCloSet.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/dasmsets/ChunkToCloSet.java @@ -16,6 +16,8 @@ import io.github.notstirred.dasm.api.annotations.selector.Ref; import io.github.opencubicchunks.cc_core.world.level.CloPos; import io.github.opencubicchunks.cubicchunks.exception.DasmFailedToApply; +import io.github.opencubicchunks.cubicchunks.movetoforgesourcesetlater.CCCommonHooks; +import io.github.opencubicchunks.cubicchunks.movetoforgesourcesetlater.CCEventHooks; import io.github.opencubicchunks.cubicchunks.movetoforgesourcesetlater.EventConstructorDelegates; import io.github.opencubicchunks.cubicchunks.server.level.CloTrackingView; import io.github.opencubicchunks.cubicchunks.world.level.chunklike.CloAccess; @@ -24,13 +26,26 @@ import io.github.opencubicchunks.cubicchunks.world.level.chunklike.ProtoClo; import io.github.opencubicchunks.cubicchunks.world.level.cube.LevelCube; import net.minecraft.core.Registry; +import net.minecraft.server.level.ChunkGenerationTask; import net.minecraft.server.level.ChunkHolder; +import net.minecraft.server.level.ChunkMap; +import net.minecraft.server.level.ChunkTaskDispatcher; +import net.minecraft.server.level.ChunkTaskPriorityQueue; import net.minecraft.server.level.ChunkTrackingView; import net.minecraft.server.level.GenerationChunkHolder; +import net.minecraft.server.level.ServerChunkCache; import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.server.level.SimulationChunkTracker; +import net.minecraft.server.level.progress.LoggerChunkProgressListener; +import net.minecraft.server.level.progress.ProcessorChunkProgressListener; +import net.minecraft.server.level.progress.StoringChunkProgressListener; +import net.minecraft.server.network.PlayerChunkSender; +import net.minecraft.world.entity.Entity; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelHeightAccessor; +import net.minecraft.world.level.TicketStorage; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.chunk.ChunkAccess; @@ -40,11 +55,14 @@ import net.minecraft.world.level.chunk.ProtoChunk; import net.minecraft.world.level.chunk.UpgradeData; import net.minecraft.world.level.chunk.status.ChunkStatus; +import net.minecraft.world.level.chunk.storage.ChunkStorage; import net.minecraft.world.level.levelgen.blending.BlendingData; import net.minecraft.world.level.material.Fluid; import net.minecraft.world.ticks.LevelChunkTicks; import net.minecraft.world.ticks.ProtoChunkTicks; import net.neoforged.bus.api.Event; +import net.neoforged.neoforge.common.CommonHooks; +import net.neoforged.neoforge.event.EventHooks; import net.neoforged.neoforge.event.level.ChunkEvent; /** @@ -89,11 +107,7 @@ interface ChunkAccess_to_CloAccess_redirects { } @TypeRedirect(from = @Ref(LevelChunk.class), to = @Ref(LevelClo.class)) - interface LevelChunk_to_LevelClo_redirects { - // TODO unnecessary once we have DASM redirect inheritance - @MethodRedirect(@MethodSig("getPos()Lnet/minecraft/world/level/ChunkPos;")) - CloPos cc_getCloPos(); - + interface LevelChunk_to_LevelClo_redirects extends ChunkAccess_to_CloAccess_redirects { @ConstructorToFactoryRedirect(@ConstructorMethodSig(args = { @Ref(Level.class), @Ref(CloPos.class) })) static LevelClo create(Level level, ChunkPos pos) { throw new DasmFailedToApply(); @@ -129,11 +143,7 @@ static LevelClo create(ServerLevel level, ProtoClo clo, @Nullable LevelClo.PostL interface LevelChunk$PostLoadProcessor_to_LevelClo$PostLoadProcessor_redirects { } @TypeRedirect(from = @Ref(ProtoChunk.class), to = @Ref(ProtoClo.class)) - interface ProtoChunk_to_ProtoClo_redirects { - // TODO unnecessary once we have DASM redirect inheritance - @MethodRedirect(@MethodSig("getPos()Lnet/minecraft/world/level/ChunkPos;")) - CloPos cc_getCloPos(); - + interface ProtoChunk_to_ProtoClo_redirects extends ChunkAccess_to_CloAccess_redirects { @ConstructorToFactoryRedirect(@ConstructorMethodSig(args = { @Ref(ChunkPos.class), @Ref(UpgradeData.class), @Ref(LevelHeightAccessor.class), @Ref(Registry.class), @Ref(BlendingData.class) })) static ProtoClo create(CloPos cloPos, UpgradeData upgradeData, LevelHeightAccessor levelHeightAccessor, Registry biomeRegistry, @Nullable BlendingData blendingData) { throw new DasmFailedToApply(); @@ -175,18 +185,17 @@ static ImposterProtoClo create(LevelClo wrapped, boolean allowWrites) { @TypeRedirect(from = @Ref(ChunkTrackingView.class), to = @Ref(CloTrackingView.class)) interface ChunkTrackingView_to_CloTrackingView_redirects { - } @TypeRedirect(from = @Ref(ChunkTrackingView.Positioned.class), to = @Ref(CloTrackingView.Positioned.class)) - abstract class ChunkTrackingView$Positioned_to_CloTrackingView$Positioned_redirects { - + abstract class ChunkTrackingView$Positioned_to_CloTrackingView$Positioned_redirects implements ChunkTrackingView_to_CloTrackingView_redirects { } - // Forge stuff + + //region [Forge stuff] // TODO move to a forge-specific sourceset @TypeRedirect(from = @Ref(ChunkEvent.Load.class), to = @Ref(Event.class)) abstract class ChunkEvent$Load_to_Event_redirects { } - @InterOwnerContainer(owner = @Ref(ChunkEvent.Load.class), newOwner = @Ref(EventConstructorDelegates.class)) + @InterOwnerContainer(from = @Ref(ChunkEvent.Load.class), to = @Ref(EventConstructorDelegates.class)) abstract class ChunkEvent$Load_delegateConstruction { @ConstructorToFactoryRedirect(@ConstructorMethodSig(args = { @Ref(LevelChunk.class), @Ref(boolean.class) })) static native Event create_ChunkEvent$Load(LevelCube levelCube, boolean newChunk); @@ -194,21 +203,98 @@ abstract class ChunkEvent$Load_delegateConstruction { @TypeRedirect(from = @Ref(ChunkEvent.Unload.class), to = @Ref(Event.class)) abstract class ChunkEvent$Unload_to_Event_redirects { } - @InterOwnerContainer(owner = @Ref(ChunkEvent.Unload.class), newOwner = @Ref(EventConstructorDelegates.class)) + @InterOwnerContainer(from = @Ref(ChunkEvent.Unload.class), to = @Ref(EventConstructorDelegates.class)) abstract class ChunkEvent$Unload_delegateConstruction { @ConstructorToFactoryRedirect(@ConstructorMethodSig(args = { @Ref(LevelChunk.class)})) static native Event create_ChunkEvent$Unload(LevelCube levelCube); } - @IntraOwnerContainer(owner = @Ref(GenerationChunkHolder.class)) + @IntraOwnerContainer(@Ref(GenerationChunkHolder.class)) abstract class GenerationChunkHolder_Forge_Jank_redirects { @FieldToMethodRedirect(value = @FieldSig(name = "currentlyLoading", type = @Ref(LevelChunk.class)), setter = "cc_setCurrentlyLoading") public native LevelClo cc_getCurrentlyLoading(); } - // TODO dasm inheritance - @IntraOwnerContainer(owner = @Ref(ChunkHolder.class)) - abstract class ChunkHolder_Forge_Jank_redirects { - @FieldToMethodRedirect(value = @FieldSig(name = "currentlyLoading", type = @Ref(LevelChunk.class)), setter = "cc_setCurrentlyLoading") - public native LevelClo cc_getCurrentlyLoading(); + @IntraOwnerContainer(@Ref(ChunkHolder.class)) + abstract class ChunkHolder_Forge_Jank_redirects extends GenerationChunkHolder_Forge_Jank_redirects {} + //endregion + + @IntraOwnerContainer(@Ref(ChunkHolder.class)) + class ChunkHolder_redirects extends GenerationChunkHolder_redirects { + } + + @IntraOwnerContainer(@Ref(ProcessorChunkProgressListener.class)) + class ProcessorChunkProgressListener_redirects { + } + + @IntraOwnerContainer(@Ref(ChunkGenerationTask.class)) + class ChunkGenerationTask_redirects { + } + + @IntraOwnerContainer(@Ref(GenerationChunkHolder.class)) + class GenerationChunkHolder_redirects { + } + + @IntraOwnerContainer(@Ref(ChunkStorage.class)) + class ChunkStorage_redirects { + } + + @IntraOwnerContainer(@Ref(ChunkMap.class)) + class ChunkMap_redirects extends ChunkStorage_redirects { + } + + @IntraOwnerContainer(@Ref(ChunkMap.TrackedEntity.class)) + class ChunkMap$TrackedEntity_redirects { + } + + @IntraOwnerContainer(@Ref(ServerChunkCache.class)) + class ServerChunkCache_redirects { + } + + @IntraOwnerContainer(@Ref(ServerLevel.class)) + class ServerLevel_redirects { + } + + @IntraOwnerContainer(@Ref(Entity.class)) + class Entity_redirects { + } + + @IntraOwnerContainer(@Ref(ServerPlayer.class)) + class ServerPlayer_redirects extends Entity_redirects { + } + + @IntraOwnerContainer(@Ref(PlayerChunkSender.class)) + class PlayerChunkSender_redirects { + } + + @InterOwnerContainer(from = @Ref(EventHooks.class), to = @Ref(CCEventHooks.class)) + class EventHooks_to_CCEventHooks_redirects { + } + + @InterOwnerContainer(from = @Ref(CommonHooks.class), to = @Ref(CCCommonHooks.class)) + class CommonHooks_to_CCCommonHooks_redirects { + } + + @IntraOwnerContainer(@Ref(ChunkTaskDispatcher.class)) + class ChunkTaskDispatcher_redirects { + } + + @IntraOwnerContainer(@Ref(ChunkTaskPriorityQueue.class)) + class ChunkTaskPriorityQueue_redirects { + } + + @IntraOwnerContainer(@Ref(SimulationChunkTracker.class)) + class SimulationChunkTracker_redirects { + } + + @IntraOwnerContainer(@Ref(LoggerChunkProgressListener.class)) + class LoggerChunkProgressListener_redirects { + } + + @IntraOwnerContainer(@Ref(StoringChunkProgressListener.class)) + class StoringChunkProgressListener_redirects { + } + + @IntraOwnerContainer(@Ref(TicketStorage.class)) + class TicketStorage_redirects { } } diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/dasmsets/ChunkToCubeSet.java b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/dasmsets/ChunkToCubeSet.java index 02124730..3e9c89b8 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/dasmsets/ChunkToCubeSet.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/dasmsets/ChunkToCubeSet.java @@ -2,6 +2,8 @@ import java.util.List; import java.util.concurrent.CompletableFuture; +import java.util.function.IntConsumer; +import java.util.function.IntSupplier; import io.github.notstirred.dasm.api.annotations.redirect.redirects.ConstructorToFactoryRedirect; import io.github.notstirred.dasm.api.annotations.redirect.redirects.FieldRedirect; @@ -19,8 +21,10 @@ import io.github.opencubicchunks.cubicchunks.client.multiplayer.ClientCubeCache; import io.github.opencubicchunks.cubicchunks.client.renderer.cube.RenderCube; import io.github.opencubicchunks.cubicchunks.client.renderer.cube.RenderRegionCacheCubeInfo; +import io.github.opencubicchunks.cubicchunks.movetoforgesourcesetlater.CCCommonHooks; import io.github.opencubicchunks.cubicchunks.movetoforgesourcesetlater.EventConstructorDelegates; import io.github.opencubicchunks.cubicchunks.server.level.CubeHolder; +import io.github.opencubicchunks.cubicchunks.server.level.CubeLevel; import io.github.opencubicchunks.cubicchunks.server.level.GeneratingCubeMap; import io.github.opencubicchunks.cubicchunks.util.StaticCache3D; import io.github.opencubicchunks.cubicchunks.world.level.cube.CubeAccess; @@ -30,16 +34,25 @@ import io.github.opencubicchunks.cubicchunks.world.level.cube.ProtoCube; import io.github.opencubicchunks.cubicchunks.world.level.cube.status.CubePyramid; import io.github.opencubicchunks.cubicchunks.world.level.cube.status.CubeStatusTask; +import io.github.opencubicchunks.cubicchunks.world.level.cube.status.CubeStatusTasks; import io.github.opencubicchunks.cubicchunks.world.level.cube.status.CubeStep; import net.minecraft.client.multiplayer.ClientChunkCache; +import net.minecraft.client.renderer.LevelRenderer; +import net.minecraft.client.renderer.SectionOcclusionGraph; import net.minecraft.client.renderer.chunk.RenderChunk; import net.minecraft.server.level.ChunkGenerationTask; import net.minecraft.server.level.ChunkHolder; +import net.minecraft.server.level.ChunkLevel; +import net.minecraft.server.level.ChunkMap; import net.minecraft.server.level.GeneratingChunkMap; import net.minecraft.server.level.GenerationChunkHolder; +import net.minecraft.server.level.ServerChunkCache; +import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.util.StaticCache2D; +import net.minecraft.world.entity.Entity; import net.minecraft.world.level.ChunkPos; +import net.minecraft.world.level.Level; import net.minecraft.world.level.chunk.ChunkAccess; import net.minecraft.world.level.chunk.EmptyLevelChunk; import net.minecraft.world.level.chunk.ImposterProtoChunk; @@ -48,8 +61,10 @@ import net.minecraft.world.level.chunk.status.ChunkPyramid; import net.minecraft.world.level.chunk.status.ChunkStatus; import net.minecraft.world.level.chunk.status.ChunkStatusTask; +import net.minecraft.world.level.chunk.status.ChunkStatusTasks; import net.minecraft.world.level.chunk.status.ChunkStep; import net.neoforged.bus.api.Event; +import net.neoforged.neoforge.common.CommonHooks; import net.neoforged.neoforge.event.level.ChunkEvent; /** @@ -155,7 +170,10 @@ abstract class ChunkPyramid_to_CubePyramid_redirects { } abstract class ChunkPyramid$Builder_to_CubePyramid$Builder_redirects { } @TypeRedirect(from = @Ref(ChunkHolder.LevelChangeListener.class), to = @Ref(CubeHolder.LevelChangeListener.class)) - interface ChunkHolder$LevelChangeListener_to_CubeHolder$LevelChangeListener_redirects { } + interface ChunkHolder$LevelChangeListener_to_CubeHolder$LevelChangeListener_redirects { + @MethodRedirect(@MethodSig("onLevelChange(Lnet/minecraft/world/level/ChunkPos;Ljava/util/function/IntSupplier;ILjava/util/function/IntConsumer;)V")) + void cc_onLevelChange(CubePos cubePos, IntSupplier queueLevelGetter, int ticketLevel, IntConsumer queueLevelSetter); + } @TypeRedirect(from = @Ref(ChunkHolder.PlayerProvider.class), to = @Ref(CubeHolder.PlayerProvider.class)) interface ChunkHolder$PlayerProvider_to_CubeHolder$PlayerProvider_redirects { @@ -172,7 +190,7 @@ interface GeneratingChunkMap_to_GeneratingCubeMap_redirects { ChunkGenerationTask cc_scheduleGenerationTask(ChunkStatus targetStatus, CubePos pos); } - @IntraOwnerContainer(owner = @Ref(ChunkGenerationTask.class)) + @IntraOwnerContainer(@Ref(ChunkGenerationTask.class)) abstract class ChunkGenerationTask_redirects { @FieldToMethodRedirect(@FieldSig(type = @Ref(GeneratingChunkMap.class), name = "chunkMap")) private native GeneratingCubeMap cc_getGeneratingCubeMap(); @@ -181,18 +199,15 @@ abstract class ChunkGenerationTask_redirects { @TypeRedirect(from = @Ref(LevelChunk.UnsavedListener.class), to = @Ref(LevelCube.UnsavedListener.class)) interface LevelChunk$UnsavedListener_to_LevelCube$UnsavedListener_redirects { } - @IntraOwnerContainer(owner = @Ref(ChunkHolder.class)) - abstract class ChunkHolder_redirects { - // TODO dasm inheritance - @FieldRedirect(@FieldSig(name = "pos", type = @Ref(ChunkPos.class))) - protected CubePos cc_cubePos; + @IntraOwnerContainer(@Ref(ChunkHolder.class)) + abstract class ChunkHolder_redirects extends GenerationChunkHolder_redirects { } - // Forge stuff + //region [Forge stuff] // TODO move to a forge-specific sourceset @TypeRedirect(from = @Ref(ChunkEvent.Load.class), to = @Ref(Event.class)) abstract class ChunkEvent$Load_to_Event_redirects { } - @InterOwnerContainer(owner = @Ref(ChunkEvent.Load.class), newOwner = @Ref(EventConstructorDelegates.class)) + @InterOwnerContainer(from = @Ref(ChunkEvent.Load.class), to = @Ref(EventConstructorDelegates.class)) abstract class ChunkEvent$Load_delegateConstruction { @ConstructorToFactoryRedirect(@ConstructorMethodSig(args = { @Ref(LevelChunk.class), @Ref(boolean.class) })) static native Event create_ChunkEvent$Load(LevelCube levelCube, boolean newChunk); @@ -200,16 +215,69 @@ abstract class ChunkEvent$Load_delegateConstruction { @TypeRedirect(from = @Ref(ChunkEvent.Unload.class), to = @Ref(Event.class)) abstract class ChunkEvent$Unload_to_Event_redirects { } - @InterOwnerContainer(owner = @Ref(ChunkEvent.Unload.class), newOwner = @Ref(EventConstructorDelegates.class)) + @InterOwnerContainer(from = @Ref(ChunkEvent.Unload.class), to = @Ref(EventConstructorDelegates.class)) abstract class ChunkEvent$Unload_delegateConstruction { @ConstructorToFactoryRedirect(@ConstructorMethodSig(args = { @Ref(LevelChunk.class)})) static native Event create_ChunkEvent$Unload(LevelCube levelCube); } - // TODO dasm inheritance - @IntraOwnerContainer(owner = @Ref(ChunkHolder.class)) - abstract class ChunkHolder_Forge_Jank_redirects { - @FieldRedirect(@FieldSig(name = "currentlyLoading", type = @Ref(LevelChunk.class))) - public LevelCube cc_currentlyLoadingCube; + @IntraOwnerContainer(@Ref(GenerationChunkHolder.class)) + abstract class GenerationChunkHolder_Forge_Jank_redirects {} + @IntraOwnerContainer(@Ref(ChunkHolder.class)) + abstract class ChunkHolder_Forge_Jank_redirects extends GenerationChunkHolder_Forge_Jank_redirects {} + //endregion + + @InterOwnerContainer(from = @Ref(ChunkLevel.class), to = @Ref(CubeLevel.class)) + class ChunkLevel_to_CubeLevel_redirects { + } + + @InterOwnerContainer(from = @Ref(ChunkStatusTasks.class), to = @Ref(CubeStatusTasks.class)) + class ChunkStatusTasks_to_CubeStatusTasks_redirects { + } + + @IntraOwnerContainer(@Ref(GenerationChunkHolder.class)) + class GenerationChunkHolder_redirects { + @FieldRedirect(@FieldSig(name = "pos", type = @Ref(ChunkPos.class))) + protected CubePos cc_cubePos; + } + + @IntraOwnerContainer(@Ref(ChunkMap.class)) + class ChunkMap_redirects { + } + + @IntraOwnerContainer(@Ref(ServerChunkCache.class)) + class ServerChunkCache_redirects { + } + + @IntraOwnerContainer(@Ref(Entity.class)) + class Entity_redirects { + } + + @IntraOwnerContainer(@Ref(ServerPlayer.class)) + class ServerPlayer_redirects extends Entity_redirects { + } + + @IntraOwnerContainer(@Ref(ClientChunkCache.class)) + class ClientChunkCache_redirects { + } + + @IntraOwnerContainer(@Ref(SectionOcclusionGraph.class)) + class SectionOcclusionGraph_redirects { + } + + @InterOwnerContainer(from = @Ref(CommonHooks.class), to = @Ref(CCCommonHooks.class)) + class CommonHooks_to_CCCommonHooks_redirects { + } + + @IntraOwnerContainer(@Ref(Level.class)) + class Level_redirects { + } + + @IntraOwnerContainer(@Ref(ServerLevel.class)) + class ServerLevel_redirects extends Level_redirects { + } + + @IntraOwnerContainer(@Ref(LevelRenderer.class)) + class LevelRenderer_redirects { } } diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/dasmsets/ForgeSet.java b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/dasmsets/ForgeSet.java index 3b781ed1..5b38e6b5 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/dasmsets/ForgeSet.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/dasmsets/ForgeSet.java @@ -1,9 +1,15 @@ package io.github.opencubicchunks.cubicchunks.mixin.dasmsets; +import io.github.notstirred.dasm.api.annotations.redirect.sets.InterOwnerContainer; import io.github.notstirred.dasm.api.annotations.redirect.sets.RedirectSet; +import io.github.notstirred.dasm.api.annotations.selector.Ref; +import io.github.opencubicchunks.cubicchunks.movetoforgesourcesetlater.CCEventHooks; +import net.neoforged.neoforge.event.EventHooks; // TODO once redirect sets can be applied conditionally, this should be in the forge sourceset and GlobalSet should no longer extend it @RedirectSet public interface ForgeSet { - + @InterOwnerContainer(from = @Ref(EventHooks.class), to = @Ref(CCEventHooks.class)) + class EventHooks_to_CCEventHooks_redirects { + } } diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/dasmsets/GlobalSet.java b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/dasmsets/GlobalSet.java index 299b3821..cc817dc3 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/dasmsets/GlobalSet.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/dasmsets/GlobalSet.java @@ -21,10 +21,12 @@ import net.minecraft.server.level.ChunkMap; import net.minecraft.server.level.ChunkResult; import net.minecraft.server.level.ChunkTrackingView; +import net.minecraft.server.level.ServerChunkCache; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ThreadedLevelLightEngine; import net.minecraft.server.level.TicketType; import net.minecraft.server.level.progress.ChunkProgressListener; +import net.minecraft.server.level.progress.StoringChunkProgressListener; import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.chunk.status.ChunkStatus; import net.minecraft.world.level.entity.ChunkStatusUpdateListener; @@ -37,7 +39,7 @@ */ @RedirectSet public interface GlobalSet extends ForgeSet { - @IntraOwnerContainer(owner = @Ref(ChunkStatus.class)) + @IntraOwnerContainer(@Ref(ChunkStatus.class)) abstract class ChunkStatus_redirects { @MethodRedirect(@MethodSig("generate(Ljava/util/concurrent/Executor;Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/level/chunk/ChunkGenerator;Lnet/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplateManager;Lnet/minecraft/server/level/ThreadedLevelLightEngine;Ljava/util/function/Function;Ljava/util/List;)Ljava/util/concurrent/CompletableFuture;")) public abstract CompletableFuture> cc_generate( @@ -68,4 +70,16 @@ interface ChunkTrackingView_to_CloTrackingView_redirects { } @TypeRedirect(from = @Ref(ChunkTrackingView.Positioned.class), to = @Ref(CloTrackingView.Positioned.class)) abstract class ChunkTrackingView$Positioned_to_CloTrackingView$Positioned_redirects { } + + @IntraOwnerContainer(@Ref(StoringChunkProgressListener.class)) + class StoringChunkProgressListener_redirects { + } + + @IntraOwnerContainer(@Ref(ChunkMap.class)) + class ChunkMap_redirects { + } + + @IntraOwnerContainer(@Ref(ServerChunkCache.class)) + class ServerChunkCache_redirects { + } } diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/dasmsets/SectionPosToChunkSet.java b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/dasmsets/SectionPosToChunkSet.java index be587699..817b079d 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/dasmsets/SectionPosToChunkSet.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/dasmsets/SectionPosToChunkSet.java @@ -13,7 +13,7 @@ */ @RedirectSet public interface SectionPosToChunkSet { - @IntraOwnerContainer(owner = @Ref(SectionPos.class)) + @IntraOwnerContainer(@Ref(SectionPos.class)) abstract class SectionPos_redirects { @MethodRedirect(@MethodSig("chunk()Lnet/minecraft/world/level/ChunkPos;")) public native CloPos cc_chunk(); diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/dasmsets/SectionPosToCubeSet.java b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/dasmsets/SectionPosToCubeSet.java index cf59a433..5de45fdd 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/dasmsets/SectionPosToCubeSet.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/dasmsets/SectionPosToCubeSet.java @@ -13,7 +13,7 @@ */ @RedirectSet public interface SectionPosToCubeSet { - @IntraOwnerContainer(owner = @Ref(SectionPos.class)) + @IntraOwnerContainer(@Ref(SectionPos.class)) abstract class SectionPos_redirects { @MethodRedirect(@MethodSig("chunk()Lnet/minecraft/world/level/ChunkPos;")) public native CloPos cc_cube(); diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/movetoforgesourcesetlater/CCCommonHooks.java b/src/main/java/io/github/opencubicchunks/cubicchunks/movetoforgesourcesetlater/CCCommonHooks.java index 2da066b1..0a79a5a1 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/movetoforgesourcesetlater/CCCommonHooks.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/movetoforgesourcesetlater/CCCommonHooks.java @@ -15,12 +15,12 @@ @Dasm(GlobalSet.class) public class CCCommonHooks { - @AddMethodToSets(sets = ChunkToCubeSet.class, owner = @Ref(CommonHooks.class), method = @MethodSig("onChunkUnload(Lnet/minecraft/world/entity/ai/village/poi/PoiManager;Lnet/minecraft/world/level/chunk/ChunkAccess;)V")) + @AddMethodToSets(containers = ChunkToCubeSet.CommonHooks_to_CCCommonHooks_redirects.class, method = @MethodSig("onChunkUnload(Lnet/minecraft/world/entity/ai/village/poi/PoiManager;Lnet/minecraft/world/level/chunk/ChunkAccess;)V")) public static void onCubeUnload(PoiManager poiManager, CubeAccess cubeAccess) { // TODO (P2) save/load: once PoiManager cubic methods are implemented, this method can be a dasm copy } - @AddMethodToSets(sets = ChunkToCloSet.class, owner = @Ref(CommonHooks.class), method = @MethodSig("onChunkUnload(Lnet/minecraft/world/entity/ai/village/poi/PoiManager;Lnet/minecraft/world/level/chunk/ChunkAccess;)V")) + @AddMethodToSets(containers = ChunkToCloSet.CommonHooks_to_CCCommonHooks_redirects.class, method = @MethodSig("onChunkUnload(Lnet/minecraft/world/entity/ai/village/poi/PoiManager;Lnet/minecraft/world/level/chunk/ChunkAccess;)V")) public static void onCloUnload(PoiManager poiManager, CloAccess cloAccess) { if (cloAccess instanceof CubeAccess cubeAccess) { onCubeUnload(poiManager, cubeAccess); diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/movetoforgesourcesetlater/CCEventHooks.java b/src/main/java/io/github/opencubicchunks/cubicchunks/movetoforgesourcesetlater/CCEventHooks.java index 9a270dcd..993446fc 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/movetoforgesourcesetlater/CCEventHooks.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/movetoforgesourcesetlater/CCEventHooks.java @@ -20,7 +20,7 @@ public class CCEventHooks { // TODO onCreateWorldSpawn? // TODO onTrySpawnPortal? - @AddMethodToSets(sets = ForgeSet.class, owner = @Ref(EventHooks.class), method = @MethodSig("fireChunkTicketLevelUpdated(Lnet/minecraft/server/level/ServerLevel;JIILnet/minecraft/server/level/ChunkHolder;)V")) + @AddMethodToSets(containers = ForgeSet.EventHooks_to_CCEventHooks_redirects.class, method = @MethodSig("fireChunkTicketLevelUpdated(Lnet/minecraft/server/level/ServerLevel;JIILnet/minecraft/server/level/ChunkHolder;)V")) public static void fireChunkTicketLevelUpdated(ServerLevel level, long cloPos, int oldTicketLevel, int newTicketLevel, @Nullable ChunkHolder chunkHolder) { if (CloPos.isChunk(cloPos)) { EventHooks.fireChunkTicketLevelUpdated(level, cloPos, oldTicketLevel, newTicketLevel, chunkHolder); @@ -30,7 +30,7 @@ public static void fireChunkTicketLevelUpdated(ServerLevel level, long cloPos, i } // TODO do we need a ChunkToCloForgeSet, etc? actually I guess if we only tell dasm about this class on forge then it's fine - @AddMethodToSets(sets = ChunkToCloSet.class, owner = @Ref(EventHooks.class), method = @MethodSig("fireChunkWatch(Lnet/minecraft/server/level/ServerPlayer;Lnet/minecraft/world/level/chunk/LevelChunk;Lnet/minecraft/server/level/ServerLevel;)V")) + @AddMethodToSets(containers = ChunkToCloSet.EventHooks_to_CCEventHooks_redirects.class, method = @MethodSig("fireChunkWatch(Lnet/minecraft/server/level/ServerPlayer;Lnet/minecraft/world/level/chunk/LevelChunk;Lnet/minecraft/server/level/ServerLevel;)V")) public static void fireChunkWatch(ServerPlayer entity, LevelClo clo, ServerLevel level) { if (clo instanceof LevelChunk chunk) { EventHooks.fireChunkWatch(entity, chunk, level); @@ -39,7 +39,7 @@ public static void fireChunkWatch(ServerPlayer entity, LevelClo clo, ServerLevel } } - @AddMethodToSets(sets = ChunkToCloSet.class, owner = @Ref(EventHooks.class), method = @MethodSig("fireChunkSent(Lnet/minecraft/server/level/ServerPlayer;Lnet/minecraft/world/level/chunk/LevelChunk;Lnet/minecraft/server/level/ServerLevel;)V")) + @AddMethodToSets(containers = ChunkToCloSet.EventHooks_to_CCEventHooks_redirects.class, method = @MethodSig("fireChunkSent(Lnet/minecraft/server/level/ServerPlayer;Lnet/minecraft/world/level/chunk/LevelChunk;Lnet/minecraft/server/level/ServerLevel;)V")) public static void fireChunkSent(ServerPlayer entity, LevelClo clo, ServerLevel level) { if (clo instanceof LevelChunk chunk) { EventHooks.fireChunkSent(entity, chunk, level); @@ -48,7 +48,7 @@ public static void fireChunkSent(ServerPlayer entity, LevelClo clo, ServerLevel } } - @AddMethodToSets(sets = ChunkToCloSet.class, owner = @Ref(EventHooks.class), method = @MethodSig("fireChunkUnWatch(Lnet/minecraft/server/level/ServerPlayer;Lnet/minecraft/world/level/ChunkPos;Lnet/minecraft/server/level/ServerLevel;)V")) + @AddMethodToSets(containers = ChunkToCloSet.EventHooks_to_CCEventHooks_redirects.class, method = @MethodSig("fireChunkUnWatch(Lnet/minecraft/server/level/ServerPlayer;Lnet/minecraft/world/level/ChunkPos;Lnet/minecraft/server/level/ServerLevel;)V")) public static void fireChunkUnWatch(ServerPlayer entity, CloPos cloPos, ServerLevel level) { if (cloPos.isChunk()) { EventHooks.fireChunkUnWatch(entity, cloPos.chunkPos(), level); diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/server/level/CloTrackingView.java b/src/main/java/io/github/opencubicchunks/cubicchunks/server/level/CloTrackingView.java index 13e878f7..ed8f725c 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/server/level/CloTrackingView.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/server/level/CloTrackingView.java @@ -17,7 +17,7 @@ @Dasm(ChunkToCloSet.class) public interface CloTrackingView extends ChunkTrackingView { - @AddFieldToSets(sets = ChunkToCloSet.class, owner = @Ref(ChunkTrackingView.class), field = @FieldSig(type = @Ref(ChunkTrackingView.class), name = "EMPTY")) + @AddFieldToSets(containers = ChunkToCloSet.ChunkTrackingView_to_CloTrackingView_redirects.class, field = @FieldSig(type = @Ref(ChunkTrackingView.class), name = "EMPTY")) CloTrackingView EMPTY = new CloTrackingView() { @Override public boolean cc_contains(int cubeX, int cubeY, int cubeZ, boolean searchAllChunks) { return false; @@ -36,12 +36,12 @@ public void forEach(Consumer action) { } }; - @AddMethodToSets(sets = ChunkToCloSet.class, owner = @Ref(ChunkTrackingView.class), method = @MethodSig("of(Lnet/minecraft/world/level/ChunkPos;I)Lnet/minecraft/server/level/ChunkTrackingView;")) + @AddMethodToSets(containers = ChunkToCloSet.ChunkTrackingView_to_CloTrackingView_redirects.class, method = @MethodSig("of(Lnet/minecraft/world/level/ChunkPos;I)Lnet/minecraft/server/level/ChunkTrackingView;")) static CloTrackingView cc_of(CloPos center, int viewDistanceCubes) { return new CloTrackingView.Positioned(center, viewDistanceCubes); } - @AddMethodToSets(sets = ChunkToCloSet.class, owner = @Ref(ChunkTrackingView.class), method = @MethodSig("difference(Lnet/minecraft/server/level/ChunkTrackingView;Lnet/minecraft/server/level/ChunkTrackingView;Ljava/util/function/Consumer;Ljava/util/function/Consumer;)V")) + @AddMethodToSets(containers = ChunkToCloSet.ChunkTrackingView_to_CloTrackingView_redirects.class, method = @MethodSig("difference(Lnet/minecraft/server/level/ChunkTrackingView;Lnet/minecraft/server/level/ChunkTrackingView;Ljava/util/function/Consumer;Ljava/util/function/Consumer;)V")) static void cc_difference(CloTrackingView oldCloTrackingView, CloTrackingView newCloTrackingView, Consumer chunkDropper, Consumer chunkMarker) { if (!oldCloTrackingView.equals(newCloTrackingView)) { if (oldCloTrackingView instanceof Positioned oldPositioned @@ -122,7 +122,7 @@ static void cc_difference(CloTrackingView oldCloTrackingView, CloTrackingView ne } } - @AddMethodToSets(sets = ChunkToCloSet.class, owner = @Ref(ChunkTrackingView.class), method = @MethodSig("contains(Lnet/minecraft/world/level/ChunkPos;)Z")) + @AddMethodToSets(containers = ChunkToCloSet.ChunkTrackingView_to_CloTrackingView_redirects.class, method = @MethodSig("contains(Lnet/minecraft/world/level/ChunkPos;)Z")) default boolean cc_contains(CloPos cloPos) { if (cloPos.isCube()) { return this.cc_contains(cloPos.getX(), cloPos.getY(), cloPos.getZ()); @@ -137,7 +137,7 @@ default boolean cc_contains(int cubeX, int cubeY, int cubeZ) { boolean cc_contains(int cubeX, int cubeY, int cubeZ, boolean searchAllChunks); - @AddMethodToSets(sets = ChunkToCloSet.class, owner = @Ref(ChunkTrackingView.class), method = @MethodSig("forEach(Ljava/util/function/Consumer;)V")) + @AddMethodToSets(containers = ChunkToCloSet.ChunkTrackingView_to_CloTrackingView_redirects.class, method = @MethodSig("forEach(Ljava/util/function/Consumer;)V")) void cc_forEach(Consumer action); default boolean cc_isInViewDistance(int cubeX, int cubeY, int cubeZ) { @@ -161,7 +161,7 @@ static boolean cc_isWithinDistanceCubeColumn(int centerCubeX, int centerCubeZ, i } @Dasm(ChunkToCloSet.class) - record Positioned(CloPos center, @AddMethodToSets(sets = ChunkToCloSet.class, owner = @Ref(ChunkTrackingView.Positioned.class), method = @MethodSig("viewDistance()I")) int viewDistanceCubes) implements CloTrackingView { + record Positioned(CloPos center, @AddMethodToSets(containers = ChunkToCloSet.ChunkTrackingView$Positioned_to_CloTrackingView$Positioned_redirects.class, method = @MethodSig("viewDistance()I")) int viewDistanceCubes) implements CloTrackingView { int minX() { return this.center.getX() - this.viewDistanceCubes - 1; } diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/server/level/CubeHolder.java b/src/main/java/io/github/opencubicchunks/cubicchunks/server/level/CubeHolder.java index ff51ffaf..26f7d9dd 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/server/level/CubeHolder.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/server/level/CubeHolder.java @@ -10,8 +10,7 @@ public interface CubeHolder { @FunctionalInterface interface LevelChangeListener { - // FIXME rename to have cc_ prefix again - currently removed due to a DASM bug with how lambdas are handled - void onLevelChange(CubePos cubePos, IntSupplier queueLevelGetter, int ticketLevel, IntConsumer queueLevelSetter); + void cc_onLevelChange(CubePos cubePos, IntSupplier queueLevelGetter, int ticketLevel, IntConsumer queueLevelSetter); } interface PlayerProvider { diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/server/level/CubeLevel.java b/src/main/java/io/github/opencubicchunks/cubicchunks/server/level/CubeLevel.java index 83db106b..d3be5617 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/server/level/CubeLevel.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/server/level/CubeLevel.java @@ -23,18 +23,18 @@ public class CubeLevel { private static final int FULL_CHUNK_LEVEL = 33; private static final CubeStep FULL_CUBE_STEP = CubePyramid.CC_GENERATION_PYRAMID_CUBES.getStepTo(ChunkStatus.FULL); - @AddFieldToSets(sets = ChunkToCubeSet.class, owner = @Ref(ChunkLevel.class), field = @FieldSig(type = @Ref(int.class), name = "RADIUS_AROUND_FULL_CHUNK")) + @AddFieldToSets(containers = ChunkToCubeSet.ChunkLevel_to_CubeLevel_redirects.class, field = @FieldSig(type = @Ref(int.class), name = "RADIUS_AROUND_FULL_CHUNK")) public static final int RADIUS_AROUND_FULL_CUBE = FULL_CUBE_STEP.accumulatedDependencies().getRadius(); // TODO not sure if this one should actually be redirected? in some cases we want this MAX_LEVEL, in some cases we want the true MAX_LEVEL, which is greater. public static final int MAX_LEVEL = FULL_CHUNK_LEVEL + RADIUS_AROUND_FULL_CUBE; - @AddMethodToSets(sets = ChunkToCubeSet.class, owner = @Ref(ChunkLevel.class), method = @MethodSig("generationStatus(I)Lnet/minecraft/world/level/chunk/status/ChunkStatus;")) + @AddMethodToSets(containers = ChunkToCubeSet.ChunkLevel_to_CubeLevel_redirects.class, method = @MethodSig("generationStatus(I)Lnet/minecraft/world/level/chunk/status/ChunkStatus;")) @Nullable public static ChunkStatus cubeGenerationStatus(int level) { return getStatusAroundFullCube(level - FULL_CHUNK_LEVEL, null); } - @AddMethodToSets(sets = ChunkToCubeSet.class, owner = @Ref(ChunkLevel.class), method = @MethodSig("getStatusAroundFullChunk(ILnet/minecraft/world/level/chunk/status/ChunkStatus;)Lnet/minecraft/world/level/chunk/status/ChunkStatus;")) + @AddMethodToSets(containers = ChunkToCubeSet.ChunkLevel_to_CubeLevel_redirects.class, method = @MethodSig("getStatusAroundFullChunk(ILnet/minecraft/world/level/chunk/status/ChunkStatus;)Lnet/minecraft/world/level/chunk/status/ChunkStatus;")) @Nullable @Contract("_,!null->!null;_,_->_") public static ChunkStatus getStatusAroundFullCube(int distance, @Nullable ChunkStatus chunkStatus) { @@ -45,17 +45,17 @@ public static ChunkStatus getStatusAroundFullCube(int distance, @Nullable ChunkS } } - @AddMethodToSets(sets = ChunkToCubeSet.class, owner = @Ref(ChunkLevel.class), method = @MethodSig("getStatusAroundFullChunk(I)Lnet/minecraft/world/level/chunk/status/ChunkStatus;")) + @AddMethodToSets(containers = ChunkToCubeSet.ChunkLevel_to_CubeLevel_redirects.class, method = @MethodSig("getStatusAroundFullChunk(I)Lnet/minecraft/world/level/chunk/status/ChunkStatus;")) public static ChunkStatus getStatusAroundFullCube(int distance) { return getStatusAroundFullCube(distance, ChunkStatus.EMPTY); } - @AddMethodToSets(sets = ChunkToCubeSet.class, owner = @Ref(ChunkLevel.class), method = @MethodSig("byStatus(Lnet/minecraft/world/level/chunk/status/ChunkStatus;)I")) + @AddMethodToSets(containers = ChunkToCubeSet.ChunkLevel_to_CubeLevel_redirects.class, method = @MethodSig("byStatus(Lnet/minecraft/world/level/chunk/status/ChunkStatus;)I")) public static int byCubeStatus(ChunkStatus status) { return FULL_CHUNK_LEVEL + FULL_CUBE_STEP.getAccumulatedRadiusOf(status); } - @AddMethodToSets(sets = ChunkToCubeSet.class, owner = @Ref(ChunkLevel.class), method = @MethodSig("isLoaded(I)Z")) + @AddMethodToSets(containers = ChunkToCubeSet.ChunkLevel_to_CubeLevel_redirects.class, method = @MethodSig("isLoaded(I)Z")) public static boolean isLoadedCube(int level) { return level <= MAX_LEVEL; } diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/world/level/chunk/status/CCChunkStatusTasks.java b/src/main/java/io/github/opencubicchunks/cubicchunks/world/level/chunk/status/CCChunkStatusTasks.java index e0447111..23270310 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/world/level/chunk/status/CCChunkStatusTasks.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/world/level/chunk/status/CCChunkStatusTasks.java @@ -27,10 +27,10 @@ */ @Dasm(ChunkInCubicContextSet.class) public class CCChunkStatusTasks { - @AddTransformToSets(ChunkInCubicContextSet.class) @TransformFromMethod(owner = @Ref(ChunkStatusTasks.class), value = @MethodSig("isLighted(Lnet/minecraft/world/level/chunk/ChunkAccess;)Z")) + @AddTransformToSets(ChunkInCubicContextSet.ChunkStatusTasks_to_CCChunkStatusTasks_redirects.class) @TransformFromMethod(owner = @Ref(ChunkStatusTasks.class), value = @MethodSig("isLighted(Lnet/minecraft/world/level/chunk/ChunkAccess;)Z")) private static native boolean isLighted(ChunkAccess chunk); - @AddMethodToSets(sets = ChunkInCubicContextSet.class, owner = @Ref(ChunkStatusTasks.class), method = @MethodSig("passThrough(Lnet/minecraft/world/level/chunk/status/WorldGenContext;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;Lnet/minecraft/world/level/chunk/ChunkAccess;)Ljava/util/concurrent/CompletableFuture;")) + @AddMethodToSets(containers = ChunkInCubicContextSet.ChunkStatusTasks_to_CCChunkStatusTasks_redirects.class, method = @MethodSig("passThrough(Lnet/minecraft/world/level/chunk/status/WorldGenContext;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;Lnet/minecraft/world/level/chunk/ChunkAccess;)Ljava/util/concurrent/CompletableFuture;")) public static CompletableFuture passThrough( WorldGenContext worldGenContext, ChunkStep step, StaticCache2D cache, ChunkAccess chunk ) { @@ -38,77 +38,77 @@ public static CompletableFuture passThrough( } // We skip chunk generation steps in cubic contexts by delegating to passThrough - @AddMethodToSets(sets = ChunkInCubicContextSet.class, owner = @Ref(ChunkStatusTasks.class), method = @MethodSig("generateStructureStarts(Lnet/minecraft/world/level/chunk/status/WorldGenContext;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;Lnet/minecraft/world/level/chunk/ChunkAccess;)Ljava/util/concurrent/CompletableFuture;"))// We skip chunk generation steps in cubic contexts by delegating to passThrough + @AddMethodToSets(containers = ChunkInCubicContextSet.ChunkStatusTasks_to_CCChunkStatusTasks_redirects.class, method = @MethodSig("generateStructureStarts(Lnet/minecraft/world/level/chunk/status/WorldGenContext;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;Lnet/minecraft/world/level/chunk/ChunkAccess;)Ljava/util/concurrent/CompletableFuture;"))// We skip chunk generation steps in cubic contexts by delegating to passThrough public static CompletableFuture generateStructureStarts( WorldGenContext worldGenContext, ChunkStep step, StaticCache2D cache, ChunkAccess chunk ) { return passThrough(worldGenContext, step, cache, chunk); } - @AddMethodToSets(sets = ChunkInCubicContextSet.class, owner = @Ref(ChunkStatusTasks.class), method = @MethodSig("loadStructureStarts(Lnet/minecraft/world/level/chunk/status/WorldGenContext;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;Lnet/minecraft/world/level/chunk/ChunkAccess;)Ljava/util/concurrent/CompletableFuture;")) + @AddMethodToSets(containers = ChunkInCubicContextSet.ChunkStatusTasks_to_CCChunkStatusTasks_redirects.class, method = @MethodSig("loadStructureStarts(Lnet/minecraft/world/level/chunk/status/WorldGenContext;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;Lnet/minecraft/world/level/chunk/ChunkAccess;)Ljava/util/concurrent/CompletableFuture;")) public static CompletableFuture loadStructureStarts( WorldGenContext worldGenContext, ChunkStep step, StaticCache2D cache, ChunkAccess chunk ) { return passThrough(worldGenContext, step, cache, chunk); } - @AddMethodToSets(sets = ChunkInCubicContextSet.class, owner = @Ref(ChunkStatusTasks.class), method = @MethodSig("generateStructureReferences(Lnet/minecraft/world/level/chunk/status/WorldGenContext;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;Lnet/minecraft/world/level/chunk/ChunkAccess;)Ljava/util/concurrent/CompletableFuture;")) + @AddMethodToSets(containers = ChunkInCubicContextSet.ChunkStatusTasks_to_CCChunkStatusTasks_redirects.class, method = @MethodSig("generateStructureReferences(Lnet/minecraft/world/level/chunk/status/WorldGenContext;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;Lnet/minecraft/world/level/chunk/ChunkAccess;)Ljava/util/concurrent/CompletableFuture;")) public static CompletableFuture generateStructureReferences( WorldGenContext worldGenContext, ChunkStep step, StaticCache2D cache, ChunkAccess chunk ) { return passThrough(worldGenContext, step, cache, chunk); } - @AddMethodToSets(sets = ChunkInCubicContextSet.class, owner = @Ref(ChunkStatusTasks.class), method = @MethodSig("generateBiomes(Lnet/minecraft/world/level/chunk/status/WorldGenContext;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;Lnet/minecraft/world/level/chunk/ChunkAccess;)Ljava/util/concurrent/CompletableFuture;")) + @AddMethodToSets(containers = ChunkInCubicContextSet.ChunkStatusTasks_to_CCChunkStatusTasks_redirects.class, method = @MethodSig("generateBiomes(Lnet/minecraft/world/level/chunk/status/WorldGenContext;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;Lnet/minecraft/world/level/chunk/ChunkAccess;)Ljava/util/concurrent/CompletableFuture;")) public static CompletableFuture generateBiomes( WorldGenContext worldGenContext, ChunkStep step, StaticCache2D cache, ChunkAccess chunk ) { return passThrough(worldGenContext, step, cache, chunk); } - @AddMethodToSets(sets = ChunkInCubicContextSet.class, owner = @Ref(ChunkStatusTasks.class), method = @MethodSig("generateNoise(Lnet/minecraft/world/level/chunk/status/WorldGenContext;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;Lnet/minecraft/world/level/chunk/ChunkAccess;)Ljava/util/concurrent/CompletableFuture;")) + @AddMethodToSets(containers = ChunkInCubicContextSet.ChunkStatusTasks_to_CCChunkStatusTasks_redirects.class, method = @MethodSig("generateNoise(Lnet/minecraft/world/level/chunk/status/WorldGenContext;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;Lnet/minecraft/world/level/chunk/ChunkAccess;)Ljava/util/concurrent/CompletableFuture;")) public static CompletableFuture generateNoise( WorldGenContext worldGenContext, ChunkStep step, StaticCache2D cache, ChunkAccess chunk ) { return passThrough(worldGenContext, step, cache, chunk); } - @AddMethodToSets(sets = ChunkInCubicContextSet.class, owner = @Ref(ChunkStatusTasks.class), method = @MethodSig("generateSurface(Lnet/minecraft/world/level/chunk/status/WorldGenContext;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;Lnet/minecraft/world/level/chunk/ChunkAccess;)Ljava/util/concurrent/CompletableFuture;")) + @AddMethodToSets(containers = ChunkInCubicContextSet.ChunkStatusTasks_to_CCChunkStatusTasks_redirects.class, method = @MethodSig("generateSurface(Lnet/minecraft/world/level/chunk/status/WorldGenContext;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;Lnet/minecraft/world/level/chunk/ChunkAccess;)Ljava/util/concurrent/CompletableFuture;")) public static CompletableFuture generateSurface( WorldGenContext worldGenContext, ChunkStep step, StaticCache2D cache, ChunkAccess chunk ) { return passThrough(worldGenContext, step, cache, chunk); } - @AddMethodToSets(sets = ChunkInCubicContextSet.class, owner = @Ref(ChunkStatusTasks.class), method = @MethodSig("generateCarvers(Lnet/minecraft/world/level/chunk/status/WorldGenContext;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;Lnet/minecraft/world/level/chunk/ChunkAccess;)Ljava/util/concurrent/CompletableFuture;")) + @AddMethodToSets(containers = ChunkInCubicContextSet.ChunkStatusTasks_to_CCChunkStatusTasks_redirects.class, method = @MethodSig("generateCarvers(Lnet/minecraft/world/level/chunk/status/WorldGenContext;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;Lnet/minecraft/world/level/chunk/ChunkAccess;)Ljava/util/concurrent/CompletableFuture;")) public static CompletableFuture generateCarvers( WorldGenContext worldGenContext, ChunkStep step, StaticCache2D cache, ChunkAccess chunk ) { return passThrough(worldGenContext, step, cache, chunk); } - @AddMethodToSets(sets = ChunkInCubicContextSet.class, owner = @Ref(ChunkStatusTasks.class), method = @MethodSig("generateFeatures(Lnet/minecraft/world/level/chunk/status/WorldGenContext;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;Lnet/minecraft/world/level/chunk/ChunkAccess;)Ljava/util/concurrent/CompletableFuture;")) + @AddMethodToSets(containers = ChunkInCubicContextSet.ChunkStatusTasks_to_CCChunkStatusTasks_redirects.class, method = @MethodSig("generateFeatures(Lnet/minecraft/world/level/chunk/status/WorldGenContext;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;Lnet/minecraft/world/level/chunk/ChunkAccess;)Ljava/util/concurrent/CompletableFuture;")) public static CompletableFuture generateFeatures( WorldGenContext worldGenContext, ChunkStep step, StaticCache2D cache, ChunkAccess chunk ) { return passThrough(worldGenContext, step, cache, chunk); } - @AddMethodToSets(sets = ChunkInCubicContextSet.class, owner = @Ref(ChunkStatusTasks.class), method = @MethodSig("initializeLight(Lnet/minecraft/world/level/chunk/status/WorldGenContext;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;Lnet/minecraft/world/level/chunk/ChunkAccess;)Ljava/util/concurrent/CompletableFuture;")) + @AddMethodToSets(containers = ChunkInCubicContextSet.ChunkStatusTasks_to_CCChunkStatusTasks_redirects.class, method = @MethodSig("initializeLight(Lnet/minecraft/world/level/chunk/status/WorldGenContext;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;Lnet/minecraft/world/level/chunk/ChunkAccess;)Ljava/util/concurrent/CompletableFuture;")) public static CompletableFuture initializeLight( WorldGenContext worldGenContext, ChunkStep step, StaticCache2D cache, ChunkAccess chunk ) { return passThrough(worldGenContext, step, cache, chunk); } - @AddMethodToSets(sets = ChunkInCubicContextSet.class, owner = @Ref(ChunkStatusTasks.class), method = @MethodSig("light(Lnet/minecraft/world/level/chunk/status/WorldGenContext;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;Lnet/minecraft/world/level/chunk/ChunkAccess;)Ljava/util/concurrent/CompletableFuture;")) + @AddMethodToSets(containers = ChunkInCubicContextSet.ChunkStatusTasks_to_CCChunkStatusTasks_redirects.class, method = @MethodSig("light(Lnet/minecraft/world/level/chunk/status/WorldGenContext;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;Lnet/minecraft/world/level/chunk/ChunkAccess;)Ljava/util/concurrent/CompletableFuture;")) public static CompletableFuture light( WorldGenContext worldGenContext, ChunkStep step, StaticCache2D cache, ChunkAccess chunk ) { return passThrough(worldGenContext, step, cache, chunk); } - @AddMethodToSets(sets = ChunkInCubicContextSet.class, owner = @Ref(ChunkStatusTasks.class), method = @MethodSig("generateSpawn(Lnet/minecraft/world/level/chunk/status/WorldGenContext;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;Lnet/minecraft/world/level/chunk/ChunkAccess;)Ljava/util/concurrent/CompletableFuture;")) + @AddMethodToSets(containers = ChunkInCubicContextSet.ChunkStatusTasks_to_CCChunkStatusTasks_redirects.class, method = @MethodSig("generateSpawn(Lnet/minecraft/world/level/chunk/status/WorldGenContext;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;Lnet/minecraft/world/level/chunk/ChunkAccess;)Ljava/util/concurrent/CompletableFuture;")) public static CompletableFuture generateSpawn( WorldGenContext worldGenContext, ChunkStep step, StaticCache2D cache, ChunkAccess chunk ) { @@ -116,12 +116,12 @@ public static CompletableFuture generateSpawn( } // We still want to upgrade ProtoChunks to LevelChunks normally - @AddTransformToSets(ChunkInCubicContextSet.class) @TransformFromMethod(owner = @Ref(ChunkStatusTasks.class), value = @MethodSig("full(Lnet/minecraft/world/level/chunk/status/WorldGenContext;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;Lnet/minecraft/world/level/chunk/ChunkAccess;)Ljava/util/concurrent/CompletableFuture;")) + @AddTransformToSets(ChunkInCubicContextSet.ChunkStatusTasks_to_CCChunkStatusTasks_redirects.class) @TransformFromMethod(owner = @Ref(ChunkStatusTasks.class), value = @MethodSig("full(Lnet/minecraft/world/level/chunk/status/WorldGenContext;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;Lnet/minecraft/world/level/chunk/ChunkAccess;)Ljava/util/concurrent/CompletableFuture;")) public static native CompletableFuture full( WorldGenContext worldGenContext, ChunkStep step, StaticCache2D cache, ChunkAccess chunk ); - @AddMethodToSets(sets = ChunkInCubicContextSet.class, owner = @Ref(ChunkStatusTasks.class), method = @MethodSig("postLoadProtoChunk(Lnet/minecraft/server/level/ServerLevel;Ljava/util/List;)V")) + @AddMethodToSets(containers = ChunkInCubicContextSet.ChunkStatusTasks_to_CCChunkStatusTasks_redirects.class, method = @MethodSig("postLoadProtoChunk(Lnet/minecraft/server/level/ServerLevel;Ljava/util/List;)V")) private static void postLoadProtoChunk(ServerLevel level, List entityTags) { // Entities should be handled on the cube, not the chunk } diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/world/level/cube/ImposterProtoCube.java b/src/main/java/io/github/opencubicchunks/cubicchunks/world/level/cube/ImposterProtoCube.java index 9715e53f..2227f0bf 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/world/level/cube/ImposterProtoCube.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/world/level/cube/ImposterProtoCube.java @@ -22,7 +22,7 @@ public ImposterProtoCube(LevelCube wrapped, boolean allowWrites) { } // Method is implemented in MixinImposterProtoCube instead, since DASM clears everything in this class. - @AddMethodToSets(sets = ChunkToCubeSet.class, owner = @Ref(ImposterProtoChunk.class), method = @MethodSig("Lnet/minecraft/world/level/chunk/ImposterProtoChunk;getWrapped()Lnet/minecraft/world/level/chunk/LevelChunk;")) + @AddMethodToSets(containers = ChunkToCubeSet.ImposterProtoChunk_to_ImposterProtoCube_redirects.class, method = @MethodSig("Lnet/minecraft/world/level/chunk/ImposterProtoChunk;getWrapped()Lnet/minecraft/world/level/chunk/LevelChunk;")) @Override public LevelClo cc_getWrappedClo() { throw new DasmFailedToApply(); } diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/world/level/cube/status/CubePyramid.java b/src/main/java/io/github/opencubicchunks/cubicchunks/world/level/cube/status/CubePyramid.java index 98463009..7d446101 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/world/level/cube/status/CubePyramid.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/world/level/cube/status/CubePyramid.java @@ -24,9 +24,9 @@ public CubeStep getStepTo(ChunkStatus status) { return this.steps.get(status.getIndex()); } - @AddFieldToSets(sets = ChunkToCubeSet.class, owner = @Ref(ChunkPyramid.class), field = @FieldSig(type = @Ref(ChunkPyramid.class), name = "GENERATION_PYRAMID")) + @AddFieldToSets(containers = ChunkToCubeSet.ChunkPyramid_to_CubePyramid_redirects.class, field = @FieldSig(type = @Ref(ChunkPyramid.class), name = "GENERATION_PYRAMID")) public static CubePyramid CC_GENERATION_PYRAMID_CUBES; - @AddFieldToSets(sets = ChunkToCubeSet.class, owner = @Ref(ChunkPyramid.class), field = @FieldSig(type = @Ref(ChunkPyramid.class), name = "LOADING_PYRAMID")) + @AddFieldToSets(containers = ChunkToCubeSet.ChunkPyramid_to_CubePyramid_redirects.class, field = @FieldSig(type = @Ref(ChunkPyramid.class), name = "LOADING_PYRAMID")) public static CubePyramid CC_LOADING_PYRAMID_CUBES; @TransformFromMethod(useRedirectSets = ChunkToCubeSet.class, owner = @Ref(ChunkPyramid.class), value = @MethodSig("()V")) diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/world/level/cube/status/CubeStatusTasks.java b/src/main/java/io/github/opencubicchunks/cubicchunks/world/level/cube/status/CubeStatusTasks.java index 261d29c0..458278f6 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/world/level/cube/status/CubeStatusTasks.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/world/level/cube/status/CubeStatusTasks.java @@ -29,10 +29,10 @@ */ @Dasm(ChunkToCubeSet.class) public class CubeStatusTasks { - @AddTransformToSets(ChunkToCubeSet.class) @TransformFromMethod(owner = @Ref(ChunkStatusTasks.class), value = @MethodSig("isLighted(Lnet/minecraft/world/level/chunk/ChunkAccess;)Z")) + @AddTransformToSets(ChunkToCubeSet.ChunkStatusTasks_to_CubeStatusTasks_redirects.class) @TransformFromMethod(owner = @Ref(ChunkStatusTasks.class), value = @MethodSig("isLighted(Lnet/minecraft/world/level/chunk/ChunkAccess;)Z")) private static native boolean isLighted(CubeAccess cube); - @AddMethodToSets(sets = ChunkToCubeSet.class, owner = @Ref(ChunkStatusTasks.class), method = @MethodSig("passThrough(Lnet/minecraft/world/level/chunk/status/WorldGenContext;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;Lnet/minecraft/world/level/chunk/ChunkAccess;)Ljava/util/concurrent/CompletableFuture;")) + @AddMethodToSets(containers = ChunkToCubeSet.ChunkStatusTasks_to_CubeStatusTasks_redirects.class, method = @MethodSig("passThrough(Lnet/minecraft/world/level/chunk/status/WorldGenContext;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;Lnet/minecraft/world/level/chunk/ChunkAccess;)Ljava/util/concurrent/CompletableFuture;")) public static CompletableFuture passThrough( WorldGenContext worldGenContext, CubeStep step, StaticCache3D cache, CubeAccess cube ) { @@ -40,35 +40,35 @@ public static CompletableFuture passThrough( } // TODO (P3) we skip cube generation steps for now by delegating to passThrough - @AddMethodToSets(sets = ChunkToCubeSet.class, owner = @Ref(ChunkStatusTasks.class), method = @MethodSig("generateStructureStarts(Lnet/minecraft/world/level/chunk/status/WorldGenContext;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;Lnet/minecraft/world/level/chunk/ChunkAccess;)Ljava/util/concurrent/CompletableFuture;"))// We skip chunk generation steps in cubic contexts by delegating to passThrough + @AddMethodToSets(containers = ChunkToCubeSet.ChunkStatusTasks_to_CubeStatusTasks_redirects.class, method = @MethodSig("generateStructureStarts(Lnet/minecraft/world/level/chunk/status/WorldGenContext;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;Lnet/minecraft/world/level/chunk/ChunkAccess;)Ljava/util/concurrent/CompletableFuture;"))// We skip chunk generation steps in cubic contexts by delegating to passThrough public static CompletableFuture generateStructureStarts( WorldGenContext worldGenContext, CubeStep step, StaticCache3D cache, CubeAccess cube ) { return passThrough(worldGenContext, step, cache, cube); } - @AddMethodToSets(sets = ChunkToCubeSet.class, owner = @Ref(ChunkStatusTasks.class), method = @MethodSig("loadStructureStarts(Lnet/minecraft/world/level/chunk/status/WorldGenContext;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;Lnet/minecraft/world/level/chunk/ChunkAccess;)Ljava/util/concurrent/CompletableFuture;")) + @AddMethodToSets(containers = ChunkToCubeSet.ChunkStatusTasks_to_CubeStatusTasks_redirects.class, method = @MethodSig("loadStructureStarts(Lnet/minecraft/world/level/chunk/status/WorldGenContext;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;Lnet/minecraft/world/level/chunk/ChunkAccess;)Ljava/util/concurrent/CompletableFuture;")) public static CompletableFuture loadStructureStarts( WorldGenContext worldGenContext, CubeStep step, StaticCache3D cache, CubeAccess cube ) { return passThrough(worldGenContext, step, cache, cube); } - @AddMethodToSets(sets = ChunkToCubeSet.class, owner = @Ref(ChunkStatusTasks.class), method = @MethodSig("generateStructureReferences(Lnet/minecraft/world/level/chunk/status/WorldGenContext;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;Lnet/minecraft/world/level/chunk/ChunkAccess;)Ljava/util/concurrent/CompletableFuture;")) + @AddMethodToSets(containers = ChunkToCubeSet.ChunkStatusTasks_to_CubeStatusTasks_redirects.class, method = @MethodSig("generateStructureReferences(Lnet/minecraft/world/level/chunk/status/WorldGenContext;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;Lnet/minecraft/world/level/chunk/ChunkAccess;)Ljava/util/concurrent/CompletableFuture;")) public static CompletableFuture generateStructureReferences( WorldGenContext worldGenContext, CubeStep step, StaticCache3D cache, CubeAccess cube ) { return passThrough(worldGenContext, step, cache, cube); } - @AddMethodToSets(sets = ChunkToCubeSet.class, owner = @Ref(ChunkStatusTasks.class), method = @MethodSig("generateBiomes(Lnet/minecraft/world/level/chunk/status/WorldGenContext;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;Lnet/minecraft/world/level/chunk/ChunkAccess;)Ljava/util/concurrent/CompletableFuture;")) + @AddMethodToSets(containers = ChunkToCubeSet.ChunkStatusTasks_to_CubeStatusTasks_redirects.class, method = @MethodSig("generateBiomes(Lnet/minecraft/world/level/chunk/status/WorldGenContext;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;Lnet/minecraft/world/level/chunk/ChunkAccess;)Ljava/util/concurrent/CompletableFuture;")) public static CompletableFuture generateBiomes( WorldGenContext worldGenContext, CubeStep step, StaticCache3D cache, CubeAccess cube ) { return passThrough(worldGenContext, step, cache, cube); } - @AddMethodToSets(sets = ChunkToCubeSet.class, owner = @Ref(ChunkStatusTasks.class), method = @MethodSig("generateNoise(Lnet/minecraft/world/level/chunk/status/WorldGenContext;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;Lnet/minecraft/world/level/chunk/ChunkAccess;)Ljava/util/concurrent/CompletableFuture;")) + @AddMethodToSets(containers = ChunkToCubeSet.ChunkStatusTasks_to_CubeStatusTasks_redirects.class, method = @MethodSig("generateNoise(Lnet/minecraft/world/level/chunk/status/WorldGenContext;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;Lnet/minecraft/world/level/chunk/ChunkAccess;)Ljava/util/concurrent/CompletableFuture;")) public static CompletableFuture generateNoise( WorldGenContext worldGenContext, CubeStep step, StaticCache3D cache, CubeAccess cube ) { @@ -91,42 +91,42 @@ public static CompletableFuture generateNoise( return CompletableFuture.completedFuture(cube); } - @AddMethodToSets(sets = ChunkToCubeSet.class, owner = @Ref(ChunkStatusTasks.class), method = @MethodSig("generateSurface(Lnet/minecraft/world/level/chunk/status/WorldGenContext;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;Lnet/minecraft/world/level/chunk/ChunkAccess;)Ljava/util/concurrent/CompletableFuture;")) + @AddMethodToSets(containers = ChunkToCubeSet.ChunkStatusTasks_to_CubeStatusTasks_redirects.class, method = @MethodSig("generateSurface(Lnet/minecraft/world/level/chunk/status/WorldGenContext;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;Lnet/minecraft/world/level/chunk/ChunkAccess;)Ljava/util/concurrent/CompletableFuture;")) public static CompletableFuture generateSurface( WorldGenContext worldGenContext, CubeStep step, StaticCache3D cache, CubeAccess cube ) { return passThrough(worldGenContext, step, cache, cube); } - @AddMethodToSets(sets = ChunkToCubeSet.class, owner = @Ref(ChunkStatusTasks.class), method = @MethodSig("generateCarvers(Lnet/minecraft/world/level/chunk/status/WorldGenContext;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;Lnet/minecraft/world/level/chunk/ChunkAccess;)Ljava/util/concurrent/CompletableFuture;")) + @AddMethodToSets(containers = ChunkToCubeSet.ChunkStatusTasks_to_CubeStatusTasks_redirects.class, method = @MethodSig("generateCarvers(Lnet/minecraft/world/level/chunk/status/WorldGenContext;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;Lnet/minecraft/world/level/chunk/ChunkAccess;)Ljava/util/concurrent/CompletableFuture;")) public static CompletableFuture generateCarvers( WorldGenContext worldGenContext, CubeStep step, StaticCache3D cache, CubeAccess cube ) { return passThrough(worldGenContext, step, cache, cube); } - @AddMethodToSets(sets = ChunkToCubeSet.class, owner = @Ref(ChunkStatusTasks.class), method = @MethodSig("generateFeatures(Lnet/minecraft/world/level/chunk/status/WorldGenContext;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;Lnet/minecraft/world/level/chunk/ChunkAccess;)Ljava/util/concurrent/CompletableFuture;")) + @AddMethodToSets(containers = ChunkToCubeSet.ChunkStatusTasks_to_CubeStatusTasks_redirects.class, method = @MethodSig("generateFeatures(Lnet/minecraft/world/level/chunk/status/WorldGenContext;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;Lnet/minecraft/world/level/chunk/ChunkAccess;)Ljava/util/concurrent/CompletableFuture;")) public static CompletableFuture generateFeatures( WorldGenContext worldGenContext, CubeStep step, StaticCache3D cache, CubeAccess cube ) { return passThrough(worldGenContext, step, cache, cube); } - @AddMethodToSets(sets = ChunkToCubeSet.class, owner = @Ref(ChunkStatusTasks.class), method = @MethodSig("initializeLight(Lnet/minecraft/world/level/chunk/status/WorldGenContext;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;Lnet/minecraft/world/level/chunk/ChunkAccess;)Ljava/util/concurrent/CompletableFuture;")) + @AddMethodToSets(containers = ChunkToCubeSet.ChunkStatusTasks_to_CubeStatusTasks_redirects.class, method = @MethodSig("initializeLight(Lnet/minecraft/world/level/chunk/status/WorldGenContext;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;Lnet/minecraft/world/level/chunk/ChunkAccess;)Ljava/util/concurrent/CompletableFuture;")) public static CompletableFuture initializeLight( WorldGenContext worldGenContext, CubeStep step, StaticCache3D cache, CubeAccess cube ) { return passThrough(worldGenContext, step, cache, cube); } - @AddMethodToSets(sets = ChunkToCubeSet.class, owner = @Ref(ChunkStatusTasks.class), method = @MethodSig("light(Lnet/minecraft/world/level/chunk/status/WorldGenContext;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;Lnet/minecraft/world/level/chunk/ChunkAccess;)Ljava/util/concurrent/CompletableFuture;")) + @AddMethodToSets(containers = ChunkToCubeSet.ChunkStatusTasks_to_CubeStatusTasks_redirects.class, method = @MethodSig("light(Lnet/minecraft/world/level/chunk/status/WorldGenContext;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;Lnet/minecraft/world/level/chunk/ChunkAccess;)Ljava/util/concurrent/CompletableFuture;")) public static CompletableFuture light( WorldGenContext worldGenContext, CubeStep step, StaticCache3D cache, CubeAccess cube ) { return passThrough(worldGenContext, step, cache, cube); } - @AddMethodToSets(sets = ChunkToCubeSet.class, owner = @Ref(ChunkStatusTasks.class), method = @MethodSig("generateSpawn(Lnet/minecraft/world/level/chunk/status/WorldGenContext;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;Lnet/minecraft/world/level/chunk/ChunkAccess;)Ljava/util/concurrent/CompletableFuture;")) + @AddMethodToSets(containers = ChunkToCubeSet.ChunkStatusTasks_to_CubeStatusTasks_redirects.class, method = @MethodSig("generateSpawn(Lnet/minecraft/world/level/chunk/status/WorldGenContext;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;Lnet/minecraft/world/level/chunk/ChunkAccess;)Ljava/util/concurrent/CompletableFuture;")) public static CompletableFuture generateSpawn( WorldGenContext worldGenContext, CubeStep step, StaticCache3D cache, CubeAccess cube ) { @@ -135,11 +135,11 @@ public static CompletableFuture generateSpawn( // Upgrade ProtoCube to LevelCube // dasm + mixin - @AddTransformToSets(ChunkToCubeSet.class) @TransformFromMethod(owner = @Ref(ChunkStatusTasks.class), value = @MethodSig("full(Lnet/minecraft/world/level/chunk/status/WorldGenContext;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;Lnet/minecraft/world/level/chunk/ChunkAccess;)Ljava/util/concurrent/CompletableFuture;")) + @AddTransformToSets(ChunkToCubeSet.ChunkStatusTasks_to_CubeStatusTasks_redirects.class) @TransformFromMethod(owner = @Ref(ChunkStatusTasks.class), value = @MethodSig("full(Lnet/minecraft/world/level/chunk/status/WorldGenContext;Lnet/minecraft/world/level/chunk/status/ChunkStep;Lnet/minecraft/util/StaticCache2D;Lnet/minecraft/world/level/chunk/ChunkAccess;)Ljava/util/concurrent/CompletableFuture;")) public static native CompletableFuture full( WorldGenContext worldGenContext, CubeStep step, StaticCache3D cache, CubeAccess cube ); - @AddTransformToSets(ChunkToCubeSet.class) @TransformFromMethod(owner = @Ref(ChunkStatusTasks.class), value = @MethodSig("postLoadProtoChunk(Lnet/minecraft/server/level/ServerLevel;Ljava/util/List;)V")) + @AddTransformToSets(ChunkToCubeSet.ChunkStatusTasks_to_CubeStatusTasks_redirects.class) @TransformFromMethod(owner = @Ref(ChunkStatusTasks.class), value = @MethodSig("postLoadProtoChunk(Lnet/minecraft/server/level/ServerLevel;Ljava/util/List;)V")) private static native void postLoadProtoCube(ServerLevel level, List entityTags); } diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/world/level/cube/status/CubeStep.java b/src/main/java/io/github/opencubicchunks/cubicchunks/world/level/cube/status/CubeStep.java index cd9dd2e3..cde4ba1e 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/world/level/cube/status/CubeStep.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/world/level/cube/status/CubeStep.java @@ -51,11 +51,11 @@ public CompletableFuture apply(WorldGenContext worldGenContext, Stat @Dasm(ChunkToCubeSet.class) public static class Builder { private final ChunkStatus status; - @AddFieldToSets(sets = ChunkToCubeSet.class, owner = @Ref(ChunkStep.Builder.class), field = @FieldSig(type = @Ref(CubeStep.class), name = "parent")) + @AddFieldToSets(containers = ChunkToCubeSet.ChunkStep$Builder_to_CubeStep$Builder_redirects.class, field = @FieldSig(type = @Ref(CubeStep.class), name = "parent")) @Nullable private final CubeStep parent; private ChunkStatus[] directDependenciesByRadius; private int blockStateWriteRadius = -1; - @AddFieldToSets(sets = ChunkToCubeSet.class, owner = @Ref(ChunkStep.Builder.class), field = @FieldSig(type = @Ref(ChunkStatusTask.class), name = "task")) + @AddFieldToSets(containers = ChunkToCubeSet.ChunkStep$Builder_to_CubeStep$Builder_redirects.class, field = @FieldSig(type = @Ref(ChunkStatusTask.class), name = "task")) private CubeStatusTask task = (worldGenContext, step, cache, cube) -> CompletableFuture.completedFuture(cube); // TODO these should be dasm-copied but for some reason it didn't work when I tried