Search in sources :

Example 1 with ItemTransformVec3f

use of net.minecraft.client.renderer.block.model.ItemTransformVec3f in project Galacticraft by micdoodle8.

the class AsteroidsModuleClient method onModelBakeEvent.

@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onModelBakeEvent(ModelBakeEvent event) {
    replaceModelDefault(event, "beam_receiver", "block/receiver.obj", ImmutableList.of("Main", "Receiver", "Ring"), ItemModelBeamReceiver.class, new ItemTransformVec3f(new Vector3f(), new Vector3f(), new Vector3f(1.0F, 1.0F, 1.0F)), "inventory", "facing=up", "facing=down", "facing=north", "facing=west", "facing=east", "facing=south");
    replaceModelDefault(event, "beam_reflector", "block/reflector.obj", ImmutableList.of("Base", "Axle", "EnergyBlaster", "Ring"), ItemModelBeamReflector.class, new ItemTransformVec3f(new Vector3f(), new Vector3f(), new Vector3f(1.0F, 1.0F, 1.0F)), "inventory", "normal");
    replaceModelDefault(event, "telepad_short", "block/telepad_short.obj", ImmutableList.of("Top", "Bottom", "Connector"), ItemModelTelepad.class, new ItemTransformVec3f(new Vector3f(), new Vector3f(), new Vector3f(0.2F, 0.2F, 0.2F)), "inventory", "normal");
    replaceModelDefault(event, "grapple", "grapple.obj", ImmutableList.of("Grapple"), ItemModelGrapple.class, TRSRTransformation.identity());
    replaceModelDefault(event, "rocket_t3", "tier3rocket.obj", ImmutableList.of("Boosters", "Cube", "NoseCone", "Rocket"), ItemModelRocketT3.class, TRSRTransformation.identity());
    replaceModelDefault(event, "astro_miner", "astro_miner_inv.obj", ImmutableList.of("Hull_Center"), ItemModelAstroMiner.class, TRSRTransformation.identity());
}
Also used : Vector3f(org.lwjgl.util.vector.Vector3f) ItemTransformVec3f(net.minecraft.client.renderer.block.model.ItemTransformVec3f) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 2 with ItemTransformVec3f

use of net.minecraft.client.renderer.block.model.ItemTransformVec3f in project BuildCraft by BuildCraft.

the class ModelItemSimple method scale.

private static ItemTransformVec3f scale(ItemTransformVec3f from, double by) {
    float scale = (float) by;
    Vector3f nScale = new Vector3f(from.scale);
    nScale.scale(scale);
    return new ItemTransformVec3f(from.rotation, from.translation, nScale);
}
Also used : Vector3f(org.lwjgl.util.vector.Vector3f) ItemTransformVec3f(net.minecraft.client.renderer.block.model.ItemTransformVec3f)

Example 3 with ItemTransformVec3f

use of net.minecraft.client.renderer.block.model.ItemTransformVec3f in project SilentGems by SilentChaos512.

the class ToolModel method getItemCameraTransforms.

@Override
public ItemCameraTransforms getItemCameraTransforms() {
    Vector3f rotation = new Vector3f();
    Vector3f translation = new Vector3f();
    Vector3f scale = new Vector3f(1f, 1f, 1f);
    // Third Person
    // (0, 90, -35)
    rotation = new Vector3f(0f, (float) -Math.PI / 2f, (float) Math.PI * 7f / 36f);
    translation = new Vector3f(0f, 5.5f, 2.5f);
    if (tool != null && tool.getItem() == ModItems.katana) {
        translation.y += 2.0f;
    }
    translation.scale(0.0625f);
    thirdPersonRight = new ItemTransformVec3f(rotation, translation, scale);
    // (0, 90, -35)
    rotation = new Vector3f(0f, (float) Math.PI / 2f, (float) -Math.PI * 7f / 36f);
    thirdPersonLeft = new ItemTransformVec3f(rotation, translation, scale);
    // First Person
    rotation = new Vector3f(0f, (float) -Math.PI * 1f / 2f, (float) Math.PI * 5f / 36f);
    translation = new Vector3f(1.13f, 3.2f, 1.13f);
    if (tool != null && tool.getItem() == ModItems.katana) {
        translation.y += 1.5f;
    }
    translation.scale(0.0625f);
    scale = new Vector3f(0.68f, 0.68f, 0.68f);
    firstPersonRight = new ItemTransformVec3f(rotation, translation, scale);
    rotation = new Vector3f(0f, (float) Math.PI * 1f / 2f, (float) -Math.PI * 5f / 36f);
    firstPersonLeft = new ItemTransformVec3f(rotation, translation, scale);
    // Head and GUI are default.
    return new ItemCameraTransforms(thirdPersonLeft, thirdPersonRight, firstPersonLeft, firstPersonRight, ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT);
}
Also used : Vector3f(org.lwjgl.util.vector.Vector3f) ItemTransformVec3f(net.minecraft.client.renderer.block.model.ItemTransformVec3f) ItemCameraTransforms(net.minecraft.client.renderer.block.model.ItemCameraTransforms)

Example 4 with ItemTransformVec3f

use of net.minecraft.client.renderer.block.model.ItemTransformVec3f 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)

Example 5 with ItemTransformVec3f

use of net.minecraft.client.renderer.block.model.ItemTransformVec3f in project BuildCraft by BuildCraft.

the class ModelItemSimple method scale.

private static ItemCameraTransforms scale(ItemCameraTransforms from, double by) {
    ItemTransformVec3f thirdperson_left = scale(from.thirdperson_left, by);
    ItemTransformVec3f thirdperson_right = scale(from.thirdperson_right, by);
    ItemTransformVec3f firstperson_left = scale(from.firstperson_left, by);
    ItemTransformVec3f firstperson_right = scale(from.firstperson_right, by);
    ItemTransformVec3f head = scale(from.head, by);
    ItemTransformVec3f gui = scale(from.gui, by);
    ItemTransformVec3f ground = scale(from.ground, by);
    ItemTransformVec3f fixed = scale(from.fixed, by);
    return new ItemCameraTransforms(thirdperson_left, thirdperson_right, firstperson_left, firstperson_right, head, gui, ground, fixed);
}
Also used : ItemTransformVec3f(net.minecraft.client.renderer.block.model.ItemTransformVec3f) ItemCameraTransforms(net.minecraft.client.renderer.block.model.ItemCameraTransforms)

Aggregations

ItemTransformVec3f (net.minecraft.client.renderer.block.model.ItemTransformVec3f)7 Vector3f (org.lwjgl.util.vector.Vector3f)5 ItemCameraTransforms (net.minecraft.client.renderer.block.model.ItemCameraTransforms)2 IOException (java.io.IOException)1 InputStreamReader (java.io.InputStreamReader)1 TransformType (net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType)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 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1