Search in sources :

Example 1 with ModelBlock

use of net.minecraft.client.renderer.block.model.ModelBlock in project GregTech by GregTechCE.

the class MetaTileEntityRenderer method postInit.

public static void postInit() {
    try {
        IResource resource = Minecraft.getMinecraft().getResourceManager().getResource(new ResourceLocation("models/block/block.json"));
        try (InputStreamReader reader = new InputStreamReader(resource.getInputStream())) {
            ModelBlock modelBlock = ModelBlock.deserialize(reader);
            for (TransformType transformType : TransformType.values()) {
                ItemTransformVec3f vec3f = modelBlock.getAllTransforms().getTransform(transformType);
                BLOCK_TRANSFORMS.put(transformType, new TRSRTransformation(vec3f));
            }
        }
    } catch (IOException exception) {
        GTLog.logger.error("Failed to load default block transforms", exception);
    }
}
Also used : TRSRTransformation(net.minecraftforge.common.model.TRSRTransformation) InputStreamReader(java.io.InputStreamReader) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) ResourceLocation(net.minecraft.util.ResourceLocation) ModelBlock(net.minecraft.client.renderer.block.model.ModelBlock) ItemTransformVec3f(net.minecraft.client.renderer.block.model.ItemTransformVec3f) IOException(java.io.IOException) TransformType(net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType) IResource(net.minecraft.client.resources.IResource)

Aggregations

IOException (java.io.IOException)1 InputStreamReader (java.io.InputStreamReader)1 TransformType (net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType)1 ItemTransformVec3f (net.minecraft.client.renderer.block.model.ItemTransformVec3f)1 ModelBlock (net.minecraft.client.renderer.block.model.ModelBlock)1 ModelResourceLocation (net.minecraft.client.renderer.block.model.ModelResourceLocation)1 IResource (net.minecraft.client.resources.IResource)1 ResourceLocation (net.minecraft.util.ResourceLocation)1 TRSRTransformation (net.minecraftforge.common.model.TRSRTransformation)1