本文整理汇总了Java中codechicken.lib.render.RenderUtils类的典型用法代码示例。如果您正苦于以下问题:Java RenderUtils类的具体用法?Java RenderUtils怎么用?Java RenderUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RenderUtils类属于codechicken.lib.render包,在下文中一共展示了RenderUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: renderItem
import codechicken.lib.render.RenderUtils; //导入依赖的package包/类
@Override
public void renderItem(ItemStack item, TransformType transformType) {
GlStateManager.pushMatrix();
CCRenderState ccrs = CCRenderState.instance();
ccrs.reset();
ccrs.pullLightmap();
Frequency frequency = Frequency.readFromStack(item);
FluidStack fluidStack = TankSynchroniser.getClientLiquid(frequency);
RenderTileEnderTank.renderTank(ccrs, 2, 0F, frequency, 0, 0, 0, 0);
if (fluidStack != null && RenderUtils.shouldRenderFluid(fluidStack)) {
RenderTileEnderTank.renderLiquid(fluidStack, 0, 0, 0);
}
//Fixes issues with inventory rendering.
//The Portal renderer modifies blend and disables it.
//Vanillas inventory relies on the fact that items don't modify gl so it never bothers to set it again.
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
GlStateManager.popMatrix();
}
示例2: renderLastEvent
import codechicken.lib.render.RenderUtils; //导入依赖的package包/类
@SubscribeEvent
public void renderLastEvent(RenderWorldLastEvent event) {
if (NEIClientConfig.isEnabled()) {
GlStateManager.pushMatrix();
GlStateTracker.pushState();
Entity entity = Minecraft.getMinecraft().getRenderViewEntity();
RenderUtils.translateToWorldCoords(entity, event.getPartialTicks());
renderChunkBounds(entity);
renderMobSpawnOverlay(entity);
GlStateTracker.popState();
GlStateManager.popMatrix();
}
}
示例3: drawHighlight
import codechicken.lib.render.RenderUtils; //导入依赖的package包/类
@Override
public boolean drawHighlight(MovingObjectPosition mop, EntityPlayer player, float frame) {
ForgeDirection face = ForgeDirection.getOrientation(mop.sideHit);
AxisAlignedBB c = net.quetzi.bluepower.util.RayTracer.getSelectedCuboid(mop, player, face, getSubParts(), true);
if (c == null) return true;
GL11.glPushMatrix();
{
GL11.glTranslated(x() - TileEntityRendererDispatcher.staticPlayerX, y() - TileEntityRendererDispatcher.staticPlayerY, z()
- TileEntityRendererDispatcher.staticPlayerZ);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glColor4d(0, 0, 0, 0);
RenderUtils.drawCuboidOutline(new Cuboid6(c).expand(0.001));
GL11.glColor4d(1, 1, 1, 1);
GL11.glEnable(GL11.GL_TEXTURE_2D);
}
GL11.glPopMatrix();
return true;
}
示例4: render
import codechicken.lib.render.RenderUtils; //导入依赖的package包/类
public static void render(float frame) {
GL11.glPushMatrix();
Entity entity = Minecraft.getMinecraft().renderViewEntity;
RenderUtils.translateToWorldCoords(entity, frame);
renderChunkBounds(entity);
renderMobSpawnOverlay(entity);
GL11.glPopMatrix();
}
示例5: render
import codechicken.lib.render.RenderUtils; //导入依赖的package包/类
public static void render(float frame) {
GlStateManager.pushMatrix();
Entity entity = Minecraft.getMinecraft().getRenderViewEntity();
RenderUtils.translateToWorldCoords(entity, frame);
renderChunkBounds(entity);
renderMobSpawnOverlay(entity);
GlStateManager.popMatrix();
}
示例6: doRenderLayer
import codechicken.lib.render.RenderUtils; //导入依赖的package包/类
@Override
public void doRenderLayer(AbstractClientPlayer entity, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
if (uuid1.equals(entity.getUniqueID()) || uuid2.equals(entity.getUniqueID()) || uuid3.equals(entity.getUniqueID()) || uuid4.equals(entity.getUniqueID())) {
GlStateManager.pushMatrix();
Matrix4 matrix4 = new Matrix4();
matrix4.apply(new Rotation(MathHelper.torad * 180, new Vector3(1, 0, 0)));
matrix4.apply(new Scale(0.5));
matrix4.glApply();
if (entity.isSneaking()) {
GlStateManager.translate(0, -0.5, 0);
}
if (entity.isElytraFlying()) {
headPitch = -45;
}
GlStateManager.rotate(netHeadYaw, 0, -1, 0);
GlStateManager.rotate(headPitch, 1, 0, 0);
GlStateManager.translate(0, 1, 0);
RenderTileEnderTank.renderTank(CCRenderState.instance(), 0, (float) (MathHelper.torad * 90F), new Frequency(), -0.5, 0, -0.5, 0);
FluidStack fluidStack = FluidUtils.water.copy();
float bob = 0.45F + RenderUtils.getPearlBob(ClientUtils.getRenderTime()) * 2;
fluidStack.amount = (int) MathHelper.map(bob, 0.2, 0.6, 1000, 14000);
RenderTileEnderTank.renderLiquid(fluidStack, -0.5, 0, -0.5);
GlStateManager.popMatrix();
}
}
示例7: renderChest
import codechicken.lib.render.RenderUtils; //导入依赖的package包/类
public static void renderChest(int rotation, Frequency freq, double x, double y, double z, int offset, float lidAngle) {
TileEntityRendererDispatcher info = TileEntityRendererDispatcher.instance;
CCRenderState ccrs = CCRenderState.instance();
ccrs.reset();
renderEndPortal.render(x, y, z, 0, info.entityX, info.entityY, info.entityZ, info.renderEngine);
GlStateManager.color(1, 1, 1, 1);
TextureUtils.changeTexture("enderstorage:textures/enderchest.png");
GlStateManager.pushMatrix();
GlStateManager.enableRescaleNormal();
GlStateManager.color(1, 1, 1, 1);
GlStateManager.translate(x, y + 1.0, z + 1.0F);
GlStateManager.scale(1.0F, -1F, -1F);
GlStateManager.translate(0.5F, 0.5F, 0.5F);
GlStateManager.rotate(rotation * 90, 0.0F, 1.0F, 0.0F);
GlStateManager.translate(-0.5F, -0.5F, -0.5F);
model.chestLid.rotateAngleX = lidAngle;
model.render(freq.hasOwner());
GlStateManager.popMatrix();
GlStateManager.pushMatrix();
GlStateManager.translate(x, y, z);
renderButtons(freq, rotation, lidAngle);
GlStateManager.popMatrix();
double time = ClientUtils.getRenderTime() + offset;
Matrix4 pearlMat = RenderUtils.getMatrix(new Vector3(x + 0.5, y + 0.2 + lidAngle * -0.5 + RenderUtils.getPearlBob(time), z + 0.5), new Rotation(time / 3, new Vector3(0, 1, 0)), 0.04);
GlStateManager.disableLighting();
TextureUtils.changeTexture("enderstorage:textures/hedronmap.png");
GlStateManager.pushMatrix();
ccrs.startDrawing(7, DefaultVertexFormats.POSITION_TEX_COLOR_NORMAL);
CCModelLibrary.icosahedron7.render(ccrs, pearlMat);
ccrs.draw();
GlStateManager.popMatrix();
GlStateManager.enableLighting();
}
示例8: renderItem
import codechicken.lib.render.RenderUtils; //导入依赖的package包/类
@Override
public void renderItem(ItemStack stack, TransformType transformType) {
renderWrapped(stack);
double rot = ClientUtils.getRenderTime() / 3F;
double height;
double size;
double updown = (float) Math.sin(((ClientUtils.getRenderTime() % 50) / 25F) * 3.141593) * 0.2;
if (stack.getMetadata() == 0) {
height = 0.9;
size = 0.08;
} else {
height = 0.5;
size = 0.05;
}
CCRenderState ccrs = CCRenderState.instance();
ccrs.reset();
Matrix4 pearlMat = RenderUtils.getMatrix(new Vector3(0.5, height + (updown + 0.3), 0.5), new Rotation(rot, new Vector3(0, 1, 0)), size);
disableLighting();
pushMatrix();
TextureUtils.changeTexture("chickenchunks:textures/hedronmap.png");
ccrs.startDrawing(4, DefaultVertexFormats.POSITION_TEX_COLOR_NORMAL);
CCModelLibrary.icosahedron4.render(ccrs, pearlMat);
ccrs.draw();
popMatrix();
enableLighting();
}
示例9: renderCuboid
import codechicken.lib.render.RenderUtils; //导入依赖的package包/类
private static void renderCuboid(Cuboid6 cuboid) {
if (ProxyClient.lasersRenderHollow) {
RenderUtils.drawCuboidOutline(cuboid);
} else {
RenderUtils.drawCuboidSolid(cuboid);
}
}
示例10: drawHighlight
import codechicken.lib.render.RenderUtils; //导入依赖的package包/类
@Override
public boolean drawHighlight(MovingObjectPosition hit, EntityPlayer player, float frame) {
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glColor4f(0, 0, 0, 0.4F);
GL11.glLineWidth(2);
GL11.glDepthMask(true);
GL11.glPushMatrix();
RenderUtils.translateToWorldCoords(player, frame);
GL11.glTranslated(x(), y(), z());
{
double d = 0.002;
if (!is2D()) {
RenderUtils.drawCuboidOutline(new Cuboid6(2 / 16D + d, isSideHidden(ForgeDirection.DOWN) ? d * 2 : -d * 2, 2 / 16D + d,
14 / 16D - d, 1 + (isSideHidden(ForgeDirection.UP) ? -d * 2 : d * 2), 14 / 16D - d));
RenderUtils.drawCuboidOutline(new Cuboid6(isSideHidden(ForgeDirection.WEST) ? d * 2 : -d * 2, 2 / 16D + d, 2 / 16D + d,
1 + (isSideHidden(ForgeDirection.EAST) ? -d * 2 : d * 2), 14 / 16D - d, 14 / 16D - d));
RenderUtils.drawCuboidOutline(new Cuboid6(2 / 16D + d, 2 / 16D + d, isSideHidden(ForgeDirection.NORTH) ? d : -d,
14 / 16D - d, 14 / 16D - d, 1 + (isSideHidden(ForgeDirection.SOUTH) ? -d * 2 : d * 2)));
}
RenderUtils.drawCuboidOutline(new Cuboid6(0, 0, 0, 1, 1, 1).expand(d));
}
GL11.glPopMatrix();
GL11.glDepthMask(false);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_BLEND);
return true;
}
示例11: renderFluidInTank
import codechicken.lib.render.RenderUtils; //导入依赖的package包/类
public void renderFluidInTank(FluidTank tank, Vector3 minCoords, Vector3 maxCoords, Vector3 offset, ModelRenderer parent)
{
if (tank != null && tank.getFluid() != null && tank.getFluid().getFluid().getIcon() != null)
{
Vector3 victor = new Vector3(
(parent.rotationPointX * 0.1f + parent.offsetX * 0.1 + offset.x) , //
(parent.rotationPointY * 0.1f + parent.offsetY * 0.1 + offset.y),
(parent.rotationPointZ * 0.1f + parent.offsetZ * 0.1 + offset.z));
Cuboid6 cat = new Cuboid6(minCoords.x,minCoords.y,minCoords.z, maxCoords.x, maxCoords.y, maxCoords.z);
//Thanks Chickenbones!
RenderUtils.renderFluidCuboid(tank.getFluid(), cat.add(victor),((1.0F * tank.getFluidAmount()) / (1.0F * tank.getCapacity())), 0.8);
}
}
示例12: drawHighlight
import codechicken.lib.render.RenderUtils; //导入依赖的package包/类
@Override
public boolean drawHighlight(MovingObjectPosition mop, EntityPlayer player, float frame) {
GL11.glPushMatrix();
GL11.glTranslated(x() - TileEntityRendererDispatcher.staticPlayerX, y() - TileEntityRendererDispatcher.staticPlayerY, z()
- TileEntityRendererDispatcher.staticPlayerZ);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glColor4d(0, 0, 0, 0);
if (highlight == -1) highlight = GL11.glGenLists(1);
GL11.glNewList(highlight, GL11.GL_COMPILE);
boolean rendered = getPart().renderSelectionBoxes(mop, player, frame);
GL11.glEndList();
GL11.glColor4d(1, 1, 1, 1);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glPopMatrix();
if (rendered) {
GL11.glCallList(highlight);
} else {
AmaMOP amamop = RayTracer.rayTrace(player, getPart().getSelectionBoxes());
if (amamop != null && amamop.getCubeHit() != null) {
RenderUtils.drawCuboidOutline(new Cuboid6(amamop.getCubeHit().toAABB()));
} else {
return false;
}
}
return true;
}
示例13: render
import codechicken.lib.render.RenderUtils; //导入依赖的package包/类
@Override
public void render(TileEnderChest enderChest, double x, double y, double z, float partialTicks, int destroyStage, float alpha) {
renderChest(enderChest.rotation, enderChest.frequency, x, y, z, RenderUtils.getTimeOffset(enderChest.getPos()), (float) enderChest.getRadianLidAngle(partialTicks));
}
示例14: render
import codechicken.lib.render.RenderUtils; //导入依赖的package包/类
@Override
public void render(TileChunkLoaderBase tile, double x, double y, double z, float partialTicks, int destroyStage, float alpha) {
CCRenderState ccrs = CCRenderState.instance();
ccrs.reset();
ccrs.setBrightness(tile.getWorld(), tile.getPos());
double rot = ClientUtils.getRenderTime() * 2;
double height;
double size;
double updown = (ClientUtils.getRenderTime() % 50) / 25F;
updown = (float) Math.sin(updown * 3.141593);
updown *= 0.2;
if (tile instanceof TileChunkLoader) {
TileChunkLoader ctile = (TileChunkLoader) tile;
rot /= Math.pow(ctile.radius, 0.2);
height = 0.9;
size = 0.08;
} else if (tile instanceof TileSpotLoader) {
height = 0.5;
size = 0.05;
} else {
return;
}
RenderInfo renderInfo = tile.renderInfo;
double active = (renderInfo.activationCounter) / 20D;
if (tile.active && renderInfo.activationCounter < 20) {
active += partialTicks / 20D;
} else if (!tile.active && renderInfo.activationCounter > 0) {
active -= partialTicks / 20D;
}
if (renderInfo.showLasers) {
disableTexture2D();
disableLighting();
disableFog();
drawRays(x, y, z, rot, updown, tile.getPos().getX(), tile.getPos().getY(), tile.getPos().getZ(), tile.getChunks());
enableTexture2D();
enableLighting();
enableFog();
}
rot = ClientUtils.getRenderTime() * active / 3F;
Matrix4 pearlMat = RenderUtils.getMatrix(new Vector3(x + 0.5, y + height + (updown + 0.3) * active, z + 0.5), new Rotation(rot, new Vector3(0, 1, 0)), size);
disableLighting();
pushMatrix();
TextureUtils.changeTexture("chickenchunks:textures/hedronmap.png");
ccrs.startDrawing(7, DefaultVertexFormats.POSITION_TEX_COLOR_NORMAL);
CCModelLibrary.icosahedron7.render(ccrs, pearlMat);
ccrs.draw();
popMatrix();
enableLighting();
}
示例15: drawLiquidSpiral
import codechicken.lib.render.RenderUtils; //导入依赖的package包/类
private void drawLiquidSpiral(CCRenderState ccrs, int src, int dst, FluidStack stack, double start, double end, double time, double theta0, double x, double y, double z) {
RenderUtils.preFluidRender();
TextureAtlasSprite tex = RenderUtils.prepareFluidRender(stack, 255);
VertexBuffer vertexBuffer = ccrs.startDrawing(7, DefaultVertexFormats.POSITION_TEX);
vertexBuffer.setTranslation(x, y, z);
Vector3[] last = new Vector3[] { new Vector3(), new Vector3(), new Vector3(), new Vector3() };
Vector3[] next = new Vector3[] { new Vector3(), new Vector3(), new Vector3(), new Vector3() };
double tess = 0.05;
Vector3 a = getPerp(src, dst);
boolean rev = sum(a.copy().crossProduct(getPathNormal(src, dst, 0))) != sum(sideVec[src]);
for (double di = end; di <= start; di += tess) {
Vector3 b = getPathNormal(src, dst, di);
Vector3 c = getPath(src, dst, di);
if (rev) {
b.negate();
}
double r = (2 * di - time / 10 + theta0 + dst / 6) * 2 * Math.PI;
double sz = 0.1;
Vector3 p = c.add(a.copy().multiply(MathHelper.sin(r) * sz)).add(b.copy().multiply(MathHelper.cos(r) * sz));
double s1 = 0.02;
double s2 = -0.02;
next[0].set(p).add(a.x * s1 + b.x * s1, a.y * s1 + b.y * s1, a.z * s1 + b.z * s1);
next[1].set(p).add(a.x * s2 + b.x * s1, a.y * s2 + b.y * s1, a.z * s2 + b.z * s1);
next[2].set(p).add(a.x * s2 + b.x * s2, a.y * s2 + b.y * s2, a.z * s2 + b.z * s2);
next[3].set(p).add(a.x * s1 + b.x * s2, a.y * s1 + b.y * s2, a.z * s1 + b.z * s2);
if (di > end) {
double u1 = tex.getInterpolatedU(Math.abs(di) * 16);
double u2 = tex.getInterpolatedU(Math.abs(di - tess) * 16);
for (int i = 0; i < 4; i++) {
int j = (i + 1) % 4;
Vector3 axis = next[j].copy().subtract(next[i]);
double v1 = tex.getInterpolatedV(Math.abs(next[i].scalarProject(axis)) * 16);
double v2 = tex.getInterpolatedV(Math.abs(next[j].scalarProject(axis)) * 16);
vertexBuffer.pos(next[i].x, next[i].y, next[i].z).tex(u1, v1).endVertex();
vertexBuffer.pos(next[j].x, next[j].y, next[j].z).tex(u1, v2).endVertex();
vertexBuffer.pos(last[j].x, last[j].y, last[j].z).tex(u2, v2).endVertex();
vertexBuffer.pos(last[i].x, last[i].y, last[i].z).tex(u2, v1).endVertex();
}
}
Vector3[] tmp = last;
last = next;
next = tmp;
}
ccrs.draw();
vertexBuffer.setTranslation(0, 0, 0);
RenderUtils.postFluidRender();
}