Java Code Examples for net.minecraft.client.renderer.vertex.DefaultVertexFormats#BLOCK

The following examples show how to use net.minecraft.client.renderer.vertex.DefaultVertexFormats#BLOCK . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Quad.java    From CodeChickenLib with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Bakes this Quad to a BakedQuad.
 *
 * @return The BakedQuad.
 */
public BakedQuad bake() {
    if (format.format != DefaultVertexFormats.BLOCK) {
        throw new IllegalStateException("Unable to bake this quad to the specified format. " + format.format);
    }
    int[] packedData = new int[format.format.getSize()];
    for (int v = 0; v < 4; v++) {
        for (int e = 0; e < format.elementCount; e++) {
            LightUtil.pack(vertices[v].raw[e], packedData, format.format, v, e);
        }
    }
    return new BakedQuad(packedData, tintIndex, orientation, sprite, diffuseLighting);
}
 
Example 2
Source File: CachedFormat.java    From CodeChickenLib with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Lookup or create the CachedFormat for a given VertexFormat.
 *
 * @param format The format to lookup.
 * @return The CachedFormat.
 */
public static CachedFormat lookup(VertexFormat format) {
    //Hotwire the common one.
    if (format == DefaultVertexFormats.BLOCK) {
        return BLOCK;
    }
    return formatCache.computeIfAbsent(format, CachedFormat::new);
}
 
Example 3
Source File: ModelBakeHandler.java    From TFC2 with GNU General Public License v3.0 5 votes vote down vote up
public static void replaceAnvilModel(ModelResourceLocation modelVariantLocation, ResourceLocation modelLocation, ModelBakeEvent event) {
	try {
		IModel model = ModelLoaderRegistry.getModel(modelLocation);
		IBakedModel standard = event.getModelRegistry().getObject(modelVariantLocation);
		if(standard instanceof IPerspectiveAwareModel) {
			IBakedModel finalModel = new BakedAnvilModel((IPerspectiveAwareModel) standard, DefaultVertexFormats.BLOCK);

			event.getModelRegistry().putObject(modelVariantLocation, finalModel);
		}

	} catch(Exception e) {
		e.printStackTrace();
	}
}
 
Example 4
Source File: ModelBakeHandler.java    From TFC2 with GNU General Public License v3.0 5 votes vote down vote up
public static void replacePitKilnModel(ModelResourceLocation modelVariantLocation, ResourceLocation modelLocation, ModelBakeEvent event) {
	try {
		IModel model = ModelLoaderRegistry.getModel(modelLocation);
		IBakedModel standard = event.getModelRegistry().getObject(modelVariantLocation);
		if(standard instanceof IPerspectiveAwareModel) {
			IBakedModel finalModel = new BakedPitKilnModel((IPerspectiveAwareModel) standard, DefaultVertexFormats.BLOCK);

			event.getModelRegistry().putObject(modelVariantLocation, finalModel);
		}

	} catch(Exception e) {
		e.printStackTrace();
	}
}
 
Example 5
Source File: ModelBakeHandler.java    From TFC2 with GNU General Public License v3.0 5 votes vote down vote up
public static void replaceSmallVesselModel(ModelResourceLocation modelVariantLocation, ResourceLocation modelLocation, ModelBakeEvent event) {
	try {
		IModel model = ModelLoaderRegistry.getModel(modelLocation);
		IBakedModel standard = event.getModelRegistry().getObject(modelVariantLocation);
		if(standard instanceof IPerspectiveAwareModel) {
			IBakedModel finalModel = new BakedSmallVesselModel((IPerspectiveAwareModel) standard, DefaultVertexFormats.BLOCK);

			event.getModelRegistry().putObject(modelVariantLocation, finalModel);
		}

	} catch(Exception e) {
		e.printStackTrace();
	}
}
 
Example 6
Source File: BakedVertexSource.java    From CodeChickenLib with GNU Lesser General Public License v2.1 votes vote down vote up
@Override public VertexFormat getVertexFormat() { return DefaultVertexFormats.BLOCK; }