Search in sources :

Example 6 with IPosition

use of net.minecraft.dispenser.IPosition in project MineFactoryReloaded by powercrystals.

the class BehaviorDispenseSafariNet method dispenseStack.

@Override
public ItemStack dispenseStack(IBlockSource dispenser, ItemStack stack) {
    World world = dispenser.getWorld();
    IPosition dispenserPos = BlockDispenser.getIPositionFromBlockSource(dispenser);
    EnumFacing dispenserFacing = BlockDispenser.getFacing(dispenser.getBlockMetadata());
    EntitySafariNet proj = new EntitySafariNet(world, dispenserPos.getX(), dispenserPos.getY(), dispenserPos.getZ(), stack.copy());
    proj.setThrowableHeading(dispenserFacing.getFrontOffsetX(), dispenserFacing.getFrontOffsetY() + 0.1, dispenserFacing.getFrontOffsetZ(), 1.1F, 6.0F);
    world.spawnEntityInWorld(proj);
    stack.splitStack(1);
    return stack;
}
Also used : IPosition(net.minecraft.dispenser.IPosition) EntitySafariNet(powercrystals.minefactoryreloaded.entity.EntitySafariNet) EnumFacing(net.minecraft.util.EnumFacing) World(net.minecraft.world.World)

Example 7 with IPosition

use of net.minecraft.dispenser.IPosition in project ClaySoldiersMod by SanAndreasP.

the class Handler_BehaviorDispenseItem method dispense2.

protected ItemStack dispense2(IBlockSource par1IBlockSource, ItemStack par2ItemStack) {
    EnumFacing var3 = EnumFacing.getFront(par1IBlockSource.getBlockMetadata());
    IPosition var4 = BlockDispenser.getIPositionFromBlockSource(par1IBlockSource);
    ItemStack var5 = par2ItemStack.splitStack(1);
    func_82486_a(par1IBlockSource.getWorld(), var5, 6, var3, var4);
    return par2ItemStack;
}
Also used : IPosition(net.minecraft.dispenser.IPosition) EnumFacing(net.minecraft.util.EnumFacing) ItemStack(net.minecraft.item.ItemStack)

Aggregations

IPosition (net.minecraft.dispenser.IPosition)7 ItemStack (net.minecraft.item.ItemStack)5 EnumFacing (net.minecraft.util.EnumFacing)4 World (net.minecraft.world.World)4 BehaviorProjectileDispense (net.minecraft.dispenser.BehaviorProjectileDispense)3 IProjectile (net.minecraft.entity.IProjectile)3 IBehaviorDispenseItem (net.minecraft.dispenser.IBehaviorDispenseItem)2 IBlockSource (net.minecraft.dispenser.IBlockSource)2 Random (java.util.Random)1 Nonnull (javax.annotation.Nonnull)1 BaublesCompatHandler (ladysnake.gaspunk.compat.BaublesCompatHandler)1 EntityGrenade (ladysnake.gaspunk.entity.EntityGrenade)1 EntityMeteorChunk (micdoodle8.mods.galacticraft.core.entities.EntityMeteorChunk)1 ItemBucketGC (micdoodle8.mods.galacticraft.core.items.ItemBucketGC)1 IBlockState (net.minecraft.block.state.IBlockState)1 BehaviorDefaultDispenseItem (net.minecraft.dispenser.BehaviorDefaultDispenseItem)1 Entity (net.minecraft.entity.Entity)1 TileEntityDispenser (net.minecraft.tileentity.TileEntityDispenser)1 BlockPos (net.minecraft.util.BlockPos)1 BlockPos (net.minecraft.util.math.BlockPos)1