ActuallyAdditions/src/main/java/de/ellpeck/actuallyadditions/mod/misc/DispenserHandlerFertilize.java

37 lines
1.2 KiB
Java
Raw Normal View History

2015-08-29 14:33:25 +02:00
/*
2016-05-16 22:52:27 +02:00
* This file ("DispenserHandlerFertilize.java") is part of the Actually Additions mod for Minecraft.
2015-08-29 14:33:25 +02:00
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
2016-05-16 22:52:27 +02:00
* http://ellpeck.de/actaddlicense
2015-08-29 14:33:25 +02:00
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
2017-01-01 16:23:26 +01:00
* © 2015-2017 Ellpeck
2015-08-29 14:33:25 +02:00
*/
2016-01-05 04:47:35 +01:00
package de.ellpeck.actuallyadditions.mod.misc;
import net.minecraft.dispenser.DefaultDispenseItemBehavior;
import net.minecraft.dispenser.IBlockSource;
import net.minecraft.item.BoneMealItem;
import net.minecraft.item.ItemStack;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.util.Direction;
2016-03-18 23:47:22 +01:00
import net.minecraft.util.math.BlockPos;
// TODO: [port][note] might not be needed anymore
public class DispenserHandlerFertilize extends DefaultDispenseItemBehavior {
@Override
2019-05-02 09:10:29 +02:00
public ItemStack dispenseStack(IBlockSource source, ItemStack stack) {
Direction facing = source.getBlockState().get(BlockStateProperties.FACING);
BlockPos pos = source.getBlockPos().offset(facing);
if (BoneMealItem.applyBonemeal(stack, source.getWorld(), pos)) {
source.getWorld().playEvent(2005, pos, 0);
}
return stack;
}
}