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

36 lines
1.3 KiB
Java
Raw Normal View History

2015-08-29 14:33:25 +02:00
/*
* 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://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
2015-11-02 20:55:19 +01:00
* © 2015 Ellpeck
2015-08-29 14:33:25 +02:00
*/
2015-12-30 22:02:15 +01:00
package de.ellpeck.actuallyadditions.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;
public class DispenserHandlerFertilize extends BehaviorDefaultDispenseItem{
@Override
public ItemStack dispenseStack(IBlockSource source, ItemStack stack){
EnumFacing facing = BlockDispenser.func_149937_b(source.getBlockMetadata());
int x = source.getXInt()+facing.getFrontOffsetX();
int y = source.getYInt()+facing.getFrontOffsetY();
int z = source.getZInt()+facing.getFrontOffsetZ();
if(ItemDye.applyBonemeal(stack, source.getWorld(), x, y, z, null)){
source.getWorld().playAuxSFX(2005, x, y, z, 0);
}
return stack;
}
}