-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
79 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package skyblock.mixin; | ||
|
||
import net.minecraft.util.crash.CrashReport; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
import skyblock.SkyBlockExtension; | ||
|
||
@Mixin(CrashReport.class) | ||
public class CrashReport_noopMixin | ||
{ | ||
@Inject(method = "initCrashReport", at = @At("HEAD")) | ||
private static void gameStarted(CallbackInfo ci) | ||
{ | ||
SkyBlockExtension.noop(); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
src/main/java/skyblock/mixin/RegistrySyncManagerMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package skyblock.mixin; | ||
|
||
import net.fabricmc.fabric.impl.registry.sync.RegistrySyncManager; | ||
import net.minecraft.util.Identifier; | ||
import net.minecraft.util.registry.Registry; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Redirect; | ||
import skyblock.SkyBlockExtension; | ||
|
||
@Mixin(value = RegistrySyncManager.class) | ||
public class RegistrySyncManagerMixin | ||
{ | ||
private static final ThreadLocal<Identifier> currentRegistry = new ThreadLocal<>(); | ||
|
||
@Redirect(method = "toTag", at = @At( | ||
value = "INVOKE", | ||
target = "Lnet/minecraft/util/registry/Registry;get(Lnet/minecraft/util/Identifier;)Ljava/lang/Object;" | ||
)) | ||
private static <T> T redirectGetRegistry(Registry<T> registry, Identifier id) | ||
{ | ||
currentRegistry.set(id); | ||
return registry.get(id); | ||
} | ||
|
||
@Redirect(method = "toTag", at = @At( | ||
value = "INVOKE", | ||
target = "Lnet/minecraft/util/registry/Registry;getId(Ljava/lang/Object;)Lnet/minecraft/util/Identifier;" | ||
)) | ||
private static <T> Identifier redirectGetId(Registry<T> mutableRegistry, T entry) | ||
{ | ||
Identifier id = mutableRegistry.getId(entry); | ||
if (SkyBlockExtension.isIgnoredForRegistrySync(currentRegistry.get(), id)) return null; | ||
return id; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters