本文整理汇总了Java中net.minecraft.dispenser.IPosition.getZ方法的典型用法代码示例。如果您正苦于以下问题:Java IPosition.getZ方法的具体用法?Java IPosition.getZ怎么用?Java IPosition.getZ使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.dispenser.IPosition
的用法示例。
在下文中一共展示了IPosition.getZ方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dispenseStack
import net.minecraft.dispenser.IPosition; //导入方法依赖的package包/类
@Override
public ItemStack dispenseStack(IBlockSource source, ItemStack stack) {
World world = source.getWorld();
BlockPos pos = source.getBlockPos();
Vec3d pos2 = new Vec3d(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
Vec3d dir = this.getNearestTargetDirection(world, pos);
if(dir == null) return null;
IPosition ipos = new PositionImpl(pos2.x + dir.x * .75, pos2.y + dir.y * .75, pos2.z + dir.z * .75);
double d0 = ipos.getX();
double d1 = ipos.getY();
double d2 = ipos.getZ();
Random random = world.rand;
double d3 = random.nextGaussian() * 0.05D + dir.x;
double d4 = random.nextGaussian() * 0.05D + dir.y;
double d5 = random.nextGaussian() * 0.05D + dir.z;
world.spawnEntity(new EntitySmallFireball(world, d0, d1, d2, d3, d4, d5));
stack.splitStack(1);
return stack;
}
示例2: doDispense
import net.minecraft.dispenser.IPosition; //导入方法依赖的package包/类
public static void doDispense(World worldIn, ItemStack stack, int speed, EnumFacing facing, IPosition position) {
double d0 = position.getX();
double d1 = position.getY();
double d2 = position.getZ();
if (facing.getAxis() == EnumFacing.Axis.Y) {
d1 = d1 - 0.125D;
}
else {
d1 = d1 - 0.15625D;
}
EntityItem entityitem = new EntityItem(worldIn, d0, d1, d2, stack);
double d3 = worldIn.rand.nextDouble() * 0.1D + 0.2D;
entityitem.motionX = (double) facing.getFrontOffsetX() * d3;
entityitem.motionY = 0.20000000298023224D;
entityitem.motionZ = (double) facing.getFrontOffsetZ() * d3;
entityitem.motionX += worldIn.rand.nextGaussian() * 0.007499999832361937D * (double) speed;
entityitem.motionY += worldIn.rand.nextGaussian() * 0.007499999832361937D * (double) speed;
entityitem.motionZ += worldIn.rand.nextGaussian() * 0.007499999832361937D * (double) speed;
worldIn.spawnEntity(entityitem);
}
示例3: dispenseStack
import net.minecraft.dispenser.IPosition; //导入方法依赖的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;
}
示例4: dispenseStack
import net.minecraft.dispenser.IPosition; //导入方法依赖的package包/类
/**
* Dispense the specified stack, play the dispense sound and spawn particles.
*/
public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack)
{
EnumFacing enumfacing = BlockTrap.getFacing(par1IBlockSource.getBlockMetadata());
IPosition iposition = BlockTrap.getIPositionFromBlockSource(par1IBlockSource);
double d0 = iposition.getX() + (double)((float)enumfacing.getFrontOffsetX() * 0.3F);
double d1 = iposition.getY() + (double)((float)enumfacing.getFrontOffsetX() * 0.3F);
double d2 = iposition.getZ() + (double)((float)enumfacing.getFrontOffsetZ() * 0.3F);
World world = par1IBlockSource.getWorld();
Random random = world.rand;
double d3 = random.nextGaussian() * 0.05D + (double)enumfacing.getFrontOffsetX();
double d4 = random.nextGaussian() * 0.05D + (double)enumfacing.getFrontOffsetY();
double d5 = random.nextGaussian() * 0.05D + (double)enumfacing.getFrontOffsetZ();
world.spawnEntityInWorld(new EntitySmallFireball(world, d0, d1, d2, d3, d4, d5));
par2ItemStack.splitStack(1);
return par2ItemStack;
}
示例5: dispense
import net.minecraft.dispenser.IPosition; //导入方法依赖的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) {}
}
}
}
}
示例6: dispenseStack
import net.minecraft.dispenser.IPosition; //导入方法依赖的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;
}
示例7: getProjectileEntity
import net.minecraft.dispenser.IPosition; //导入方法依赖的package包/类
/**
* Return the projectile entity spawned by this dispense behavior.
*/
protected IProjectile getProjectileEntity(World world, IPosition pos, int meta)
{
EntityArrowMF arrow = new EntityArrowMF(world, pos.getX(), pos.getY(), pos.getZ(), meta);
arrow.canBePickedUp = 1;
return arrow;
}
示例8: getProjectileEntity
import net.minecraft.dispenser.IPosition; //导入方法依赖的package包/类
/**
* Return the projectile entity spawned by this dispense behavior.
*/
protected IProjectile getProjectileEntity(World world, IPosition pos, int meta)
{
EntityBoltMF bolt = new EntityBoltMF(world, pos.getX(), pos.getY(), pos.getZ(), meta);
bolt.canBePickedUp = 1;
return bolt;
}
示例9: getProjectileEntity
import net.minecraft.dispenser.IPosition; //导入方法依赖的package包/类
/**
* Return the projectile entity spawned by this dispense behavior.
*/
protected IProjectile getProjectileEntity(World par1World, IPosition par2IPosition)
{
/*EntityArrow entityarrow = new EntityArrow(par1World, par2IPosition.getX(), par2IPosition.getY(), par2IPosition.getZ());
entityarrow.canBePickedUp = 1;
entityarrow.setDamage(6);
return entityarrow;*/
EntitySpecialArrow entityarrow = new EntitySpecialArrow(par1World, par2IPosition.getX(), par2IPosition.getY(), par2IPosition.getZ(), 2);
entityarrow.canBePickedUp = 1;
return entityarrow;
}
示例10: EntityYa
import net.minecraft.dispenser.IPosition; //导入方法依赖的package包/类
public EntityYa(World worldIn, IPosition pos) {
super(worldIn, pos.getX(), pos.getY(), pos.getZ());
}
示例11: EntityGreatarrow
import net.minecraft.dispenser.IPosition; //导入方法依赖的package包/类
public EntityGreatarrow(World worldIn, IPosition pos) {
super(worldIn, pos.getX(), pos.getY(), pos.getZ());
}
示例12: getProjectileEntity
import net.minecraft.dispenser.IPosition; //导入方法依赖的package包/类
@Override
protected IProjectile getProjectileEntity(World world, IPosition position, ItemStack stackIn) {
return new EntityTomato(world, position.getX(), position.getY(), position.getZ());
}
示例13: convertIposToBlockpos
import net.minecraft.dispenser.IPosition; //导入方法依赖的package包/类
public static BlockPos convertIposToBlockpos(IPosition here) {
return new BlockPos(here.getX(), here.getY(), here.getZ());
}
示例14: getProjectileEntity
import net.minecraft.dispenser.IPosition; //导入方法依赖的package包/类
@Override
protected IProjectile getProjectileEntity(World worldIn, IPosition pos)
{
return new EntityIceball(worldIn, pos.getX(), pos.getY(), pos.getZ(), 0, 0, 0.1);
}
示例15: getProjectileEntity
import net.minecraft.dispenser.IPosition; //导入方法依赖的package包/类
@Override
protected IProjectile getProjectileEntity(World worldIn, IPosition pos)
{
return new EntityMudBall(worldIn, pos.getX(), pos.getY(), pos.getZ());
}