Search in sources :

Example 6 with ModelResourceLocation

use of net.minecraft.client.resources.model.ModelResourceLocation in project SecurityCraft by Geforce132.

the class ClientProxy method registerTextureFiles.

/**
 * Register the texture files used by blocks with metadata/variants with the ModelBakery.
 */
@Override
@SideOnly(Side.CLIENT)
public void registerTextureFiles() {
    ModelBakery.addVariantName(GameRegistry.findItem(SecurityCraft.MODID, "reinforcedPlanks"), "securitycraft:reinforcedPlanks_Oak", "securitycraft:reinforcedPlanks_Spruce", "securitycraft:reinforcedPlanks_Birch", "securitycraft:reinforcedPlanks_Jungle", "securitycraft:reinforcedPlanks_Acacia", "securitycraft:reinforcedPlanks_DarkOak");
    ModelBakery.addVariantName(GameRegistry.findItem(SecurityCraft.MODID, "reinforcedStainedGlass"), "securitycraft:reinforcedStainedGlass_white", "securitycraft:reinforcedStainedGlass_orange", "securitycraft:reinforcedStainedGlass_magenta", "securitycraft:reinforcedStainedGlass_light_blue", "securitycraft:reinforcedStainedGlass_yellow", "securitycraft:reinforcedStainedGlass_lime", "securitycraft:reinforcedStainedGlass_pink", "securitycraft:reinforcedStainedGlass_gray", "securitycraft:reinforcedStainedGlass_silver", "securitycraft:reinforcedStainedGlass_cyan", "securitycraft:reinforcedStainedGlass_purple", "securitycraft:reinforcedStainedGlass_blue", "securitycraft:reinforcedStainedGlass_brown", "securitycraft:reinforcedStainedGlass_green", "securitycraft:reinforcedStainedGlass_red", "securitycraft:reinforcedStainedGlass_black");
    ModelBakery.addVariantName(GameRegistry.findItem(SecurityCraft.MODID, "reinforcedStainedGlassPanes"), "securitycraft:reinforcedStainedGlassPanes_white", "securitycraft:reinforcedStainedGlassPanes_orange", "securitycraft:reinforcedStainedGlassPanes_magenta", "securitycraft:reinforcedStainedGlassPanes_light_blue", "securitycraft:reinforcedStainedGlassPanes_yellow", "securitycraft:reinforcedStainedGlassPanes_lime", "securitycraft:reinforcedStainedGlassPanes_pink", "securitycraft:reinforcedStainedGlassPanes_gray", "securitycraft:reinforcedStainedGlassPanes_silver", "securitycraft:reinforcedStainedGlassPanes_cyan", "securitycraft:reinforcedStainedGlassPanes_purple", "securitycraft:reinforcedStainedGlassPanes_blue", "securitycraft:reinforcedStainedGlassPanes_brown", "securitycraft:reinforcedStainedGlassPanes_green", "securitycraft:reinforcedStainedGlassPanes_red", "securitycraft:reinforcedStainedGlassPanes_black");
    ModelBakery.addVariantName(GameRegistry.findItem(SecurityCraft.MODID, "reinforcedSandstone"), "securitycraft:reinforcedSandstone_normal", "securitycraft:reinforcedSandstone_chiseled", "securitycraft:reinforcedSandstone_smooth");
    ModelBakery.addVariantName(GameRegistry.findItem(SecurityCraft.MODID, "reinforcedWoodSlabs"), "securitycraft:reinforcedWoodSlabs_oak", "securitycraft:reinforcedWoodSlabs_spruce", "securitycraft:reinforcedWoodSlabs_birch", "securitycraft:reinforcedWoodSlabs_jungle", "securitycraft:reinforcedWoodSlabs_acacia", "securitycraft:reinforcedWoodSlabs_darkoak");
    ModelBakery.addVariantName(GameRegistry.findItem(SecurityCraft.MODID, "reinforcedStoneSlabs"), "securitycraft:reinforcedStoneSlabs_stone", "securitycraft:reinforcedStoneSlabs_cobblestone", "securitycraft:reinforcedStoneSlabs_sandstone", "securitycraft:reinforcedDirtSlab", "securitycraft:reinforcedStoneSlabs_stonebrick", "securitycraft:reinforcedStoneSlabs_brick", "securitycraft:reinforcedStoneSlabs_netherbrick", "securitycraft:reinforcedStoneSlabs_quartz");
    ModelBakery.addVariantName(GameRegistry.findItem(SecurityCraft.MODID, "reinforcedStoneSlabs2"), "securitycraft:reinforcedStoneSlabs2_red_sandstone");
    ModelBakery.addVariantName(GameRegistry.findItem(SecurityCraft.MODID, "reinforcedStoneBrick"), "securitycraft:reinforcedStoneBrick_default", "securitycraft:reinforcedStoneBrick_mossy", "securitycraft:reinforcedStoneBrick_cracked", "securitycraft:reinforcedStoneBrick_chiseled");
    ModelBakery.addVariantName(GameRegistry.findItem(SecurityCraft.MODID, "reinforcedStainedHardenedClay"), "securitycraft:reinforcedStainedHardenedClay_white", "securitycraft:reinforcedStainedHardenedClay_orange", "securitycraft:reinforcedStainedHardenedClay_magenta", "securitycraft:reinforcedStainedHardenedClay_light_blue", "securitycraft:reinforcedStainedHardenedClay_yellow", "securitycraft:reinforcedStainedHardenedClay_lime", "securitycraft:reinforcedStainedHardenedClay_pink", "securitycraft:reinforcedStainedHardenedClay_gray", "securitycraft:reinforcedStainedHardenedClay_silver", "securitycraft:reinforcedStainedHardenedClay_cyan", "securitycraft:reinforcedStainedHardenedClay_purple", "securitycraft:reinforcedStainedHardenedClay_blue", "securitycraft:reinforcedStainedHardenedClay_brown", "securitycraft:reinforcedStainedHardenedClay_green", "securitycraft:reinforcedStainedHardenedClay_red", "securitycraft:reinforcedStainedHardenedClay_black");
    ModelBakery.addVariantName(GameRegistry.findItem(SecurityCraft.MODID, "reinforcedLogs"), "securitycraft:reinforcedLogs_oak", "securitycraft:reinforcedLogs_spruce", "securitycraft:reinforcedLogs_birch", "securitycraft:reinforcedLogs_jungle");
    ModelBakery.addVariantName(GameRegistry.findItem(SecurityCraft.MODID, "reinforcedLogs2"), "securitycraft:reinforcedLogs2_acacia", "securitycraft:reinforcedLogs2_big_oak");
    ModelBakery.addVariantName(GameRegistry.findItem(SecurityCraft.MODID, "reinforcedMetals"), "securitycraft:reinforcedMetals_gold", "securitycraft:reinforcedMetals_iron", "securitycraft:reinforcedMetals_diamond", "securitycraft:reinforcedMetals_emerald");
    ModelBakery.addVariantName(GameRegistry.findItem(SecurityCraft.MODID, "reinforcedCompressedBlocks"), "securitycraft:reinforcedCompressedBlocks_lapis", "securitycraft:reinforcedCompressedBlocks_coal");
    ModelBakery.addVariantName(GameRegistry.findItem(SecurityCraft.MODID, "reinforcedWool"), "securitycraft:reinforcedWool_white", "securitycraft:reinforcedWool_orange", "securitycraft:reinforcedWool_magenta", "securitycraft:reinforcedWool_light_blue", "securitycraft:reinforcedWool_yellow", "securitycraft:reinforcedWool_lime", "securitycraft:reinforcedWool_pink", "securitycraft:reinforcedWool_gray", "securitycraft:reinforcedWool_silver", "securitycraft:reinforcedWool_cyan", "securitycraft:reinforcedWool_purple", "securitycraft:reinforcedWool_blue", "securitycraft:reinforcedWool_brown", "securitycraft:reinforcedWool_green", "securitycraft:reinforcedWool_red", "securitycraft:reinforcedWool_black");
    ModelBakery.addVariantName(GameRegistry.findItem(SecurityCraft.MODID, "reinforcedQuartz"), "securitycraft:reinforcedQuartz_default", "securitycraft:reinforcedQuartz_chiseled", "securitycraft:reinforcedQuartz_pillar");
    ModelBakery.addVariantName(GameRegistry.findItem(SecurityCraft.MODID, "reinforcedPrismarine"), "securitycraft:reinforcedPrismarine_default", "securitycraft:reinforcedPrismarine_bricks", "securitycraft:reinforcedPrismarine_dark");
    ModelBakery.addVariantName(GameRegistry.findItem(SecurityCraft.MODID, "reinforcedRedSandstone"), "securitycraft:reinforcedRedSandstone_default", "securitycraft:reinforcedRedSandstone_chiseled", "securitycraft:reinforcedRedSandstone_smooth");
    ModelBakery.addVariantName(GameRegistry.findItem(SecurityCraft.MODID, "reinforcedStone"), "securitycraft:reinforcedStone_default", "securitycraft:reinforcedStone_granite", "securitycraft:reinforcedStone_smooth_granite", "securitycraft:reinforcedStone_diorite", "securitycraft:reinforcedStone_smooth_diorite", "securitycraft:reinforcedStone_andesite", "securitycraft:reinforcedStone_smooth_andesite");
    Item fakeWater = GameRegistry.findItem(SecurityCraft.MODID, "bogusWater");
    ModelBakery.addVariantName(fakeWater);
    ModelLoader.setCustomMeshDefinition(fakeWater, stack -> new ModelResourceLocation("securitycraft:fakeLiquids", "water"));
    ModelLoader.setCustomStateMapper(SCContent.bogusWater, new StateMapperBase() {

        @Override
        protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
            return new ModelResourceLocation("securitycraft:fakeLiquids", "water");
        }
    });
    Item fakeWaterFlowing = GameRegistry.findItem(SecurityCraft.MODID, "bogusWaterFlowing");
    ModelBakery.addVariantName(fakeWaterFlowing);
    ModelLoader.setCustomMeshDefinition(fakeWaterFlowing, stack -> new ModelResourceLocation("securitycraft:fakeLiquids", "water_flowing"));
    ModelLoader.setCustomStateMapper(SCContent.bogusWaterFlowing, new StateMapperBase() {

        @Override
        protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
            return new ModelResourceLocation("securitycraft:fakeLiquids", "water_flowing");
        }
    });
    Item fakeLava = GameRegistry.findItem(SecurityCraft.MODID, "bogusLava");
    ModelBakery.addVariantName(fakeLava);
    ModelLoader.setCustomMeshDefinition(fakeLava, stack -> new ModelResourceLocation("securitycraft:fakeLiquids", "lava"));
    ModelLoader.setCustomStateMapper(SCContent.bogusLava, new StateMapperBase() {

        @Override
        protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
            return new ModelResourceLocation("securitycraft:fakeLiquids", "lava");
        }
    });
    Item fakeLavaFlowing = GameRegistry.findItem(SecurityCraft.MODID, "bogusLavaFlowing");
    ModelBakery.addVariantName(fakeLavaFlowing);
    ModelLoader.setCustomMeshDefinition(fakeLavaFlowing, stack -> new ModelResourceLocation("securitycraft:fakeLiquids", "lava_flowing"));
    ModelLoader.setCustomStateMapper(SCContent.bogusLavaFlowing, new StateMapperBase() {

        @Override
        protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
            return new ModelResourceLocation("securitycraft:fakeLiquids", "lava_flowing");
        }
    });
}
Also used : StateMapperBase(net.minecraft.client.renderer.block.statemap.StateMapperBase) Item(net.minecraft.item.Item) IBlockState(net.minecraft.block.state.IBlockState) ModelResourceLocation(net.minecraft.client.resources.model.ModelResourceLocation) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 7 with ModelResourceLocation

use of net.minecraft.client.resources.model.ModelResourceLocation in project Galacticraft by micdoodle8.

the class SpawnerRenderer method renderItem.

public void renderItem(ItemStack stack) {
    int meta = stack.getItemDamage();
    if (meta == 0) {
        meta = ItemMobSpawner.idPig;
    }
    String bossName = BossStatus.bossName;
    int bossTimeout = BossStatus.statusBarTime;
    Minecraft mc = Minecraft.getMinecraft();
    World world = mc.theWorld;
    IBakedModel baseModel = mc.getRenderItem().getItemModelMesher().getModelManager().getModel(new ModelResourceLocation("mob_spawner"));
    GlStateManager.pushMatrix();
    GlStateManager.translate(.5, .5, .5);
    GlStateManager.scale(2, 2, 2);
    mc.getRenderItem().renderItem(stack, baseModel);
    GlStateManager.popMatrix();
    try {
        Entity entity = ItemMobSpawner.getEntity(meta);
        entity.setWorld(world);
        float scale = 0.6F / Math.max(entity.height, entity.width);
        GlStateManager.pushMatrix();
        GlStateManager.translate(0.5, 0.4, 0.5);
        GlStateManager.rotate((float) (ClientUtils.getRenderTime() * 10), 0, 1, 0);
        GlStateManager.rotate(-20, 1, 0, 0);
        GlStateManager.translate(0, -0.4, 0);
        GlStateManager.scale(scale, scale, scale);
        entity.setLocationAndAngles(0, 0, 0, 0, 0);
        mc.getRenderManager().renderEntityWithPosYaw(entity, 0, 0, 0, 0, 0);
        GlStateManager.disableLighting();
        GlStateManager.popMatrix();
        GL11.glEnable(GL12.GL_RESCALE_NORMAL);
        OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
    } catch (Exception e) {
        if (Tessellator.getInstance().getWorldRenderer().isDrawing) {
            Tessellator.getInstance().draw();
        }
    }
    BossStatus.bossName = bossName;
    BossStatus.statusBarTime = bossTimeout;
}
Also used : Entity(net.minecraft.entity.Entity) IBakedModel(net.minecraft.client.resources.model.IBakedModel) ModelResourceLocation(net.minecraft.client.resources.model.ModelResourceLocation) World(net.minecraft.world.World) Minecraft(net.minecraft.client.Minecraft)

Example 8 with ModelResourceLocation

use of net.minecraft.client.resources.model.ModelResourceLocation in project Galacticraft by micdoodle8.

the class ModelRegistryHelper method registerItemRenderer.

public static void registerItemRenderer(Item item, IItemRenderer renderer, ResourceLocation location) {
    final ModelResourceLocation modelLoc = new ModelResourceLocation(location, "inventory");
    register(modelLoc, renderer);
    registerItemMesher(item, new ItemMeshDefinition() {

        @Override
        public ModelResourceLocation getModelLocation(ItemStack stack) {
            return modelLoc;
        }
    });
}
Also used : ItemMeshDefinition(net.minecraft.client.renderer.ItemMeshDefinition) ModelResourceLocation(net.minecraft.client.resources.model.ModelResourceLocation) ItemStack(net.minecraft.item.ItemStack)

Example 9 with ModelResourceLocation

use of net.minecraft.client.resources.model.ModelResourceLocation in project BuildCraft by BuildCraft.

the class BuildCraftRobotics method registerModels.

@SubscribeEvent
@SideOnly(Side.CLIENT)
public void registerModels(ModelBakeEvent event) {
    if (robotStationItem != null) {
        ModelResourceLocation mrl = ModelHelper.getItemResourceLocation(robotStationItem, "");
        event.modelRegistry.putObject(mrl, RobotStationModel.INSTANCE.createItemModel());
    }
}
Also used : ModelResourceLocation(net.minecraft.client.resources.model.ModelResourceLocation) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 10 with ModelResourceLocation

use of net.minecraft.client.resources.model.ModelResourceLocation in project BuildCraft by BuildCraft.

the class BlockGenericPipe method setCusomStateMappers.

@Override
@SideOnly(Side.CLIENT)
public void setCusomStateMappers() {
    final ModelResourceLocation loc = new ModelResourceLocation(Utils.getNameForBlock(this).replace("|", ""));
    ModelLoader.setCustomStateMapper(this, new StateMapperBase() {

        @Override
        protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
            return loc;
        }
    });
}
Also used : StateMapperBase(net.minecraft.client.renderer.block.statemap.StateMapperBase) IBlockState(net.minecraft.block.state.IBlockState) ModelResourceLocation(net.minecraft.client.resources.model.ModelResourceLocation) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

ModelResourceLocation (net.minecraft.client.resources.model.ModelResourceLocation)21 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)14 ItemMeshDefinition (net.minecraft.client.renderer.ItemMeshDefinition)8 ItemStack (net.minecraft.item.ItemStack)8 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)5 DimletType (mcjty.rftoolsdim.dimensions.dimlets.types.DimletType)2 IBlockState (net.minecraft.block.state.IBlockState)2 StateMapperBase (net.minecraft.client.renderer.block.statemap.StateMapperBase)2 IBakedModel (net.minecraft.client.resources.model.IBakedModel)2 Joiner (com.google.common.base.Joiner)1 HashMultimap (com.google.common.collect.HashMultimap)1 Multimap (com.google.common.collect.Multimap)1 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Minecraft (net.minecraft.client.Minecraft)1 BlockModelShaper (net.minecraft.client.renderer.block.BlockModelShaper)1 BlockRenderDispatcher (net.minecraft.client.renderer.block.BlockRenderDispatcher)1 BakedModel (net.minecraft.client.resources.model.BakedModel)1 ModelManager (net.minecraft.client.resources.model.ModelManager)1