本文整理汇总了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;
}