當前位置: 首頁>>代碼示例>>Java>>正文


Java BlockDispenser.getDispensePosition方法代碼示例

本文整理匯總了Java中net.minecraft.block.BlockDispenser.getDispensePosition方法的典型用法代碼示例。如果您正苦於以下問題:Java BlockDispenser.getDispensePosition方法的具體用法?Java BlockDispenser.getDispensePosition怎麽用?Java BlockDispenser.getDispensePosition使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.block.BlockDispenser的用法示例。


在下文中一共展示了BlockDispenser.getDispensePosition方法的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 source, ItemStack stack)
{
    World world = source.getWorld();
    IPosition iposition = BlockDispenser.getDispensePosition(source);
    EnumFacing enumfacing = BlockDispenser.getFacing(source.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);
    stack.splitStack(1);
    return stack;
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:15,代碼來源:BehaviorProjectileDispense.java

示例2: dispenseStack

import net.minecraft.block.BlockDispenser; //導入方法依賴的package包/類
/**
 * Dispense the specified stack, play the dispense sound and spawn particles.
 */
protected ItemStack dispenseStack(IBlockSource source, ItemStack stack)
{
    EnumFacing enumfacing = BlockDispenser.getFacing(source.getBlockMetadata());
    IPosition iposition = BlockDispenser.getDispensePosition(source);
    ItemStack itemstack = stack.splitStack(1);
    doDispense(source.getWorld(), itemstack, 6, enumfacing, iposition);
    return stack;
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:12,代碼來源:BehaviorDefaultDispenseItem.java

示例3: dispenseStack

import net.minecraft.block.BlockDispenser; //導入方法依賴的package包/類
/**
 * Dispense the specified stack, play the dispense sound and spawn particles.
 */
public ItemStack dispenseStack(IBlockSource source, ItemStack stack)
{
    World world = source.getWorld();
    IPosition iposition = BlockDispenser.getDispensePosition(source);
    EnumFacing enumfacing = (EnumFacing)source.getBlockState().getValue(BlockDispenser.FACING);
    IProjectile iprojectile = this.getProjectileEntity(world, iposition, stack);
    iprojectile.setThrowableHeading((double)enumfacing.getFrontOffsetX(), (double)((float)enumfacing.getFrontOffsetY() + 0.1F), (double)enumfacing.getFrontOffsetZ(), this.getProjectileVelocity(), this.getProjectileInaccuracy());
    world.spawnEntityInWorld((Entity)iprojectile);
    stack.func_190918_g(1);
    return stack;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數: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 source, ItemStack stack)
{
    EnumFacing enumfacing = (EnumFacing)source.getBlockState().getValue(BlockDispenser.FACING);
    IPosition iposition = BlockDispenser.getDispensePosition(source);
    ItemStack itemstack = stack.splitStack(1);
    doDispense(source.getWorld(), itemstack, 6, enumfacing, iposition);
    return stack;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:12,代碼來源:BehaviorDefaultDispenseItem.java

示例5: dispenseStack

import net.minecraft.block.BlockDispenser; //導入方法依賴的package包/類
/**
 * Dispense the specified stack, play the dispense sound and spawn particles.
 */
public ItemStack dispenseStack(IBlockSource source, ItemStack stack)
{
    World world = source.getWorld();
    IPosition iposition = BlockDispenser.getDispensePosition(source);
    EnumFacing enumfacing = (EnumFacing)source.getBlockState().getValue(BlockDispenser.FACING);
    IProjectile iprojectile = this.getProjectileEntity(world, iposition, stack);
    iprojectile.setThrowableHeading((double)enumfacing.getFrontOffsetX(), (double)((float)enumfacing.getFrontOffsetY() + 0.1F), (double)enumfacing.getFrontOffsetZ(), this.getProjectileVelocity(), this.getProjectileInaccuracy());
    world.spawnEntityInWorld((Entity)iprojectile);
    stack.splitStack(1);
    return stack;
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:15,代碼來源:BehaviorProjectileDispense.java

示例6: dispense

import net.minecraft.block.BlockDispenser; //導入方法依賴的package包/類
protected void dispense(World worldIn, BlockPos pos)
{
    BlockSourceImpl blocksourceimpl = new BlockSourceImpl(worldIn, pos);
    TileEntityDispenser tileentitydispenser = (TileEntityDispenser)blocksourceimpl.getBlockTileEntity();

    if (tileentitydispenser != null)
    {
        int i = tileentitydispenser.getDispenseSlot();
        	
        if (i < 0)
        {
            worldIn.playAuxSFX(1001, pos, 0);
        }
        else
        {
            ItemStack itemstack = tileentitydispenser.getStackInSlot(i);
            IBehaviorDispenseItem ibehaviordispenseitem = this.getBehavior(itemstack);

            if (ibehaviordispenseitem != IBehaviorDispenseItem.itemDispenseBehaviorProvider)
            {
            	try{
            	    IPosition iposition = BlockDispenser.getDispensePosition(blocksourceimpl);
            	    BlockPos pos1 = new BlockPos(iposition.getX(), iposition.getY(), iposition.getZ());
            		Block block = Block.getBlockFromItem(itemstack.getItem());
            		if (worldIn.canBlockBePlaced(block,pos1,true,BlockPistonBase.getFacing(1),en,itemstack)){
            	ItemStack itemstack1 = this.dispenseStack(blocksourceimpl, itemstack, worldIn);
            	worldIn.playSoundEffect(iposition.getX(), iposition.getY(), iposition.getZ(), block.stepSound.getPlaceSound(), 1.0f, 1.0f);
                if (block.getStateFromMeta(itemstack1.getMetadata())==worldIn.getBlockState(pos1))tileentitydispenser.setInventorySlotContents(i, itemstack1.stackSize == 0 ? null : itemstack1);
            	    }}
            	    catch (Exception e) {}
            }
        }
    }
}
 
開發者ID:ORCHARD-Minecraft-Mod-Class,項目名稱:RandomMine,代碼行數:35,代碼來源:BlockPlacer.java

示例7: dispenseStack

import net.minecraft.block.BlockDispenser; //導入方法依賴的package包/類
protected ItemStack dispenseStack(IBlockSource source, ItemStack stack,World worldIn)
{ 
	try{
    IPosition iposition = BlockDispenser.getDispensePosition(source);
    ItemStack itemstack1 = stack.splitStack(1);
    BlockPos pos = new BlockPos(iposition.getX(), iposition.getY(), iposition.getZ());
	Block block;
	block = Block.getBlockFromItem(itemstack1.getItem());
    if( worldIn.canBlockBePlaced(block,pos,true,BlockPistonBase.getFacing(1),en,itemstack1)){
    worldIn.setBlockState(pos, block.getStateFromMeta(itemstack1.getMetadata()));
    }}
	catch (Exception e) {return stack;}

    return stack;
}
 
開發者ID:ORCHARD-Minecraft-Mod-Class,項目名稱:RandomMine,代碼行數:16,代碼來源:BlockPlacer.java

示例8: spawnDispenseParticles

import net.minecraft.block.BlockDispenser; //導入方法依賴的package包/類
@Override
protected void spawnDispenseParticles(IBlockSource blocksource, EnumFacing face)
{
	super.spawnDispenseParticles(blocksource, face);
	IPosition pos = BlockDispenser.getDispensePosition(blocksource);
	blocksource.getWorld().spawnParticle(EnumParticleTypes.FLAME,
			pos.getX() + face.getFrontOffsetX(), pos.getY() + face.getFrontOffsetY(),
			pos.getZ() + face.getFrontOffsetZ(), 0.0D, 0.2D, 0.0D);
}
 
開發者ID:Archiving,項目名稱:ARKCraft-Code,代碼行數:10,代碼來源:DispenseRocketPropelledGrenade.java

示例9: spawnDispenseParticles

import net.minecraft.block.BlockDispenser; //導入方法依賴的package包/類
@Override
protected void spawnDispenseParticles(IBlockSource blocksource, EnumFacing face)
{
    super.spawnDispenseParticles(blocksource, face);
    IPosition pos = BlockDispenser.getDispensePosition(blocksource);
    blocksource.getWorld().spawnParticle(EnumParticleTypes.FLAME, pos.getX() + face.getFrontOffsetX(), pos.getY() + face.getFrontOffsetY(), pos.getZ() + face.getFrontOffsetZ(), 0.0D, 0.2D, 0.0D);
}
 
開發者ID:Archiving,項目名稱:ARKCraft-Code,代碼行數:8,代碼來源:DispenseSimpleRifleAmmo.java

示例10: dispenseStack

import net.minecraft.block.BlockDispenser; //導入方法依賴的package包/類
@Override
public ItemStack dispenseStack(IBlockSource blocksource, ItemStack itemstack)
{
    EnumFacing face = EnumFacing.getFront(blocksource.getBlockMetadata());

    IPosition pos = BlockDispenser.getDispensePosition(blocksource);
    EntitySimpleShotgunAmmo.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:Archiving,項目名稱:ARKCraft-Code,代碼行數:11,代碼來源:DispenseSimpleShotgunAmmo.java

示例11: spawnDispenseParticles

import net.minecraft.block.BlockDispenser; //導入方法依賴的package包/類
@Override
protected void spawnDispenseParticles(IBlockSource blocksource, EnumFacing face)
{
    super.spawnDispenseParticles(blocksource, face);
    IPosition pos = BlockDispenser.getDispensePosition(blocksource);
    blocksource.getWorld().spawnParticle(EnumParticleTypes.FLAME, pos.getX() + face.getFrontOffsetX(), pos.getY() + face.getFrontOffsetY(), pos.getZ() + face.getFrontOffsetZ(), 0.0D, 0.0D, 0.0D);
}
 
開發者ID:Archiving,項目名稱:ARKCraft-Code,代碼行數:8,代碼來源:DispenseSimpleShotgunAmmo.java

示例12: dispenseStack

import net.minecraft.block.BlockDispenser; //導入方法依賴的package包/類
@Override
public ItemStack dispenseStack(IBlockSource blocksource, ItemStack itemstack)
{
    World world = blocksource.getWorld();
    IPosition pos = BlockDispenser.getDispensePosition(blocksource);
    EnumFacing face = BlockDispenser.getFacing(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:Archiving,項目名稱:ARKCraft-Code,代碼行數:13,代碼來源:DispenseWeaponProjectile.java

示例13: spawnDispenseParticles

import net.minecraft.block.BlockDispenser; //導入方法依賴的package包/類
@Override
protected void spawnDispenseParticles(IBlockSource blocksource, EnumFacing face)
{
	super.spawnDispenseParticles(blocksource, face);
	if (!normalDispense)
	{
		IPosition pos = BlockDispenser.getDispensePosition(blocksource);
		blocksource.getWorld().spawnParticle(EnumParticleTypes.FLAME,
				pos.getX() + face.getFrontOffsetX(), pos.getY(),
				pos.getZ() + face.getFrontOffsetZ(), 0.0D, 0.0D, 0.0D);
	}
}
 
開發者ID:Archiving,項目名稱:ARKCraft-Code,代碼行數:13,代碼來源:DispenseBallistaBolt.java

示例14: dispenseStack

import net.minecraft.block.BlockDispenser; //導入方法依賴的package包/類
/**
 * Dispense the specified stack, play the dispense sound and spawn particles.
 */
public ItemStack dispenseStack(IBlockSource source, ItemStack stack)
{
    World world = source.getWorld();
    IPosition iposition = BlockDispenser.getDispensePosition(source);
    EnumFacing enumfacing = (EnumFacing)source.func_189992_e().getValue(BlockDispenser.FACING);
    IProjectile iprojectile = this.getProjectileEntity(world, iposition, stack);
    iprojectile.setThrowableHeading((double)enumfacing.getFrontOffsetX(), (double)((float)enumfacing.getFrontOffsetY() + 0.1F), (double)enumfacing.getFrontOffsetZ(), this.getProjectileVelocity(), this.getProjectileInaccuracy());
    world.spawnEntityInWorld((Entity)iprojectile);
    stack.splitStack(1);
    return stack;
}
 
開發者ID:BlazeAxtrius,項目名稱:ExpandedRailsMod,代碼行數:15,代碼來源:BehaviorProjectileDispense.java

示例15: dispenseStack

import net.minecraft.block.BlockDispenser; //導入方法依賴的package包/類
/**
 * Dispense the specified stack, play the dispense sound and spawn particles.
 */
protected ItemStack dispenseStack(IBlockSource source, ItemStack stack)
{
    EnumFacing enumfacing = (EnumFacing)source.func_189992_e().getValue(BlockDispenser.FACING);
    IPosition iposition = BlockDispenser.getDispensePosition(source);
    ItemStack itemstack = stack.splitStack(1);
    doDispense(source.getWorld(), itemstack, 6, enumfacing, iposition);
    return stack;
}
 
開發者ID:BlazeAxtrius,項目名稱:ExpandedRailsMod,代碼行數:12,代碼來源:BehaviorDefaultDispenseItem.java


注:本文中的net.minecraft.block.BlockDispenser.getDispensePosition方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。