Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,10 @@ neoForge {
configureEach {
jvmArguments = args
// systemProperty 'forge.logging.markers', 'REGISTRIES'
systemProperty 'forge.logging.console.level', 'debug'
systemProperty 'forge.logging.console.level', 'info'
logLevel = org.slf4j.event.Level.INFO

systemProperty 'terminal.ansi', 'true'
}

client {
Expand Down Expand Up @@ -264,7 +267,7 @@ dependencies {
targetConfiguration = "testArchivesOutput"
}

libraries("io.github.notstirred:dasm:2.5.2") {
libraries("io.github.notstirred:dasm:2.5.4") {
transitive = false
}
libraries("io.github.opencubicchunks:regionlib:0.63.0-SNAPSHOT")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@

import com.mojang.datafixers.util.Either;
import io.github.notstirred.dasm.annotation.AnnotationParser;
import io.github.notstirred.dasm.annotation.AnnotationUtil;
import io.github.notstirred.dasm.annotation.parse.RefImpl;
import io.github.notstirred.dasm.api.annotations.Dasm;
import io.github.notstirred.dasm.api.annotations.transform.ApplicationStage;
import io.github.notstirred.dasm.api.provider.MappingsProvider;
import io.github.notstirred.dasm.exception.DasmException;
Expand All @@ -30,6 +33,7 @@
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.Format;
import io.github.notstirred.dasm.util.NotifyStack;
import io.github.notstirred.dasm.util.Pair;
import io.github.opencubicchunks.cc_core.annotation.Public;
Expand All @@ -39,6 +43,7 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.Type;
import org.objectweb.asm.tree.AnnotationNode;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.MethodNode;
Expand Down Expand Up @@ -83,11 +88,22 @@ public ASMConfigPlugin() {
return null;
}

@SuppressWarnings("checkstyle:CyclomaticComplexity") // I'm to lazy to fix this as the class is hopefully being deleted soon
@Override public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
try {
ClassNode targetClass = MixinService.getService().getBytecodeProvider().getClassNode(targetClassName);
ClassNode mixinClass = MixinService.getService().getBytecodeProvider().getClassNode(mixinClassName);
mixinClass.name = targetClass.name;

// Helpfully crash if dasm target doesn't make sense for a mixin class. This uses a ton of mostly static dasm internals.
AnnotationNode dasmAnnotation = AnnotationUtil.getAnnotationIfPresent(mixinClass.invisibleAnnotations, Dasm.class);
if (dasmAnnotation != null) {
Optional<Type> dasmTarget = RefImpl
.parseOptionalRefAnnotation((AnnotationNode) AnnotationUtil.getAnnotationValues(dasmAnnotation, Dasm.class).get("target"));
if (dasmTarget.isEmpty() || dasmTarget.get().equals(Type.getType(Dasm.SELF_TARGET.class))) {
throw new RuntimeException("Mixin class " + Format.formatObjectType(Type.getObjectType(mixinClass.name))
+ " with @Dasm annotation should probably have a @Dasm(value = Set.class, target = ...) targeting the mixin target class");
}
}

// PRE_APPLY
handleError(this.annotationParser.findDasmAnnotations(mixinClass));
Expand Down Expand Up @@ -301,7 +317,7 @@ private void handleError(List<Notification> notifications) {
logger.warn(notification.message);
break;
case ERROR:
logger.error(notification.message);
logger.fatal(notification.message);
break;
default:
throw new IllegalStateException("Unknown enum variant: " + notification.kind);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
* center and range of the chunk storage.
* This mixin adds versions of these methods for cubes, meaning that this class now stores both cubes and chunks.
*/
@Dasm(ChunkToCubeSet.class)
@Dasm(value = ChunkToCubeSet.class, target = @Ref(ClientChunkCache.class))
@Mixin(ClientChunkCache.class)
public abstract class MixinClientChunkCache extends MixinChunkSource implements ClientCubeCache {
@AddFieldToSets(containers = ChunkToCubeSet.ClientChunkCache_redirects.class, field = @FieldSig(type = @Ref(ClientChunkCache.Storage.class), name = "storage"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
import io.github.notstirred.dasm.api.annotations.Dasm;
import io.github.notstirred.dasm.api.annotations.redirect.redirects.AddTransformToSets;
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.cubicchunks.client.renderer.CubicLevelRenderer;
import io.github.opencubicchunks.cubicchunks.mixin.dasmsets.ChunkToCubeSet;
import net.minecraft.client.renderer.LevelRenderer;
import org.spongepowered.asm.mixin.Mixin;

@Dasm(ChunkToCubeSet.class)
@Dasm(value = ChunkToCubeSet.class, target = @Ref(LevelRenderer.class))
@Mixin(LevelRenderer.class)
public abstract class MixinLevelRenderer implements CubicLevelRenderer {
@AddTransformToSets(ChunkToCubeSet.LevelRenderer_redirects.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
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.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.utils.Coords;
Expand All @@ -28,7 +29,7 @@
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Dasm(ChunkToCubeSet.class)
@Dasm(value = ChunkToCubeSet.class, target = @Ref(SectionOcclusionGraph.class))
@Mixin(SectionOcclusionGraph.class)
public abstract class MixinSectionOcclusionGraph {
private boolean cc_isCubic = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;

@Dasm(GlobalSet.class)
@Dasm(value = GlobalSet.class, target = @Ref(GenerationChunkHolder.class))
@Mixin(GenerationChunkHolder.class)
public class MixinGenerationChunkHolder_Forge {
protected CubePos cc_cubePos;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
* invariants
* (cube status never exceeds the status of any chunks intersecting it)
*/
@Dasm(GlobalSet.class)
@Dasm(value = GlobalSet.class, target = @Ref(ChunkGenerationTask.class))
@Mixin(ChunkGenerationTask.class)
public abstract class MixinChunkGenerationTask implements CloGenerationTask {
@Shadow @Final private ChunkPos pos;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
* This mixin adds cubic chunks equivalents for methods where necessary, to allow GenerationChunkHolder to dynamically wrap either a chunk or a cube
* (i.e. a CLO).
*/
@Dasm(ChunkToCubeSet.class)
@Dasm(value = ChunkToCubeSet.class, target = @Ref(ChunkHolder.class))
@Mixin(ChunkHolder.class)
public abstract class MixinChunkHolder extends MixinGenerationChunkHolder implements CloHolder, CubeHolder {
@Shadow private boolean hasChangedSections;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import io.github.notstirred.dasm.api.annotations.Dasm;
import io.github.notstirred.dasm.api.annotations.redirect.redirects.AddTransformToSets;
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.cubicchunks.mixin.dasmsets.ChunkToCloSet;
import net.minecraft.server.level.ChunkMap;
Expand All @@ -15,7 +16,7 @@
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

@Dasm(ChunkToCloSet.class)
@Dasm(value = ChunkToCloSet.class, target = @Ref(ChunkMap.TrackedEntity.class))
@Mixin(ChunkMap.TrackedEntity.class)
public abstract class MixinChunkMap$TrackedEntity {
@Shadow @Final Entity entity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
* neighboring chunks.
* This mixin adds cubic chunks equivalents for methods where necessary, to allow ChunkMap to work with CLOs (i.e. both chunks and cubes).
*/
@Dasm(ChunkToCloSet.class)
@Dasm(value = ChunkToCloSet.class, target = @Ref(ChunkMap.class))
@Mixin(ChunkMap.class)
public abstract class MixinChunkMap extends MixinChunkStorage implements GeneratingCubeMap, CubicChunkMap, CubeHolder.PlayerProvider {
@Shadow public abstract ReportedException debugFuturesAndCreateReportedException(IllegalStateException exception, String details);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import net.minecraft.server.level.ChunkTaskDispatcher;
import org.spongepowered.asm.mixin.Mixin;

@Dasm(ChunkToCloSet.class)
@Dasm(value = ChunkToCloSet.class, target = @Ref(ChunkTaskDispatcher.class))
@Mixin(ChunkTaskDispatcher.class)
public class MixinChunkTaskDispatcher implements CubeHolder.LevelChangeListener, CloTaskDispatcher {
@AddTransformToSets(ChunkToCloSet.ChunkTaskDispatcher_redirects.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import io.github.notstirred.dasm.api.annotations.Dasm;
import io.github.notstirred.dasm.api.annotations.redirect.redirects.AddTransformToSets;
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.annotation.UsedFromASM;
import io.github.opencubicchunks.cc_core.world.level.CloPos;
Expand All @@ -15,7 +16,7 @@
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Dasm(ChunkToCloSet.class)
@Dasm(value = ChunkToCloSet.class, target = @Ref(ChunkTaskPriorityQueue.class))
@Mixin(ChunkTaskPriorityQueue.class)
public abstract class MixinChunkTaskPriorityQueue implements MarkableAsCubic {
protected boolean cc_isCubic;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import io.github.notstirred.dasm.api.annotations.Dasm;
import io.github.notstirred.dasm.api.annotations.selector.Ref;
import io.github.opencubicchunks.cc_core.world.level.CloPos;
import io.github.opencubicchunks.cubicchunks.MarkableAsCubic;
import io.github.opencubicchunks.cubicchunks.mixin.dasmsets.ChunkToCloSet;
Expand All @@ -29,7 +30,7 @@
* <br>
* This mixin mostly just replaces calls to ChunkPos with CloPos.
*/
@Dasm(ChunkToCloSet.class)
@Dasm(value = ChunkToCloSet.class, target = @Ref(DistanceManager.class))
@Mixin(DistanceManager.class)
public abstract class MixinDistanceManager implements MarkableAsCubic {
protected boolean cc_isCubic;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
* This mixin adds cubic chunks equivalents for methods where necessary, to allow GenerationChunkHolder to dynamically wrap either a chunk or a cube
* (i.e. a CLO).
*/
@Dasm(ChunkToCubeSet.class)
@Dasm(value = ChunkToCubeSet.class, target = @Ref(GenerationChunkHolder.class))
@Mixin(GenerationChunkHolder.class)
public abstract class MixinGenerationChunkHolder implements GenerationCloHolder {
@Shadow @Final protected ChunkPos pos;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
* block+light updates, managing chunkloading tickets, etc.
* This mixin adds versions of these methods for cubes, meaning that this class now stores and manages both cubes and chunks.
*/
@Dasm(ChunkToCubeSet.class)
@Dasm(value = ChunkToCubeSet.class, target = @Ref(ServerChunkCache.class))
@Mixin(ServerChunkCache.class)
public abstract class MixinServerChunkCache extends MixinChunkSource implements ServerCubeCache {
// Cube equivalents for cached chunks
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
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.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.world.level.CloPos;
import io.github.opencubicchunks.cubicchunks.mixin.core.common.world.level.MixinLevel;
Expand Down Expand Up @@ -37,7 +38,7 @@
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Dasm(ChunkToCloSet.class)
@Dasm(value = ChunkToCloSet.class, target = @Ref(ServerLevel.class))
@Mixin(ServerLevel.class)
public abstract class MixinServerLevel extends MixinLevel implements CubicServerLevel {
@Shadow @Final private ServerChunkCache chunkSource;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import net.minecraft.server.level.ServerPlayer;
import org.spongepowered.asm.mixin.Mixin;

@Dasm(ChunkToCloSet.class)
@Dasm(value = ChunkToCloSet.class, target = @Ref(ServerPlayer.class))
@Mixin(ServerPlayer.class)
public abstract class MixinServerPlayer extends MixinEntity implements CCServerPlayer {
@AddFieldToSets(containers = ChunkToCloSet.ServerPlayer_redirects.class, field = @FieldSig(type = @Ref(ChunkTrackingView.class), name = "chunkTrackingView"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Dasm(ChunkToCloSet.class)
@Dasm(value = ChunkToCloSet.class, target = @Ref(SimulationChunkTracker.class))
@Mixin(SimulationChunkTracker.class)
public abstract class MixinSimulationChunkTracker extends MixinChunkTracker implements SimulationCloTracker {
@AddTransformToSets(ChunkToCloSet.SimulationChunkTracker_redirects.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import io.github.notstirred.dasm.api.annotations.Dasm;
import io.github.notstirred.dasm.api.annotations.redirect.redirects.AddTransformToSets;
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.world.level.CloPos;
import io.github.opencubicchunks.cubicchunks.mixin.dasmsets.ChunkToCloSet;
Expand All @@ -12,7 +13,7 @@
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Mixin;

@Dasm(ChunkToCloSet.class)
@Dasm(value = ChunkToCloSet.class, target = @Ref(LoggerChunkProgressListener.class))
@Mixin(LoggerChunkProgressListener.class)
public abstract class MixinLoggerChunkProgressListener implements CloProgressListener {
@AddTransformToSets(ChunkToCloSet.LoggerChunkProgressListener_redirects.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Dasm(ChunkToCloSet.class)
@Dasm(value = ChunkToCloSet.class, target = @Ref(ProcessorChunkProgressListener.class))
@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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import net.minecraft.world.level.chunk.status.ChunkStatus;
import org.spongepowered.asm.mixin.Mixin;

@Dasm(ChunkToCloSet.class)
@Dasm(value = ChunkToCloSet.class, target = @Ref(StoringChunkProgressListener.class))
@Mixin(StoringChunkProgressListener.class)
public abstract class MixinStoringChunkProgressListener implements CloProgressListener {
@AddFieldToSets(containers = GlobalSet.StoringChunkProgressListener_redirects.class, field = @FieldSig(type = @Ref(ChunkPos.class), name = "spawnPos"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
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.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.world.level.CloPos;
import io.github.opencubicchunks.cubicchunks.CanBeCubic;
Expand Down Expand Up @@ -38,7 +39,7 @@
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Dasm(ChunkToCloSet.class)
@Dasm(value = ChunkToCloSet.class, target = @Ref(PlayerChunkSender.class))
@Mixin(PlayerChunkSender.class)
public class MixinPlayerChunkSender {
@Shadow private int unacknowledgedBatches;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
* We modify Entity to track its cube position, and to replace calls to chunk-specific methods with their corresponding cubic methods when in a cubic
* Level.
*/
@Dasm(ChunkToCubeSet.class)
@Dasm(value = ChunkToCubeSet.class, target = @Ref(Entity.class))
@Mixin(Entity.class)
public abstract class MixinEntity implements EntityCubePosGetter {
@Shadow private Level level;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import io.github.notstirred.dasm.api.annotations.Dasm;
import io.github.notstirred.dasm.api.annotations.redirect.redirects.AddTransformToSets;
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.utils.Coords;
import io.github.opencubicchunks.cubicchunks.CubicChunks;
Expand Down Expand Up @@ -42,7 +43,7 @@
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Dasm(ChunkToCloSet.class)
@Dasm(value = ChunkToCloSet.class, target = @Ref(Level.class))
@Mixin(Level.class)
public abstract class MixinLevel implements CubicLevel, MarkableAsCubic, LevelAccessor {
@Shadow public abstract @Nullable ChunkAccess getChunk(int chunkX, int chunkZ, ChunkStatus requestedStatus, boolean forceLoad);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import net.minecraft.world.level.TicketStorage;
import org.spongepowered.asm.mixin.Mixin;

@Dasm(ChunkToCloSet.class)
@Dasm(value = ChunkToCloSet.class, target = @Ref(TicketStorage.class))
@Mixin(TicketStorage.class)
public class MixinTicketStorage implements CubicTicketStorage {
// TODO (P2) codec nonsense for save/load
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
import io.github.notstirred.dasm.api.annotations.Dasm;
import io.github.notstirred.dasm.api.annotations.redirect.redirects.AddMethodToSets;
import io.github.notstirred.dasm.api.annotations.selector.MethodSig;
import io.github.notstirred.dasm.api.annotations.selector.Ref;
import io.github.opencubicchunks.cc_core.world.level.CloPos;
import io.github.opencubicchunks.cubicchunks.mixin.dasmsets.ChunkToCloSet;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.level.chunk.storage.ChunkStorage;
import org.spongepowered.asm.mixin.Mixin;

@Dasm(ChunkToCloSet.class)
@Dasm(value = ChunkToCloSet.class, target = @Ref(ChunkStorage.class))
@Mixin(ChunkStorage.class)
public abstract class MixinChunkStorage {
@AddMethodToSets(containers = ChunkToCloSet.ChunkStorage_redirects.class, method = @MethodSig("isOldChunkAround(Lnet/minecraft/world/level/ChunkPos;I)Z"))
Expand Down