Search in sources :

Example 11 with ModelResourceLocation

use of net.minecraft.client.renderer.block.model.ModelResourceLocation in project Realistic-Terrain-Generation by Team-RTG.

the class ButtonEntry method doRegisterModel.

@Override
protected void doRegisterModel(IStateMapper stateMapper) {
    for (EnumFacing facing : EnumFacing.VALUES) ModelLoader.setCustomStateMapper(getBlock(facing), stateMapper);
    for (int meta = 0; meta < button().getNbVariants(); ++meta) {
        String variants = "type=" + button().getVariantName(meta);
        ModelResourceLocation location = new ModelResourceLocation(externalName(internalName), variants);
        ModelLoader.setCustomModelResourceLocation(getItemBlock(), meta, location);
        LOGGER.debug("Model location: " + location);
    }
}
Also used : EnumFacing(net.minecraft.util.EnumFacing) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation)

Example 12 with ModelResourceLocation

use of net.minecraft.client.renderer.block.model.ModelResourceLocation in project Realistic-Terrain-Generation by Team-RTG.

the class ItemEntry method doRegisterModel.

@Override
protected void doRegisterModel(IStateMapper stateMapper) {
    if (getItem() instanceof Variable) {
        Variable varItem = (Variable) getItem();
        for (int meta = 0; meta < varItem.getNbVariants(); ++meta) {
            ModelResourceLocation location = new ModelResourceLocation(externalName(varItem.getVariantName(meta)));
            ModelLoader.setCustomModelResourceLocation(getItem(), meta, location);
            LOGGER.debug("Model location: " + location);
        }
    } else {
        ModelResourceLocation location = new ModelResourceLocation(externalName(internalName));
        ModelLoader.setCustomModelResourceLocation(getItem(), 0, location);
        LOGGER.debug("Model location: " + location);
    }
}
Also used : Variable(exterminatorjeff.undergroundbiomes.api.common.Variable) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation)

Example 13 with ModelResourceLocation

use of net.minecraft.client.renderer.block.model.ModelResourceLocation in project Realistic-Terrain-Generation by Team-RTG.

the class StairsEntry method doRegisterModel.

@Override
protected void doRegisterModel(IStateMapper stateMapper) {
    for (EnumFacing facing : EnumFacing.HORIZONTALS) ModelLoader.setCustomStateMapper(getBlock(facing), stateMapper);
    for (int meta = 0; meta < stairs().getNbVariants(); ++meta) {
        ModelResourceLocation location = new ModelResourceLocation(externalName(internalName), stairs().getVariantName(meta));
        ModelLoader.setCustomModelResourceLocation(getItemBlock(), meta, location);
        LOGGER.debug("Model location: " + location);
    }
}
Also used : EnumFacing(net.minecraft.util.EnumFacing) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation)

Example 14 with ModelResourceLocation

use of net.minecraft.client.renderer.block.model.ModelResourceLocation in project Realistic-Terrain-Generation by Team-RTG.

the class BlockEntry method doRegisterModel.

@Override
protected void doRegisterModel(IStateMapper stateMapper) {
    for (int meta = 0; meta < getUBBlock().getNbVariants(); ++meta) {
        ModelResourceLocation location = new ModelResourceLocation(externalName(internalName), "type=" + getUBBlock().getVariantName(meta));
        ModelLoader.setCustomModelResourceLocation(getItemBlock(), meta, location);
        LOGGER.debug("Model location: " + location);
    }
}
Also used : ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation)

Example 15 with ModelResourceLocation

use of net.minecraft.client.renderer.block.model.ModelResourceLocation in project Railcraft by Railcraft.

the class ItemTrackOutfitted method initializeClient.

@SideOnly(Side.CLIENT)
@Override
public void initializeClient() {
    ArrayList<ModelResourceLocation> textures = new ArrayList<>();
    for (TrackType trackType : TrackRegistry.TRACK_TYPE) {
        for (TrackKit trackKit : TrackRegistry.TRACK_KIT) {
            textures.add(new ModelResourceLocation(new ResourceLocation(RailcraftConstants.RESOURCE_DOMAIN, MODEL_PREFIX + trackType.getName() + "." + trackKit.getName()), "inventory"));
        }
    }
    ModelManager.registerComplexItemModel(this, (stack -> new ModelResourceLocation(new ResourceLocation(RailcraftConstants.RESOURCE_DOMAIN, MODEL_PREFIX + getSuffix(stack)), "inventory")), textures.toArray(new ModelResourceLocation[textures.size()]));
}
Also used : HashMap(java.util.HashMap) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) ArrayList(java.util.ArrayList) ItemStack(net.minecraft.item.ItemStack) Block(net.minecraft.block.Block) Side(net.minecraftforge.fml.relauncher.Side) Map(java.util.Map) SideOnly(net.minecraftforge.fml.relauncher.SideOnly) TrackRegistry(mods.railcraft.api.tracks.TrackRegistry) World(net.minecraft.world.World) ITrackItem(mods.railcraft.api.core.items.ITrackItem) EnumFacing(net.minecraft.util.EnumFacing) BlockPos(net.minecraft.util.math.BlockPos) ItemTrack(mods.railcraft.common.blocks.tracks.ItemTrack) TrackKit(mods.railcraft.api.tracks.TrackKit) LocalizationPlugin(mods.railcraft.common.plugins.forge.LocalizationPlugin) IBlockState(net.minecraft.block.state.IBlockState) ILocalizedObject(mods.railcraft.api.core.ILocalizedObject) ModelManager(mods.railcraft.client.render.models.resource.ModelManager) EntityPlayer(net.minecraft.entity.player.EntityPlayer) TrackType(mods.railcraft.api.tracks.TrackType) ResourceLocation(net.minecraft.util.ResourceLocation) TileEntity(net.minecraft.tileentity.TileEntity) CreativePlugin(mods.railcraft.common.plugins.forge.CreativePlugin) RailcraftConstants(mods.railcraft.common.core.RailcraftConstants) TrackType(mods.railcraft.api.tracks.TrackType) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) ResourceLocation(net.minecraft.util.ResourceLocation) ArrayList(java.util.ArrayList) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) TrackKit(mods.railcraft.api.tracks.TrackKit) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

ModelResourceLocation (net.minecraft.client.renderer.block.model.ModelResourceLocation)106 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)44 ResourceLocation (net.minecraft.util.ResourceLocation)31 ArrayList (java.util.ArrayList)20 Item (net.minecraft.item.Item)19 IBlockState (net.minecraft.block.state.IBlockState)10 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)8 Block (net.minecraft.block.Block)7 RenderItem (net.minecraft.client.renderer.RenderItem)7 StateMapperBase (net.minecraft.client.renderer.block.statemap.StateMapperBase)7 Map (java.util.Map)6 ItemMeshDefinition (net.minecraft.client.renderer.ItemMeshDefinition)6 IBakedModel (net.minecraft.client.renderer.block.model.IBakedModel)6 EnumFacing (net.minecraft.util.EnumFacing)6 StateMap (net.minecraft.client.renderer.block.statemap.StateMap)5 ItemStack (net.minecraft.item.ItemStack)4 HashMap (java.util.HashMap)3 BlockFenceGate (net.minecraft.block.BlockFenceGate)3 BlockSlab (net.minecraft.block.BlockSlab)3 BlockWall (net.minecraft.block.BlockWall)3