use of net.minecraft.client.renderer.model.ModelResourceLocation in project BluePower by Qmunity.
the class RenderHelper method drawColoredCube.
/**
* Draws a colored cube with the size of vector. All faces have the specified color. This uses OpenGL
*
* @author Koen Beckers (K4Unl) and Amadornes
* @param vector
*/
public static void drawColoredCube(AxisAlignedBB vector, IVertexBuilder vertexBuilder, MatrixStack matrixStack, int r, int g, int b, int a, int light, boolean... renderFaces) {
MatrixStack.Entry entry = matrixStack.last();
Matrix4f positionMatrix = entry.pose();
Matrix3f normalMatrix = entry.normal();
TextureAtlasSprite sprite = Minecraft.getInstance().getModelManager().getModel(new ModelResourceLocation("minecraft:white_concrete", "")).getParticleIcon();
float minU = sprite.getU0();
float maxU = sprite.getU1();
float minV = sprite.getV0();
float maxV = sprite.getV1();
// Top side
if (renderFaces.length < 1 || renderFaces[0]) {
vertexBuilder.vertex(positionMatrix, (float) vector.minX, (float) vector.maxY, (float) vector.maxZ).color(r, g, b, a).uv(minU, maxV).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(light).normal(normalMatrix, 0.0F, 1.0F, 0.0F).endVertex();
vertexBuilder.vertex(positionMatrix, (float) vector.maxX, (float) vector.maxY, (float) vector.maxZ).color(r, g, b, a).uv(minU, minV).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(light).normal(normalMatrix, 0.0F, 1.0F, 0.0F).endVertex();
vertexBuilder.vertex(positionMatrix, (float) vector.maxX, (float) vector.maxY, (float) vector.minZ).color(r, g, b, a).uv(maxU, minV).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(light).normal(normalMatrix, 0.0F, 1.0F, 0.0F).endVertex();
vertexBuilder.vertex(positionMatrix, (float) vector.minX, (float) vector.maxY, (float) vector.minZ).color(r, g, b, a).uv(maxU, maxV).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(light).normal(normalMatrix, 0.0F, 1.0F, 0.0F).endVertex();
}
// Bottom side
if (renderFaces.length < 2 || renderFaces[1]) {
vertexBuilder.vertex(positionMatrix, (float) vector.maxX, (float) vector.minY, (float) vector.maxZ).color(r, g, b, a).uv(minU, maxV).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(light).normal(normalMatrix, 0.0F, -1.0F, 0.0F).endVertex();
vertexBuilder.vertex(positionMatrix, (float) vector.minX, (float) vector.minY, (float) vector.maxZ).color(r, g, b, a).uv(minU, minV).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(light).normal(normalMatrix, 0.0F, -1.0F, 0.0F).endVertex();
vertexBuilder.vertex(positionMatrix, (float) vector.minX, (float) vector.minY, (float) vector.minZ).color(r, g, b, a).uv(maxU, minV).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(light).normal(normalMatrix, 0.0F, -1.0F, 0.0F).endVertex();
vertexBuilder.vertex(positionMatrix, (float) vector.maxX, (float) vector.minY, (float) vector.minZ).color(r, g, b, a).uv(maxU, maxV).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(light).normal(normalMatrix, 0.0F, -1.0F, 0.0F).endVertex();
}
// Draw west side:
if (renderFaces.length < 3 || renderFaces[5]) {
vertexBuilder.vertex(positionMatrix, (float) vector.minX, (float) vector.minY, (float) vector.maxZ).color(r, g, b, a).uv(minU, maxV).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(light).normal(normalMatrix, -1.0F, 0.0F, 0.0F).endVertex();
vertexBuilder.vertex(positionMatrix, (float) vector.minX, (float) vector.maxY, (float) vector.maxZ).color(r, g, b, a).uv(minU, minV).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(light).normal(normalMatrix, -1.0F, 0.0F, 0.0F).endVertex();
vertexBuilder.vertex(positionMatrix, (float) vector.minX, (float) vector.maxY, (float) vector.minZ).color(r, g, b, a).uv(maxU, minV).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(light).normal(normalMatrix, -1.0F, 0.0F, 0.0F).endVertex();
vertexBuilder.vertex(positionMatrix, (float) vector.minX, (float) vector.minY, (float) vector.minZ).color(r, g, b, a).uv(maxU, maxV).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(light).normal(normalMatrix, -1.0F, 0.0F, 0.0F).endVertex();
}
// Draw east side:
if (renderFaces.length < 4 || renderFaces[4]) {
vertexBuilder.vertex(positionMatrix, (float) vector.maxX, (float) vector.minY, (float) vector.minZ).color(r, g, b, a).uv(minU, maxV).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(light).normal(normalMatrix, 1.0F, 0.0F, 0.0F).endVertex();
vertexBuilder.vertex(positionMatrix, (float) vector.maxX, (float) vector.maxY, (float) vector.minZ).color(r, g, b, a).uv(minU, minV).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(light).normal(normalMatrix, 1.0F, 0.0F, 0.0F).endVertex();
vertexBuilder.vertex(positionMatrix, (float) vector.maxX, (float) vector.maxY, (float) vector.maxZ).color(r, g, b, a).uv(maxU, minV).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(light).normal(normalMatrix, 1.0F, 0.0F, 0.0F).endVertex();
vertexBuilder.vertex(positionMatrix, (float) vector.maxX, (float) vector.minY, (float) vector.maxZ).color(r, g, b, a).uv(maxU, maxV).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(light).normal(normalMatrix, 1.0F, 0.0F, 0.0F).endVertex();
}
// Draw north side
if (renderFaces.length < 5 || renderFaces[3]) {
vertexBuilder.vertex(positionMatrix, (float) vector.minX, (float) vector.minY, (float) vector.minZ).color(r, g, b, a).uv(minU, maxV).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(light).normal(normalMatrix, 0.0F, 0.0F, -1.0F).endVertex();
vertexBuilder.vertex(positionMatrix, (float) vector.minX, (float) vector.maxY, (float) vector.minZ).color(r, g, b, a).uv(minU, minV).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(light).normal(normalMatrix, 0.0F, 0.0F, -1.0F).endVertex();
vertexBuilder.vertex(positionMatrix, (float) vector.maxX, (float) vector.maxY, (float) vector.minZ).color(r, g, b, a).uv(maxU, minV).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(light).normal(normalMatrix, 0.0F, 0.0F, -1.0F).endVertex();
vertexBuilder.vertex(positionMatrix, (float) vector.maxX, (float) vector.minY, (float) vector.minZ).color(r, g, b, a).uv(maxU, maxV).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(light).normal(normalMatrix, 0.0F, 0.0F, -1.0F).endVertex();
}
// Draw south side
if (renderFaces.length < 6 || renderFaces[2]) {
vertexBuilder.vertex(positionMatrix, (float) vector.minX, (float) vector.minY, (float) vector.maxZ).color(r, g, b, a).uv(minU, maxV).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(light).normal(normalMatrix, 0.0F, 0.0F, 1.0F).endVertex();
vertexBuilder.vertex(positionMatrix, (float) vector.maxX, (float) vector.minY, (float) vector.maxZ).color(r, g, b, a).uv(minU, minV).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(light).normal(normalMatrix, 0.0F, 0.0F, 1.0F).endVertex();
vertexBuilder.vertex(positionMatrix, (float) vector.maxX, (float) vector.maxY, (float) vector.maxZ).color(r, g, b, a).uv(maxU, minV).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(light).normal(normalMatrix, 0.0F, 0.0F, 1.0F).endVertex();
vertexBuilder.vertex(positionMatrix, (float) vector.minX, (float) vector.maxY, (float) vector.maxZ).color(r, g, b, a).uv(maxU, maxV).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(light).normal(normalMatrix, 0.0F, 0.0F, 1.0F).endVertex();
}
}
use of net.minecraft.client.renderer.model.ModelResourceLocation in project Overloaded by CJ-MC-Mods.
the class BlockAlmostInfiniteCapacitor method registerModel.
@OnlyIn(Dist.CLIENT)
@Override
public void registerModel() {
ModelResourceLocation location = new ModelResourceLocation(getRegistryName(), null);
// ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(this), 0, location);
ResizeableTextureGenerator.addToTextureQueue(new ResizeableTextureGenerator.ResizableTexture(new ResourceLocation(MODID, "textures/block/almost_infinite_capacitor.png"), new ResourceLocation(MODID, "textures/dynamic/blocks/almost_infinite_capacitor.png"), OverloadedConfig.INSTANCE.textureResolutions.blockResolution));
}
use of net.minecraft.client.renderer.model.ModelResourceLocation in project Overloaded by CJ-MC-Mods.
the class BlockCreativeGenerator method registerModel.
@OnlyIn(Dist.CLIENT)
@Override
public void registerModel() {
ModelResourceLocation location = new ModelResourceLocation(getRegistryName(), "inventory");
// ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(this), 0, location);
ImageUtil.registerDynamicTexture(new ResourceLocation(MODID, "textures/block/creative_generator.png"), OverloadedConfig.INSTANCE.textureResolutions.blockResolution);
}
use of net.minecraft.client.renderer.model.ModelResourceLocation in project Overloaded by CJ-MC-Mods.
the class ItemRailGun method registerModel.
@OnlyIn(Dist.CLIENT)
@Override
public void registerModel() {
ModelResourceLocation location = new ModelResourceLocation(new ResourceLocation(MODID, "railgun"), null);
// ModelLoader.setCustomModelResourceLocation(this, 0, location);
ImageUtil.registerDynamicTexture(new ResourceLocation(MODID, "textures/item/railgun.png"), OverloadedConfig.INSTANCE.textureResolutions.itemResolution);
}
use of net.minecraft.client.renderer.model.ModelResourceLocation in project Overloaded by CJ-MC-Mods.
the class ItemSettingEditor method registerModel.
@OnlyIn(Dist.CLIENT)
@Override
public void registerModel() {
ModelResourceLocation location = new ModelResourceLocation(new ResourceLocation(MODID, "settings_editor"), null);
// ModelLoader.setCustomModelResourceLocation(this, 0, location);
ImageUtil.registerDynamicTexture(new ResourceLocation(MODID, "textures/item/settings_editor.png"), OverloadedConfig.INSTANCE.textureResolutions.itemResolution);
}
Aggregations