Ensure cached resources are cleared when connecting to multiplayer
This commit is contained in:
parent
701def339f
commit
d10ff8a24e
|
|
@ -12,8 +12,11 @@ import net.minecraft.world.level.DataPackConfig;
|
|||
import org.embeddedt.modernfix.ModernFix;
|
||||
import org.embeddedt.modernfix.duck.reuse_datapacks.ICachingResourceClient;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
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.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
|
@ -21,7 +24,9 @@ import java.util.concurrent.CompletableFuture;
|
|||
import java.util.concurrent.Executor;
|
||||
|
||||
@Mixin(Minecraft.class)
|
||||
public class MinecraftMixin implements ICachingResourceClient {
|
||||
public abstract class MinecraftMixin implements ICachingResourceClient {
|
||||
@Shadow public abstract boolean isLocalServer();
|
||||
|
||||
private ServerResources cachedResources;
|
||||
private List<String> cachedDataPackConfig;
|
||||
|
||||
|
|
@ -67,4 +72,10 @@ public class MinecraftMixin implements ICachingResourceClient {
|
|||
public void setCachedDataPackConfig(Collection<String> c) {
|
||||
cachedDataPackConfig = ImmutableList.copyOf(c);
|
||||
}
|
||||
|
||||
@Inject(method = "setLevel", at = @At("HEAD"))
|
||||
private void clearResourcesIfNotLocal(CallbackInfo ci) {
|
||||
if(!this.isLocalServer())
|
||||
cachedResources = null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user