当前位置: 首页>>代码示例>>Java>>正文


Java Entity.getPosition方法代码示例

本文整理汇总了Java中net.minecraft.entity.Entity.getPosition方法的典型用法代码示例。如果您正苦于以下问题:Java Entity.getPosition方法的具体用法?Java Entity.getPosition怎么用?Java Entity.getPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.entity.Entity的用法示例。


在下文中一共展示了Entity.getPosition方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPos

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
public static BlockPos getPos(Entity ent) {
    return ent.getPosition();
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:4,代码来源:ZWrapper.java

示例2: render

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
@Override
public void render(float partialTicks, WorldClient world, Minecraft mc)
{
	if (((ExPWorld)IExPWorld.of(world)).rainTicksRemaining <= 0)
	{
		return;
	}
	
	GlStateManager.depthMask(true);
	Vec3d offset = IExPWorld.of(world).getWindDirection();
	offset = offset.scale(IExPWorld.of(world).getWindStrength() / 3);
	float wStr = IExPWorld.of(world).getWindStrength();
	Random rand = new Random();
	GlStateManager.disableCull();
	GlStateManager.enableBlend();
       GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
       GlStateManager.alphaFunc(516, 0.1F);
	mc.renderEngine.bindTexture(ExPTextures.WEATHER);
	Entity entity = mc.getRenderViewEntity();
	double d0 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double)partialTicks;
       double d1 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double)partialTicks;
       double d2 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double)partialTicks;
       BlockPos pos = entity.getPosition();
	BufferBuilder vb = Tessellator.getInstance().getBuffer();
	vb.setTranslation(-d0, -d1, -d2);
	vb.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
	int x = pos.getX();
	int y = pos.getY();
	int z = pos.getZ();
	for (int dx = -8; dx <= 8; ++dx)
	{
		for (int dz = -8; dz <= 8; ++dz)
		{
			rand.setSeed(MathHelper.getCoordinateRandom(x + dx, 0, z + dz));
			int py = world.getPrecipitationHeight(pos.add(dx, 0, dz)).getY();
			py = Math.max(py, y - 8);
			double offsetYTex = rand.nextDouble() + (float)(world.getWorldTime() % 10) / 10 + partialTicks / 10;
			BlockPos renderedAt = new BlockPos(x + dx, py, z + dz);
			double offsetXTex = Helpers.getTemperatureAt(world, renderedAt) < 0 ? 0.5 : 0;
			float rOffX = rand.nextFloat() / 10;
			float rOffZ = rand.nextFloat() / 10;
			
			if (offsetXTex == 0.5)
			{
				float texOf = Math.max(2, 55 - wStr);
				offsetYTex = rand.nextDouble() + world.getWorldTime() % texOf / texOf + partialTicks / texOf;
			}
			
			int j3 = world.getCombinedLight(renderedAt, 0);
               int k3 = j3 >> 16 & 65535;
               int l3 = j3 & 65535;
			vb.pos(rOffX + x + 1 + dx - offset.x, py + 16, rOffZ + z + dz + 0.5 - offset.z).tex(offsetXTex, offsetYTex + 4).color(1, 1, 1, 0.5F).lightmap(k3, l3).endVertex();
			vb.pos(rOffX + x + dx - offset.x, py + 16, rOffZ + z + dz + 0.5 - offset.z).tex(offsetXTex + 0.5, offsetYTex + 4).color(1, 1, 1, 0.5F).lightmap(k3, l3).endVertex();
			vb.pos(rOffX + x + dx, py, rOffZ + z + dz + 0.5).tex(offsetXTex + 0.5, offsetYTex).color(1, 1, 1, 0.5F).lightmap(k3, l3).endVertex();
			vb.pos(rOffX + x + 1 + dx, py, rOffZ + z + dz + 0.5).tex(offsetXTex, offsetYTex).color(1, 1, 1, 0.5F).lightmap(k3, l3).endVertex();
			vb.pos(rOffX + x + 0.5 + dx - offset.x, py + 16, rOffZ + z + dz + 1 - offset.z).tex(offsetXTex, offsetYTex + 4).color(1, 1, 1, 0.5F).lightmap(k3, l3).endVertex();
			vb.pos(rOffX + x + 0.5 + dx - offset.x, py + 16, rOffZ + z + dz - offset.z).tex(offsetXTex + 0.5, offsetYTex + 4).color(1, 1, 1, 0.5F).lightmap(k3, l3).endVertex();
			vb.pos(rOffX + x + 0.5 + dx , py, rOffZ + z + dz).tex(offsetXTex + 0.5, offsetYTex).color(1, 1, 1, 0.5F).lightmap(k3, l3).endVertex();
			vb.pos(rOffX + x + 0.5 + dx, py, z + rOffZ + dz + 1).tex(offsetXTex, offsetYTex).color(1, 1, 1, 0.5F).lightmap(k3, l3).endVertex();
		}
	}
	
	Tessellator.getInstance().draw();
	vb.setTranslation(0, 0, 0);
	GlStateManager.enableCull();
       GlStateManager.disableBlend();
       GlStateManager.alphaFunc(516, 0.1F);
       GlStateManager.depthMask(false);
}
 
开发者ID:V0idWa1k3r,项目名称:ExPetrum,代码行数:70,代码来源:WorldWeatherRenderer.java


注:本文中的net.minecraft.entity.Entity.getPosition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。