本文整理了Java中net.minecraft.util.math.BlockPos.getZ()
方法的一些代码示例,展示了BlockPos.getZ()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BlockPos.getZ()
方法的具体详情如下:
包路径:net.minecraft.util.math.BlockPos
类名称:BlockPos
方法名:getZ
暂无
代码示例来源:origin: EngineHub/WorldEdit
public static BlockVector3 adapt(BlockPos pos) {
return BlockVector3.at(pos.getX(), pos.getY(), pos.getZ());
}
代码示例来源:origin: Vazkii/Botania
@Override
public void recieveMana(int mana) {
if(mana > 0)
for(int i = 0; i < 10; i++)
Botania.proxy.sparkleFX(pos.getX() + Math.random(), pos.getY() + Math.random(), pos.getZ() + Math.random(), 0.2F, 0.2F, 0.2F, 0.7F + 0.5F * (float) Math.random(), 5);
}
代码示例来源:origin: Vazkii/Botania
boolean checkAll(BlockPos[] relPositions, Block block) {
for (BlockPos position : relPositions) {
if(!checkPlatform(position.getX(), position.getZ(), block))
return false;
}
return true;
}
代码示例来源:origin: EngineHub/WorldEdit
Location pos = new Location(world, event.getPos().getX(), event.getPos().getY(), event.getPos().getZ());
Location pos = new Location(world, event.getPos().getX(), event.getPos().getY(), event.getPos().getZ());
代码示例来源:origin: Vazkii/Botania
private boolean inRange(BlockPos pos, BlockPos srcPos, int range, double heightscale, boolean pointy) {
if(pos.getY() >= srcPos.getY())
return MathHelper.pointDistanceSpace(pos.getX(), 0, pos.getZ(), srcPos.getX(), 0, srcPos.getZ()) < range;
else if(!pointy)
return MathHelper.pointDistanceSpace(pos.getX(), pos.getY() / heightscale, pos.getZ(), srcPos.getX(), srcPos.getY() / heightscale, srcPos.getZ()) < range;
else return MathHelper.pointDistanceSpace(pos.getX(), 0, pos.getZ(), srcPos.getX(), 0, srcPos.getZ()) < range - (srcPos.getY() - pos.getY()) / heightscale;
}
代码示例来源:origin: Vazkii/Botania
@SideOnly(Side.CLIENT)
@Override
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
int hex = state.getValue(BotaniaStateProps.COLOR).getColorValue();
int r = (hex & 0xFF0000) >> 16;
int g = (hex & 0xFF00) >> 8;
int b = hex & 0xFF;
if(rand.nextDouble() < ConfigHandler.flowerParticleFrequency)
Botania.proxy.sparkleFX(pos.getX() + 0.3 + rand.nextFloat() * 0.5, pos.getY() + 0.5 + rand.nextFloat() * 0.5, pos.getZ() + 0.3 + rand.nextFloat() * 0.5, r / 255F, g / 255F, b / 255F, rand.nextFloat(), 5);
}
代码示例来源:origin: Vazkii/Botania
private static int getGaiaGuardiansAround(World world, BlockPos source) {
float range = 15F;
List l = world.getEntitiesWithinAABB(EntityDoppleganger.class, new AxisAlignedBB(source.getX() + 0.5 - range, source.getY() + 0.5 - range, source.getZ() + 0.5 - range, source.getX() + 0.5 + range, source.getY() + 0.5 + range, source.getZ() + 0.5 + range));
return l.size();
}
代码示例来源:origin: Vazkii/Botania
@Override
public ISparkEntity getAttachedSpark() {
List<Entity> sparks = world.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(pos.getX(), pos.getY() + 1, pos.getZ(), pos.getX() + 1, pos.getY() + 2, pos.getZ() + 1), Predicates.instanceOf(ISparkEntity.class));
if(sparks.size() == 1) {
Entity e = sparks.get(0);
return (ISparkEntity) e;
}
return null;
}
代码示例来源:origin: Vazkii/Botania
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
state = getActualState(state, world, pos);
int hex = state.getValue(second ? BotaniaStateProps.DOUBLEFLOWER_VARIANT_2 : BotaniaStateProps.DOUBLEFLOWER_VARIANT_1).getColorValue();
int r = (hex & 0xFF0000) >> 16;
int g = (hex & 0xFF00) >> 8;
int b = hex & 0xFF;
if(rand.nextDouble() < ConfigHandler.flowerParticleFrequency)
Botania.proxy.sparkleFX(pos.getX() + 0.3 + rand.nextFloat() * 0.5, pos.getY() + 0.5 + rand.nextFloat() * 0.5, pos.getZ() + 0.3 + rand.nextFloat() * 0.5, r / 255F, g / 255F, b / 255F, rand.nextFloat(), 5);
}
代码示例来源:origin: Vazkii/Botania
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
TileEntity tile = world.getTileEntity(pos);
if(tile instanceof TileTinyPotato) {
((TileTinyPotato) tile).interact(player, hand, player.getHeldItem(hand), par6);
world.spawnParticle(EnumParticleTypes.HEART, pos.getX() + AABB.minX + Math.random() * (AABB.maxX - AABB.minX), pos.getY() + AABB.maxY, pos.getZ() + AABB.minZ + Math.random() * (AABB.maxZ - AABB.minZ), 0, 0 ,0);
}
return true;
}
代码示例来源:origin: Vazkii/Botania
private void particles(World world, BlockPos pos, Entity entity) {
if(world instanceof WorldServer) {
WorldServer ws = (WorldServer) world;
ws.spawnParticle(EnumParticleTypes.EXPLOSION_NORMAL, entity.posX + entity.width / 2, entity.posY + entity.height / 2, entity.posZ + entity.width / 2, 100, entity.width, entity.height, entity.width, 0.05);
ws.spawnParticle(EnumParticleTypes.PORTAL, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, 40, 0, 0, 0, 0.6);
}
}
代码示例来源:origin: Vazkii/Botania
@Override
public void breakBlock(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull IBlockState state) {
TileEnchanter enchanter = (TileEnchanter) world.getTileEntity(pos);
if(!enchanter.itemToEnchant.isEmpty()) {
world.spawnEntity(new EntityItem(world, pos.getX(), pos.getY(), pos.getZ(), enchanter.itemToEnchant));
}
world.updateComparatorOutputLevel(pos, state.getBlock());
super.breakBlock(world, pos, state);
}
代码示例来源:origin: Vazkii/Botania
@Nonnull
@Override
public NBTTagCompound writeToNBT(NBTTagCompound par1nbtTagCompound) {
NBTTagCompound ret = super.writeToNBT(par1nbtTagCompound);
ret.setInteger(TAG_FLOWER_X, flowerPos.getX());
ret.setInteger(TAG_FLOWER_Y, flowerPos.getY());
ret.setInteger(TAG_FLOWER_Z, flowerPos.getZ());
return ret;
}
代码示例来源:origin: Vazkii/Botania
private void keepInsideArena(EntityPlayer player) {
if(vazkii.botania.common.core.helper.MathHelper.pointDistanceSpace(player.posX, player.posY, player.posZ, source.getX() + 0.5, source.getY() + 0.5, source.getZ() + 0.5) >= ARENA_RANGE) {
Vector3 sourceVector = new Vector3(source.getX() + 0.5, source.getY() + 0.5, source.getZ() + 0.5);
Vector3 playerVector = Vector3.fromEntityCenter(player);
Vector3 motion = sourceVector.subtract(playerVector).normalize();
player.motionX = motion.x;
player.motionY = 0.2;
player.motionZ = motion.z;
player.velocityChanged = true;
}
}
代码示例来源:origin: Vazkii/Botania
@Override
public void writePacketNBT(NBTTagCompound cmp) {
cmp.setInteger(TAG_BIND_X, bindPos.getX());
cmp.setInteger(TAG_BIND_Y, bindPos.getY());
cmp.setInteger(TAG_BIND_Z, bindPos.getZ());
}
代码示例来源:origin: Vazkii/Botania
/**
* Returns the multiblock component for the coordinates, adjusted based on the anchor
*/
private MultiblockComponent getComponent(BlockPos pos) {
return multiblock.getComponentForLocation(pos.add(new BlockPos(-anchorPos.getX(), -anchorPos.getY(), -anchorPos.getZ())));
}
}
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
public long getSortValue()
{
final TileEntity te = this.iHost.getTileEntity();
return ( te.getPos().getZ() << 24 ) ^ ( te.getPos().getX() << 8 ) ^ te.getPos().getY();
}
代码示例来源:origin: Vazkii/Botania
@Override
public void writeToPacketNBT(NBTTagCompound cmp) {
super.writeToPacketNBT(cmp);
cmp.setInteger(TAG_BIND_X, bindPos.getX());
cmp.setInteger(TAG_BIND_Y, bindPos.getY());
cmp.setInteger(TAG_BIND_Z, bindPos.getZ());
}
代码示例来源:origin: Vazkii/Botania
public static void dispatchTEToNearbyPlayers(TileEntity tile) {
SPacketUpdateTileEntity packet = tile.getUpdatePacket();
if(packet != null && tile.getWorld() instanceof WorldServer) {
PlayerChunkMapEntry chunk = ((WorldServer) tile.getWorld()).getPlayerChunkMap().getEntry(tile.getPos().getX() >> 4, tile.getPos().getZ() >> 4);
if(chunk != null) {
chunk.sendPacket(packet);
}
}
}
代码示例来源:origin: Vazkii/Botania
public static void dropInventory(TileSimpleInventory inv, World world, IBlockState state, BlockPos pos) {
if(inv != null) {
for(int j1 = 0; j1 < inv.getSizeInventory(); ++j1) {
ItemStack itemstack = inv.getItemHandler().getStackInSlot(j1);
if(!itemstack.isEmpty()) {
net.minecraft.inventory.InventoryHelper.spawnItemStack(world, pos.getX(), pos.getY(), pos.getZ(), itemstack);
}
}
world.updateComparatorOutputLevel(pos, state.getBlock());
}
}
内容来源于网络,如有侵权,请联系作者删除!