Example usage for net.minecraftforge.client.model.obj OBJLoader INSTANCE

List of usage examples for net.minecraftforge.client.model.obj OBJLoader INSTANCE

Introduction

In this page you can find the example usage for net.minecraftforge.client.model.obj OBJLoader INSTANCE.

Prototype

OBJLoader INSTANCE

To view the source code for net.minecraftforge.client.model.obj OBJLoader INSTANCE.

Click Source Link

Usage

From source file:blusunrize.immersiveengineering.client.models.obj.IEOBJLoader.java

@Nonnull
@Override/*from   w w w.  j a  v  a  2 s.  co m*/
public IModel loadModel(@Nonnull ResourceLocation modelLocation) throws Exception {
    if (!cache.containsKey(modelLocation)) {
        IModel model = OBJLoader.INSTANCE.loadModel(modelLocation);
        if (model instanceof OBJModel) {
            IEOBJModel ieobj = new IEOBJModel(((OBJModel) model).getMatLib(), modelLocation);
            cache.put(modelLocation, ieobj);
        }
    }
    IEOBJModel model = cache.get(modelLocation);
    if (model == null)
        return ModelLoaderRegistry.getMissingModel();
    return model;
}

From source file:buildcraft.factory.FactoryProxyClient.java

License:Minecraft Mod Public

@Override
public void fmlInit() {
    super.fmlInit();

    if (BuildCraftFactory.tankBlock != null) {
        ClientRegistry.bindTileEntitySpecialRenderer(TileTank.class, new RenderTank());
    }/*from   ww  w . ja  va 2  s . co m*/

    if (BuildCraftFactory.refineryBlock != null) {
        ClientRegistry.bindTileEntitySpecialRenderer(TileRefinery.class, new RenderRefinery());
    }

    OBJLoader.INSTANCE.addDomain("buildcraftfactory");
}

From source file:buildcraft.silicon.SiliconProxyClient.java

License:Minecraft Mod Public

@Override
public void preInit() {
    OBJLoader.instance.addDomain("buildcraftsilicon");
}

From source file:com.buuz135.industrial.proxy.client.ClientProxy.java

License:Open Source License

@Override
public void preInit(FMLPreInitializationEvent event) {
    super.preInit(event);
    OBJLoader.INSTANCE.addDomain(Reference.MOD_ID);

    MinecraftForge.EVENT_BUS.register(new IFClientEvents());
    MinecraftForge.EVENT_BUS.register(new IFWorldRenderLastEvent());
    MinecraftForge.EVENT_BUS.register(new IFTooltipEvent());
}

From source file:com.buuz135.industrial.proxy.client.ClientProxy.java

License:Open Source License

@Override
public void init() {
    super.init();
    try {//  w  ww.j a  v a  2  s  .co  m
        ears_model = OBJLoader.INSTANCE
                .loadModel(new ResourceLocation(Reference.MOD_ID, "models/block/catears.obj"));
        ears_baked = ears_model.bake(TRSRTransformation.identity(), DefaultVertexFormats.BLOCK,
                ModelLoader.defaultTextureGetter());
    } catch (Exception e) {
        e.printStackTrace();
    }
    RenderManager manager = Minecraft.getMinecraft().getRenderManager();
    Map<String, RenderPlayer> map = manager.getSkinMap();
    map.get("default").addLayer(new ContributorsCatEarsRender());
    map.get("slim").addLayer(new ContributorsCatEarsRender());

    manager.entityRenderMap.put(EntityPinkSlime.class, new RenderPinkSlime(manager));

    ((IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager())
            .registerReloadListener(resourceManager -> FluidUtils.colorCache.clear());
    ((IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager())
            .registerReloadListener(resourceManager -> IFManual.buildManual());

    if (ItemRegistry.artificalDye != null)
        Minecraft.getMinecraft().getItemColors().registerItemColorHandler((stack,
                tintIndex) -> ItemDye.DYE_COLORS[EnumDyeColor.byMetadata(stack.getMetadata()).getDyeDamage()],
                ItemRegistry.artificalDye);
    Minecraft.getMinecraft().getItemColors().registerItemColorHandler((stack, tintIndex) -> {
        if (tintIndex == 1) {
            return ItemDye.DYE_COLORS[EnumDyeColor.byMetadata(stack.getMetadata()).getDyeDamage()];
        }
        return 0xFFFFFF;
    }, BlockRegistry.blockConveyor.getItem());
    Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler((state, worldIn, pos, tintIndex) -> {
        if (tintIndex == 0) {
            TileEntity entity = worldIn.getTileEntity(pos);
            if (entity instanceof TileEntityConveyor) {
                return ItemDye.DYE_COLORS[((TileEntityConveyor) entity).getColor()];
            }
        }
        return 0xFFFFFFF;
    }, BlockRegistry.blockConveyor);
    Minecraft.getMinecraft().getItemColors().registerItemColorHandler((stack, tintIndex) -> {
        if (tintIndex == 1 || tintIndex == 2 || tintIndex == 3) {
            EntityList.EntityEggInfo info = null;
            if (stack.hasTagCompound() && stack.getTagCompound().hasKey("entity", Constants.NBT.TAG_STRING)) {
                ResourceLocation id = new ResourceLocation(stack.getTagCompound().getString("entity"));
                info = EntityList.ENTITY_EGGS.get(id);
            }
            return info == null ? 0x636363
                    : tintIndex == 3
                            ? BlockRegistry.mobDuplicatorBlock.blacklistedEntities
                                    .contains(info.spawnedID.toString()) ? 0xDB201A : 0x636363
                            : tintIndex == 1 ? info.primaryColor : info.secondaryColor;
        }
        return 0xFFFFFF;
    }, ItemRegistry.mobImprisonmentToolItem);
    Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler((state, worldIn, pos, tintIndex) -> {
        if (tintIndex == 0 && worldIn.getTileEntity(pos) instanceof BlackHoleTankTile) {
            BlackHoleTankTile tank = (BlackHoleTankTile) worldIn.getTileEntity(pos);
            if (tank != null && tank.getTank().getFluidAmount() > 0) {
                int color = FluidUtils.getFluidColor(tank.getTank().getFluid());
                if (color != -1)
                    return color;
            }
        }
        return 0xFFFFFF;
    }, BlockRegistry.blackHoleTankBlock);
    Minecraft.getMinecraft().getItemColors().registerItemColorHandler((stack, tintIndex) -> {
        if (tintIndex == 0 && stack.hasTagCompound() && stack.getTagCompound().hasKey("FluidName")
                && FluidRegistry.isFluidRegistered(stack.getTagCompound().getString("FluidName"))) {
            Fluid fluid = FluidRegistry.getFluid(stack.getTagCompound().getString("FluidName"));
            int color = FluidUtils.getFluidColor(fluid);
            if (color != -1)
                return color;
        }
        return 0xFFFFFF;
    }, BlockRegistry.blackHoleTankBlock);
    Minecraft.getMinecraft().getItemColors().registerItemColorHandler((stack, tintIndex) -> {
        if (tintIndex == 0) {
            return ItemInfinityDrill.DrillTier
                    .getTierBraquet(ItemRegistry.itemInfinityDrill.getPowerFromStack(stack)).getLeft()
                    .getTextureColor();
        }
        return 0xFFFFFF;
    }, ItemRegistry.itemInfinityDrill);
}

From source file:com.elytradev.thermionics.client.ClientProxy.java

License:Open Source License

@Override
public void preInit() {
    OBJLoader.INSTANCE.addDomain(Thermionics.MODID);
}

From source file:com.foudroyantfactotum.mod.fousarchive.proxy.ClientRenderProxy.java

License:Open Source License

@Override
public void preInit() {
    OBJLoader.INSTANCE.addDomain(TheMod.MOD_ID);
    StructureNetwork.init(new SimpleNetworkWrapper(TheMod.MOD_ID));
}

From source file:disconsented.cristallum.client.ClientProxy.java

License:Open Source License

public static void registerRenderers() {
    OBJLoader.INSTANCE.addDomain(Reference.ID.toLowerCase());
    ModelLoader.setCustomModelResourceLocation(Store.refineryItem, 0,
            new ModelResourceLocation(Store.blockRefinery.name, "inventory"));
    ModelLoader.setCustomModelResourceLocation(ItemCrystal.instance, 0,
            new ModelResourceLocation(ItemCrystal.name + "Green", "inventory"));
    ModelLoader.setCustomModelResourceLocation(ItemCrystal.instance, 1,
            new ModelResourceLocation(ItemCrystal.name + "Blue", "inventory"));
    ModelLoader.setCustomModelResourceLocation(ItemCrystal.instance, 2,
            new ModelResourceLocation(ItemCrystal.name + "Red", "inventory"));
}

From source file:hellfirepvp.astralsorcery.client.ClientProxy.java

License:Open Source License

@Override
public void preInit() {
    try {// ww w.j  a v a 2s. com
        ((IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager())
                .registerReloadListener(AssetLibrary.resReloadInstance);
    } catch (Exception exc) {
        AstralSorcery.log.warn(
                "AstralSorcery: Could not add AssetLibrary to resource manager! Texture reloading will have no effect on AstralSorcery textures.");
        AssetLibrary.resReloadInstance.onResourceManagerReload(null);
    }
    ModelLoaderRegistry.registerLoader(new DummyModelLoader()); //IItemRenderer Hook ModelLoader
    OBJLoader.INSTANCE.addDomain(AstralSorcery.MODID);

    super.preInit();

    registerFluidRenderers();
    registerEntityRenderers();

    CraftingAccessManager.ignoreJEI = false;
}

From source file:malte0811.industrialWires.client.ClientProxy.java

License:Open Source License

@Override
public void preInit() {
    super.preInit();
    ConnLoader.baseModels.put("ic2_conn_tin",
            new ResourceLocation("immersiveengineering:block/connector/connectorLV.obj"));
    ConnLoader.textureReplacements.put("ic2_conn_tin",
            ImmutableMap.of("#immersiveengineering:blocks/connector_connectorLV",
                    IndustrialWires.MODID + ":blocks/ic2_connTin"));
    ConnLoader.baseModels.put("ic2_relay_tin",
            new ResourceLocation("immersiveengineering:block/connector/connectorLV.obj"));
    ConnLoader.textureReplacements.put("ic2_relay_tin",
            ImmutableMap.of("#immersiveengineering:blocks/connector_connectorLV",
                    IndustrialWires.MODID + ":blocks/ic2_relayTin"));

    ConnLoader.baseModels.put("ic2_conn_copper",
            new ResourceLocation("immersiveengineering:block/connector/connectorLV.obj"));
    ConnLoader.textureReplacements.put("ic2_conn_copper",
            ImmutableMap.of("#immersiveengineering:blocks/connector_connectorLV",
                    IndustrialWires.MODID + ":blocks/ic2_connCopper"));
    ConnLoader.baseModels.put("ic2_relay_copper",
            new ResourceLocation("immersiveengineering:block/connector/connectorLV.obj"));
    ConnLoader.textureReplacements.put("ic2_relay_copper",
            ImmutableMap.of("#immersiveengineering:blocks/connector_connectorLV",
                    IndustrialWires.MODID + ":blocks/ic2_relayCopper"));

    ConnLoader.baseModels.put("ic2_conn_gold",
            new ResourceLocation("immersiveengineering:block/connector/connectorMV.obj"));
    ConnLoader.textureReplacements.put("ic2_conn_gold",
            ImmutableMap.of("#immersiveengineering:blocks/connector_connectorMV",
                    IndustrialWires.MODID + ":blocks/ic2_connGold"));
    ConnLoader.baseModels.put("ic2_relay_gold",
            new ResourceLocation("immersiveengineering:block/connector/connectorMV.obj"));
    ConnLoader.textureReplacements.put("ic2_relay_gold",
            ImmutableMap.of("#immersiveengineering:blocks/connector_connectorMV",
                    IndustrialWires.MODID + ":blocks/ic2_relayGold"));

    ConnLoader.baseModels.put("ic2_conn_hv",
            new ResourceLocation("immersiveengineering:block/connector/connectorHV.obj"));
    ConnLoader.textureReplacements.put("ic2_conn_hv",
            ImmutableMap.of("#immersiveengineering:blocks/connector_connectorHV",
                    IndustrialWires.MODID + ":blocks/ic2_connHV"));
    ConnLoader.baseModels.put("ic2_relay_hv",
            new ResourceLocation("immersiveengineering:block/connector/relayHV.obj"));

    ConnLoader.baseModels.put("ic2_conn_glass",
            new ResourceLocation("immersiveengineering:block/connector/connectorHV.obj"));
    ConnLoader.textureReplacements.put("ic2_conn_glass",
            ImmutableMap.of("#immersiveengineering:blocks/connector_connectorHV",
                    IndustrialWires.MODID + ":blocks/ic2_connGlass"));
    ConnLoader.baseModels.put("ic2_relay_glass",
            new ResourceLocation("immersiveengineering:block/connector/relayHV.obj"));
    ConnLoader.textureReplacements.put("ic2_relay_glass",
            ImmutableMap.of("#immersiveengineering:blocks/connector_relayHV",
                    IndustrialWires.MODID + ":blocks/ic2_relayGlass"));

    ConnLoader.baseModels.put("rs_panel_conn", new ResourceLocation("industrialwires:block/rs_panel_conn.obj"));
    for (int meta = 0; meta < ItemIC2Coil.subNames.length; meta++) {
        ResourceLocation loc = new ResourceLocation(IndustrialWires.MODID,
                "ic2wireCoil/" + ItemIC2Coil.subNames[meta]);
        ModelBakery.registerItemVariants(IndustrialWires.coil, loc);
        ModelLoader.setCustomModelResourceLocation(IndustrialWires.coil, meta,
                new ModelResourceLocation(loc, "inventory"));
    }/*  w  w w  . j  a  va  2 s . c o m*/
    for (int meta = 0; meta < ItemPanelComponent.types.length; meta++) {
        ResourceLocation loc = new ResourceLocation(IndustrialWires.MODID,
                "panel_component/" + ItemPanelComponent.types[meta]);
        ModelBakery.registerItemVariants(IndustrialWires.panelComponent, loc);
        ModelLoader.setCustomModelResourceLocation(IndustrialWires.panelComponent, meta,
                new ModelResourceLocation(loc, "inventory"));
    }

    Block[] blocks = { IndustrialWires.ic2conn, IndustrialWires.mechConv, IndustrialWires.jacobsLadder,
            IndustrialWires.panel };
    for (Block b : blocks) {
        if (b != null) {
            Item blockItem = Item.getItemFromBlock(b);
            final ResourceLocation loc = b.getRegistryName();
            ModelLoader.setCustomMeshDefinition(blockItem,
                    stack -> new ModelResourceLocation(loc, "inventory"));
            Object[] v = ((IMetaEnum) b).getValues();
            for (int meta = 0; meta < v.length; meta++) {
                String location = loc.toString();
                String prop = "inventory,type=" + v[meta].toString().toLowerCase(Locale.US);
                try {
                    ModelLoader.setCustomModelResourceLocation(blockItem, meta,
                            new ModelResourceLocation(location, prop));
                } catch (NullPointerException npe) {
                    throw new RuntimeException(b + " lacks an item!", npe);
                }
            }
        }
    }
    OBJLoader.INSTANCE.addDomain(IndustrialWires.MODID);
    ModelLoaderRegistry.registerLoader(new PanelModelLoader());
    MinecraftForge.EVENT_BUS.register(new ClientEventHandler());
    ClientRegistry.bindTileEntitySpecialRenderer(TileEntityJacobsLadder.class, new TileRenderJacobsLadder());
}