mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-05 00:29:08 +01:00
36 lines
1.1 KiB
Java
36 lines
1.1 KiB
Java
/*
|
|
* This file ("DispenserHandlerFertilize.java") is part of the Actually Additions mod for Minecraft.
|
|
* It is created and owned by Ellpeck and distributed
|
|
* under the Actually Additions License to be found at
|
|
* http://ellpeck.de/actaddlicense
|
|
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
*
|
|
* © 2015-2017 Ellpeck
|
|
*/
|
|
|
|
package de.ellpeck.actuallyadditions.mod.misc;
|
|
|
|
|
|
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;
|
|
import net.minecraft.util.math.BlockPos;
|
|
|
|
public class DispenserHandlerFertilize extends BehaviorDefaultDispenseItem{
|
|
|
|
@Override
|
|
public ItemStack dispenseStack(IBlockSource source, ItemStack stack){
|
|
EnumFacing facing = source.getBlockState().getValue(BlockDispenser.FACING);
|
|
BlockPos pos = source.getBlockPos().offset(facing);
|
|
|
|
if(ItemDye.applyBonemeal(stack, source.getWorld(), pos)){
|
|
source.getWorld().playEvent(2005, pos, 0);
|
|
}
|
|
|
|
return stack;
|
|
}
|
|
|
|
}
|