[BUG] Fix example mod not being able to compile - #1
This commit is contained in:
@@ -3,7 +3,7 @@ package com.author.examplemod;
|
||||
import com.author.examplemod.platform.IPlatformHelper;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.world.food.FoodProperties;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.item.TooltipFlag;
|
||||
@@ -20,14 +20,9 @@ public class ExampleModCommon {
|
||||
// This method serves as a hook to modify item tooltips. The vanilla game
|
||||
// has no mechanism to load tooltip listeners so this must be registered
|
||||
// by a mod loader like Forge or Fabric.
|
||||
public static void onItemTooltip(ItemStack stack, TooltipFlag context, List<Component> tooltip) {
|
||||
public static void onItemTooltip(ItemStack stack, Item.TooltipContext context, TooltipFlag flag, List<Component> tooltip) {
|
||||
if (!stack.isEmpty()) {
|
||||
final FoodProperties food = stack.getItem().getFoodProperties();
|
||||
|
||||
if (food != null) {
|
||||
tooltip.add(Component.literal("Nutrition: " + food.getNutrition()));
|
||||
tooltip.add(Component.literal("Saturation: " + food.getSaturationModifier()));
|
||||
}
|
||||
tooltip.add(Component.literal("Hey you!"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -15,6 +15,6 @@ public class ExampleModForge {
|
||||
}
|
||||
|
||||
private void onItemTooltip(ItemTooltipEvent event) {
|
||||
ExampleModCommon.onItemTooltip(event.getItemStack(), event.getFlags(), event.getToolTip());
|
||||
ExampleModCommon.onItemTooltip(event.getItemStack(), event.getContext(), event.getFlags(), event.getToolTip());
|
||||
}
|
||||
}
|
@@ -14,10 +14,10 @@ minecraft_version=1.21
|
||||
|
||||
# Fabric
|
||||
fabric_loader=0.15.11
|
||||
fabric_api=0.100.1+1.21
|
||||
fabric_api=0.102.0+1.21
|
||||
|
||||
# NeoForge
|
||||
neoforge_version=8-beta
|
||||
neoforge_version=167
|
||||
|
||||
# Gradle Options
|
||||
org.gradle.jvmargs=-Xmx3G
|
||||
|
Reference in New Issue
Block a user