當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。