From 35e08e338756bf1e674bf9c17d6bf8fe4bb42757 Mon Sep 17 00:00:00 2001
From: modmuss50 <modmuss50@gmail.com>
Date: Wed, 8 Jul 2020 19:31:01 +0100
Subject: [PATCH] 20w28a - no biomes or dimensions

---
 build.gradle                                  |  8 +--
 fabric-registry-sync-v0/build.gradle          |  2 +-
 .../registry/sync/FabricRegistryInit.java     |  5 --
 .../trackers/vanilla/BiomeParentTracker.java  | 69 -------------------
 .../mixin/registry/sync/MixinBootstrap.java   |  2 -
 .../mixin/registry/sync/MixinIdRegistry.java  |  6 +-
 .../sync/MixinLevelStorageSession.java        |  4 +-
 fabric-resource-loader-v0/build.gradle        |  2 +-
 .../MixinKeyedResourceReloadListener.java     |  8 +--
 fabric-tag-extensions-v0/build.gradle         |  2 +-
 .../fabricmc/fabric/api/tag/TagRegistry.java  | 12 ++--
 .../impl/tag/extension/TagDelegate.java       | 14 ++--
 settings.gradle                               |  4 +-
 src/main/resources/fabric.mod.json            |  4 +-
 14 files changed, 33 insertions(+), 109 deletions(-)
 delete mode 100644 fabric-registry-sync-v0/src/main/java/net/fabricmc/fabric/impl/registry/sync/trackers/vanilla/BiomeParentTracker.java

diff --git a/build.gradle b/build.gradle
index c27f33373..9d4d6f7c7 100644
--- a/build.gradle
+++ b/build.gradle
@@ -18,9 +18,9 @@ plugins {
 def ENV = System.getenv()
 
 class Globals {
-	static def baseVersion = "0.14.2"
-	static def mcVersion = "20w27a"
-	static def yarnVersion = "+build.1"
+	static def baseVersion = "0.14.3"
+	static def mcVersion = "20w28a"
+	static def yarnVersion = "+build.2"
 }
 
 version = Globals.baseVersion + "+" + (ENV.BUILD_NUMBER ? ("build." + ENV.BUILD_NUMBER) : "local") + "-" + getBranch()
@@ -73,7 +73,7 @@ allprojects {
 	dependencies {
 		minecraft "com.mojang:minecraft:$Globals.mcVersion"
 		mappings "net.fabricmc:yarn:${Globals.mcVersion}${Globals.yarnVersion}:v2"
-		modCompile "net.fabricmc:fabric-loader:0.8.8+build.202"
+		modCompile "net.fabricmc:fabric-loader:0.8.9+build.203"
 	}
 
 	configurations {
diff --git a/fabric-registry-sync-v0/build.gradle b/fabric-registry-sync-v0/build.gradle
index 7ef8dd24c..e11e74fa3 100644
--- a/fabric-registry-sync-v0/build.gradle
+++ b/fabric-registry-sync-v0/build.gradle
@@ -1,5 +1,5 @@
 archivesBaseName = "fabric-registry-sync-v0"
-version = getSubprojectVersion(project, "0.3.8")
+version = getSubprojectVersion(project, "0.3.9")
 
 dependencies {
 	compile project(path: ':fabric-api-base', configuration: 'dev')
diff --git a/fabric-registry-sync-v0/src/main/java/net/fabricmc/fabric/impl/registry/sync/FabricRegistryInit.java b/fabric-registry-sync-v0/src/main/java/net/fabricmc/fabric/impl/registry/sync/FabricRegistryInit.java
index 0e4f84151..13a71e624 100644
--- a/fabric-registry-sync-v0/src/main/java/net/fabricmc/fabric/impl/registry/sync/FabricRegistryInit.java
+++ b/fabric-registry-sync-v0/src/main/java/net/fabricmc/fabric/impl/registry/sync/FabricRegistryInit.java
@@ -69,11 +69,6 @@ public class FabricRegistryInit implements ModInitializer {
 		// Serialised by string, doesnt seem to be synced
 		RegistryAttributeHolder.get(Registry.DECORATOR);
 
-		// Saved to level format
-		RegistryAttributeHolder.get(Registry.BIOME)
-				.addAttribute(RegistryAttribute.SYNCED)
-				.addAttribute(RegistryAttribute.PERSISTED);
-
 		// Serialised by string, doesnt seem to be synced
 		RegistryAttributeHolder.get(Registry.BLOCK_STATE_PROVIDER_TYPE);
 
diff --git a/fabric-registry-sync-v0/src/main/java/net/fabricmc/fabric/impl/registry/sync/trackers/vanilla/BiomeParentTracker.java b/fabric-registry-sync-v0/src/main/java/net/fabricmc/fabric/impl/registry/sync/trackers/vanilla/BiomeParentTracker.java
deleted file mode 100644
index debaba7ad..000000000
--- a/fabric-registry-sync-v0/src/main/java/net/fabricmc/fabric/impl/registry/sync/trackers/vanilla/BiomeParentTracker.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2016, 2017, 2018, 2019 FabricMC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.fabricmc.fabric.impl.registry.sync.trackers.vanilla;
-
-import java.util.Objects;
-
-import it.unimi.dsi.fastutil.ints.Int2IntMap;
-
-import net.minecraft.util.Identifier;
-import net.minecraft.util.registry.Registry;
-import net.minecraft.world.biome.Biome;
-
-import net.fabricmc.fabric.api.event.registry.RegistryEntryAddedCallback;
-import net.fabricmc.fabric.api.event.registry.RegistryEntryRemovedCallback;
-import net.fabricmc.fabric.api.event.registry.RegistryIdRemapCallback;
-import net.fabricmc.fabric.impl.registry.sync.RemovableIdList;
-
-public final class BiomeParentTracker implements RegistryEntryAddedCallback<Biome>, RegistryEntryRemovedCallback<Biome>, RegistryIdRemapCallback<Biome> {
-	private final Registry<Biome> registry;
-
-	private BiomeParentTracker(Registry<Biome> registry) {
-		this.registry = registry;
-	}
-
-	public static void register(Registry<Biome> registry) {
-		BiomeParentTracker tracker = new BiomeParentTracker(registry);
-		RegistryEntryAddedCallback.event(registry).register(tracker);
-		RegistryIdRemapCallback.event(registry).register(tracker);
-		RegistryEntryRemovedCallback.event(registry).register(tracker);
-	}
-
-	@Override
-	public void onEntryAdded(int rawId, Identifier id, Biome object) {
-		if (object.hasParent()) {
-			Biome.PARENT_BIOME_ID_MAP.set(object, registry.getRawId(registry.get(new Identifier(Objects.requireNonNull(object.getParent())))));
-		}
-	}
-
-	@Override
-	public void onRemap(RemapState<Biome> state) {
-		for (Int2IntMap.Entry entry : state.getRawIdChangeMap().int2IntEntrySet()) {
-			if (Biome.PARENT_BIOME_ID_MAP.get(entry.getIntKey()) != null) {
-				//noinspection unchecked
-				((RemovableIdList<Biome>) Biome.PARENT_BIOME_ID_MAP).fabric_remapId(entry.getIntKey(), entry.getIntValue());
-			}
-		}
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public void onEntryRemoved(int rawId, Identifier id, Biome object) {
-		((RemovableIdList<Biome>) Biome.PARENT_BIOME_ID_MAP).fabric_remove(object);
-		((RemovableIdList<Biome>) Biome.PARENT_BIOME_ID_MAP).fabric_removeId(rawId);
-	}
-}
diff --git a/fabric-registry-sync-v0/src/main/java/net/fabricmc/fabric/mixin/registry/sync/MixinBootstrap.java b/fabric-registry-sync-v0/src/main/java/net/fabricmc/fabric/mixin/registry/sync/MixinBootstrap.java
index 41e13059b..f46b25df0 100644
--- a/fabric-registry-sync-v0/src/main/java/net/fabricmc/fabric/mixin/registry/sync/MixinBootstrap.java
+++ b/fabric-registry-sync-v0/src/main/java/net/fabricmc/fabric/mixin/registry/sync/MixinBootstrap.java
@@ -32,7 +32,6 @@ import net.minecraft.world.biome.Biomes;
 
 import net.fabricmc.fabric.impl.registry.sync.RegistrySyncManager;
 import net.fabricmc.fabric.impl.registry.sync.trackers.StateIdTracker;
-import net.fabricmc.fabric.impl.registry.sync.trackers.vanilla.BiomeParentTracker;
 import net.fabricmc.fabric.impl.registry.sync.trackers.vanilla.BlockInitTracker;
 import net.fabricmc.fabric.impl.registry.sync.trackers.vanilla.BlockItemTracker;
 
@@ -55,7 +54,6 @@ public class MixinBootstrap {
 		StateIdTracker.register(Registry.FLUID, Fluid.STATE_IDS, (fluid) -> fluid.getStateManager().getStates());
 
 		// map tracking
-		BiomeParentTracker.register(Registry.BIOME);
 		BlockItemTracker.register(Registry.ITEM);
 
 		// block initialization, like Blocks
diff --git a/fabric-registry-sync-v0/src/main/java/net/fabricmc/fabric/mixin/registry/sync/MixinIdRegistry.java b/fabric-registry-sync-v0/src/main/java/net/fabricmc/fabric/mixin/registry/sync/MixinIdRegistry.java
index d8e567bd9..8147367d6 100644
--- a/fabric-registry-sync-v0/src/main/java/net/fabricmc/fabric/mixin/registry/sync/MixinIdRegistry.java
+++ b/fabric-registry-sync-v0/src/main/java/net/fabricmc/fabric/mixin/registry/sync/MixinIdRegistry.java
@@ -129,7 +129,7 @@ public abstract class MixinIdRegistry<T> implements RemappableRegistry, Listenab
 	@SuppressWarnings({"unchecked", "ConstantConditions"})
 	@Inject(method = "set", at = @At("HEAD"))
 	public void setPre(int id, RegistryKey<T> registryId, Object object, CallbackInfoReturnable info) {
-		int indexedEntriesId = indexedEntries.getId((T) object);
+		int indexedEntriesId = indexedEntries.getRawId((T) object);
 
 		if (indexedEntriesId >= 0) {
 			throw new RuntimeException("Attempted to register object " + object + " twice! (at raw IDs " + indexedEntriesId + " and " + id + " )");
@@ -141,7 +141,7 @@ public abstract class MixinIdRegistry<T> implements RemappableRegistry, Listenab
 			T oldObject = entriesById.get(registryId.getValue());
 
 			if (oldObject != null && oldObject != object) {
-				int oldId = indexedEntries.getId(oldObject);
+				int oldId = indexedEntries.getRawId(oldObject);
 
 				if (oldId != id) {
 					throw new RuntimeException("Attempted to register ID " + registryId + " at different raw IDs (" + oldId + ", " + id + ")! If you're trying to override an item, use .set(), not .register()!");
@@ -370,7 +370,7 @@ public abstract class MixinIdRegistry<T> implements RemappableRegistry, Listenab
 			remap(name, fabric_prevIndexedEntries, RemapMode.AUTHORITATIVE);
 
 			for (Identifier id : addedIds) {
-				fabric_getAddObjectEvent().invoker().onEntryAdded(indexedEntries.getId(entriesById.get(id)), id, entriesById.get(id));
+				fabric_getAddObjectEvent().invoker().onEntryAdded(indexedEntries.getRawId(entriesById.get(id)), id, entriesById.get(id));
 			}
 
 			fabric_prevIndexedEntries = null;
diff --git a/fabric-registry-sync-v0/src/main/java/net/fabricmc/fabric/mixin/registry/sync/MixinLevelStorageSession.java b/fabric-registry-sync-v0/src/main/java/net/fabricmc/fabric/mixin/registry/sync/MixinLevelStorageSession.java
index 73d4ce48a..09206d4dd 100644
--- a/fabric-registry-sync-v0/src/main/java/net/fabricmc/fabric/mixin/registry/sync/MixinLevelStorageSession.java
+++ b/fabric-registry-sync-v0/src/main/java/net/fabricmc/fabric/mixin/registry/sync/MixinLevelStorageSession.java
@@ -39,7 +39,7 @@ import net.minecraft.nbt.CompoundTag;
 import net.minecraft.nbt.NbtIo;
 import net.minecraft.world.SaveProperties;
 import net.minecraft.world.level.storage.LevelStorage;
-import net.minecraft.util.registry.RegistryTracker;
+import net.minecraft.class_5455;
 
 import net.fabricmc.fabric.impl.registry.sync.RegistrySyncManager;
 import net.fabricmc.fabric.impl.registry.sync.RemapException;
@@ -130,7 +130,7 @@ public class MixinLevelStorageSession {
 	}
 
 	@Inject(method = "method_27426", at = @At("HEAD"))
-	public void saveWorld(RegistryTracker registryTracker, SaveProperties saveProperties, CompoundTag compoundTag, CallbackInfo info) {
+	public void saveWorld(class_5455 registryTracker, SaveProperties saveProperties, CompoundTag compoundTag, CallbackInfo info) {
 		if (!Files.exists(directory)) {
 			return;
 		}
diff --git a/fabric-resource-loader-v0/build.gradle b/fabric-resource-loader-v0/build.gradle
index 634423976..84a3471c2 100644
--- a/fabric-resource-loader-v0/build.gradle
+++ b/fabric-resource-loader-v0/build.gradle
@@ -1,2 +1,2 @@
 archivesBaseName = "fabric-resource-loader-v0"
-version = getSubprojectVersion(project, "0.2.7")
+version = getSubprojectVersion(project, "0.2.8")
diff --git a/fabric-resource-loader-v0/src/main/java/net/fabricmc/fabric/mixin/resource/loader/MixinKeyedResourceReloadListener.java b/fabric-resource-loader-v0/src/main/java/net/fabricmc/fabric/mixin/resource/loader/MixinKeyedResourceReloadListener.java
index 1b70ab8ee..cc329acc2 100644
--- a/fabric-resource-loader-v0/src/main/java/net/fabricmc/fabric/mixin/resource/loader/MixinKeyedResourceReloadListener.java
+++ b/fabric-resource-loader-v0/src/main/java/net/fabricmc/fabric/mixin/resource/loader/MixinKeyedResourceReloadListener.java
@@ -33,7 +33,7 @@ import net.minecraft.client.texture.TextureManager;
 import net.minecraft.recipe.RecipeManager;
 import net.minecraft.server.ServerAdvancementLoader;
 import net.minecraft.server.function.CommandFunctionManager;
-import net.minecraft.tag.RegistryTagManager;
+import net.minecraft.tag.TagManagerLoader;
 import net.minecraft.util.Identifier;
 import net.minecraft.loot.LootManager;
 
@@ -96,7 +96,7 @@ public class MixinKeyedResourceReloadListener {
 
 	@Mixin({
 			/* public */
-			RecipeManager.class, ServerAdvancementLoader.class, CommandFunctionManager.class, LootManager.class, RegistryTagManager.class
+			RecipeManager.class, ServerAdvancementLoader.class, CommandFunctionManager.class, LootManager.class, TagManagerLoader.class
 			/* private */
 	})
 	public abstract static class Server implements IdentifiableResourceReloadListener {
@@ -109,7 +109,7 @@ public class MixinKeyedResourceReloadListener {
 			if (fabric_idDeps == null) {
 				Object self = this;
 
-				if (self instanceof RegistryTagManager) {
+				if (self instanceof TagManagerLoader) {
 					fabric_idDeps = Collections.emptyList();
 				} else {
 					fabric_idDeps = Collections.singletonList(ResourceReloadListenerKeys.TAGS);
@@ -133,7 +133,7 @@ public class MixinKeyedResourceReloadListener {
 					fabric_id = ResourceReloadListenerKeys.FUNCTIONS;
 				} else if (self instanceof LootManager) {
 					fabric_id = ResourceReloadListenerKeys.LOOT_TABLES;
-				} else if (self instanceof RegistryTagManager) {
+				} else if (self instanceof TagManagerLoader) {
 					fabric_id = ResourceReloadListenerKeys.TAGS;
 				} else {
 					fabric_id = new Identifier("minecraft", "private/" + self.getClass().getSimpleName().toLowerCase(Locale.ROOT));
diff --git a/fabric-tag-extensions-v0/build.gradle b/fabric-tag-extensions-v0/build.gradle
index 7ce160cc5..53c78b667 100644
--- a/fabric-tag-extensions-v0/build.gradle
+++ b/fabric-tag-extensions-v0/build.gradle
@@ -1,5 +1,5 @@
 archivesBaseName = "fabric-tag-extensions-v0"
-version = getSubprojectVersion(project, "1.0.0")
+version = getSubprojectVersion(project, "1.0.1")
 
 dependencies {
 	compile project(path: ':fabric-api-base', configuration: 'dev')
diff --git a/fabric-tag-extensions-v0/src/main/java/net/fabricmc/fabric/api/tag/TagRegistry.java b/fabric-tag-extensions-v0/src/main/java/net/fabricmc/fabric/api/tag/TagRegistry.java
index bbe08a6a7..eba76bd5c 100644
--- a/fabric-tag-extensions-v0/src/main/java/net/fabricmc/fabric/api/tag/TagRegistry.java
+++ b/fabric-tag-extensions-v0/src/main/java/net/fabricmc/fabric/api/tag/TagRegistry.java
@@ -19,7 +19,7 @@ package net.fabricmc.fabric.api.tag;
 import java.util.function.Supplier;
 
 import net.minecraft.block.Block;
-import net.minecraft.class_5414;
+import net.minecraft.tag.TagGroup;
 import net.minecraft.entity.EntityType;
 import net.minecraft.fluid.Fluid;
 import net.minecraft.item.Item;
@@ -38,23 +38,23 @@ import net.fabricmc.fabric.impl.tag.extension.TagDelegate;
 public final class TagRegistry {
 	private TagRegistry() { }
 
-	public static <T> Tag.Identified<T> create(Identifier id, Supplier<class_5414<T>> containerSupplier) {
+	public static <T> Tag.Identified<T> create(Identifier id, Supplier<TagGroup<T>> containerSupplier) {
 		return new TagDelegate<>(id, containerSupplier);
 	}
 
 	public static Tag<Block> block(Identifier id) {
-		return create(id, BlockTags::getContainer);
+		return create(id, BlockTags::getTagGroup);
 	}
 
 	public static Tag<EntityType<?>> entityType(Identifier id) {
-		return create(id, EntityTypeTags::getContainer);
+		return create(id, EntityTypeTags::getTagGroup);
 	}
 
 	public static Tag<Fluid> fluid(Identifier id) {
-		return create(id, FluidTags::getContainer);
+		return create(id, FluidTags::getTagGroup);
 	}
 
 	public static Tag<Item> item(Identifier id) {
-		return create(id, ItemTags::getContainer);
+		return create(id, ItemTags::getTagGroup);
 	}
 }
diff --git a/fabric-tag-extensions-v0/src/main/java/net/fabricmc/fabric/impl/tag/extension/TagDelegate.java b/fabric-tag-extensions-v0/src/main/java/net/fabricmc/fabric/impl/tag/extension/TagDelegate.java
index 104b3568e..db6ebbe31 100644
--- a/fabric-tag-extensions-v0/src/main/java/net/fabricmc/fabric/impl/tag/extension/TagDelegate.java
+++ b/fabric-tag-extensions-v0/src/main/java/net/fabricmc/fabric/impl/tag/extension/TagDelegate.java
@@ -19,7 +19,7 @@ package net.fabricmc.fabric.impl.tag.extension;
 import java.util.List;
 import java.util.function.Supplier;
 
-import net.minecraft.class_5414;
+import net.minecraft.tag.TagGroup;
 import net.minecraft.tag.Tag;
 import net.minecraft.util.Identifier;
 
@@ -27,11 +27,11 @@ import net.fabricmc.fabric.api.tag.FabricTag;
 
 public final class TagDelegate<T> implements Tag.Identified<T>, FabricTag<T>, FabricTagHooks {
 	private final Identifier id;
-	private final Supplier<class_5414<T>> containerSupplier;
+	private final Supplier<TagGroup<T>> containerSupplier;
 	private volatile Target<T> target;
 	private int clearCount;
 
-	public TagDelegate(Identifier id, Supplier<class_5414<T>> containerSupplier) {
+	public TagDelegate(Identifier id, Supplier<TagGroup<T>> containerSupplier) {
 		this.id = id;
 		this.containerSupplier = containerSupplier;
 	}
@@ -57,11 +57,11 @@ public final class TagDelegate<T> implements Tag.Identified<T>, FabricTag<T>, Fa
 	 */
 	private Tag<T> getTag() {
 		Target<T> target = this.target;
-		class_5414<T> reqContainer = containerSupplier.get();
+		TagGroup<T> reqContainer = containerSupplier.get();
 		Tag<T> ret;
 
 		if (target == null || target.container != reqContainer) {
-			ret = reqContainer.method_30213(getId());
+			ret = reqContainer.getTagOrEmpty(getId());
 			this.target = new Target<>(reqContainer, ret);
 		} else {
 			ret = target.tag;
@@ -86,12 +86,12 @@ public final class TagDelegate<T> implements Tag.Identified<T>, FabricTag<T>, Fa
 	}
 
 	private static final class Target<T> {
-		Target(class_5414<T> container, Tag<T> tag) {
+		Target(TagGroup<T> container, Tag<T> tag) {
 			this.container = container;
 			this.tag = tag;
 		}
 
-		final class_5414<T> container;
+		final TagGroup<T> container;
 		final Tag<T> tag;
 	}
 }
diff --git a/settings.gradle b/settings.gradle
index 3b458247c..e30e3c16e 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -14,14 +14,14 @@ rootProject.name = "fabric-api"
 
 include 'fabric-api-base'
 
-include 'fabric-biomes-v1'
+//include 'fabric-biomes-v1'
 include 'fabric-blockrenderlayer-v1'
 include 'fabric-commands-v0'
 include 'fabric-command-api-v1'
 include 'fabric-containers-v0'
 include 'fabric-content-registries-v0'
 include 'fabric-crash-report-info-v1'
-include 'fabric-dimensions-v1'
+//include 'fabric-dimensions-v1'
 include 'fabric-events-interaction-v0'
 include 'fabric-events-lifecycle-v0'
 include 'fabric-item-api-v1'
diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json
index b50bf8225..535c84f1e 100644
--- a/src/main/resources/fabric.mod.json
+++ b/src/main/resources/fabric.mod.json
@@ -16,8 +16,8 @@
     "FabricMC"
   ],
   "depends": {
-    "fabricloader": ">=0.8.7",
-    "minecraft": "~1.16-alpha.20.14.a"
+    "fabricloader": ">=0.8.9",
+    "minecraft": "~1.16.2-alpha.20.28.a"
   },
   "description": "Core API module providing key hooks and intercompatibility features."
 }