2014-03-02 09:35:11 +01:00
|
|
|
package appeng.hooks;
|
2013-12-27 23:59:59 +01:00
|
|
|
|
|
|
|
import net.minecraft.block.BlockDispenser;
|
|
|
|
import net.minecraft.dispenser.BehaviorDefaultDispenseItem;
|
|
|
|
import net.minecraft.dispenser.IBlockSource;
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraft.util.EnumFacing;
|
|
|
|
import net.minecraft.world.World;
|
|
|
|
import appeng.entity.EntityTinyTNTPrimed;
|
|
|
|
|
|
|
|
final public class DispenserBehaviorTinyTNT extends BehaviorDefaultDispenseItem
|
|
|
|
{
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected ItemStack dispenseStack(IBlockSource dispenser, ItemStack dispensedItem)
|
|
|
|
{
|
2014-02-09 02:34:52 +01:00
|
|
|
EnumFacing enumfacing = BlockDispenser.func_149937_b( dispenser.getBlockMetadata() );
|
2013-12-27 23:59:59 +01:00
|
|
|
World world = dispenser.getWorld();
|
|
|
|
int i = dispenser.getXInt() + enumfacing.getFrontOffsetX();
|
|
|
|
int j = dispenser.getYInt() + enumfacing.getFrontOffsetY();
|
|
|
|
int k = dispenser.getZInt() + enumfacing.getFrontOffsetZ();
|
2014-09-28 20:56:16 +02:00
|
|
|
EntityTinyTNTPrimed primedTinyTNTEntity = new EntityTinyTNTPrimed( world, i + 0.5F, j + 0.5F,
|
2014-09-29 09:42:50 +02:00
|
|
|
k + 0.5F, null );
|
2014-09-28 11:47:17 +02:00
|
|
|
world.spawnEntityInWorld( primedTinyTNTEntity );
|
2013-12-27 23:59:59 +01:00
|
|
|
--dispensedItem.stackSize;
|
|
|
|
return dispensedItem;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|