本文整理匯總了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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) {}
}
}
}
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}