当前位置: 首页>>代码示例>>Java>>正文


Java BlockDispenser.func_149939_a方法代码示例

本文整理汇总了Java中net.minecraft.block.BlockDispenser.func_149939_a方法的典型用法代码示例。如果您正苦于以下问题:Java BlockDispenser.func_149939_a方法的具体用法?Java BlockDispenser.func_149939_a怎么用?Java BlockDispenser.func_149939_a使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.block.BlockDispenser的用法示例。


在下文中一共展示了BlockDispenser.func_149939_a方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: dispenseStack

import net.minecraft.block.BlockDispenser; //导入方法依赖的package包/类
/**
 * Dispense the specified stack, play the dispense sound and spawn particles.
 */
public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack) {
    World world = par1IBlockSource.getWorld();
    IPosition iposition = BlockDispenser.func_149939_a(par1IBlockSource);
    EnumFacing enumfacing = BlockDispenser.func_149937_b(par1IBlockSource.getBlockMetadata());
    ItemStack stack = par2ItemStack.splitStack(1);
    if (matchesItem(par2ItemStack)) {
        // dispense item as projectile because the item matches
        IProjectile iprojectile = this.getProjectileEntity(world, iposition, par2ItemStack);
        iprojectile.setThrowableHeading((double) enumfacing.getFrontOffsetX(), (double) ((float) enumfacing.getFrontOffsetY() + 0.1F), (double) enumfacing.getFrontOffsetZ(), this.func_82500_b(), this.func_82498_a());
        world.spawnEntityInWorld((Entity) iprojectile);
    } else {
        // dispense item as item because it doesn't match
        BehaviorDefaultDispenseItem.doDispense(world, stack, 6, enumfacing, iposition);
    }
    return par2ItemStack;
}
 
开发者ID:meew0,项目名称:AdvancedPotions,代码行数:20,代码来源:BehaviorAdvancedProjectileDispense.java

示例2: dispenseStack

import net.minecraft.block.BlockDispenser; //导入方法依赖的package包/类
public ItemStack dispenseStack(IBlockSource blockSource, ItemStack stack) {
	if (NBTHelper.hasTag(stack, "identifier")) {
		World world = blockSource.getWorld();
		IPosition iposition = BlockDispenser.func_149939_a(blockSource);
		EnumFacing enumfacing = BlockDispenser.func_149937_b(blockSource.getBlockMetadata());
		EntityNanoBotSwarm iprojectile = new EntityNanoBotSwarm(world, iposition.getX(), iposition.getY(), iposition.getZ());
		iprojectile.antennaIdentifier = UUID.fromString(NBTHelper.getString(stack, "identifier"));
		if (NBTHelper.hasTag(stack, "label"))
			iprojectile.label = NBTHelper.getString(stack, "label");
		iprojectile.setThrowableHeading((double) enumfacing.getFrontOffsetX(), (double) ((float) enumfacing.getFrontOffsetY()+0.1F), (double) enumfacing.getFrontOffsetZ(), this.func_82500_b(), this.func_82498_a());
		world.spawnEntityInWorld(iprojectile);
		stack.splitStack(1);
	} else {
		return super.dispenseStack(blockSource, stack);
	}
	return stack;
}
 
开发者ID:austinv11,项目名称:PeripheralsPlusPlus,代码行数:18,代码来源:ItemNanoSwarm.java

示例3: dispenseStack

import net.minecraft.block.BlockDispenser; //导入方法依赖的package包/类
/**
 * Dispense the specified stack, play the dispense sound and spawn particles.
 */
public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack)
{
    World var3 = par1IBlockSource.getWorld();
    IPosition var4 = BlockDispenser.func_149939_a(par1IBlockSource);
    EnumFacing var5 = BlockDispenser.func_149937_b(par1IBlockSource.getBlockMetadata());
    IProjectile var6 = this.getProjectileEntity(var3, var4);
    var6.setThrowableHeading((double)var5.getFrontOffsetX(), (double)((float)var5.getFrontOffsetY() + 0.1F), (double)var5.getFrontOffsetZ(), this.func_82500_b(), this.func_82498_a());
    var3.spawnEntityInWorld((Entity)var6);
    par2ItemStack.splitStack(1);
    return par2ItemStack;
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:15,代码来源:BehaviorProjectileDispense.java

示例4: dispenseStack

import net.minecraft.block.BlockDispenser; //导入方法依赖的package包/类
/**
 * Dispense the specified stack, play the dispense sound and spawn particles.
 */
protected ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack)
{
    EnumFacing var3 = BlockDispenser.func_149937_b(par1IBlockSource.getBlockMetadata());
    IPosition var4 = BlockDispenser.func_149939_a(par1IBlockSource);
    ItemStack var5 = par2ItemStack.splitStack(1);
    doDispense(par1IBlockSource.getWorld(), var5, 6, var3, var4);
    return par2ItemStack;
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:12,代码来源:BehaviorDefaultDispenseItem.java

示例5: spawnDispenseParticles

import net.minecraft.block.BlockDispenser; //导入方法依赖的package包/类
@Override
protected void spawnDispenseParticles(IBlockSource blocksource, EnumFacing face)
{
	super.spawnDispenseParticles(blocksource, face);
	if (!normalDispense)
	{
		IPosition pos = BlockDispenser.func_149939_a(blocksource);
		blocksource.getWorld().spawnParticle("flame", pos.getX() + face.getFrontOffsetX(), pos.getY(), pos.getZ() + face.getFrontOffsetZ(), 0.0D, 0.0D, 0.0D);
	}
}
 
开发者ID:Ckathode,项目名称:balkons-weaponmod,代码行数:11,代码来源:DispenseCannonBall.java

示例6: spawnDispenseParticles

import net.minecraft.block.BlockDispenser; //导入方法依赖的package包/类
@Override
protected void spawnDispenseParticles(IBlockSource blocksource, EnumFacing face)
{
	super.spawnDispenseParticles(blocksource, face);
	IPosition pos = BlockDispenser.func_149939_a(blocksource);
	blocksource.getWorld().spawnParticle("flame", pos.getX() + face.getFrontOffsetX(), pos.getY() + face.getFrontOffsetY(), pos.getZ() + face.getFrontOffsetZ(), 0.0D, 0.2D, 0.0D);
}
 
开发者ID:Ckathode,项目名称:balkons-weaponmod,代码行数:8,代码来源:DispenseMusketBullet.java

示例7: dispenseStack

import net.minecraft.block.BlockDispenser; //导入方法依赖的package包/类
@Override
public ItemStack dispenseStack(IBlockSource blocksource, ItemStack itemstack)
{
	EnumFacing face = EnumFacing.getFront(blocksource.getBlockMetadata());
	
	IPosition pos = BlockDispenser.func_149939_a(blocksource);
	EntityBlunderShot.fireFromDispenser(blocksource.getWorld(), pos.getX() + face.getFrontOffsetX(), pos.getY() + face.getFrontOffsetY(), pos.getZ() + face.getFrontOffsetZ(), face.getFrontOffsetX(), face.getFrontOffsetY(), face.getFrontOffsetZ());
	itemstack.splitStack(1);
	return itemstack;
}
 
开发者ID:Ckathode,项目名称:balkons-weaponmod,代码行数:11,代码来源:DispenseBlunderShot.java

示例8: spawnDispenseParticles

import net.minecraft.block.BlockDispenser; //导入方法依赖的package包/类
@Override
protected void spawnDispenseParticles(IBlockSource blocksource, EnumFacing face)
{
	super.spawnDispenseParticles(blocksource, face);
	IPosition pos = BlockDispenser.func_149939_a(blocksource);
	blocksource.getWorld().spawnParticle("flame", pos.getX() + face.getFrontOffsetX(), pos.getY() + face.getFrontOffsetY(), pos.getZ() + face.getFrontOffsetZ(), 0.0D, 0.0D, 0.0D);
}
 
开发者ID:Ckathode,项目名称:balkons-weaponmod,代码行数:8,代码来源:DispenseBlunderShot.java

示例9: dispenseStack

import net.minecraft.block.BlockDispenser; //导入方法依赖的package包/类
@Override
public ItemStack dispenseStack(IBlockSource blocksource, ItemStack itemstack)
{
	World world = blocksource.getWorld();
	IPosition pos = BlockDispenser.func_149939_a(blocksource);
	EnumFacing face = BlockDispenser.func_149937_b(blocksource.getBlockMetadata());
	IProjectile projectile = getProjectileEntity(world, pos, itemstack);
	projectile.setThrowableHeading(face.getFrontOffsetX(), face.getFrontOffsetY() + getYVel(), face.getFrontOffsetZ(), getVelocity(), getDeviation());
	world.spawnEntityInWorld((Entity) projectile);
	itemstack.splitStack(1);
	return itemstack;
}
 
开发者ID:Ckathode,项目名称:balkons-weaponmod,代码行数:13,代码来源:DispenseWeaponProjectile.java

示例10: dispenseStack

import net.minecraft.block.BlockDispenser; //导入方法依赖的package包/类
protected ItemStack dispenseStack(IBlockSource p_82487_1_, ItemStack p_82487_2_)
{
    EnumFacing enumfacing = BlockDispenser.func_149937_b(p_82487_1_.getBlockMetadata());
    IPosition iposition = BlockDispenser.func_149939_a(p_82487_1_);
    ItemStack itemstack1 = p_82487_2_.splitStack(1);
    // CraftBukkit start
    if (!doDispense(p_82487_1_.getWorld(), itemstack1, 6, enumfacing, p_82487_1_))
    {
       p_82487_2_.stackSize++;
    }

    // CraftBukkit end
    return p_82487_2_;
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:15,代码来源:BehaviorDefaultDispenseItem.java

示例11: dispenseStack

import net.minecraft.block.BlockDispenser; //导入方法依赖的package包/类
public ItemStack dispenseStack(IBlockSource p_82487_1_, ItemStack p_82487_2_)
{
    World world = p_82487_1_.getWorld();
    IPosition iposition = BlockDispenser.func_149939_a(p_82487_1_);
    EnumFacing enumfacing = BlockDispenser.func_149937_b(p_82487_1_.getBlockMetadata());
    IProjectile iprojectile = this.getProjectileEntity(world, iposition);
    iprojectile.setThrowableHeading((double)enumfacing.getFrontOffsetX(), (double)((float)enumfacing.getFrontOffsetY() + 0.1F), (double)enumfacing.getFrontOffsetZ(), this.func_82500_b(), this.func_82498_a());
    world.spawnEntityInWorld((Entity)iprojectile);
    p_82487_2_.splitStack(1);
    return p_82487_2_;
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:12,代码来源:BehaviorProjectileDispense.java

示例12: dispenseStack

import net.minecraft.block.BlockDispenser; //导入方法依赖的package包/类
protected ItemStack dispenseStack(IBlockSource p_82487_1_, ItemStack p_82487_2_)
{
    EnumFacing enumfacing = BlockDispenser.func_149937_b(p_82487_1_.getBlockMetadata());
    IPosition iposition = BlockDispenser.func_149939_a(p_82487_1_);
    ItemStack itemstack1 = p_82487_2_.splitStack(1);
    doDispense(p_82487_1_.getWorld(), itemstack1, 6, enumfacing, iposition);
    return p_82487_2_;
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:9,代码来源:BehaviorDefaultDispenseItem.java

示例13: dispenseStack

import net.minecraft.block.BlockDispenser; //导入方法依赖的package包/类
@Override
public ItemStack dispenseStack(IBlockSource blocksource, ItemStack itemstack)
{
	boolean canfire = false;
	normalDispense = false;
	TileEntity tileentity = blocksource.getWorld().getTileEntity(MathHelper.floor_double(blocksource.getXInt()), MathHelper.floor_double(blocksource.getYInt()), MathHelper.floor_double(blocksource.getZInt()));
	if (tileentity instanceof TileEntityDispenser)
	{
		TileEntityDispenser dispenser = ((TileEntityDispenser) tileentity);
		Item itemtocheck = null;
		if (itemstack.getItem() == Items.gunpowder)
		{
			itemtocheck = BalkonsWeaponMod.cannonBall;
		} else if (itemstack.getItem() == BalkonsWeaponMod.cannonBall)
		{
			itemtocheck = Items.gunpowder;
		}
		
		for (int i = 0; i < dispenser.getSizeInventory(); i++)
		{
			ItemStack itemstack1 = dispenser.getStackInSlot(i);
			if (itemstack1 != null && itemstack1.getItem() == itemtocheck)
			{
				dispenser.decrStackSize(i, 1);
				canfire = true;
				break;
			}
		}
	}
	
	if (!canfire)
	{
		normalDispense = true;
		return super.dispenseStack(blocksource, itemstack);
	}
	
	EnumFacing face = BlockDispenser.func_149937_b(blocksource.getBlockMetadata());
	double xvel = face.getFrontOffsetX() * 1.5D;
	double yvel = face.getFrontOffsetY() * 1.5D;
	double zvel = face.getFrontOffsetZ() * 1.5D;
	IPosition pos = BlockDispenser.func_149939_a(blocksource);
	
	EntityCannonBall entitycannonball = new EntityCannonBall(blocksource.getWorld(), pos.getX() + xvel, pos.getY() + yvel, pos.getZ() + zvel);
	entitycannonball.setThrowableHeading(xvel, yvel + 0.15D, zvel, 2.0F, 2.0F);
	blocksource.getWorld().spawnEntityInWorld(entitycannonball);
	itemstack.splitStack(1);
	return itemstack;
}
 
开发者ID:Ckathode,项目名称:balkons-weaponmod,代码行数:49,代码来源:DispenseCannonBall.java

示例14: dispenseStack

import net.minecraft.block.BlockDispenser; //导入方法依赖的package包/类
public ItemStack dispenseStack(IBlockSource p_82487_1_, ItemStack p_82487_2_)
{
    World world = p_82487_1_.getWorld();
    IPosition iposition = BlockDispenser.func_149939_a(p_82487_1_);
    EnumFacing enumfacing = BlockDispenser.func_149937_b(p_82487_1_.getBlockMetadata());
    IProjectile iprojectile = this.getProjectileEntity(world, iposition);
    // CraftBukkit start
    ItemStack itemstack1 = p_82487_2_.splitStack(1);
    org.bukkit.block.Block block = world.getWorld().getBlockAt(p_82487_1_.getXInt(), p_82487_1_.getYInt(), p_82487_1_.getZInt());
    CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
    BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector((double) enumfacing.getFrontOffsetX(), (double)((float) enumfacing.getFrontOffsetY() + 0.1F), (double) enumfacing.getFrontOffsetZ()));

    if (!BlockDispenser.eventFired)
    {
        world.getServer().getPluginManager().callEvent(event);
    }

    if (event.isCancelled())
    {
        p_82487_2_.stackSize++;
        return p_82487_2_;
    }

    if (!event.getItem().equals(craftItem))
    {
        p_82487_2_.stackSize++;
        // Chain to handler for new item
        ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
        IBehaviorDispenseItem ibehaviordispenseitem = (IBehaviorDispenseItem) BlockDispenser.dispenseBehaviorRegistry.getObject(eventStack.getItem());

        if (ibehaviordispenseitem != IBehaviorDispenseItem.itemDispenseBehaviorProvider && ibehaviordispenseitem != this)
        {
            ibehaviordispenseitem.dispense(p_82487_1_, eventStack);
            return p_82487_2_;
        }
    }

    iprojectile.setThrowableHeading((double)enumfacing.getFrontOffsetX(), (double)((float)enumfacing.getFrontOffsetY() + 0.1F), (double)enumfacing.getFrontOffsetZ(), this.func_82500_b(), this.func_82498_a());
    ((Entity) iprojectile).projectileSource = new org.bukkit.craftbukkit.projectiles.CraftBlockProjectileSource((TileEntityDispenser) p_82487_1_.getBlockTileEntity());
    // CraftBukkit end
    world.spawnEntityInWorld((Entity)iprojectile);
    // p_82487_2_.splitStack(1); // CraftBukkit - Handled during event processing
    return p_82487_2_;
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:45,代码来源:BehaviorProjectileDispense.java

示例15: doDispense

import net.minecraft.block.BlockDispenser; //导入方法依赖的package包/类
public static boolean doDispense(World world, ItemStack itemstack, int i, EnumFacing enumfacing, IBlockSource iblocksource)
{
    IPosition iposition = BlockDispenser.func_149939_a(iblocksource);
    // CraftBukkit end
    double d0 = iposition.getX();
    double d1 = iposition.getY();
    double d2 = iposition.getZ();
    EntityItem entityitem = new EntityItem(world, d0, d1 - 0.3D, d2, itemstack);
    double d3 = world.rand.nextDouble() * 0.1D + 0.2D;
    entityitem.motionX = (double) enumfacing.getFrontOffsetX() * d3;
    entityitem.motionY = 0.20000000298023224D;
    entityitem.motionZ = (double) enumfacing.getFrontOffsetZ() * d3;
    entityitem.motionX += world.rand.nextGaussian() * 0.007499999832361937D * (double) i;
    entityitem.motionY += world.rand.nextGaussian() * 0.007499999832361937D * (double) i;
    entityitem.motionZ += world.rand.nextGaussian() * 0.007499999832361937D * (double) i;
    // CraftBukkit start
    org.bukkit.block.Block block = world.getWorld().getBlockAt(iblocksource.getXInt(), iblocksource.getYInt(), iblocksource.getZInt());
    CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack);
    BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(entityitem.motionX, entityitem.motionY, entityitem.motionZ));

    if (!BlockDispenser.eventFired)
    {
        world.getServer().getPluginManager().callEvent(event);
    }

    if (event.isCancelled())
    {
        return false;
    }

    entityitem.setEntityItemStack(CraftItemStack.asNMSCopy(event.getItem()));
    entityitem.motionX = event.getVelocity().getX();
    entityitem.motionY = event.getVelocity().getY();
    entityitem.motionZ = event.getVelocity().getZ();

    if (!event.getItem().equals(craftItem))
    {
        // Chain to handler for new item
        ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
        IBehaviorDispenseItem ibehaviordispenseitem = (IBehaviorDispenseItem) BlockDispenser.dispenseBehaviorRegistry.getObject(eventStack.getItem());

        if (ibehaviordispenseitem != IBehaviorDispenseItem.itemDispenseBehaviorProvider && ibehaviordispenseitem.getClass() != BehaviorDefaultDispenseItem.class)
        {
            ibehaviordispenseitem.dispense(iblocksource, eventStack);
        }
        else
        {
            world.spawnEntityInWorld(entityitem);
        }

        return false;
    }

    world.spawnEntityInWorld(entityitem);
    return true;
    // CraftBukkit end
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:58,代码来源:BehaviorDefaultDispenseItem.java


注:本文中的net.minecraft.block.BlockDispenser.func_149939_a方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。