use of net.minecraft.client.renderer.block.model.BakedQuad in project BuildCraft by BuildCraft.
the class PlugPluggableModel method renderPlug.
public static List<BakedQuad> renderPlug(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 GateItemModel method handleItemState.
@Override
public GateItemModel handleItemState(ItemStack stack) {
KeyPlugGate key = getState(stack);
if (!map.containsKey(key)) {
List<BakedQuad> quads = Lists.newArrayList();
List<MutableQuad> mutableQuads = GatePluggableModel.INSTANCE.renderGate(key, DefaultVertexFormats.ITEM);
Matrix4f rotation = MatrixUtil.rotateTowardsFace(EnumFacing.SOUTH);
Matrix4f matScale = new Matrix4f();
matScale.setIdentity();
matScale.setScale(2);
matScale.setTranslation(new Vector3f(-0.5f, -0.5f, -0.5f));
Matrix4f translateToItem = new Matrix4f();
translateToItem.setIdentity();
translateToItem.setTranslation(new Vector3f(0, 0, -0.4f));
Matrix4f totalMatrix = new Matrix4f();
totalMatrix.setIdentity();
totalMatrix.mul(translateToItem);
totalMatrix.mul(matScale);
totalMatrix.mul(rotation);
for (MutableQuad quad : mutableQuads) {
quad.transform(totalMatrix);
quad.colouri(0xFF_FF_FF_FF);
quads.add(quad.toUnpacked(DefaultVertexFormats.ITEM));
}
map.put(key, new GateItemModel(ImmutableList.copyOf(quads), null, DefaultVertexFormats.ITEM));
}
return map.get(key);
}
use of net.minecraft.client.renderer.block.model.BakedQuad in project BuildCraft by BuildCraft.
the class FacadeItemModel method createFacadeItemModel.
private FacadeItemModel createFacadeItemModel(FacadeState state) {
List<BakedQuad> quads = Lists.newArrayList();
IModel model;
if (state.hollow)
model = FacadePluggableModel.INSTANCE.modelHollow();
else
model = FacadePluggableModel.INSTANCE.modelFilled();
TextureAtlasSprite sprite = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getTexture(state.state);
if (sprite == null) {
sprite = Minecraft.getMinecraft().getTextureMapBlocks().getMissingSprite();
}
List<BakedQuad> bakedQuads = model.bake(ModelRotation.X0_Y0, DefaultVertexFormats.ITEM, singleTextureFunction(sprite)).getGeneralQuads();
Matrix4f rotation = MatrixUtil.rotateTowardsFace(EnumFacing.EAST);
Matrix4f translateToItem = new Matrix4f();
translateToItem.setIdentity();
translateToItem.setTranslation(new Vector3f(0.4f, 0, 0));
Matrix4f totalMatrix = new Matrix4f();
totalMatrix.setIdentity();
// The last one is applied FIRST
totalMatrix.mul(rotation);
totalMatrix.mul(translateToItem);
for (BakedQuad quad : bakedQuads) {
MutableQuad mutable = MutableQuad.create(quad);
mutable.transform(totalMatrix);
mutable.colouri(0xFF_FF_FF_FF);
ModelUtil.appendBakeQuads(quads, DefaultVertexFormats.ITEM, mutable);
}
return new FacadeItemModel(ImmutableList.copyOf(quads), sprite, DefaultVertexFormats.ITEM);
}
use of net.minecraft.client.renderer.block.model.BakedQuad in project BuildCraft by BuildCraft.
the class RobotStationModel method baseQuads.
private List<MutableQuad> baseQuads() {
if (modelBaseQuads.isEmpty()) {
IModel base = modelBase();
if (base != null) {
Function<ResourceLocation, TextureAtlasSprite> singleTextureFunction = BuildCraftBakedModel.singleTextureFunction(baseSprite);
IFlexibleBakedModel baked = base.bake(ModelRotation.X0_Y0, DefaultVertexFormats.BLOCK, singleTextureFunction);
for (BakedQuad quad : baked.getGeneralQuads()) {
MutableQuad mutable = MutableQuad.create(quad);
modelBaseQuads.add(mutable);
}
}
}
return modelBaseQuads;
}
use of net.minecraft.client.renderer.block.model.BakedQuad in project RebornCore by TechReborn.
the class MultiblockRenderEvent method renderQuads.
private void renderQuads(final World world, final IBlockState actualState, final BlockPos pos, final List<BakedQuad> quads, final int alpha) {
final Tessellator tessellator = Tessellator.getInstance();
final BufferBuilder buffer = tessellator.getBuffer();
if (quads == null || quads.isEmpty()) {
// Bad things
return;
}
for (final BakedQuad quad : quads) {
buffer.begin(GL11.GL_QUADS, quad.getFormat());
final int color = quad.hasTintIndex() ? this.getTint(world, actualState, pos, alpha, quad.getTintIndex()) : alpha | 0xffffff;
LightUtil.renderQuadColor(buffer, quad, color);
tessellator.draw();
}
}
Aggregations