Skip to content

Commit

Permalink
update cauldron util to use the right fluid property, have a tryDrain…
Browse files Browse the repository at this point in the history
…Fluid method
  • Loading branch information
LemmaEOF committed Mar 30, 2019
1 parent 249a6d0 commit 782ff94
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion project.gradle
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
}
}
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "cotton",
"name": "Cotton",
"version": "0.1.1",
"version": "0.1.2",
"side": "universal",
"initializers": [
"io.github.cottonmc.cotton.Cotton"
Expand Down

0 comments on commit 782ff94

Please sign in to comment.