diff --git a/deprecated/fabric-events-lifecycle-v0/build.gradle b/deprecated/fabric-events-lifecycle-v0/build.gradle deleted file mode 100644 index 20e1a551dd..0000000000 --- a/deprecated/fabric-events-lifecycle-v0/build.gradle +++ /dev/null @@ -1,7 +0,0 @@ -version = getSubprojectVersion(project) - -moduleDependencies(project, [ - 'fabric-api-base', - 'fabric-item-api-v1', - 'fabric-lifecycle-events-v1' -]) diff --git a/deprecated/fabric-events-lifecycle-v0/src/client/java/net/fabricmc/fabric/api/event/client/ClientTickCallback.java b/deprecated/fabric-events-lifecycle-v0/src/client/java/net/fabricmc/fabric/api/event/client/ClientTickCallback.java deleted file mode 100644 index 575e7efe27..0000000000 --- a/deprecated/fabric-events-lifecycle-v0/src/client/java/net/fabricmc/fabric/api/event/client/ClientTickCallback.java +++ /dev/null @@ -1,42 +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.api.event.client; - -import net.minecraft.client.MinecraftClient; - -import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; -import net.fabricmc.fabric.api.event.Event; -import net.fabricmc.fabric.api.event.EventFactory; - -@Deprecated -public interface ClientTickCallback { - /** - * @deprecated Please use {@link ClientTickEvents#END_CLIENT_TICK}. - */ - @Deprecated - Event EVENT = EventFactory.createArrayBacked(ClientTickCallback.class, - (listeners) -> { - return (client) -> { - for (ClientTickCallback event : listeners) { - event.tick(client); - } - }; - } - ); - - void tick(MinecraftClient client); -} diff --git a/deprecated/fabric-events-lifecycle-v0/src/client/java/net/fabricmc/fabric/api/event/client/ItemTooltipCallback.java b/deprecated/fabric-events-lifecycle-v0/src/client/java/net/fabricmc/fabric/api/event/client/ItemTooltipCallback.java deleted file mode 100644 index f01252953f..0000000000 --- a/deprecated/fabric-events-lifecycle-v0/src/client/java/net/fabricmc/fabric/api/event/client/ItemTooltipCallback.java +++ /dev/null @@ -1,50 +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.api.event.client; - -import java.util.List; - -import net.minecraft.client.item.TooltipContext; -import net.minecraft.item.ItemStack; -import net.minecraft.text.Text; - -import net.fabricmc.fabric.api.event.Event; -import net.fabricmc.fabric.api.event.EventFactory; - -/** - * @deprecated Please use {@link net.fabricmc.fabric.api.client.item.v1.ItemTooltipCallback} - */ -@Deprecated -public interface ItemTooltipCallback { - /** - * Fired after the game has appended all base tooltip lines to the list. - */ - @Deprecated - Event EVENT = EventFactory.createArrayBacked(ItemTooltipCallback.class, (listeners) -> (stack, tooltipContext, lines) -> { - for (ItemTooltipCallback callback : listeners) { - callback.getTooltip(stack, tooltipContext, lines); - } - }); - - /** - * Called when an item stack's tooltip is rendered. Text added to {@code lines} will be - * rendered with the tooltip. - * - * @param lines the list containing the lines of text displayed on the stack's tooltip - */ - void getTooltip(ItemStack stack, TooltipContext tooltipContext, List lines); -} diff --git a/deprecated/fabric-events-lifecycle-v0/src/client/java/net/fabricmc/fabric/impl/event/lifecycle/v0/client/LegacyClientEventInvokers.java b/deprecated/fabric-events-lifecycle-v0/src/client/java/net/fabricmc/fabric/impl/event/lifecycle/v0/client/LegacyClientEventInvokers.java deleted file mode 100644 index 9d5c6548ca..0000000000 --- a/deprecated/fabric-events-lifecycle-v0/src/client/java/net/fabricmc/fabric/impl/event/lifecycle/v0/client/LegacyClientEventInvokers.java +++ /dev/null @@ -1,35 +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.event.lifecycle.v0.client; - -import net.fabricmc.api.ClientModInitializer; -import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; -import net.fabricmc.fabric.api.event.client.ClientTickCallback; -import net.fabricmc.fabric.api.event.client.ItemTooltipCallback; -import net.fabricmc.fabric.api.event.world.WorldTickCallback; - -public class LegacyClientEventInvokers implements ClientModInitializer { - @Override - public void onInitializeClient() { - // Allows deprecated events to still be invoked by the newer implementations - ClientTickEvents.END_CLIENT_TICK.register(client -> ClientTickCallback.EVENT.invoker().tick(client)); - // Tick old events on ClientWorld - ClientTickEvents.END_WORLD_TICK.register(world -> WorldTickCallback.EVENT.invoker().tick(world)); - // This is part of item api now. - net.fabricmc.fabric.api.client.item.v1.ItemTooltipCallback.EVENT.register((stack, context, lines) -> ItemTooltipCallback.EVENT.invoker().getTooltip(stack, context, lines)); - } -} diff --git a/deprecated/fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/api/event/server/ServerStartCallback.java b/deprecated/fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/api/event/server/ServerStartCallback.java deleted file mode 100644 index 45f402f25b..0000000000 --- a/deprecated/fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/api/event/server/ServerStartCallback.java +++ /dev/null @@ -1,39 +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.api.event.server; - -import net.minecraft.server.MinecraftServer; - -import net.fabricmc.fabric.api.event.Event; -import net.fabricmc.fabric.api.event.EventFactory; - -@Deprecated -public interface ServerStartCallback { - /** - * @deprecated Please use {@link net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents#SERVER_STARTED} - */ - @Deprecated - Event EVENT = EventFactory.createArrayBacked(ServerStartCallback.class, - (listeners) -> (server) -> { - for (ServerStartCallback event : listeners) { - event.onStartServer(server); - } - } - ); - - void onStartServer(MinecraftServer server); -} diff --git a/deprecated/fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/api/event/server/ServerStopCallback.java b/deprecated/fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/api/event/server/ServerStopCallback.java deleted file mode 100644 index ff47a1a035..0000000000 --- a/deprecated/fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/api/event/server/ServerStopCallback.java +++ /dev/null @@ -1,39 +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.api.event.server; - -import net.minecraft.server.MinecraftServer; - -import net.fabricmc.fabric.api.event.Event; -import net.fabricmc.fabric.api.event.EventFactory; - -@Deprecated -public interface ServerStopCallback { - /** - * @deprecated Please use {@link net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents#SERVER_STOPPING} - */ - @Deprecated - Event EVENT = EventFactory.createArrayBacked(ServerStopCallback.class, - (listeners) -> (server) -> { - for (ServerStopCallback event : listeners) { - event.onStopServer(server); - } - } - ); - - void onStopServer(MinecraftServer server); -} diff --git a/deprecated/fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/api/event/server/ServerTickCallback.java b/deprecated/fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/api/event/server/ServerTickCallback.java deleted file mode 100644 index 0a2d0c60ef..0000000000 --- a/deprecated/fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/api/event/server/ServerTickCallback.java +++ /dev/null @@ -1,42 +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.api.event.server; - -import net.minecraft.server.MinecraftServer; - -import net.fabricmc.fabric.api.event.Event; -import net.fabricmc.fabric.api.event.EventFactory; -import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents; - -@Deprecated -public interface ServerTickCallback { - /** - * @deprecated Please use {@link ServerTickEvents#END_SERVER_TICK} - */ - @Deprecated - Event EVENT = EventFactory.createArrayBacked(ServerTickCallback.class, - (listeners) -> { - return (server) -> { - for (ServerTickCallback event : listeners) { - event.tick(server); - } - }; - } - ); - - void tick(MinecraftServer server); -} diff --git a/deprecated/fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/api/event/world/WorldTickCallback.java b/deprecated/fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/api/event/world/WorldTickCallback.java deleted file mode 100644 index 3947bec07c..0000000000 --- a/deprecated/fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/api/event/world/WorldTickCallback.java +++ /dev/null @@ -1,43 +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.api.event.world; - -import net.minecraft.world.World; - -import net.fabricmc.fabric.api.event.Event; -import net.fabricmc.fabric.api.event.EventFactory; -import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents; - -@Deprecated -public interface WorldTickCallback { - /** - * @deprecated The new WorldTickCallback has been split into a client and server callback. - * Please use the {@link ServerTickEvents#END_WORLD_TICK server} or {@link net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents#END_WORLD_TICK client} callbacks. - */ - @Deprecated - Event EVENT = EventFactory.createArrayBacked(WorldTickCallback.class, - (listeners) -> { - return (world) -> { - for (WorldTickCallback event : listeners) { - event.tick(world); - } - }; - } - ); - - void tick(World world); -} diff --git a/deprecated/fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/impl/event/lifecycle/v0/LegacyEventInvokers.java b/deprecated/fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/impl/event/lifecycle/v0/LegacyEventInvokers.java deleted file mode 100644 index 9fbc0a6f9a..0000000000 --- a/deprecated/fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/impl/event/lifecycle/v0/LegacyEventInvokers.java +++ /dev/null @@ -1,37 +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.event.lifecycle.v0; - -import net.fabricmc.api.ModInitializer; -import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents; -import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents; -import net.fabricmc.fabric.api.event.server.ServerStartCallback; -import net.fabricmc.fabric.api.event.server.ServerStopCallback; -import net.fabricmc.fabric.api.event.server.ServerTickCallback; -import net.fabricmc.fabric.api.event.world.WorldTickCallback; - -public class LegacyEventInvokers implements ModInitializer { - @Override - public void onInitialize() { - // Allows deprecated events to still be invoked by the newer implementations - ServerLifecycleEvents.SERVER_STARTED.register(server -> ServerStartCallback.EVENT.invoker().onStartServer(server)); - ServerLifecycleEvents.SERVER_STOPPING.register(server -> ServerStopCallback.EVENT.invoker().onStopServer(server)); - ServerTickEvents.END_SERVER_TICK.register(server -> ServerTickCallback.EVENT.invoker().tick(server)); - // Tick old events on ServerWorld - ServerTickEvents.END_WORLD_TICK.register(world -> WorldTickCallback.EVENT.invoker().tick(world)); - } -} diff --git a/deprecated/fabric-events-lifecycle-v0/src/main/resources/assets/fabric-events-lifecycle-v0/icon.png b/deprecated/fabric-events-lifecycle-v0/src/main/resources/assets/fabric-events-lifecycle-v0/icon.png deleted file mode 100644 index 2931efbf61..0000000000 Binary files a/deprecated/fabric-events-lifecycle-v0/src/main/resources/assets/fabric-events-lifecycle-v0/icon.png and /dev/null differ diff --git a/deprecated/fabric-events-lifecycle-v0/src/main/resources/fabric.mod.json b/deprecated/fabric-events-lifecycle-v0/src/main/resources/fabric.mod.json deleted file mode 100644 index e66e61f7c8..0000000000 --- a/deprecated/fabric-events-lifecycle-v0/src/main/resources/fabric.mod.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "schemaVersion": 1, - "id": "fabric-events-lifecycle-v0", - "name": "Fabric Events Lifecycle (v0)", - "version": "${version}", - "environment": "*", - "license": "Apache-2.0", - "icon": "assets/fabric-events-lifecycle-v0/icon.png", - "contact": { - "homepage": "https://fabricmc.net", - "irc": "irc://irc.esper.net:6667/fabric", - "issues": "https://github.com/FabricMC/fabric/issues", - "sources": "https://github.com/FabricMC/fabric" - }, - "authors": [ - "FabricMC" - ], - "entrypoints": { - "main": [ - "net.fabricmc.fabric.impl.event.lifecycle.v0.LegacyEventInvokers" - ], - "client": [ - "net.fabricmc.fabric.impl.event.lifecycle.v0.client.LegacyClientEventInvokers" - ] - }, - "depends": { - "fabricloader": ">=0.15.6", - "fabric-api-base": "*", - "fabric-item-api-v1": "*", - "fabric-lifecycle-events-v1": "*" - }, - "description": "Legacy events for the game's lifecycle, superseded by fabric-lifecycle-events-v1 and fabric-item-api-v1.", - "custom": { - "fabric-api:module-lifecycle": "deprecated" - } -} diff --git a/deprecated/fabric-events-lifecycle-v0/src/testmod/java/net/fabricmc/fabric/test/event/lifecycle/legacy/LegacyLifecycleEventsTest.java b/deprecated/fabric-events-lifecycle-v0/src/testmod/java/net/fabricmc/fabric/test/event/lifecycle/legacy/LegacyLifecycleEventsTest.java deleted file mode 100644 index 40cdd489c0..0000000000 --- a/deprecated/fabric-events-lifecycle-v0/src/testmod/java/net/fabricmc/fabric/test/event/lifecycle/legacy/LegacyLifecycleEventsTest.java +++ /dev/null @@ -1,64 +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.test.event.lifecycle.legacy; - -import java.util.HashMap; -import java.util.Map; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import net.minecraft.registry.RegistryKey; -import net.minecraft.world.World; - -import net.fabricmc.api.ModInitializer; -import net.fabricmc.fabric.api.event.server.ServerStartCallback; -import net.fabricmc.fabric.api.event.server.ServerStopCallback; -import net.fabricmc.fabric.api.event.server.ServerTickCallback; -import net.fabricmc.fabric.api.event.world.WorldTickCallback; - -public class LegacyLifecycleEventsTest implements ModInitializer { - public static final Logger LOGGER = LoggerFactory.getLogger("LegacyLifecycleEventsTest"); - private Map, Integer> tickTracker = new HashMap<>(); - - @Override - public void onInitialize() { - ServerTickCallback.EVENT.register(server -> { - if (server.getTicks() % 200 == 0) { // Log every 200 ticks to verify the tick callback works on the server - LOGGER.info("Ticked Server at " + server.getTicks() + " ticks. (Legacy)"); - } - }); - - ServerStartCallback.EVENT.register(server -> { - LOGGER.info("Started Server! (Legacy)"); - }); - - ServerStopCallback.EVENT.register(server -> { - LOGGER.info("Stopping Server! (Legacy)"); - }); - - WorldTickCallback.EVENT.register(world -> { - final int worldTicks = tickTracker.computeIfAbsent(world.getRegistryKey(), k -> 0); - - if (worldTicks % 200 == 0) { // Log every 200 ticks to verify the tick callback works on the server world - LOGGER.info("[LEGACY] Ticked World " + world.getRegistryKey().getValue() + " - " + worldTicks + " ticks: " + world.getClass().getName()); - } - - this.tickTracker.put(world.getRegistryKey(), worldTicks + 1); - }); - } -} diff --git a/deprecated/fabric-events-lifecycle-v0/src/testmod/resources/fabric.mod.json b/deprecated/fabric-events-lifecycle-v0/src/testmod/resources/fabric.mod.json deleted file mode 100644 index c989750513..0000000000 --- a/deprecated/fabric-events-lifecycle-v0/src/testmod/resources/fabric.mod.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "schemaVersion": 1, - "id": "fabric-events-lifecycle-v0-testmod", - "name": "Fabric Events Lifecycle (v0) Test Mod", - "version": "1.0.0", - "environment": "*", - "license": "Apache-2.0", - "depends": { - "fabric-events-lifecycle-v0": "*" - }, - "entrypoints": { - "main": [ - "net.fabricmc.fabric.test.event.lifecycle.legacy.LegacyLifecycleEventsTest" - ], - "client": [ - "net.fabricmc.fabric.test.event.lifecycle.legacy.client.LegacyClientLifecycleEventsTest" - ] - } -} diff --git a/deprecated/fabric-events-lifecycle-v0/src/testmodClient/java/net/fabricmc/fabric/test/event/lifecycle/legacy/client/LegacyClientLifecycleEventsTest.java b/deprecated/fabric-events-lifecycle-v0/src/testmodClient/java/net/fabricmc/fabric/test/event/lifecycle/legacy/client/LegacyClientLifecycleEventsTest.java deleted file mode 100644 index 71391cce9e..0000000000 --- a/deprecated/fabric-events-lifecycle-v0/src/testmodClient/java/net/fabricmc/fabric/test/event/lifecycle/legacy/client/LegacyClientLifecycleEventsTest.java +++ /dev/null @@ -1,43 +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.test.event.lifecycle.legacy.client; - -import net.minecraft.text.Text; - -import net.fabricmc.api.ClientModInitializer; -import net.fabricmc.fabric.api.event.client.ClientTickCallback; -import net.fabricmc.fabric.api.event.client.ItemTooltipCallback; -import net.fabricmc.fabric.test.event.lifecycle.legacy.LegacyLifecycleEventsTest; - -public class LegacyClientLifecycleEventsTest implements ClientModInitializer { - private int ticks; - - @Override - public void onInitializeClient() { - ClientTickCallback.EVENT.register(client -> { - this.ticks++; // Just track our own tick since the client doesn't have a ticks value. - - if (this.ticks % 200 == 0) { - LegacyLifecycleEventsTest.LOGGER.info("Ticked Client at " + this.ticks + " ticks. (Legacy)"); - } - }); - - ItemTooltipCallback.EVENT.register((stack, context, lines) -> { - lines.add(Text.literal("A Legacy Tooltip")); - }); - } -} diff --git a/fabric-content-registries-v0/src/main/java/net/fabricmc/fabric/api/registry/BrewingRecipeRegistryBuilderCallback.java b/fabric-content-registries-v0/src/main/java/net/fabricmc/fabric/api/registry/BrewingRecipeRegistryBuilderCallback.java new file mode 100644 index 0000000000..f167a77006 --- /dev/null +++ b/fabric-content-registries-v0/src/main/java/net/fabricmc/fabric/api/registry/BrewingRecipeRegistryBuilderCallback.java @@ -0,0 +1,43 @@ +/* + * 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.api.registry; + +import net.minecraft.recipe.BrewingRecipeRegistry; + +import net.fabricmc.fabric.api.event.Event; +import net.fabricmc.fabric.api.event.EventFactory; + +/** + * Use this event to register custom brewing recipes. + */ +public interface BrewingRecipeRegistryBuilderCallback { + /** + * An event that is called when the brewing recipe registry is being built. + */ + Event BUILD = EventFactory.createArrayBacked(BrewingRecipeRegistryBuilderCallback.class, listeners -> builder -> { + for (BrewingRecipeRegistryBuilderCallback listener : listeners) { + listener.build(builder); + } + }); + + /** + * Called when the brewing recipe registry is being built. + * + * @param builder the {@link BrewingRecipeRegistry} instance + */ + void build(BrewingRecipeRegistry.class_9665 builder); +} diff --git a/fabric-content-registries-v0/src/main/java/net/fabricmc/fabric/api/registry/FabricBrewingRecipeRegistry.java b/fabric-content-registries-v0/src/main/java/net/fabricmc/fabric/api/registry/FabricBrewingRecipeRegistry.java deleted file mode 100644 index 3bffe284ff..0000000000 --- a/fabric-content-registries-v0/src/main/java/net/fabricmc/fabric/api/registry/FabricBrewingRecipeRegistry.java +++ /dev/null @@ -1,68 +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.api.registry; - -import java.util.Objects; - -import net.minecraft.item.Item; -import net.minecraft.item.PotionItem; -import net.minecraft.potion.Potion; -import net.minecraft.recipe.BrewingRecipeRegistry; -import net.minecraft.recipe.Ingredient; -import net.minecraft.registry.entry.RegistryEntry; - -/** - * Counterpart of {@link BrewingRecipeRegistry} with methods that allow adding recipes which use Ingredients instead of Items. - */ -public final class FabricBrewingRecipeRegistry { - private FabricBrewingRecipeRegistry() { - } - - /** - * Register a recipe for brewing one potion type into another (e.g. regular to splash). - * Only one recipe is necessary for all potions of the input type to be brewable into the output type using the ingredient. - * Use {@link BrewingRecipeRegistry#registerPotionType(Item)} to register new potion types. - * @param input the input potion type (e.g. regular potion) - * @param ingredient the required ingredient (e.g. gunpowder) - * @param output the output type (e.g. splash potion) - * @see BrewingRecipeRegistry#registerItemRecipe(Item, Item, Item) - */ - public static void registerItemRecipe(PotionItem input, Ingredient ingredient, PotionItem output) { - Objects.requireNonNull(input, "Input cannot be null!"); - Objects.requireNonNull(ingredient, "Ingredient cannot be null!"); - Objects.requireNonNull(output, "Output cannot be null!"); - - BrewingRecipeRegistry.ITEM_RECIPES.add(new BrewingRecipeRegistry.Recipe<>(input.getRegistryEntry(), ingredient, output.getRegistryEntry())); - } - - /** - * Register a recipe for converting from one potion to another (e.g. awkward to instant health). - * This does not automatically create long or strong versions of the output potion. - * They require separate recipes. - * @param input input potion (e.g. awkward) - * @param ingredient the required ingredient (e.g. glistering melon) - * @param output output potion (e.g. instant health) - * @see BrewingRecipeRegistry#registerPotionRecipe(RegistryEntry, Item, RegistryEntry) - */ - public static void registerPotionRecipe(RegistryEntry input, Ingredient ingredient, RegistryEntry output) { - Objects.requireNonNull(input, "Input cannot be null!"); - Objects.requireNonNull(ingredient, "Ingredient cannot be null!"); - Objects.requireNonNull(output, "Output cannot be null"); - - BrewingRecipeRegistry.POTION_RECIPES.add(new BrewingRecipeRegistry.Recipe<>(input, ingredient, output)); - } -} diff --git a/fabric-content-registries-v0/src/testmod/java/net/fabricmc/fabric/test/mixin/content/registry/BrewingRecipeRegistryAccessor.java b/fabric-content-registries-v0/src/main/java/net/fabricmc/fabric/mixin/content/registry/BrewingRecipeRegistryBuilderMixin.java similarity index 52% rename from fabric-content-registries-v0/src/testmod/java/net/fabricmc/fabric/test/mixin/content/registry/BrewingRecipeRegistryAccessor.java rename to fabric-content-registries-v0/src/main/java/net/fabricmc/fabric/mixin/content/registry/BrewingRecipeRegistryBuilderMixin.java index b63342129a..cf5c0f0c46 100644 --- a/fabric-content-registries-v0/src/testmod/java/net/fabricmc/fabric/test/mixin/content/registry/BrewingRecipeRegistryAccessor.java +++ b/fabric-content-registries-v0/src/main/java/net/fabricmc/fabric/mixin/content/registry/BrewingRecipeRegistryBuilderMixin.java @@ -14,22 +14,21 @@ * limitations under the License. */ -package net.fabricmc.fabric.test.mixin.content.registry; +package net.fabricmc.fabric.mixin.content.registry; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Invoker; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import net.minecraft.item.Item; import net.minecraft.recipe.BrewingRecipeRegistry; -@Mixin(BrewingRecipeRegistry.class) -public interface BrewingRecipeRegistryAccessor { - /* Required for the testmod - * The TAW cannot be used due to current limitations of Loom - * TODO review when upgrading to Loom 1.1 - */ - @Invoker("registerPotionType") - static void callRegisterPotionType(Item item) { - throw new AssertionError("Untransformed @Invoker"); +import net.fabricmc.fabric.api.registry.BrewingRecipeRegistryBuilderCallback; + +@Mixin(BrewingRecipeRegistry.class_9665.class) +public class BrewingRecipeRegistryBuilderMixin { + @Inject(method = "method_59701", at = @At("HEAD")) + private void build(CallbackInfoReturnable cir) { + BrewingRecipeRegistryBuilderCallback.BUILD.invoker().build((BrewingRecipeRegistry.class_9665) (Object) this); } } diff --git a/fabric-content-registries-v0/src/main/resources/fabric-content-registries-v0.accesswidener b/fabric-content-registries-v0/src/main/resources/fabric-content-registries-v0.accesswidener index dd3f409040..b43be0dc0a 100644 --- a/fabric-content-registries-v0/src/main/resources/fabric-content-registries-v0.accesswidener +++ b/fabric-content-registries-v0/src/main/resources/fabric-content-registries-v0.accesswidener @@ -4,5 +4,3 @@ accessible method net/minecraft/block/entity/AbstractFurnaceBlockEntity addFuel accessible method net/minecraft/block/entity/AbstractFurnaceBlockEntity addFuel (Ljava/util/Map;Lnet/minecraft/item/ItemConvertible;I)V accessible method net/minecraft/recipe/BrewingRecipeRegistry$Recipe (Lnet/minecraft/registry/entry/RegistryEntry;Lnet/minecraft/recipe/Ingredient;Lnet/minecraft/registry/entry/RegistryEntry;)V -accessible field net/minecraft/recipe/BrewingRecipeRegistry POTION_RECIPES Ljava/util/List; -accessible field net/minecraft/recipe/BrewingRecipeRegistry ITEM_RECIPES Ljava/util/List; diff --git a/fabric-content-registries-v0/src/main/resources/fabric-content-registries-v0.mixins.json b/fabric-content-registries-v0/src/main/resources/fabric-content-registries-v0.mixins.json index 7399012463..93595dda42 100644 --- a/fabric-content-registries-v0/src/main/resources/fabric-content-registries-v0.mixins.json +++ b/fabric-content-registries-v0/src/main/resources/fabric-content-registries-v0.mixins.json @@ -4,6 +4,7 @@ "compatibilityLevel": "JAVA_17", "mixins": [ "AxeItemAccessor", + "BrewingRecipeRegistryBuilderMixin", "PathContextMixin", "FarmerWorkTaskAccessor", "GiveGiftsToHeroTaskAccessor", diff --git a/fabric-content-registries-v0/src/testmod/java/net/fabricmc/fabric/test/content/registry/ContentRegistryTest.java b/fabric-content-registries-v0/src/testmod/java/net/fabricmc/fabric/test/content/registry/ContentRegistryTest.java index 4930899472..b42c7772e1 100644 --- a/fabric-content-registries-v0/src/testmod/java/net/fabricmc/fabric/test/content/registry/ContentRegistryTest.java +++ b/fabric-content-registries-v0/src/testmod/java/net/fabricmc/fabric/test/content/registry/ContentRegistryTest.java @@ -30,8 +30,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.item.PotionItem; -import net.minecraft.potion.Potions; -import net.minecraft.recipe.Ingredient; import net.minecraft.registry.Registries; import net.minecraft.registry.Registry; import net.minecraft.registry.RegistryKey; @@ -49,8 +47,8 @@ import net.minecraft.world.event.GameEvent; import net.fabricmc.api.ModInitializer; +import net.fabricmc.fabric.api.registry.BrewingRecipeRegistryBuilderCallback; import net.fabricmc.fabric.api.registry.CompostingChanceRegistry; -import net.fabricmc.fabric.api.registry.FabricBrewingRecipeRegistry; import net.fabricmc.fabric.api.registry.FlammableBlockRegistry; import net.fabricmc.fabric.api.registry.FlattenableBlockRegistry; import net.fabricmc.fabric.api.registry.FuelRegistry; @@ -60,7 +58,6 @@ import net.fabricmc.fabric.api.registry.StrippableBlockRegistry; import net.fabricmc.fabric.api.registry.TillableBlockRegistry; import net.fabricmc.fabric.api.registry.VillagerInteractionRegistries; -import net.fabricmc.fabric.test.mixin.content.registry.BrewingRecipeRegistryAccessor; public final class ContentRegistryTest implements ModInitializer { public static final Logger LOGGER = LoggerFactory.getLogger(ContentRegistryTest.class); @@ -154,14 +151,17 @@ public void onInitialize() { LOGGER.info("SculkSensorFrequencyRegistry test passed!"); } - FabricBrewingRecipeRegistry.registerPotionRecipe(Potions.AWKWARD, Ingredient.fromTag(ItemTags.SMALL_FLOWERS), Potions.HEALING); var dirtyPotion = new DirtyPotionItem(new Item.Settings().maxCount(1)); Registry.register(Registries.ITEM, new Identifier("fabric-content-registries-v0-testmod", "dirty_potion"), dirtyPotion); /* Mods should use BrewingRecipeRegistry.registerPotionType(Item), which is access widened by fabric-transitive-access-wideners-v1 * This testmod uses an accessor due to Loom limitations that prevent TAWs from applying across Gradle subproject boundaries */ - BrewingRecipeRegistryAccessor.callRegisterPotionType(dirtyPotion); - FabricBrewingRecipeRegistry.registerItemRecipe((PotionItem) Items.POTION, Ingredient.fromTag(ItemTags.DIRT), dirtyPotion); + BrewingRecipeRegistryBuilderCallback.BUILD.register(builder -> { + builder.method_59702(dirtyPotion); + // TODO 1.20.5 Ingredient.fromTag(ItemTags.DIRT) + builder.method_59703(Items.POTION, Items.DIRT, dirtyPotion); + // registerPotionRecipe(Potions.AWKWARD, Ingredient.fromTag(ItemTags.SMALL_FLOWERS), Potions.HEALING); + }); } public static class TestEventBlock extends Block { diff --git a/fabric-content-registries-v0/src/testmod/resources/fabric-content-registries-v0-testmod.mixins.json b/fabric-content-registries-v0/src/testmod/resources/fabric-content-registries-v0-testmod.mixins.json index 563de96636..ad31e080bd 100644 --- a/fabric-content-registries-v0/src/testmod/resources/fabric-content-registries-v0-testmod.mixins.json +++ b/fabric-content-registries-v0/src/testmod/resources/fabric-content-registries-v0-testmod.mixins.json @@ -3,7 +3,6 @@ "package": "net.fabricmc.fabric.test.mixin.content.registry", "compatibilityLevel": "JAVA_17", "mixins": [ - "BrewingRecipeRegistryAccessor" ], "injectors": { "defaultRequire": 1 diff --git a/fabric-item-api-v1/src/client/java/net/fabricmc/fabric/api/client/item/v1/ItemTooltipCallback.java b/fabric-item-api-v1/src/client/java/net/fabricmc/fabric/api/client/item/v1/ItemTooltipCallback.java index 137b04a87a..b5f6b41fca 100644 --- a/fabric-item-api-v1/src/client/java/net/fabricmc/fabric/api/client/item/v1/ItemTooltipCallback.java +++ b/fabric-item-api-v1/src/client/java/net/fabricmc/fabric/api/client/item/v1/ItemTooltipCallback.java @@ -18,7 +18,8 @@ import java.util.List; -import net.minecraft.client.item.TooltipContext; +import net.minecraft.client.item.TooltipType; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.text.Text; @@ -29,9 +30,9 @@ public interface ItemTooltipCallback { /** * Fired after the game has appended all base tooltip lines to the list. */ - Event EVENT = EventFactory.createArrayBacked(ItemTooltipCallback.class, callbacks -> (stack, context, lines) -> { + Event EVENT = EventFactory.createArrayBacked(ItemTooltipCallback.class, callbacks -> (stack, context, type, lines) -> { for (ItemTooltipCallback callback : callbacks) { - callback.getTooltip(stack, context, lines); + callback.getTooltip(stack, context, type, lines); } }); @@ -41,5 +42,5 @@ public interface ItemTooltipCallback { * * @param lines the list containing the lines of text displayed on the stack's tooltip */ - void getTooltip(ItemStack stack, TooltipContext context, List lines); + void getTooltip(ItemStack stack, Item.TooltipContext tooltipContext, TooltipType tooltipType, List lines); } diff --git a/fabric-item-api-v1/src/client/java/net/fabricmc/fabric/mixin/item/client/ItemStackMixin.java b/fabric-item-api-v1/src/client/java/net/fabricmc/fabric/mixin/item/client/ItemStackMixin.java index 0140977864..0de9fcf650 100644 --- a/fabric-item-api-v1/src/client/java/net/fabricmc/fabric/mixin/item/client/ItemStackMixin.java +++ b/fabric-item-api-v1/src/client/java/net/fabricmc/fabric/mixin/item/client/ItemStackMixin.java @@ -24,7 +24,7 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import net.minecraft.client.item.TooltipContext; +import net.minecraft.client.item.TooltipType; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -35,7 +35,7 @@ @Mixin(ItemStack.class) public abstract class ItemStackMixin { @Inject(method = "getTooltip", at = @At("RETURN")) - private void getTooltip(Item.class_9635 arg, @Nullable PlayerEntity entity, TooltipContext tooltipContext, CallbackInfoReturnable> info) { - ItemTooltipCallback.EVENT.invoker().getTooltip((ItemStack) (Object) this, tooltipContext, info.getReturnValue()); + private void getTooltip(Item.TooltipContext tooltipContext, @Nullable PlayerEntity entity, TooltipType tooltipType, CallbackInfoReturnable> info) { + ItemTooltipCallback.EVENT.invoker().getTooltip((ItemStack) (Object) this, tooltipContext, tooltipType, info.getReturnValue()); } } diff --git a/fabric-item-api-v1/src/main/java/net/fabricmc/fabric/mixin/item/BrewingStandBlockEntityMixin.java b/fabric-item-api-v1/src/main/java/net/fabricmc/fabric/mixin/item/BrewingStandBlockEntityMixin.java index c397ad1fec..81a2e15d53 100644 --- a/fabric-item-api-v1/src/main/java/net/fabricmc/fabric/mixin/item/BrewingStandBlockEntityMixin.java +++ b/fabric-item-api-v1/src/main/java/net/fabricmc/fabric/mixin/item/BrewingStandBlockEntityMixin.java @@ -16,17 +16,19 @@ package net.fabricmc.fabric.mixin.item; +import com.llamalad7.mixinextras.injector.wrapoperation.Operation; +import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.ModifyVariable; import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.LocalCapture; import net.minecraft.block.entity.BrewingStandBlockEntity; import net.minecraft.item.Item; +import net.minecraft.item.ItemConvertible; import net.minecraft.item.ItemStack; import net.minecraft.util.collection.DefaultedList; import net.minecraft.util.math.BlockPos; @@ -50,8 +52,8 @@ private static boolean hasStackRecipeRemainder(Item instance) { /** * Injected after the {@link Item#getRecipeRemainder} to replace the old remainder with are new one. */ - @ModifyVariable(method = "craft", at = @At(value = "STORE"), index = 4) - private static ItemStack createStackRecipeRemainder(ItemStack old) { + @WrapOperation(method = "craft", at = @At(value = "NEW", target = "(Lnet/minecraft/item/ItemConvertible;)Lnet/minecraft/item/ItemStack;")) + private static ItemStack createStackRecipeRemainder(ItemConvertible item, Operation original) { ItemStack remainder = REMAINDER_STACK.get(); REMAINDER_STACK.remove(); return remainder; diff --git a/fabric-item-api-v1/src/testmod/java/net/fabricmc/fabric/test/item/CustomDamageTest.java b/fabric-item-api-v1/src/testmod/java/net/fabricmc/fabric/test/item/CustomDamageTest.java index e72fe4392f..1db6a5253a 100644 --- a/fabric-item-api-v1/src/testmod/java/net/fabricmc/fabric/test/item/CustomDamageTest.java +++ b/fabric-item-api-v1/src/testmod/java/net/fabricmc/fabric/test/item/CustomDamageTest.java @@ -22,8 +22,6 @@ import net.minecraft.item.PickaxeItem; import net.minecraft.item.ToolMaterials; import net.minecraft.network.codec.PacketCodecs; -import net.minecraft.potion.Potions; -import net.minecraft.recipe.Ingredient; import net.minecraft.registry.Registries; import net.minecraft.registry.Registry; import net.minecraft.text.Text; @@ -32,7 +30,6 @@ import net.fabricmc.api.ModInitializer; import net.fabricmc.fabric.api.item.v1.CustomDamageHandler; -import net.fabricmc.fabric.api.registry.FabricBrewingRecipeRegistry; import net.fabricmc.fabric.api.registry.FuelRegistry; public class CustomDamageTest implements ModInitializer { @@ -44,7 +41,8 @@ public class CustomDamageTest implements ModInitializer { public void onInitialize() { Registry.register(Registries.ITEM, new Identifier("fabric-item-api-v1-testmod", "weird_pickaxe"), WEIRD_PICK); FuelRegistry.INSTANCE.add(WEIRD_PICK, 200); - FabricBrewingRecipeRegistry.registerPotionRecipe(Potions.WATER, Ingredient.ofItems(WEIRD_PICK), Potions.AWKWARD); + // TODO 1.20.5 + // FabricBrewingRecipeRegistry.registerPotionRecipe(Potions.WATER, Ingredient.ofItems(WEIRD_PICK), Potions.AWKWARD); } public static final CustomDamageHandler WEIRD_DAMAGE_HANDLER = (stack, amount, entity, slot, breakCallback) -> { diff --git a/fabric-item-api-v1/src/testmodClient/java/net/fabricmc/fabric/test/item/client/TooltipTests.java b/fabric-item-api-v1/src/testmodClient/java/net/fabricmc/fabric/test/item/client/TooltipTests.java index a007a4debb..3f061f5b4a 100644 --- a/fabric-item-api-v1/src/testmodClient/java/net/fabricmc/fabric/test/item/client/TooltipTests.java +++ b/fabric-item-api-v1/src/testmodClient/java/net/fabricmc/fabric/test/item/client/TooltipTests.java @@ -26,7 +26,7 @@ public class TooltipTests implements ClientModInitializer { @Override public void onInitializeClient() { // Adds a tooltip to all items so testing can be verified easily. - ItemTooltipCallback.EVENT.register((stack, context, lines) -> { + ItemTooltipCallback.EVENT.register((stack, context, type, lines) -> { lines.add(Text.literal("Fancy Tooltips").formatted(Formatting.LIGHT_PURPLE)); }); } diff --git a/fabric-resource-conditions-api-v1/src/main/java/net/fabricmc/fabric/mixin/resource/conditions/DataPackContentsMixin.java b/fabric-resource-conditions-api-v1/src/main/java/net/fabricmc/fabric/mixin/resource/conditions/DataPackContentsMixin.java index bc13236eda..bf7d0dcd2c 100644 --- a/fabric-resource-conditions-api-v1/src/main/java/net/fabricmc/fabric/mixin/resource/conditions/DataPackContentsMixin.java +++ b/fabric-resource-conditions-api-v1/src/main/java/net/fabricmc/fabric/mixin/resource/conditions/DataPackContentsMixin.java @@ -28,7 +28,6 @@ import net.minecraft.registry.CombinedDynamicRegistries; import net.minecraft.registry.ServerDynamicRegistryType; import net.minecraft.resource.ResourceManager; -import net.minecraft.resource.featuretoggle.FeatureFlags; import net.minecraft.resource.featuretoggle.FeatureSet; import net.minecraft.server.DataPackContents; import net.minecraft.server.command.CommandManager; @@ -50,7 +49,6 @@ private void hookRefresh(CallbackInfo ci) { at = @At("HEAD") ) private static void hookReload(ResourceManager manager, CombinedDynamicRegistries combinedDynamicRegistries, FeatureSet enabledFeatures, CommandManager.RegistrationEnvironment environment, int functionPermissionLevel, Executor prepareExecutor, Executor applyExecutor, CallbackInfoReturnable> cir) { - System.out.println("Enabling " + FeatureFlags.FEATURE_MANAGER.toId(enabledFeatures)); ResourceConditionsImpl.currentFeatures = enabledFeatures; } } diff --git a/fabric-transfer-api-v1/src/client/java/net/fabricmc/fabric/api/transfer/v1/client/fluid/FluidVariantRenderHandler.java b/fabric-transfer-api-v1/src/client/java/net/fabricmc/fabric/api/transfer/v1/client/fluid/FluidVariantRenderHandler.java index 7649c3122d..0690a98748 100644 --- a/fabric-transfer-api-v1/src/client/java/net/fabricmc/fabric/api/transfer/v1/client/fluid/FluidVariantRenderHandler.java +++ b/fabric-transfer-api-v1/src/client/java/net/fabricmc/fabric/api/transfer/v1/client/fluid/FluidVariantRenderHandler.java @@ -20,7 +20,7 @@ import org.jetbrains.annotations.Nullable; -import net.minecraft.client.item.TooltipContext; +import net.minecraft.client.item.TooltipType; import net.minecraft.client.texture.Sprite; import net.minecraft.text.Text; import net.minecraft.util.math.BlockPos; @@ -41,7 +41,7 @@ public interface FluidVariantRenderHandler { *

The name of the fluid, and its identifier if the tooltip context is advanced, should not be appended. * They are already added by {@link FluidVariantRendering#getTooltip}. */ - default void appendTooltip(FluidVariant fluidVariant, List tooltip, TooltipContext tooltipContext) { + default void appendTooltip(FluidVariant fluidVariant, List tooltip, TooltipType tooltipType) { } /** diff --git a/fabric-transfer-api-v1/src/client/java/net/fabricmc/fabric/api/transfer/v1/client/fluid/FluidVariantRendering.java b/fabric-transfer-api-v1/src/client/java/net/fabricmc/fabric/api/transfer/v1/client/fluid/FluidVariantRendering.java index edf9a907e2..90ab41edd5 100644 --- a/fabric-transfer-api-v1/src/client/java/net/fabricmc/fabric/api/transfer/v1/client/fluid/FluidVariantRendering.java +++ b/fabric-transfer-api-v1/src/client/java/net/fabricmc/fabric/api/transfer/v1/client/fluid/FluidVariantRendering.java @@ -23,7 +23,7 @@ import org.jetbrains.annotations.Nullable; import net.minecraft.client.MinecraftClient; -import net.minecraft.client.item.TooltipContext; +import net.minecraft.client.item.TooltipType; import net.minecraft.client.texture.Sprite; import net.minecraft.fluid.Fluid; import net.minecraft.registry.Registries; @@ -75,27 +75,27 @@ public static FluidVariantRenderHandler getHandlerOrDefault(Fluid fluid) { * Return a mutable list: the tooltip for the passed fluid variant, including the name and additional lines if available * and the id of the fluid if advanced tooltips are enabled. * - *

Compared to {@linkplain #getTooltip(FluidVariant, TooltipContext) the other overload}, the current tooltip context is automatically used. + *

Compared to {@linkplain #getTooltip(FluidVariant, TooltipType) the other overload}, the current tooltip context is automatically used. */ public static List getTooltip(FluidVariant fluidVariant) { - return getTooltip(fluidVariant, MinecraftClient.getInstance().options.advancedItemTooltips ? TooltipContext.Default.ADVANCED : TooltipContext.Default.BASIC); + return getTooltip(fluidVariant, MinecraftClient.getInstance().options.advancedItemTooltips ? TooltipType.Default.ADVANCED : TooltipType.Default.BASIC); } /** * Return a mutable list: the tooltip for the passed fluid variant, including the name and additional lines if available * and the id of the fluid if advanced tooltips are enabled. */ - public static List getTooltip(FluidVariant fluidVariant, TooltipContext context) { + public static List getTooltip(FluidVariant fluidVariant, TooltipType type) { List tooltip = new ArrayList<>(); // Name first tooltip.add(FluidVariantAttributes.getName(fluidVariant)); // Additional tooltip information - getHandlerOrDefault(fluidVariant.getFluid()).appendTooltip(fluidVariant, tooltip, context); + getHandlerOrDefault(fluidVariant.getFluid()).appendTooltip(fluidVariant, tooltip, type); // If advanced tooltips are enabled, render the fluid id - if (context.isAdvanced()) { + if (type.isAdvanced()) { tooltip.add(Text.literal(Registries.FLUID.getId(fluidVariant.getFluid()).toString()).formatted(Formatting.DARK_GRAY)); } diff --git a/fabric-transitive-access-wideners-v1/src/main/resources/fabric-transitive-access-wideners-v1.accesswidener b/fabric-transitive-access-wideners-v1/src/main/resources/fabric-transitive-access-wideners-v1.accesswidener index 30d2345eaf..5d132bde7e 100644 --- a/fabric-transitive-access-wideners-v1/src/main/resources/fabric-transitive-access-wideners-v1.accesswidener +++ b/fabric-transitive-access-wideners-v1/src/main/resources/fabric-transitive-access-wideners-v1.accesswidener @@ -46,11 +46,6 @@ transitive-accessible method net/minecraft/entity/SpawnRestriction register (Lne transitive-accessible method net/minecraft/item/ItemUsageContext (Lnet/minecraft/world/World;Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/util/Hand;Lnet/minecraft/item/ItemStack;Lnet/minecraft/util/hit/BlockHitResult;)V transitive-accessible method net/minecraft/item/ItemPlacementContext (Lnet/minecraft/world/World;Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/util/Hand;Lnet/minecraft/item/ItemStack;Lnet/minecraft/util/hit/BlockHitResult;)V -# Registering custom brewing recipes -transitive-accessible method net/minecraft/recipe/BrewingRecipeRegistry registerItemRecipe (Lnet/minecraft/item/Item;Lnet/minecraft/item/Item;Lnet/minecraft/item/Item;)V -transitive-accessible method net/minecraft/recipe/BrewingRecipeRegistry registerPotionType (Lnet/minecraft/item/Item;)V -transitive-accessible method net/minecraft/recipe/BrewingRecipeRegistry registerPotionRecipe (Lnet/minecraft/registry/entry/RegistryEntry;Lnet/minecraft/item/Item;Lnet/minecraft/registry/entry/RegistryEntry;)V - # Registering custom scoreboard criteria transitive-accessible method net/minecraft/scoreboard/ScoreboardCriterion create (Ljava/lang/String;ZLnet/minecraft/scoreboard/ScoreboardCriterion$RenderType;)Lnet/minecraft/scoreboard/ScoreboardCriterion; transitive-accessible method net/minecraft/scoreboard/ScoreboardCriterion create (Ljava/lang/String;)Lnet/minecraft/scoreboard/ScoreboardCriterion; @@ -228,14 +223,14 @@ transitive-accessible method net/minecraft/block/StemBlock (Lnet/minecraf transitive-accessible method net/minecraft/block/StructureBlock (Lnet/minecraft/block/AbstractBlock$Settings;)V transitive-accessible method net/minecraft/block/StructureVoidBlock (Lnet/minecraft/block/AbstractBlock$Settings;)V transitive-accessible method net/minecraft/block/SugarCaneBlock (Lnet/minecraft/block/AbstractBlock$Settings;)V -transitive-accessible method net/minecraft/block/TorchBlock (Lnet/minecraft/particle/DefaultParticleType;Lnet/minecraft/block/AbstractBlock$Settings;)V +transitive-accessible method net/minecraft/block/TorchBlock (Lnet/minecraft/particle/SimpleParticleType;Lnet/minecraft/block/AbstractBlock$Settings;)V transitive-accessible method net/minecraft/block/TranslucentBlock (Lnet/minecraft/block/AbstractBlock$Settings;)V transitive-accessible method net/minecraft/block/TransparentBlock (Lnet/minecraft/block/AbstractBlock$Settings;)V transitive-accessible method net/minecraft/block/TrapdoorBlock (Lnet/minecraft/block/BlockSetType;Lnet/minecraft/block/AbstractBlock$Settings;)V transitive-accessible method net/minecraft/block/WallPlayerSkullBlock (Lnet/minecraft/block/AbstractBlock$Settings;)V transitive-accessible method net/minecraft/block/WallRedstoneTorchBlock (Lnet/minecraft/block/AbstractBlock$Settings;)V transitive-accessible method net/minecraft/block/WallSkullBlock (Lnet/minecraft/block/SkullBlock$SkullType;Lnet/minecraft/block/AbstractBlock$Settings;)V -transitive-accessible method net/minecraft/block/WallTorchBlock (Lnet/minecraft/particle/DefaultParticleType;Lnet/minecraft/block/AbstractBlock$Settings;)V +transitive-accessible method net/minecraft/block/WallTorchBlock (Lnet/minecraft/particle/SimpleParticleType;Lnet/minecraft/block/AbstractBlock$Settings;)V transitive-accessible method net/minecraft/block/WallWitherSkullBlock (Lnet/minecraft/block/AbstractBlock$Settings;)V transitive-accessible method net/minecraft/block/WearableCarvedPumpkinBlock (Lnet/minecraft/block/AbstractBlock$Settings;)V transitive-accessible method net/minecraft/block/WeightedPressurePlateBlock (ILnet/minecraft/block/BlockSetType;Lnet/minecraft/block/AbstractBlock$Settings;)V diff --git a/fabric-transitive-access-wideners-v1/template.accesswidener b/fabric-transitive-access-wideners-v1/template.accesswidener index 414cf79b1b..d7a40fd4d9 100644 --- a/fabric-transitive-access-wideners-v1/template.accesswidener +++ b/fabric-transitive-access-wideners-v1/template.accesswidener @@ -41,11 +41,6 @@ transitive-accessible method net/minecraft/entity/SpawnRestriction register (Lne transitive-accessible method net/minecraft/item/ItemUsageContext (Lnet/minecraft/world/World;Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/util/Hand;Lnet/minecraft/item/ItemStack;Lnet/minecraft/util/hit/BlockHitResult;)V transitive-accessible method net/minecraft/item/ItemPlacementContext (Lnet/minecraft/world/World;Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/util/Hand;Lnet/minecraft/item/ItemStack;Lnet/minecraft/util/hit/BlockHitResult;)V -# Registering custom brewing recipes -transitive-accessible method net/minecraft/recipe/BrewingRecipeRegistry registerItemRecipe (Lnet/minecraft/item/Item;Lnet/minecraft/item/Item;Lnet/minecraft/item/Item;)V -transitive-accessible method net/minecraft/recipe/BrewingRecipeRegistry registerPotionType (Lnet/minecraft/item/Item;)V -transitive-accessible method net/minecraft/recipe/BrewingRecipeRegistry registerPotionRecipe (Lnet/minecraft/registry/entry/RegistryEntry;Lnet/minecraft/item/Item;Lnet/minecraft/registry/entry/RegistryEntry;)V - # Registering custom scoreboard criteria transitive-accessible method net/minecraft/scoreboard/ScoreboardCriterion create (Ljava/lang/String;ZLnet/minecraft/scoreboard/ScoreboardCriterion$RenderType;)Lnet/minecraft/scoreboard/ScoreboardCriterion; transitive-accessible method net/minecraft/scoreboard/ScoreboardCriterion create (Ljava/lang/String;)Lnet/minecraft/scoreboard/ScoreboardCriterion; diff --git a/gradle.properties b/gradle.properties index 33374a1e8c..ed36cce09f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,9 +2,9 @@ org.gradle.jvmargs=-Xmx2560M org.gradle.parallel=true fabric.loom.multiProjectOptimisation=true -version=0.96.14 -minecraft_version=24w14a -yarn_version=+build.1 +version=0.96.15 +minecraft_version=1.20.5-pre1 +yarn_version=+build.2 loader_version=0.15.6 installer_version=0.11.1 @@ -21,17 +21,16 @@ fabric-blockrenderlayer-v1-version=1.1.49 fabric-command-api-v1-version=1.2.44 fabric-command-api-v2-version=2.2.23 fabric-commands-v0-version=0.2.61 -fabric-content-registries-v0-version=6.0.16 +fabric-content-registries-v0-version=7.0.0 fabric-crash-report-info-v1-version=0.2.26 fabric-data-attachment-api-v1-version=1.1.11 -fabric-data-generation-api-v1-version=18.0.2 +fabric-data-generation-api-v1-version=19.0.0 fabric-dimensions-v1-version=2.1.66 fabric-entity-events-v1-version=1.6.7 fabric-events-interaction-v0-version=0.7.5 -fabric-events-lifecycle-v0-version=0.2.86 fabric-game-rule-api-v1-version=1.0.49 fabric-gametest-api-v1-version=1.3.12 -fabric-item-api-v1-version=7.0.0 +fabric-item-api-v1-version=8.0.0 fabric-item-group-api-v1-version=4.0.34 fabric-key-binding-api-v1-version=1.0.44 fabric-keybindings-v0-version=0.2.42 @@ -52,12 +51,12 @@ fabric-rendering-data-attachment-v1-version=0.3.45 fabric-rendering-fluids-v1-version=3.1.2 fabric-rendering-v0-version=1.1.63 fabric-rendering-v1-version=4.2.3 -fabric-resource-conditions-api-v1-version=3.0.1 +fabric-resource-conditions-api-v1-version=4.0.0 fabric-resource-loader-v0-version=1.0.1 fabric-screen-api-v1-version=2.0.20 fabric-screen-handler-api-v1-version=1.3.69 fabric-sound-api-v1-version=1.0.20 -fabric-transfer-api-v1-version=5.1.4 -fabric-transitive-access-wideners-v1-version=6.0.8 +fabric-transfer-api-v1-version=5.1.5 +fabric-transitive-access-wideners-v1-version=6.0.9 fabric-convention-tags-v1-version=1.5.16 fabric-client-tags-api-v1-version=1.1.10 diff --git a/settings.gradle b/settings.gradle index 9485a68530..9be28e117b 100644 --- a/settings.gradle +++ b/settings.gradle @@ -42,7 +42,7 @@ include 'fabric-message-api-v1' include 'fabric-model-loading-api-v1' include 'fabric-networking-api-v1' include 'fabric-object-builder-api-v1' -include 'fabric-particles-v1' +//include 'fabric-particles-v1' include 'fabric-recipe-api-v1' include 'fabric-registry-sync-v0' include 'fabric-renderer-api-v1' @@ -60,7 +60,6 @@ include 'fabric-transitive-access-wideners-v1' include 'deprecated' include 'deprecated:fabric-command-api-v1' include 'deprecated:fabric-commands-v0' -include 'deprecated:fabric-events-lifecycle-v0' include 'deprecated:fabric-keybindings-v0' include 'deprecated:fabric-models-v0' include 'deprecated:fabric-renderer-registries-v1'