2020-09-09 16:49:01 +02:00
|
|
|
package de.ellpeck.actuallyadditions.common.misc;
|
2015-06-29 20:55:56 +02:00
|
|
|
|
|
|
|
import net.minecraft.block.BlockDispenser;
|
|
|
|
import net.minecraft.dispenser.BehaviorDefaultDispenseItem;
|
|
|
|
import net.minecraft.dispenser.IBlockSource;
|
|
|
|
import net.minecraft.item.ItemDye;
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraft.util.EnumFacing;
|
2016-03-18 23:47:22 +01:00
|
|
|
import net.minecraft.util.math.BlockPos;
|
2015-06-29 20:55:56 +02:00
|
|
|
|
2019-05-02 09:10:29 +02:00
|
|
|
public class DispenserHandlerFertilize extends BehaviorDefaultDispenseItem {
|
2015-06-29 20:55:56 +02:00
|
|
|
|
|
|
|
@Override
|
2019-05-02 09:10:29 +02:00
|
|
|
public ItemStack dispenseStack(IBlockSource source, ItemStack stack) {
|
2016-11-19 21:11:17 +01:00
|
|
|
EnumFacing facing = source.getBlockState().getValue(BlockDispenser.FACING);
|
2016-06-23 19:27:42 +02:00
|
|
|
BlockPos pos = source.getBlockPos().offset(facing);
|
2015-06-29 20:55:56 +02:00
|
|
|
|
2019-05-02 09:10:29 +02:00
|
|
|
if (ItemDye.applyBonemeal(stack, source.getWorld(), pos)) {
|
2016-06-03 21:05:49 +02:00
|
|
|
source.getWorld().playEvent(2005, pos, 0);
|
2015-06-29 20:55:56 +02:00
|
|
|
}
|
2016-06-23 19:27:42 +02:00
|
|
|
|
2015-06-29 20:55:56 +02:00
|
|
|
return stack;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|