use of net.minecraft.client.renderer.vertex.VertexFormat in project EnderIO by SleepyTrousers.
the class YetaWrenchOverlayRenderer method doRenderOverlay.
private void doRenderOverlay(@Nonnull RenderGameOverlayEvent event, @Nonnull ItemStack equippedWrench) {
ConduitDisplayMode mode = ConduitDisplayMode.getDisplayMode(equippedWrench);
if (mode != cachedMode) {
cachedMode = mode;
displayTickCount = 20;
lastTick = ClientHandler.getTicksElapsed();
}
ScaledResolution res = event.getResolution();
int modeCount = ConduitDisplayMode.registrySize();
Iterable<ConduitDisplayMode> renderable = ConduitDisplayMode.getRenderableModes();
switch(PersonalConfig.yetaOverlayMode.get()) {
case 0:
if (displayTickCount > 0) {
if (lastTick < ClientHandler.getTicksElapsed()) {
lastTick++;
displayTickCount--;
}
int x = res.getScaledWidth() / 2 - 8;
int y = res.getScaledHeight() / 2 - 24;
IWidgetIcon widget = mode.getWidgetSelected();
RenderUtil.bindTexture(widget.getMap().getTexture());
widget.getMap().render(widget, x, y, true);
int size = 12;
widget = mode.previous().getWidgetSelected();
RenderUtil.bindTexture(widget.getMap().getTexture());
widget.getMap().render(widget, x - 18 + (16 - size), y + (16 - size), size, size, 0, true);
widget = mode.next().getWidgetSelected();
RenderUtil.bindTexture(widget.getMap().getTexture());
widget.getMap().render(widget, x + 18, y + (16 - size), size, size, 0, true);
} else {
int x = res.getScaledWidth() - 20;
int y = res.getScaledHeight() - 20;
IWidgetIcon widget = mode.getWidgetSelected();
RenderUtil.bindTexture(widget.getMap().getTexture());
widget.getMap().render(widget, x, y, true);
}
break;
case 1:
int size = 16;
int padding = 2;
int inset = (int) (size / 1.5);
int offsetX = res.getScaledWidth() - inset - 1;
int offsetY = res.getScaledHeight() - modeCount * (size + padding) - padding;
inset = size - inset;
int x = offsetX + 2;
int y = offsetY - (padding * 2);
int height = (modeCount * (size + padding)) + (padding * 3);
// FIXME
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glShadeModel(GL11.GL_SMOOTH);
VertexFormat vf = DefaultVertexFormats.POSITION_COLOR;
Tessellator tess = Tessellator.getInstance();
BufferBuilder wr = tess.getBuffer();
wr.begin(GL11.GL_QUADS, vf);
wr.pos(x, y, -5).color(0, 0, 0, 0.2f).endVertex();
;
wr.pos(x, y + height, -5).color(0, 0, 0, 0.2f).endVertex();
;
Vector4f color = new Vector4f(0, 0, 0, 1);
wr.pos(x + size, y + height, -5).color(color.x, color.y, color.z, color.w).endVertex();
wr.pos(x + size, y, -5).color(color.x, color.y, color.z, color.w).endVertex();
tess.draw();
GlStateManager.color(1, 1, 1);
GL11.glShadeModel(GL11.GL_FLAT);
y += padding * 2;
x -= 2;
if (mode == ConduitDisplayMode.ALL) {
x -= inset;
}
GL11.glEnable(GL11.GL_TEXTURE_2D);
for (ConduitDisplayMode toRender : renderable) {
IWidgetIcon widget = mode == ConduitDisplayMode.ALL ? toRender.getWidgetSelected() : toRender.getWidgetUnselected();
RenderUtil.bindTexture(widget.getMap().getTexture());
if (toRender == mode) {
widget = toRender.getWidgetSelected();
widget.getMap().render(widget, x - inset, y, true);
} else {
widget.getMap().render(widget, x, y, true);
}
y += size + padding;
}
break;
case 2:
offsetX = res.getScaledWidth() - (modeCount * 8) - 16;
y = res.getScaledHeight() - 40;
x = offsetX;
if (modeCount % 2 == 1) {
x += 8;
}
int count = 0;
for (ConduitDisplayMode toRender : renderable) {
IWidgetIcon widget = mode == ConduitDisplayMode.ALL || toRender == mode ? toRender.getWidgetSelected() : toRender.getWidgetUnselected();
RenderUtil.bindTexture(widget.getMap().getTexture());
widget.getMap().render(widget, x, y, true);
x += 16;
if (count == modeCount / 2 - 1) {
x = offsetX;
y += 16;
}
count++;
}
}
}
use of net.minecraft.client.renderer.vertex.VertexFormat in project BuildCraft by BuildCraft.
the class LensPluggableModel method create.
public static PerspAwareModelBase create(ItemLens lensItem, int meta) {
LensPluggable lens = new LensPluggable(new ItemStack(lensItem, 1, meta));
ImmutableList.Builder<BakedQuad> quads = ImmutableList.builder();
VertexFormat format = DefaultVertexFormats.ITEM;
quads.addAll(INSTANCE.bakeCutout(lens.isFilter, EnumFacing.EAST, format));
quads.addAll(INSTANCE.bakeTransclucent(lens.dyeColor, lens.isFilter, EnumFacing.EAST, format));
return new PerspAwareModelBase(format, quads.build(), spriteLensCutout, getBlockTransforms());
}
use of net.minecraft.client.renderer.vertex.VertexFormat in project BuildCraft by BuildCraft.
the class ModelPowerAdapter method create.
public static PerspAwareModelBase create() {
ImmutableList.Builder<BakedQuad> quads = ImmutableList.builder();
VertexFormat format = DefaultVertexFormats.ITEM;
quads.addAll(INSTANCE.bakeCutout(EnumFacing.EAST, format));
return new PerspAwareModelBase(format, quads.build(), spritePowerAdapter, getBlockTransforms());
}
use of net.minecraft.client.renderer.vertex.VertexFormat in project BuildCraft by BuildCraft.
the class PlugPluggableModel method create.
public static PerspAwareModelBase create() {
ImmutableList.Builder<BakedQuad> quads = ImmutableList.builder();
VertexFormat format = DefaultVertexFormats.ITEM;
quads.addAll(INSTANCE.bakeCutout(EnumFacing.SOUTH, format));
return new PerspAwareModelBase(format, quads.build(), spritePlug, getPluggableTransforms());
}
use of net.minecraft.client.renderer.vertex.VertexFormat in project BuildCraft by BuildCraft.
the class PipeWireRenderer method renderQuads.
private static void renderQuads(MutableQuad[] quads, ISprite sprite, int level) {
VertexFormat vf = DefaultVertexFormats.POSITION_TEX_COLOR;
Tessellator tessellator = new Tessellator(quads.length * vf.getNextOffset());
BufferBuilder bb = tessellator.getBuffer();
bb.begin(GL11.GL_QUADS, vf);
float vOffset = (level & 0xF) / 16f;
for (MutableQuad q : quads) {
if (q.getFace() != EnumFacing.UP && level != 15) {
q = new MutableQuad(q);
float shade = 1 - q.getCalculatedDiffuse();
shade = shade * (15 - level) / 15;
shade = 1 - shade;
q.multColourd(shade);
}
renderVertex(bb, q.vertex_0, sprite, vOffset);
renderVertex(bb, q.vertex_1, sprite, vOffset);
renderVertex(bb, q.vertex_2, sprite, vOffset);
renderVertex(bb, q.vertex_3, sprite, vOffset);
}
tessellator.draw();
}
Aggregations