|
54 | 54 | import net.minecraft.world.item.context.UseOnContext; |
55 | 55 | import net.minecraft.world.level.ClipContext; |
56 | 56 | import net.minecraft.world.level.Level; |
57 | | -import net.minecraft.world.level.block.Block; |
58 | 57 | import net.minecraft.world.level.block.Blocks; |
59 | 58 | import net.minecraft.world.level.block.BucketPickup; |
60 | 59 | import net.minecraft.world.level.block.DispenserBlock; |
|
71 | 70 | import net.neoforged.neoforge.common.SoundActions; |
72 | 71 | import net.neoforged.neoforge.fluids.FluidStack; |
73 | 72 | import net.neoforged.neoforge.fluids.FluidType; |
74 | | -import net.neoforged.neoforge.fluids.IFluidBlock; |
75 | | -import net.neoforged.neoforge.fluids.capability.IFluidHandler.FluidAction; |
76 | 73 | import net.neoforged.neoforge.fluids.capability.IFluidHandlerItem; |
77 | 74 | import org.jetbrains.annotations.NotNull; |
78 | 75 | import org.jetbrains.annotations.Nullable; |
@@ -199,16 +196,7 @@ public InteractionResultHolder<ItemStack> use(@NotNull Level world, Player playe |
199 | 196 | // only allow collecting from non-empty sources |
200 | 197 | Fluid fluid = fluidState.getType(); |
201 | 198 | FluidStack fluidStack = new FluidStack(fluid, FluidType.BUCKET_VOLUME); |
202 | | - Block block = blockState.getBlock(); |
203 | | - if (block instanceof IFluidBlock fluidBlock) { |
204 | | - fluidStack = fluidBlock.drain(world, pos, FluidAction.SIMULATE); |
205 | | - if (!validFluid(fluidTank, fluidStack)) { |
206 | | - //If the fluid is not valid, pass on doing anything |
207 | | - return InteractionResultHolder.pass(stack); |
208 | | - } |
209 | | - //Actually drain it |
210 | | - fluidStack = fluidBlock.drain(world, pos, FluidAction.EXECUTE); |
211 | | - } else if (block instanceof BucketPickup bucketPickup && validFluid(fluidTank, fluidStack)) { |
| 199 | + if (blockState.getBlock() instanceof BucketPickup bucketPickup && validFluid(fluidTank, fluidStack)) { |
212 | 200 | //If it can be picked up by a bucket, and we actually want to pick it up, do so to update the fluid type we are doing |
213 | 201 | // otherwise we assume the type from the fluid state is correct |
214 | 202 | ItemStack pickedUpStack = bucketPickup.pickupBlock(player, world, pos, blockState); |
@@ -341,16 +329,7 @@ public ItemStack execute(@NotNull BlockSource source, @NotNull ItemStack stack) |
341 | 329 | // only allow collecting from non-empty sources |
342 | 330 | Fluid fluid = fluidState.getType(); |
343 | 331 | FluidStack fluidStack = new FluidStack(fluid, FluidType.BUCKET_VOLUME); |
344 | | - Block block = blockState.getBlock(); |
345 | | - if (block instanceof IFluidBlock fluidBlock) { |
346 | | - fluidStack = fluidBlock.drain(world, pos, FluidAction.SIMULATE); |
347 | | - if (!validFluid(fluidTank, fluidStack)) { |
348 | | - //If the fluid is not valid, then eject the stack similar to how vanilla does for buckets |
349 | | - return super.execute(source, stack); |
350 | | - } |
351 | | - //Actually drain it |
352 | | - fluidStack = fluidBlock.drain(world, pos, FluidAction.EXECUTE); |
353 | | - } else if (block instanceof BucketPickup bucketPickup && validFluid(fluidTank, fluidStack)) { |
| 332 | + if (blockState.getBlock() instanceof BucketPickup bucketPickup && validFluid(fluidTank, fluidStack)) { |
354 | 333 | //If it can be picked up by a bucket, and we actually want to pick it up, do so to update the fluid type we are doing |
355 | 334 | // otherwise we assume the type from the fluid state is correct |
356 | 335 | ItemStack pickedUpStack = bucketPickup.pickupBlock(null, world, pos, blockState); |
|
0 commit comments