Update mappings

This commit is contained in:
Player 2022-03-23 01:15:45 +01:00
parent 583ee89038
commit c8c49daef7
7 changed files with 29 additions and 44 deletions
fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/impl/biome/modification
fabric-registry-sync-v0/src/main/java/net/fabricmc/fabric/impl/registry/sync
fabric-resource-loader-v0/src/main
gradle.properties

View file

@ -85,7 +85,7 @@ public class BiomeSelectionContextImpl implements BiomeSelectionContext {
return false;
}
return instance.method_41607().contains(getBiomeRegistryEntry());
return instance.getValidBiomes().contains(getBiomeRegistryEntry());
}
@Override

View file

@ -104,7 +104,7 @@ public class FabricRegistryInit implements ModInitializer {
RegistryAttributeHolder.get(Registry.CHUNK_STATUS);
// Serialised by string, doesnt seem to be synced
RegistryAttributeHolder.get(Registry.STRUCTURE_FEATURE);
RegistryAttributeHolder.get(Registry.STRUCTURE_TYPE);
// Serialised by string, doesnt seem to be synced
RegistryAttributeHolder.get(Registry.STRUCTURE_PIECE);

View file

@ -31,7 +31,6 @@ import java.util.stream.Collectors;
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
import net.minecraft.resource.NamespaceResourceManager;
import net.minecraft.resource.NamespaceResourceManager.class_7083;
import net.minecraft.resource.ResourceNotFoundException;
import net.minecraft.resource.ResourcePack;
import net.minecraft.resource.ResourceType;
@ -118,7 +117,7 @@ public abstract class GroupResourcePack implements ResourcePack {
return this.namespacedPacks.keySet();
}
public void appendResources(NamespaceResourceManagerAccessor manager, Identifier id, List<class_7083> resources) {
public void appendResources(NamespaceResourceManagerAccessor manager, Identifier id, List<NamespaceResourceManager.Entry> resources) {
List<ModResourcePack> packs = this.namespacedPacks.get(id.getNamespace());
if (packs == null) {
@ -129,7 +128,7 @@ public abstract class GroupResourcePack implements ResourcePack {
for (ModResourcePack pack : packs) {
if (pack.contains(manager.getType(), id)) {
resources.add(((NamespaceResourceManager) manager).new class_7083(id, metadataId, pack));
resources.add(((NamespaceResourceManager) manager).new Entry(id, metadataId, pack));
}
}
}

View file

@ -25,10 +25,9 @@ import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
import net.minecraft.class_7086;
import net.minecraft.resource.NamespaceResourceManager;
import net.minecraft.resource.NamespaceResourceManager.class_7083;
import net.minecraft.resource.ResourcePack;
import net.minecraft.resource.ResourceRef;
import net.minecraft.resource.ResourceType;
import net.minecraft.util.Identifier;
@ -39,27 +38,17 @@ import net.fabricmc.fabric.impl.resource.loader.GroupResourcePack;
*/
@Mixin(NamespaceResourceManager.class)
public class NamespaceResourceManagerMixin {
private final ThreadLocal<List<class_7083>> fabric$getAllResources$resources = new ThreadLocal<>();
private final ThreadLocal<List<NamespaceResourceManager.Entry>> fabric$getAllResources$resources = new ThreadLocal<>();
@Inject(
method = "getAllResources",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/resource/NamespaceResourceManager;getMetadataPath(Lnet/minecraft/util/Identifier;)Lnet/minecraft/util/Identifier;"
),
locals = LocalCapture.CAPTURE_FAILHARD
)
private void onGetAllResources(Identifier id, CallbackInfoReturnable<List<class_7086>> cir, List<class_7083> resources) {
@Inject(method = "getAllResources",
at = @At(value = "INVOKE", target = "Lnet/minecraft/resource/NamespaceResourceManager;getMetadataPath(Lnet/minecraft/util/Identifier;)Lnet/minecraft/util/Identifier;"),
locals = LocalCapture.CAPTURE_FAILHARD)
private void onGetAllResources(Identifier id, CallbackInfoReturnable<List<ResourceRef>> cir, List<NamespaceResourceManager.Entry> resources) {
this.fabric$getAllResources$resources.set(resources);
}
@Redirect(
method = "getAllResources",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/resource/ResourcePack;contains(Lnet/minecraft/resource/ResourceType;Lnet/minecraft/util/Identifier;)Z"
)
)
@Redirect(method = "getAllResources",
at = @At(value = "INVOKE", target = "Lnet/minecraft/resource/ResourcePack;contains(Lnet/minecraft/resource/ResourceType;Lnet/minecraft/util/Identifier;)Z"))
private boolean onResourceAdd(ResourcePack pack, ResourceType type, Identifier id) {
if (pack instanceof GroupResourcePack) {
((GroupResourcePack) pack).appendResources((NamespaceResourceManagerAccessor) this, id, this.fabric$getAllResources$resources.get());
@ -70,21 +59,16 @@ public class NamespaceResourceManagerMixin {
return pack.contains(type, id);
}
@Redirect(
method = "method_41258",
at = @At(
value = "INVOKE",
target = "Ljava/util/List;add(Ljava/lang/Object;)Z"
),
allow = 1
)
private boolean onResourceAdd(List<NamespaceResourceManager.class_7083> entries, Object entryObject) {
@Redirect(method = "findAndAdd",
at = @At(value = "INVOKE", target = "Ljava/util/List;add(Ljava/lang/Object;)Z"),
allow = 1)
private boolean onResourceAdd(List<NamespaceResourceManager.Entry> entries, Object entryObject) {
// Required due to type erasure of List.add
NamespaceResourceManager.class_7083 entry = (NamespaceResourceManager.class_7083) entryObject;
ResourcePack pack = entry.field_37286;
NamespaceResourceManager.Entry entry = (NamespaceResourceManager.Entry) entryObject;
ResourcePack pack = entry.pack;
if (pack instanceof GroupResourcePack grp) {
grp.appendResources((NamespaceResourceManagerAccessor) this, entry.field_37284, entries);
grp.appendResources((NamespaceResourceManagerAccessor) this, entry.id, entries);
return true;
}

View file

@ -46,20 +46,22 @@ public class CreateWorldScreenMixin {
private ResourcePackManager packManager;
@ModifyVariable(method = "create(Lnet/minecraft/client/MinecraftClient;Lnet/minecraft/client/gui/screen/Screen;)V",
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/world/CreateWorldScreen;method_41849(Lnet/minecraft/resource/ResourcePackManager;Lnet/minecraft/resource/DataPackSettings;)Lnet/minecraft/class_7237$FunctionLoaderConfig;"))
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/world/CreateWorldScreen;method_41849(Lnet/minecraft/resource/ResourcePackManager;Lnet/minecraft/resource/DataPackSettings;)Lnet/minecraft/server/SaveLoading$ServerConfig;"))
private static ResourcePackManager onCreateResManagerInit(ResourcePackManager manager) {
// Add mod data packs to the initial res pack manager so they are active even if the user doesn't use custom data packs
((ResourcePackManagerAccessor) manager).getProviders().add(new ModResourcePackCreator(ResourceType.SERVER_DATA));
return manager;
}
@Inject(method = "getScannedPack", at = @At(value = "INVOKE", target = "Lnet/minecraft/resource/ResourcePackManager;scanPacks()V", shift = At.Shift.BEFORE))
@Inject(method = "getScannedPack",
at = @At(value = "INVOKE", target = "Lnet/minecraft/resource/ResourcePackManager;scanPacks()V", shift = At.Shift.BEFORE))
private void onScanPacks(CallbackInfoReturnable<Pair<File, ResourcePackManager>> cir) {
// Allow to display built-in data packs in the data pack selection screen at world creation.
((ResourcePackManagerAccessor) this.packManager).getProviders().add(new ModResourcePackCreator(ResourceType.SERVER_DATA));
}
@ModifyArg(method = "create", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/world/CreateWorldScreen;<init>(Lnet/minecraft/client/gui/screen/Screen;Lnet/minecraft/resource/DataPackSettings;Lnet/minecraft/client/gui/screen/world/MoreOptionsDialog;)V"), index = 1)
@ModifyArg(method = "create",
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/world/CreateWorldScreen;<init>(Lnet/minecraft/client/gui/screen/Screen;Lnet/minecraft/resource/DataPackSettings;Lnet/minecraft/client/gui/screen/world/MoreOptionsDialog;)V"), index = 1)
private static DataPackSettings onNew(DataPackSettings settings) {
ModResourcePackCreator modResourcePackCreator = new ModResourcePackCreator(ResourceType.SERVER_DATA);
List<ResourcePackProfile> moddedResourcePacks = new ArrayList<>();

View file

@ -1,5 +1,5 @@
accessWidener v2 named
accessible method net/minecraft/resource/NamespaceResourceManager$class_7083 <init> (Lnet/minecraft/resource/NamespaceResourceManager;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;Lnet/minecraft/resource/ResourcePack;)V
accessible field net/minecraft/resource/NamespaceResourceManager$class_7083 field_37284 Lnet/minecraft/util/Identifier;
accessible field net/minecraft/resource/NamespaceResourceManager$class_7083 field_37286 Lnet/minecraft/resource/ResourcePack;
accessible method net/minecraft/resource/NamespaceResourceManager$Entry <init> (Lnet/minecraft/resource/NamespaceResourceManager;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;Lnet/minecraft/resource/ResourcePack;)V
accessible field net/minecraft/resource/NamespaceResourceManager$Entry id Lnet/minecraft/util/Identifier;
accessible field net/minecraft/resource/NamespaceResourceManager$Entry pack Lnet/minecraft/resource/ResourcePack;

View file

@ -2,10 +2,10 @@ org.gradle.jvmargs=-Xmx2560M
version=0.49.2
minecraft_version=22w11a
yarn_version=+build.2
yarn_version=+build.4
loader_version=0.13.3
prerelease=false
prerelease=true
# Do not manually update, use the bumpversions task:
fabric-api-base-version=0.4.4