diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinTextureManager.java | 25 | ||||
-rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java | 1 |
2 files changed, 26 insertions, 0 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinTextureManager.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinTextureManager.java index d8a48ecd..01c053b8 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinTextureManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinTextureManager.java @@ -19,20 +19,45 @@ package io.github.moulberry.notenoughupdates.mixins; +import com.google.common.collect.Lists; import io.github.moulberry.notenoughupdates.miscfeatures.ItemCustomizeManager; +import io.github.moulberry.notenoughupdates.profileviewer.BasicPage; +import net.minecraft.client.renderer.texture.ITickable; import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.util.ResourceLocation; +import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Mutable; +import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import java.util.Collections; +import java.util.List; + @Mixin(TextureManager.class) public class MixinTextureManager { + + @Mutable + @Final + @Shadow + private List<ITickable> listTickables; + @Inject(method = "bindTexture", at = @At("HEAD"), cancellable = true) public void bindTexture(ResourceLocation location, CallbackInfo ci) { if (ItemCustomizeManager.disableTextureBinding) { ci.cancel(); } } + + /** + Fixes ConcurrentModificationException in TextureManager#tick + This is caused by NEU loading a player asynchronously which can cause issues with other mods (5zig in this case) + @see BasicPage#drawPage at profileLoader.submit() + */ + @Inject(method = "<init>", at = @At("RETURN")) + public void constructor(CallbackInfo ci) { + listTickables = Collections.synchronizedList(Lists.newArrayList()); + } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java index 0011272f..d10acea9 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java @@ -471,6 +471,7 @@ public class BasicPage extends GuiProfileViewerPage { loadingProfile = true; UUID playerUUID = UUID.fromString(niceUuid(profile.getUuid())); + // Loads the player asynchronously profileLoader.submit(() -> { GameProfile fakeProfile = Minecraft .getMinecraft() |