當前位置: 首頁>>代碼示例>>Java>>正文


Java BufferBuilder.setTranslation方法代碼示例

本文整理匯總了Java中net.minecraft.client.renderer.BufferBuilder.setTranslation方法的典型用法代碼示例。如果您正苦於以下問題:Java BufferBuilder.setTranslation方法的具體用法?Java BufferBuilder.setTranslation怎麽用?Java BufferBuilder.setTranslation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.client.renderer.BufferBuilder的用法示例。


在下文中一共展示了BufferBuilder.setTranslation方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: render

import net.minecraft.client.renderer.BufferBuilder; //導入方法依賴的package包/類
void render() {
	Tessellator tessellator = Tessellator.getInstance();
	BufferBuilder buff = tessellator.getBuffer();

	buff.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION_COLOR);
	buff.setTranslation(
			-TileEntityRendererDispatcher.staticPlayerX,
			-TileEntityRendererDispatcher.staticPlayerY,
			-TileEntityRendererDispatcher.staticPlayerZ
	);
	buff.pos(from.x, from.y, from.z).color(getRedColorF(), getGreenColorF(), getBlueColorF(), alpha * particleAlpha)
			.endVertex();
	buff.pos(to.x, to.y, to.z).color(getRedColorF(), getGreenColorF(), getBlueColorF(), alpha * particleAlpha)
			.endVertex();
	buff.setTranslation(0,0,0);
	tessellator.draw();
}
 
開發者ID:ArekkuusuJerii,項目名稱:Solar,代碼行數:18,代碼來源:ParticleBolt.java

示例2: renderOffsetAABB

import net.minecraft.client.renderer.BufferBuilder; //導入方法依賴的package包/類
private static void renderOffsetAABB(AxisAlignedBB aabb, double x, double y, double z) {
    BufferBuilder wr = Tessellator.getInstance().getBuffer();
    wr.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_NORMAL);
    wr.setTranslation(x, y, z);

    wr.pos(aabb.minX, aabb.maxY, aabb.minZ).normal(0, 0, -1).endVertex();
    wr.pos(aabb.maxX, aabb.maxY, aabb.minZ).normal(0, 0, -1).endVertex();
    wr.pos(aabb.maxX, aabb.minY, aabb.minZ).normal(0, 0, -1).endVertex();
    wr.pos(aabb.minX, aabb.minY, aabb.minZ).normal(0, 0, -1).endVertex();

    wr.pos(aabb.minX, aabb.minY, aabb.maxZ).normal(0, 0, 1).endVertex();
    wr.pos(aabb.maxX, aabb.minY, aabb.maxZ).normal(0, 0, 1).endVertex();
    wr.pos(aabb.maxX, aabb.maxY, aabb.maxZ).normal(0, 0, 1).endVertex();
    wr.pos(aabb.minX, aabb.maxY, aabb.maxZ).normal(0, 0, 1).endVertex();

    wr.pos(aabb.minX, aabb.minY, aabb.minZ).normal(0, -1, 0).endVertex();
    wr.pos(aabb.maxX, aabb.minY, aabb.minZ).normal(0, -1, 0).endVertex();
    wr.pos(aabb.maxX, aabb.minY, aabb.maxZ).normal(0, -1, 0).endVertex();
    wr.pos(aabb.minX, aabb.minY, aabb.maxZ).normal(0, -1, 0).endVertex();

    wr.pos(aabb.minX, aabb.maxY, aabb.maxZ).normal(0, 1, 0).endVertex();
    wr.pos(aabb.maxX, aabb.maxY, aabb.maxZ).normal(0, 1, 0).endVertex();
    wr.pos(aabb.maxX, aabb.maxY, aabb.minZ).normal(0, 1, 0).endVertex();
    wr.pos(aabb.minX, aabb.maxY, aabb.minZ).normal(0, 1, 0).endVertex();

    wr.pos(aabb.minX, aabb.minY, aabb.maxZ).normal(-1, 0, 0).endVertex();
    wr.pos(aabb.minX, aabb.maxY, aabb.maxZ).normal(-1, 0, 0).endVertex();
    wr.pos(aabb.minX, aabb.maxY, aabb.minZ).normal(-1, 0, 0).endVertex();
    wr.pos(aabb.minX, aabb.minY, aabb.minZ).normal(-1, 0, 0).endVertex();

    wr.pos(aabb.maxX, aabb.minY, aabb.minZ).normal(1, 0, 0).endVertex();
    wr.pos(aabb.maxX, aabb.maxY, aabb.minZ).normal(1, 0, 0).endVertex();
    wr.pos(aabb.maxX, aabb.maxY, aabb.maxZ).normal(1, 0, 0).endVertex();
    wr.pos(aabb.maxX, aabb.minY, aabb.maxZ).normal(1, 0, 0).endVertex();
    wr.setTranslation(0.0D, 0.0D, 0.0D);
    Tessellator.getInstance().draw();
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:38,代碼來源:SemiBlockRendererLogistics.java

示例3: renderHighlightedBlocks

import net.minecraft.client.renderer.BufferBuilder; //導入方法依賴的package包/類
private static void renderHighlightedBlocks(RenderWorldLastEvent evt, EntityPlayerSP p, Map<Long, Byte> cleanAir) {
    double doubleX = p.lastTickPosX + (p.posX - p.lastTickPosX) * evt.getPartialTicks();
    double doubleY = p.lastTickPosY + (p.posY - p.lastTickPosY) * evt.getPartialTicks();
    double doubleZ = p.lastTickPosZ + (p.posZ - p.lastTickPosZ) * evt.getPartialTicks();

    GlStateManager.pushMatrix();
    GlStateManager.translate(-doubleX, -doubleY, -doubleZ);

    GlStateManager.disableDepth();
    GlStateManager.enableTexture2D();

    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder buffer = tessellator.getBuffer();

    Minecraft.getMinecraft().getTextureManager().bindTexture(BLUEGLOW);

    buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_LMAP_COLOR);

    GlStateManager.enableBlend();
    GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    for (Map.Entry<Long, Byte> entry : cleanAir.entrySet()) {
        int value = entry.getValue() & 0xff;
        BlockPos coordinate = BlockPos.fromLong(entry.getKey());
        float x = coordinate.getX();
        float y = coordinate.getY();
        float z = coordinate.getZ();
        buffer.setTranslation(buffer.xOffset + x, buffer.yOffset + y, buffer.zOffset + z);

        int alpha = value;
        float mult = 0.4f;          // 1.1f
        if (alpha < 25) {
            mult = 0.025f;
        } else if (alpha < 50) {
            mult = 0.05f;
        } else if (alpha < 80) {
            mult = 0.1f;
        } else if (alpha < 110) {
            mult = 0.15f;
        } else if (alpha < 130) {
            mult = 0.2f;
        } else if (alpha < 150) {
            mult = 0.25f;
        } else if (alpha < 180) {
            mult = 0.3f;
        } else if (alpha < 210) {
            mult = 0.35f;
        }

        float offset = 0.5f - (mult/2);

        RenderGlowEffect.addSideFullTexture(buffer, EnumFacing.UP.ordinal(), mult, offset, alpha);
        RenderGlowEffect.addSideFullTexture(buffer, EnumFacing.DOWN.ordinal(), mult, offset, alpha);
        RenderGlowEffect.addSideFullTexture(buffer, EnumFacing.NORTH.ordinal(), mult, offset, alpha);
        RenderGlowEffect.addSideFullTexture(buffer, EnumFacing.SOUTH.ordinal(), mult, offset, alpha);
        RenderGlowEffect.addSideFullTexture(buffer, EnumFacing.WEST.ordinal(), mult, offset, alpha);
        RenderGlowEffect.addSideFullTexture(buffer, EnumFacing.EAST.ordinal(), mult, offset, alpha);
        buffer.setTranslation(buffer.xOffset - x, buffer.yOffset - y, buffer.zOffset - z);
    }
    tessellator.draw();

    GlStateManager.disableBlend();

    GlStateManager.popMatrix();
}
 
開發者ID:McJty,項目名稱:needtobreath,代碼行數:66,代碼來源:NTBOverlayRenderer.java

示例4: onPipeBoundingBoxRender

import net.minecraft.client.renderer.BufferBuilder; //導入方法依賴的package包/類
@SubscribeEvent
public static void onPipeBoundingBoxRender(DrawBlockHighlightEvent event) {
	if (event.getTarget() != null && event.getTarget().typeOfHit == RayTraceResult.Type.BLOCK) {
		BlockPos pos = event.getTarget().getBlockPos();
		EntityPlayer player = event.getPlayer();
		EnumFacing side = event.getTarget().sideHit;
		if (player.world.getBlockState(pos).getBlock() == RegistryManager.pipe
				&& player.world.getTileEntity(pos) != null) {
			TileEntityPipe te = (TileEntityPipe) player.world.getTileEntity(pos);
			float hitX = 0, hitY = 0, hitZ = 0;
			if (side.getAxis() != EnumFacing.Axis.X) {
				hitX = (float) event.getTarget().hitVec.x - pos.getX();
			}
			if (side.getAxis() != EnumFacing.Axis.Y) {
				hitY = (float) event.getTarget().hitVec.y - pos.getY();
			}
			if (side.getAxis() != EnumFacing.Axis.Z) {
				hitZ = (float) event.getTarget().hitVec.z - pos.getZ();
			}
			EnumFacing connection = te.viewedConnection(player, side, hitX, hitY, hitZ);
			event.setCanceled(true);

			GlStateManager.enableBlend();
			GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA,
					GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE,
					GlStateManager.DestFactor.ZERO);
			GlStateManager.glLineWidth(2.0F);
			GlStateManager.disableTexture2D();
			GlStateManager.depthMask(false);

			double d0 = player.lastTickPosX
					+ (player.posX - player.lastTickPosX) * (double) event.getPartialTicks();
			double d1 = player.lastTickPosY
					+ (player.posY - player.lastTickPosY) * (double) event.getPartialTicks();
			double d2 = player.lastTickPosZ
					+ (player.posZ - player.lastTickPosZ) * (double) event.getPartialTicks();
			Tessellator tessellator = Tessellator.getInstance();
			BufferBuilder vertexbuffer = tessellator.getBuffer();
			vertexbuffer.begin(3, DefaultVertexFormats.POSITION_COLOR);
			vertexbuffer.setTranslation(-d0, -d1, -d2);

			if (player.getHeldItem(EnumHand.MAIN_HAND).getItem() == RegistryManager.tuning_fork
					|| player.getHeldItem(EnumHand.OFF_HAND).getItem() == RegistryManager.tuning_fork) {
				drawPipeConnectionAABB(vertexbuffer, connection, pos);
			} else {
				IBlockState blockstate = player.world.getBlockState(pos);
				IExtendedBlockState state = (IExtendedBlockState) blockstate.getBlock().getExtendedState(blockstate,
						player.world, pos);
				drawFullPipeAABB(vertexbuffer, state, pos, player.world);
			}

			tessellator.draw();
			vertexbuffer.setTranslation(0D, 0D, 0D);

			GlStateManager.depthMask(true);
			GlStateManager.enableTexture2D();
			GlStateManager.disableBlend();
		}
	}
}
 
開發者ID:the-realest-stu,項目名稱:Etheric,代碼行數:61,代碼來源:BoundingBoxRenderHandler.java

示例5: render

import net.minecraft.client.renderer.BufferBuilder; //導入方法依賴的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.client.renderer.BufferBuilder.setTranslation方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。