src/main/java/cech12/ceramicbucket/init/ModItems.java
@Nonnull
            public ItemStack dispenseStack(IBlockSource source, ItemStack stack) {
                IWorld iworld = source.getWorld();
                BlockPos blockpos = source.getBlockPos().offset(source.getBlockState().get(DispenserBlock.FACING));
                BlockState blockstate = iworld.getBlockState(blockpos);
                Block block = blockstate.getBlock();
                if (block instanceof IBucketPickupHandler) {
                    Fluid fluid = ((IBucketPickupHandler)block).pickupFluid(iworld, blockpos, blockstate);
                    if (!(fluid instanceof FlowingFluid)) {
                        return super.dispenseStack(source, stack);
                    } else {
                        ItemStack bucket = ((FilledCeramicBucketItem) CeramicBucketItems.FILLED_CERAMIC_BUCKET).getFilledInstance(fluid);
                        stack.shrink(1);
                        if (stack.isEmpty()) {
                            return bucket;
                        } else {
                            if (source.<DispenserTileEntity>getBlockTileEntity().addItemStack(bucket) < 0) {
                                this.dispenseBehavior.dispense(source, bucket);
                            }

                            return stack;
                        }
                    }
                } else {
                    return super.dispenseStack(source, stack);
                }
            }
/**
             * Dispense the specified stack, play the dispense sound and spawn particles.
             */
Dispense the specified stack, play the dispense sound and spawn particles.
Dispense the specified stack play the dispense sound and spawn particles .
@Nonnull
            public ItemStack dispenseStack(IBlockSource source, ItemStack stack) {
                IWorld iworld = source.getWorld();
                BlockPos blockpos = source.getBlockPos().offset(source.getBlockState().get(DispenserBlock.FACING));
                BlockState blockstate = iworld.getBlockState(blockpos);
                Block block = blockstate.getBlock();
                if (block instanceof IBucketPickupHandler) {
                    Fluid fluid = ((IBucketPickupHandler)block).pickupFluid(iworld, blockpos, blockstate);
                    if (!(fluid instanceof FlowingFluid)) {
                        return super.dispenseStack(source, stack);
                    } else {
                        ItemStack bucket = ((FilledCeramicBucketItem) CeramicBucketItems.FILLED_CERAMIC_BUCKET).getFilledInstance(fluid);
                        stack.shrink(1);
                        if (stack.isEmpty()) {
                            return bucket;
                        } else {
                            if (source.<DispenserTileEntity>getBlockTileEntity().addItemStack(bucket) < 0) {
                                this.dispenseBehavior.dispense(source, bucket);
                            }
                            return stack;
                        }
                    }
                } else {
                    return super.dispenseStack(source, stack);
                }
            }
@ Nonnull public ItemStack dispenseStack ( IBlockSource source , ItemStack stack ) { IWorld iworld = source . getWorld ( ) ; BlockPos blockpos = source . getBlockPos ( ) . offset ( source . getBlockState ( ) . get ( DispenserBlock . FACING ) ) ; BlockState blockstate = iworld . getBlockState ( blockpos ) ; Block block = blockstate . getBlock ( ) ; if ( block instanceof IBucketPickupHandler ) { Fluid fluid = ( ( IBucketPickupHandler ) block ) . pickupFluid ( iworld , blockpos , blockstate ) ; if ( ! ( fluid instanceof FlowingFluid ) ) { return super . dispenseStack ( source , stack ) ; } else { ItemStack bucket = ( ( FilledCeramicBucketItem ) CeramicBucketItems . FILLED_CERAMIC_BUCKET ) . getFilledInstance ( fluid ) ; stack . shrink ( 1 ) ; if ( stack . isEmpty ( ) ) { return bucket ; } else { if ( source . < DispenserTileEntity > getBlockTileEntity ( ) . addItemStack ( bucket ) < 0 ) { this . dispenseBehavior . dispense ( source , bucket ) ; } return stack ; } } } else { return super . dispenseStack ( source , stack ) ; } }
Dispense the specified stack, play the dispense sound and spawn particles.
Dispense the specified stack play the dispense sound and spawn particles .