use of net.minecraft.client.renderer.block.model.BakedQuad in project BuildCraft by BuildCraft.
the class GatePluggableModel method renderGate.
public List<MutableQuad> renderGate(KeyPlugGate gate, VertexFormat format) {
TextureAtlasSprite logicSprite = gate.lit ? gate.logic.getIconLit() : gate.logic.getIconDark();
TextureAtlasSprite materialSprite = gate.material.getIconBlock();
IModel main = modelMain();
IModel material = modelMaterial();
List<MutableQuad> quads = Lists.newArrayList();
IFlexibleBakedModel baked = main.bake(ModelRotation.X0_Y0, format, singleTextureFunction(logicSprite));
for (BakedQuad quad : baked.getGeneralQuads()) {
MutableQuad mutable = MutableQuad.create(quad, format);
quads.add(mutable);
}
if (materialSprite != null) {
// Its null for redstone (As we don't render any material for redstone gates)
baked = material.bake(ModelRotation.X0_Y0, format, singleTextureFunction(materialSprite));
for (BakedQuad quad : baked.getGeneralQuads()) {
quads.add(MutableQuad.create(quad, format));
}
}
for (GateExpansionModelKey<?> expansion : gate.expansions) {
generate(quads, expansion);
}
return quads;
}
use of net.minecraft.client.renderer.block.model.BakedQuad in project BuildCraft by BuildCraft.
the class GatePluggableModel method generate.
private static <K extends GateExpansionModelKey<K>> void generate(List<MutableQuad> quads, GateExpansionModelKey<K> expansion) {
IExpansionBaker<K> baker = expansion.baker;
VertexFormat format = baker.getVertexFormat();
for (BakedQuad q : baker.bake((K) expansion)) {
quads.add(MutableQuad.create(q, format));
}
}
use of net.minecraft.client.renderer.block.model.BakedQuad in project BuildCraft by BuildCraft.
the class ModelPowerAdapter method bakeCutout.
private List<BakedQuad> bakeCutout(EnumFacing face, VertexFormat format) {
IModel model = modelPowerAdapter();
TextureAtlasSprite sprite = spritePowerAdapter;
List<BakedQuad> quads = Lists.newArrayList();
List<BakedQuad> bakedQuads = renderAdapter(model, sprite, format);
Matrix4f matrix = MatrixUtil.rotateTowardsFace(face);
for (BakedQuad quad : bakedQuads) {
MutableQuad mutable = MutableQuad.create(quad);
mutable.transform(matrix);
ModelUtil.appendBakeQuads(quads, format, mutable);
}
return quads;
}
use of net.minecraft.client.renderer.block.model.BakedQuad in project BuildCraft by BuildCraft.
the class ModelPowerAdapter method renderAdapter.
public static List<BakedQuad> renderAdapter(IModel model, TextureAtlasSprite sprite, VertexFormat format) {
List<BakedQuad> quads = Lists.newArrayList();
IFlexibleBakedModel baked = model.bake(ModelRotation.X0_Y0, format, singleTextureFunction(sprite));
for (BakedQuad quad : baked.getGeneralQuads()) {
MutableQuad mutable = MutableQuad.create(quad);
mutable.colouri(0xFF_FF_FF_FF);
ModelUtil.appendBakeQuads(quads, format, mutable);
}
return quads;
}
use of net.minecraft.client.renderer.block.model.BakedQuad in project BuildCraft by BuildCraft.
the class PipeItemModel method create.
public static PipeItemModel create(ItemPipe item, int colorIndex) {
TextureAtlasSprite sprite = item.getSprite();
if (sprite == null) {
sprite = Minecraft.getMinecraft().getTextureMapBlocks().getMissingSprite();
}
Vec3d center = Utils.VEC_HALF;
Vec3d radius = new Vec3d(0.25, 0.5, 0.25);
EntityResizableCuboid cuboid = new EntityResizableCuboid(null);
cuboid.texture = sprite;
cuboid.setTextureOffset(new Vec3d(4, 0, 4));
cuboid.setPosition(center.subtract(radius));
cuboid.setSize(Utils.multiply(radius, 2));
List<MutableQuad> unprocessed = Lists.newArrayList();
List<BakedQuad> quads = Lists.newArrayList();
RenderResizableCuboid.bakeCube(unprocessed, cuboid, true, false);
for (MutableQuad quad : unprocessed) {
quad.normalf(0, 1, 0);
ModelUtil.appendBakeQuads(quads, DefaultVertexFormats.ITEM, quad);
}
unprocessed.clear();
// Set up the colour
if (colorIndex != 0) {
// Very sligthly smaller
radius = new Vec3d(0.249, 0.499, 0.249);
cuboid = new EntityResizableCuboid(null);
cuboid.setTextureOffset(new Vec3d(4, 0, 4));
cuboid.texture = PipeIconProvider.TYPE.PipeStainedOverlay.getIcon();
cuboid.setPosition(center.subtract(radius));
cuboid.setSize(Utils.multiply(radius, 2));
// Render it into a different list
RenderResizableCuboid.bakeCube(unprocessed, cuboid, true, false);
EnumDyeColor dye = EnumDyeColor.byDyeDamage(colorIndex - 1);
int quadColor = ColorUtils.getLightHex(dye);
// Add all of the quads we just rendered to the main list
for (MutableQuad quad : unprocessed) {
quad.normalf(0, 1, 0);
quad.setTint(quadColor);
ModelUtil.appendBakeQuads(quads, DefaultVertexFormats.ITEM, quad);
}
unprocessed.clear();
}
return new PipeItemModel(ImmutableList.copyOf(quads), sprite);
}
Aggregations