Fixed MultiPackResourceManagerMixin

This commit is contained in:
Frank 2022-03-18 20:44:50 +01:00
parent 12a8b0c23a
commit c783d007b1
4 changed files with 83 additions and 92 deletions

View file

@ -0,0 +1,30 @@
package ru.bclib.mixin.common;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.packs.resources.MultiPackResourceManager;
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.CallbackInfoReturnable;
@Mixin(MultiPackResourceManager.class)
public class MultiPackResourceManagerMixin {
private static final String[] BCLIB_MISSING_RESOURCES = new String[] {
"dimension/the_end.json",
"dimension/the_nether.json",
"dimension_type/the_end.json",
"dimension_type/the_nether.json"
};
@Inject(method = "hasResource", at = @At("HEAD"), cancellable = true)
private void bclib_hasResource(ResourceLocation resourceLocation, CallbackInfoReturnable<Boolean> info) {
if (resourceLocation.getNamespace().equals("minecraft")) {
for (String key: BCLIB_MISSING_RESOURCES) {
if (resourceLocation.getPath().equals(key)) {
info.setReturnValue(false);
return;
}
}
}
}
}