Skip to content

Commit

Permalink
Fix empty bucket showing fluid tootlip (#2724)
Browse files Browse the repository at this point in the history
  • Loading branch information
krossgg authored Jan 12, 2025
1 parent b8de76c commit b71e95e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/main/java/com/gregtechceu/gtceu/client/TooltipsHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.gregtechceu.gtceu.api.fluids.FluidState;
import com.gregtechceu.gtceu.api.fluids.GTFluid;
import com.gregtechceu.gtceu.common.data.GTFluids;
import com.gregtechceu.gtceu.common.data.GTMaterials;
import com.gregtechceu.gtceu.common.fluid.potion.PotionFluidHelper;
import com.gregtechceu.gtceu.data.lang.LangHandler;
import com.gregtechceu.gtceu.utils.GTUtil;
Expand All @@ -21,7 +22,9 @@
import net.minecraft.tags.FluidTags;
import net.minecraft.world.item.BucketItem;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.MilkBucketItem;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.level.material.EmptyFluid;
import net.minecraft.world.level.material.Fluid;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
Expand Down Expand Up @@ -52,7 +55,12 @@ public static void appendTooltips(ItemStack stack, TooltipFlag flag, List<Compon
.withStyle(ChatFormatting.YELLOW));
}
if (stack.getItem() instanceof BucketItem bucket) {
appendFluidTooltips(new FluidStack(bucket.getFluid(), FluidType.BUCKET_VOLUME), tooltips::add, flag);
var fluid = bucket.getFluid();
if (!(fluid instanceof EmptyFluid)) {
appendFluidTooltips(new FluidStack(fluid, FluidType.BUCKET_VOLUME), tooltips::add, flag);
}
} else if (stack.getItem() instanceof MilkBucketItem) {
appendFluidTooltips(GTMaterials.Milk.getFluid(FluidType.BUCKET_VOLUME), tooltips::add, flag);
}

// Block/Item custom tooltips
Expand Down

0 comments on commit b71e95e

Please sign in to comment.