mirror of
https://github.com/FabricMC/fabric.git
synced 2025-04-15 00:14:28 -04:00
1.20.5-pre1 (#3700)
* 1.20.5-pre1 * BrewingRecipeRegistryBuilderCallback * Remove debug line * Fix build * Bump version
This commit is contained in:
parent
3b6dc5deb2
commit
74e2f560d5
33 changed files with 98 additions and 635 deletions
deprecated/fabric-events-lifecycle-v0
build.gradle
src
client/java/net/fabricmc/fabric
api/event/client
impl/event/lifecycle/v0/client
main
java/net/fabricmc/fabric
api/event
server
world
impl/event/lifecycle/v0
resources
testmod
java/net/fabricmc/fabric/test/event/lifecycle/legacy
resources
testmodClient/java/net/fabricmc/fabric/test/event/lifecycle/legacy/client
fabric-content-registries-v0/src
main
java/net/fabricmc/fabric
api/registry
mixin/content/registry
resources
testmod
java/net/fabricmc/fabric/test/content/registry
resources
fabric-item-api-v1/src
client/java/net/fabricmc/fabric
main/java/net/fabricmc/fabric/mixin/item
testmod/java/net/fabricmc/fabric/test/item
testmodClient/java/net/fabricmc/fabric/test/item/client
fabric-resource-conditions-api-v1/src/main/java/net/fabricmc/fabric/mixin/resource/conditions
fabric-transfer-api-v1/src/client/java/net/fabricmc/fabric/api/transfer/v1/client/fluid
fabric-transitive-access-wideners-v1
gradle.propertiessettings.gradle
|
@ -1,7 +0,0 @@
|
|||
version = getSubprojectVersion(project)
|
||||
|
||||
moduleDependencies(project, [
|
||||
'fabric-api-base',
|
||||
'fabric-item-api-v1',
|
||||
'fabric-lifecycle-events-v1'
|
||||
])
|
|
@ -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<ClientTickCallback> EVENT = EventFactory.createArrayBacked(ClientTickCallback.class,
|
||||
(listeners) -> {
|
||||
return (client) -> {
|
||||
for (ClientTickCallback event : listeners) {
|
||||
event.tick(client);
|
||||
}
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
void tick(MinecraftClient client);
|
||||
}
|
|
@ -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<ItemTooltipCallback> 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<Text> lines);
|
||||
}
|
|
@ -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));
|
||||
}
|
||||
}
|
|
@ -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<ServerStartCallback> EVENT = EventFactory.createArrayBacked(ServerStartCallback.class,
|
||||
(listeners) -> (server) -> {
|
||||
for (ServerStartCallback event : listeners) {
|
||||
event.onStartServer(server);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
void onStartServer(MinecraftServer server);
|
||||
}
|
|
@ -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<ServerStopCallback> EVENT = EventFactory.createArrayBacked(ServerStopCallback.class,
|
||||
(listeners) -> (server) -> {
|
||||
for (ServerStopCallback event : listeners) {
|
||||
event.onStopServer(server);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
void onStopServer(MinecraftServer server);
|
||||
}
|
|
@ -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<ServerTickCallback> EVENT = EventFactory.createArrayBacked(ServerTickCallback.class,
|
||||
(listeners) -> {
|
||||
return (server) -> {
|
||||
for (ServerTickCallback event : listeners) {
|
||||
event.tick(server);
|
||||
}
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
void tick(MinecraftServer server);
|
||||
}
|
|
@ -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<WorldTickCallback> EVENT = EventFactory.createArrayBacked(WorldTickCallback.class,
|
||||
(listeners) -> {
|
||||
return (world) -> {
|
||||
for (WorldTickCallback event : listeners) {
|
||||
event.tick(world);
|
||||
}
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
void tick(World world);
|
||||
}
|
|
@ -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));
|
||||
}
|
||||
}
|
Binary file not shown.
Before ![]() (image error) Size: 1.5 KiB |
|
@ -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"
|
||||
}
|
||||
}
|
|
@ -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<RegistryKey<World>, 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);
|
||||
});
|
||||
}
|
||||
}
|
|
@ -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"
|
||||
]
|
||||
}
|
||||
}
|
|
@ -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"));
|
||||
});
|
||||
}
|
||||
}
|
|
@ -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<BrewingRecipeRegistryBuilderCallback> 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);
|
||||
}
|
|
@ -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<Potion> input, Ingredient ingredient, RegistryEntry<Potion> 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));
|
||||
}
|
||||
}
|
|
@ -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<BrewingRecipeRegistry> cir) {
|
||||
BrewingRecipeRegistryBuilderCallback.BUILD.invoker().build((BrewingRecipeRegistry.class_9665) (Object) this);
|
||||
}
|
||||
}
|
|
@ -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 <init> (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;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
"compatibilityLevel": "JAVA_17",
|
||||
"mixins": [
|
||||
"AxeItemAccessor",
|
||||
"BrewingRecipeRegistryBuilderMixin",
|
||||
"PathContextMixin",
|
||||
"FarmerWorkTaskAccessor",
|
||||
"GiveGiftsToHeroTaskAccessor",
|
||||
|
|
|
@ -30,8 +30,6 @@ import net.minecraft.item.Item;
|
|||
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.World;
|
|||
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.SculkSensorFrequencyRegistry;
|
|||
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 final class ContentRegistryTest implements ModInitializer {
|
|||
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 {
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
"package": "net.fabricmc.fabric.test.mixin.content.registry",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"mixins": [
|
||||
"BrewingRecipeRegistryAccessor"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
|
|
|
@ -18,7 +18,8 @@ package net.fabricmc.fabric.api.client.item.v1;
|
|||
|
||||
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<ItemTooltipCallback> EVENT = EventFactory.createArrayBacked(ItemTooltipCallback.class, callbacks -> (stack, context, lines) -> {
|
||||
Event<ItemTooltipCallback> 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<Text> lines);
|
||||
void getTooltip(ItemStack stack, Item.TooltipContext tooltipContext, TooltipType tooltipType, List<Text> lines);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ 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.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 @@ import net.fabricmc.fabric.api.client.item.v1.ItemTooltipCallback;
|
|||
@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<List<Text>> info) {
|
||||
ItemTooltipCallback.EVENT.invoker().getTooltip((ItemStack) (Object) this, tooltipContext, info.getReturnValue());
|
||||
private void getTooltip(Item.TooltipContext tooltipContext, @Nullable PlayerEntity entity, TooltipType tooltipType, CallbackInfoReturnable<List<Text>> info) {
|
||||
ItemTooltipCallback.EVENT.invoker().getTooltip((ItemStack) (Object) this, tooltipContext, tooltipType, info.getReturnValue());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 @@ public class BrewingStandBlockEntityMixin {
|
|||
/**
|
||||
* 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<ItemStack> original) {
|
||||
ItemStack remainder = REMAINDER_STACK.get();
|
||||
REMAINDER_STACK.remove();
|
||||
return remainder;
|
||||
|
|
|
@ -22,8 +22,6 @@ import net.minecraft.item.ItemStack;
|
|||
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.minecraft.util.dynamic.Codecs;
|
|||
|
||||
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) -> {
|
||||
|
|
|
@ -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));
|
||||
});
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|||
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 @@ public class DataPackContentsMixin {
|
|||
at = @At("HEAD")
|
||||
)
|
||||
private static void hookReload(ResourceManager manager, CombinedDynamicRegistries<ServerDynamicRegistryType> combinedDynamicRegistries, FeatureSet enabledFeatures, CommandManager.RegistrationEnvironment environment, int functionPermissionLevel, Executor prepareExecutor, Executor applyExecutor, CallbackInfoReturnable<CompletableFuture<DataPackContents>> cir) {
|
||||
System.out.println("Enabling " + FeatureFlags.FEATURE_MANAGER.toId(enabledFeatures));
|
||||
ResourceConditionsImpl.currentFeatures = enabledFeatures;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ import java.util.List;
|
|||
|
||||
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 {
|
|||
* <p>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<Text> tooltip, TooltipContext tooltipContext) {
|
||||
default void appendTooltip(FluidVariant fluidVariant, List<Text> tooltip, TooltipType tooltipType) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -23,7 +23,7 @@ import java.util.Objects;
|
|||
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 final class FluidVariantRendering {
|
|||
* 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.
|
||||
*
|
||||
* <p>Compared to {@linkplain #getTooltip(FluidVariant, TooltipContext) the other overload}, the current tooltip context is automatically used.
|
||||
* <p>Compared to {@linkplain #getTooltip(FluidVariant, TooltipType) the other overload}, the current tooltip context is automatically used.
|
||||
*/
|
||||
public static List<Text> 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<Text> getTooltip(FluidVariant fluidVariant, TooltipContext context) {
|
||||
public static List<Text> getTooltip(FluidVariant fluidVariant, TooltipType type) {
|
||||
List<Text> 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));
|
||||
}
|
||||
|
||||
|
|
|
@ -46,11 +46,6 @@ transitive-accessible method net/minecraft/entity/SpawnRestriction register (Lne
|
|||
transitive-accessible method net/minecraft/item/ItemUsageContext <init> (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 <init> (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 <init> (Lnet/minecraf
|
|||
transitive-accessible method net/minecraft/block/StructureBlock <init> (Lnet/minecraft/block/AbstractBlock$Settings;)V
|
||||
transitive-accessible method net/minecraft/block/StructureVoidBlock <init> (Lnet/minecraft/block/AbstractBlock$Settings;)V
|
||||
transitive-accessible method net/minecraft/block/SugarCaneBlock <init> (Lnet/minecraft/block/AbstractBlock$Settings;)V
|
||||
transitive-accessible method net/minecraft/block/TorchBlock <init> (Lnet/minecraft/particle/DefaultParticleType;Lnet/minecraft/block/AbstractBlock$Settings;)V
|
||||
transitive-accessible method net/minecraft/block/TorchBlock <init> (Lnet/minecraft/particle/SimpleParticleType;Lnet/minecraft/block/AbstractBlock$Settings;)V
|
||||
transitive-accessible method net/minecraft/block/TranslucentBlock <init> (Lnet/minecraft/block/AbstractBlock$Settings;)V
|
||||
transitive-accessible method net/minecraft/block/TransparentBlock <init> (Lnet/minecraft/block/AbstractBlock$Settings;)V
|
||||
transitive-accessible method net/minecraft/block/TrapdoorBlock <init> (Lnet/minecraft/block/BlockSetType;Lnet/minecraft/block/AbstractBlock$Settings;)V
|
||||
transitive-accessible method net/minecraft/block/WallPlayerSkullBlock <init> (Lnet/minecraft/block/AbstractBlock$Settings;)V
|
||||
transitive-accessible method net/minecraft/block/WallRedstoneTorchBlock <init> (Lnet/minecraft/block/AbstractBlock$Settings;)V
|
||||
transitive-accessible method net/minecraft/block/WallSkullBlock <init> (Lnet/minecraft/block/SkullBlock$SkullType;Lnet/minecraft/block/AbstractBlock$Settings;)V
|
||||
transitive-accessible method net/minecraft/block/WallTorchBlock <init> (Lnet/minecraft/particle/DefaultParticleType;Lnet/minecraft/block/AbstractBlock$Settings;)V
|
||||
transitive-accessible method net/minecraft/block/WallTorchBlock <init> (Lnet/minecraft/particle/SimpleParticleType;Lnet/minecraft/block/AbstractBlock$Settings;)V
|
||||
transitive-accessible method net/minecraft/block/WallWitherSkullBlock <init> (Lnet/minecraft/block/AbstractBlock$Settings;)V
|
||||
transitive-accessible method net/minecraft/block/WearableCarvedPumpkinBlock <init> (Lnet/minecraft/block/AbstractBlock$Settings;)V
|
||||
transitive-accessible method net/minecraft/block/WeightedPressurePlateBlock <init> (ILnet/minecraft/block/BlockSetType;Lnet/minecraft/block/AbstractBlock$Settings;)V
|
||||
|
|
|
@ -41,11 +41,6 @@ transitive-accessible method net/minecraft/entity/SpawnRestriction register (Lne
|
|||
transitive-accessible method net/minecraft/item/ItemUsageContext <init> (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 <init> (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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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'
|
||||
|
|
Loading…
Add table
Reference in a new issue