Use the bucket tag for filling jars instead of just the vanilla bucket

This commit is contained in:
Sollace 2024-10-08 15:02:26 +01:00
parent 0b583e7276
commit 73cab14bbb
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB

View file

@ -5,11 +5,11 @@ import com.minelittlepony.unicopia.block.ItemJarBlock.JarContents;
import com.minelittlepony.unicopia.block.ItemJarBlock.TileData; import com.minelittlepony.unicopia.block.ItemJarBlock.TileData;
import com.minelittlepony.unicopia.util.FluidHelper; import com.minelittlepony.unicopia.util.FluidHelper;
import net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags;
import net.fabricmc.fabric.api.transfer.v1.fluid.FluidConstants; import net.fabricmc.fabric.api.transfer.v1.fluid.FluidConstants;
import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant; import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtCompound;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.TypedActionResult; import net.minecraft.util.TypedActionResult;
@ -27,7 +27,7 @@ public record FluidOnlyJarContents (
@Override @Override
public TypedActionResult<JarContents> interact(PlayerEntity player, Hand hand) { public TypedActionResult<JarContents> interact(PlayerEntity player, Hand hand) {
ItemStack stack = player.getStackInHand(hand); ItemStack stack = player.getStackInHand(hand);
if (stack.isOf(Items.BUCKET)) { if (stack.isIn(ConventionalItemTags.EMPTY_BUCKETS)) {
long remainder = FluidHelper.deposit(stack, player, hand, fluid, amount); long remainder = FluidHelper.deposit(stack, player, hand, fluid, amount);
tile.markDirty(); tile.markDirty();
fluid.getFluid().getBucketFillSound().ifPresent(sound -> player.playSound(sound, 1, 1)); fluid.getFluid().getBucketFillSound().ifPresent(sound -> player.playSound(sound, 1, 1));