Skip to content

Commit eff2638

Browse files
authored
23w16a (#3018)
# Breaking changes - `VillagerPlantableRegistry` replaced with `ItemTags.VILLAGER_PLANTABLE_SEEDS` - `FabricItemGroup.builder()` no longer takes an `Identifier` - `FabricItemGroup.build()` no longer registers the ItemGroup, this now needs to go in the vanilla registry. - `ItemGroupEvents.modifyEntriesEvent` now takes a `RegistryKey<ItemGroup>` in place of an `Identifier` - `FabricLanguageProvider` now takes a `RegistryKey<ItemGroup>` in place of an `ItemGroup` - `IdentifiableItemGroup` removed, replaced with vanilla registries. - `FabricMaterialBuilder` removed, no replacement. - `HudRenderCallback.onHudRender` now passed a `DrawableHelper` in place of `MatrixStack` - `ScreenEvents.beforeRender` now passed a `DrawableHelper` in place of `MatrixStack` - `ScreenEvents.afterRender` now passed a `DrawableHelper` in place of `MatrixStack` - `Screens.getItemRenderer()` removed. Replace with `MinecraftClient.getItemRenderer()` `DrawableHelper` is likely to be renamed soon, see: FabricMC/yarn#3548
1 parent 4514938 commit eff2638

File tree

60 files changed

+305
-921
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+305
-921
lines changed

fabric-api-lookup-api-v1/src/testmod/java/net/fabricmc/fabric/test/lookup/FabricApiLookupTest.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,17 @@ public class FabricApiLookupTest implements ModInitializer {
4242
public static final String MOD_ID = "fabric-lookup-api-v1-testmod";
4343
// Chute - Block without model that transfers item from the container above to the container below.
4444
// It's meant to work with unsided containers: chests, dispensers, droppers and hoppers.
45-
public static final ChuteBlock CHUTE_BLOCK = new ChuteBlock(FabricBlockSettings.of(Material.field_44489));
45+
public static final ChuteBlock CHUTE_BLOCK = new ChuteBlock(FabricBlockSettings.of(Material.GENERIC));
4646
public static final BlockItem CHUTE_ITEM = new BlockItem(CHUTE_BLOCK, new Item.Settings());
4747
public static BlockEntityType<ChuteBlockEntity> CHUTE_BLOCK_ENTITY_TYPE;
4848
// Cobble gen - Block without model that can generate infinite cobblestone when placed above a chute.
4949
// It's meant to test BlockApiLookup#registerSelf.
50-
public static final CobbleGenBlock COBBLE_GEN_BLOCK = new CobbleGenBlock(FabricBlockSettings.of(Material.field_44489));
50+
public static final CobbleGenBlock COBBLE_GEN_BLOCK = new CobbleGenBlock(FabricBlockSettings.of(Material.GENERIC));
5151
public static final BlockItem COBBLE_GEN_ITEM = new BlockItem(COBBLE_GEN_BLOCK, new Item.Settings());
5252
public static BlockEntityType<CobbleGenBlockEntity> COBBLE_GEN_BLOCK_ENTITY_TYPE;
5353
// Testing for item api lookups is done in the `item` package.
5454

55-
public static final InspectorBlock INSPECTOR_BLOCK = new InspectorBlock(FabricBlockSettings.of(Material.field_44489));
55+
public static final InspectorBlock INSPECTOR_BLOCK = new InspectorBlock(FabricBlockSettings.of(Material.GENERIC));
5656
public static final BlockItem INSPECTOR_ITEM = new BlockItem(INSPECTOR_BLOCK, new Item.Settings());
5757

5858
@Override

fabric-content-registries-v0/src/main/java/net/fabricmc/fabric/api/registry/SculkSensorFrequencyRegistry.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@
1616

1717
package net.fabricmc.fabric.api.registry;
1818

19+
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
1920
import org.slf4j.Logger;
2021
import org.slf4j.LoggerFactory;
2122

23+
import net.minecraft.class_8514;
2224
import net.minecraft.registry.tag.GameEventTags;
2325
import net.minecraft.world.event.GameEvent;
24-
import net.minecraft.world.event.listener.VibrationListener;
2526

2627
/**
2728
* Provides a method for registering sculk sensor frequencies.
@@ -51,7 +52,8 @@ public static void register(GameEvent event, int frequency) {
5152
throw new IllegalArgumentException("Attempted to register Sculk Sensor frequency for event "+event.getId()+" with frequency "+frequency+". Sculk Sensor frequencies must be between 1 and 15 inclusive.");
5253
}
5354

54-
int replaced = VibrationListener.FREQUENCIES.put(event, frequency);
55+
final Object2IntOpenHashMap<GameEvent> map = (Object2IntOpenHashMap<GameEvent>) class_8514.field_44639;
56+
int replaced = map.put(event, frequency);
5557

5658
if (replaced != 0) {
5759
LOGGER.debug("Replaced old frequency mapping for {} - was {}, now {}", event.getId(), replaced, frequency);

fabric-content-registries-v0/src/main/java/net/fabricmc/fabric/api/registry/VillagerPlantableRegistry.java

-113
This file was deleted.

fabric-content-registries-v0/src/main/java/net/fabricmc/fabric/mixin/content/registry/FarmerVillagerTaskMixin.java

-63
This file was deleted.

fabric-content-registries-v0/src/main/java/net/fabricmc/fabric/mixin/content/registry/VibrationListenerMixin.java

-37
This file was deleted.

fabric-content-registries-v0/src/main/java/net/fabricmc/fabric/mixin/content/registry/VillagerEntityMixin.java

-37
This file was deleted.

fabric-content-registries-v0/src/main/resources/fabric-content-registries-v0.mixins.json

+1-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"compatibilityLevel": "JAVA_16",
55
"mixins": [
66
"AxeItemAccessor",
7-
"FarmerVillagerTaskMixin",
87
"FarmerWorkTaskAccessor",
98
"GiveGiftsToHeroTaskAccessor",
109
"HoeItemAccessor",
@@ -13,10 +12,8 @@
1312
"AbstractFurnaceBlockEntityMixin",
1413
"FireBlockMixin",
1514
"OxidizableMixin",
16-
"VibrationListenerMixin",
1715
"ShovelItemAccessor",
18-
"VillagerEntityAccessor",
19-
"VillagerEntityMixin"
16+
"VillagerEntityAccessor"
2017
],
2118
"injectors": {
2219
"defaultRequire": 1

fabric-content-registries-v0/src/testmod/java/net/fabricmc/fabric/test/content/registry/ContentRegistryTest.java

-12
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@
5858
import net.fabricmc.fabric.api.registry.StrippableBlockRegistry;
5959
import net.fabricmc.fabric.api.registry.TillableBlockRegistry;
6060
import net.fabricmc.fabric.api.registry.VillagerInteractionRegistries;
61-
import net.fabricmc.fabric.api.registry.VillagerPlantableRegistry;
6261
import net.fabricmc.fabric.test.mixin.content.registry.BrewingRecipeRegistryAccessor;
6362

6463
public final class ContentRegistryTest implements ModInitializer {
@@ -137,17 +136,6 @@ public void onInitialize() {
137136
VillagerInteractionRegistries.registerCompostable(Items.APPLE);
138137

139138
VillagerInteractionRegistries.registerCollectable(Items.OAK_SAPLING);
140-
VillagerPlantableRegistry.register(Items.OAK_SAPLING);
141-
142-
// assert that VillagerPlantablesRegistry throws when getting a non-BlockItem
143-
try {
144-
VillagerPlantableRegistry.register(Items.STICK);
145-
146-
throw new AssertionError("VillagerPlantablesRegistry didn't throw when item is not BlockItem!");
147-
} catch (Exception e) {
148-
// expected behavior
149-
LOGGER.info("VillagerPlantablesRegistry test passed!");
150-
}
151139

152140
VillagerInteractionRegistries.registerGiftLootTable(VillagerProfession.NITWIT, new Identifier("fake_loot_table"));
153141

fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/api/datagen/v1/provider/FabricLanguageProvider.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
import net.minecraft.entity.effect.StatusEffect;
4040
import net.minecraft.item.Item;
4141
import net.minecraft.item.ItemGroup;
42+
import net.minecraft.registry.Registries;
43+
import net.minecraft.registry.RegistryKey;
4244
import net.minecraft.stat.StatType;
4345
import net.minecraft.text.TextContent;
4446
import net.minecraft.text.TranslatableTextContent;
@@ -145,10 +147,11 @@ default void add(Block block, String value) {
145147
/**
146148
* Adds a translation for an {@link ItemGroup}.
147149
*
148-
* @param group The {@link ItemGroup} to get the translation key from.
150+
* @param registryKey The {@link RegistryKey} to get the translation key from.
149151
* @param value The value of the entry.
150152
*/
151-
default void add(ItemGroup group, String value) {
153+
default void add(RegistryKey<ItemGroup> registryKey, String value) {
154+
final ItemGroup group = Registries.ITEM_GROUP.getOrThrow(registryKey);
152155
final TextContent content = group.getDisplayName().getContent();
153156

154157
if (content instanceof TranslatableTextContent translatableTextContent) {

fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/api/datagen/v1/provider/FabricLootTableProvider.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
import com.google.gson.JsonObject;
3131
import org.jetbrains.annotations.ApiStatus;
3232

33-
import net.minecraft.class_8490;
33+
import net.minecraft.loot.LootDataType;
3434
import net.minecraft.data.DataOutput;
3535
import net.minecraft.data.DataProvider;
3636
import net.minecraft.data.DataWriter;
@@ -87,7 +87,7 @@ default CompletableFuture<?> run(DataWriter writer) {
8787
final List<CompletableFuture<?>> futures = new ArrayList<>();
8888

8989
for (Map.Entry<Identifier, LootTable> entry : builders.entrySet()) {
90-
JsonObject tableJson = (JsonObject) class_8490.LOOT_TABLES.method_51203().toJsonTree(entry.getValue());
90+
JsonObject tableJson = (JsonObject) LootDataType.LOOT_TABLES.getGson().toJsonTree(entry.getValue());
9191
ConditionJsonProvider.write(tableJson, conditionMap.remove(entry.getKey()));
9292

9393
futures.add(DataProvider.writeToPath(writer, tableJson, getOutputPath(entry.getKey())));

0 commit comments

Comments
 (0)