本文整理汇总了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();
}
示例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();
}
示例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();
}
示例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();
}
}
}
示例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);
}