From 782ff94b1496dca4efd75ffb41d27dd898584135 Mon Sep 17 00:00:00 2001 From: Meredith Espinosa Date: Sat, 30 Mar 2019 14:53:55 -0700 Subject: [PATCH] update cauldron util to use the right fluid property, have a tryDrainFluid method --- project.gradle | 2 +- .../cottonmc/cotton/behavior/CauldronUtils.java | 13 ++++++++++++- src/main/resources/fabric.mod.json | 2 +- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/project.gradle b/project.gradle index 06b8307..2e2040f 100644 --- a/project.gradle +++ b/project.gradle @@ -1,7 +1,7 @@ ext { projectName = "cotton"; group = "io.github.cottonmc"; - version = "0.1.1+19w13b"; + version = "0.1.2+19w13b"; snapshot = true; minecraft = "19w13b"; diff --git a/src/main/java/io/github/cottonmc/cotton/behavior/CauldronUtils.java b/src/main/java/io/github/cottonmc/cotton/behavior/CauldronUtils.java index 4a8c6aa..0cf1a02 100644 --- a/src/main/java/io/github/cottonmc/cotton/behavior/CauldronUtils.java +++ b/src/main/java/io/github/cottonmc/cotton/behavior/CauldronUtils.java @@ -12,7 +12,7 @@ import net.minecraft.world.World; public class CauldronUtils { - private static final FluidProperty FLUID = FluidProperty.VANILLA_FLUIDS; + private static final FluidProperty FLUID = FluidProperty.ANY_FLUID; private static final IntegerProperty LEVEL = CauldronBlock.LEVEL; public static boolean canPlaceFluid(BlockState state, FluidProperty.Wrapper fluid) { @@ -44,4 +44,15 @@ public static Fluid tryEmptyFluid(IWorld world, BlockPos pos, BlockState state) return Fluids.EMPTY; } + + public static boolean tryDrainFluid(IWorld world, BlockPos pos, BlockState state) { + int level = state.get(LEVEL); + + if (level > 0) { + world.setBlockState(pos, state.with(LEVEL, level - 1), 3); + setFluidFromLevel(world, pos); + return true; + } + return false; + } } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index da88532..d0bcc58 100755 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -1,7 +1,7 @@ { "id": "cotton", "name": "Cotton", - "version": "0.1.1", + "version": "0.1.2", "side": "universal", "initializers": [ "io.github.cottonmc.cotton.Cotton"