Search in sources :

Example 1 with ItemModelMapperExplosive

use of icbm.classic.client.mapper.ItemModelMapperExplosive in project ICBM-Classic by BuiltBrokenModding.

the class ClientReg method registerCartRenders.

protected static void registerCartRenders() {
    for (// TODO run loop once for all 4 content types
    IExplosiveData data : // TODO run loop once for all 4 content types
    ICBMClassicAPI.EX_MINECART_REGISTRY.getExplosives()) {
        final String resourcePath = data.getRegistryName().getNamespace() + ":bombcarts/" + data.getRegistryName().getPath();
        cartModelMap.put(data, new ModelResourceLocation(resourcePath, "inventory"));
    }
    ModelLoader.registerItemVariants(ItemReg.itemBombCart, cartModelMap.values().stream().map(model -> new ResourceLocation(model.getNamespace() + ":" + model.getPath())).toArray(ResourceLocation[]::new));
    ModelLoader.setCustomMeshDefinition(ItemReg.itemBombCart, new ItemModelMapperExplosive(cartModelMap, cartModelMap.get(ICBMExplosives.CONDENSED)));
}
Also used : ItemModelMapperExplosive(icbm.classic.client.mapper.ItemModelMapperExplosive) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) ResourceLocation(net.minecraft.util.ResourceLocation) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) IExplosiveData(icbm.classic.api.reg.IExplosiveData)

Example 2 with ItemModelMapperExplosive

use of icbm.classic.client.mapper.ItemModelMapperExplosive in project ICBM-Classic by BuiltBrokenModding.

the class ClientReg method registerExBlockRenders.

protected static void registerExBlockRenders() {
    for (// TODO run loop once for all 4 content types
    IExplosiveData data : // TODO run loop once for all 4 content types
    ICBMClassicAPI.EX_BLOCK_REGISTRY.getExplosives()) {
        // Add block state
        final HashMap<EnumFacing, ModelResourceLocation> facingModelMap = new HashMap<>();
        final String resourcePath = data.getRegistryName().getNamespace() + ":explosives/" + data.getRegistryName().getPath();
        for (EnumFacing facing : EnumFacing.VALUES) {
            facingModelMap.put(facing, new ModelResourceLocation(resourcePath, "explosive=" + data.getRegistryName().toString().replace(":", "_") + ",rotation=" + facing));
        }
        blockModelMap.put(data, facingModelMap);
        // Add item state
        // IBlockState state = BlockReg.blockExplosive.getDefaultState().withProperty(BlockICBM.ROTATION_PROP, EnumFacing.UP);
        // String properties_string = getPropertyString(state.getProperties());
        itemBlockModelMap.put(data, new ModelResourceLocation(resourcePath, "inventory"));
    }
    // Block state mapper
    ModelLoader.setCustomStateMapper(BlockReg.blockExplosive, new BlockModelMapperExplosive(blockModelMap, blockModelMap.get(ICBMExplosives.CONDENSED).get(EnumFacing.UP)));
    // Item state mapper
    ModelLoader.setCustomMeshDefinition(Item.getItemFromBlock(BlockReg.blockExplosive), new ItemModelMapperExplosive(itemBlockModelMap, itemBlockModelMap.get(ICBMExplosives.CONDENSED)));
    ModelBakery.registerItemVariants(Item.getItemFromBlock(BlockReg.blockExplosive), itemBlockModelMap.values().stream().map(mrl -> new ResourceLocation(mrl.getNamespace(), mrl.getPath())).collect(Collectors.toList()).toArray(new ResourceLocation[itemBlockModelMap.values().size()]));
}
Also used : TileEMPTower(icbm.classic.content.blocks.emptower.TileEMPTower) Item(net.minecraft.item.Item) TileLauncherFrame(icbm.classic.content.blocks.launcher.frame.TileLauncherFrame) ModelRegistryEvent(net.minecraftforge.client.event.ModelRegistryEvent) TESRRadarStation(icbm.classic.content.blocks.radarstation.TESRRadarStation) TileLauncherScreen(icbm.classic.content.blocks.launcher.screen.TileLauncherScreen) ItemCrafting(icbm.classic.content.items.ItemCrafting) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) icbm.classic.content.entity(icbm.classic.content.entity) OBJLoader(net.minecraftforge.client.model.obj.OBJLoader) IProperty(net.minecraft.block.properties.IProperty) Block(net.minecraft.block.Block) Side(net.minecraftforge.fml.relauncher.Side) ICBMExplosives(icbm.classic.api.refs.ICBMExplosives) TileRadarStation(icbm.classic.content.blocks.radarstation.TileRadarStation) Map(java.util.Map) ItemModelMapperExplosive(icbm.classic.client.mapper.ItemModelMapperExplosive) BlockICBM(icbm.classic.prefab.tile.BlockICBM) TESRCruiseLauncher(icbm.classic.content.blocks.launcher.cruise.TESRCruiseLauncher) Collectors(java.util.stream.Collectors) icbm.classic.content.entity.mobs(icbm.classic.content.entity.mobs) icbm.classic.client.render.entity(icbm.classic.client.render.entity) BlockReg(icbm.classic.content.reg.BlockReg) HashMap(java.util.HashMap) BlockModelMapperExplosive(icbm.classic.client.mapper.BlockModelMapperExplosive) EntityMissile(icbm.classic.content.entity.missile.EntityMissile) ModelBakery(net.minecraft.client.renderer.block.model.ModelBakery) ClientRegistry(net.minecraftforge.fml.client.registry.ClientRegistry) IExplosiveData(icbm.classic.api.reg.IExplosiveData) EnumTier(icbm.classic.api.EnumTier) RenderingRegistry(net.minecraftforge.fml.client.registry.RenderingRegistry) Mod(net.minecraftforge.fml.common.Mod) ModelLoader(net.minecraftforge.client.model.ModelLoader) ItemReg(icbm.classic.content.reg.ItemReg) DefaultStateMapper(net.minecraft.client.renderer.block.statemap.DefaultStateMapper) ICBMConstants(icbm.classic.ICBMConstants) TESRLauncherBase(icbm.classic.content.blocks.launcher.base.TESRLauncherBase) TileLauncherBase(icbm.classic.content.blocks.launcher.base.TileLauncherBase) EnumFacing(net.minecraft.util.EnumFacing) ConfigItems(icbm.classic.config.ConfigItems) TESRLauncherFrame(icbm.classic.content.blocks.launcher.frame.TESRLauncherFrame) ICBMClassicAPI(icbm.classic.api.ICBMClassicAPI) IBlockState(net.minecraft.block.state.IBlockState) TESREMPTower(icbm.classic.content.blocks.emptower.TESREMPTower) TESRLauncherScreen(icbm.classic.content.blocks.launcher.screen.TESRLauncherScreen) ResourceLocation(net.minecraft.util.ResourceLocation) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent) TileCruiseLauncher(icbm.classic.content.blocks.launcher.cruise.TileCruiseLauncher) Collections(java.util.Collections) ItemModelMapperExplosive(icbm.classic.client.mapper.ItemModelMapperExplosive) HashMap(java.util.HashMap) EnumFacing(net.minecraft.util.EnumFacing) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) ResourceLocation(net.minecraft.util.ResourceLocation) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) BlockModelMapperExplosive(icbm.classic.client.mapper.BlockModelMapperExplosive) IExplosiveData(icbm.classic.api.reg.IExplosiveData)

Example 3 with ItemModelMapperExplosive

use of icbm.classic.client.mapper.ItemModelMapperExplosive in project ICBM-Classic by BuiltBrokenModding.

the class ClientReg method registerGrenadeRenders.

protected static void registerGrenadeRenders() {
    for (// TODO run loop once for all 4 content types
    IExplosiveData data : // TODO run loop once for all 4 content types
    ICBMClassicAPI.EX_GRENADE_REGISTRY.getExplosives()) {
        final String resourcePath = data.getRegistryName().getNamespace() + ":grenades/" + data.getRegistryName().getPath();
        grenadeModelMap.put(data, new ModelResourceLocation(resourcePath, "inventory"));
    }
    ModelLoader.registerItemVariants(ItemReg.itemGrenade, grenadeModelMap.values().stream().map(model -> new ResourceLocation(model.getNamespace() + ":" + model.getPath())).toArray(ResourceLocation[]::new));
    ModelLoader.setCustomMeshDefinition(ItemReg.itemGrenade, new ItemModelMapperExplosive(grenadeModelMap, grenadeModelMap.get(ICBMExplosives.CONDENSED)));
}
Also used : ItemModelMapperExplosive(icbm.classic.client.mapper.ItemModelMapperExplosive) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) ResourceLocation(net.minecraft.util.ResourceLocation) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) IExplosiveData(icbm.classic.api.reg.IExplosiveData)

Example 4 with ItemModelMapperExplosive

use of icbm.classic.client.mapper.ItemModelMapperExplosive in project ICBM-Classic by BuiltBrokenModding.

the class ClientReg method registerMissileRenders.

protected static void registerMissileRenders() {
    for (// TODO run loop once for all 4 content types
    IExplosiveData data : // TODO run loop once for all 4 content types
    ICBMClassicAPI.EX_MISSILE_REGISTRY.getExplosives()) {
        final String resourcePath = data.getRegistryName().getNamespace() + ":missiles/" + data.getRegistryName().getPath();
        missileModelMap.put(data, new ModelResourceLocation(resourcePath, "inventory"));
    }
    ModelLoader.registerItemVariants(ItemReg.itemMissile, missileModelMap.values().stream().map(model -> new ResourceLocation(model.getNamespace() + ":" + model.getPath())).toArray(ResourceLocation[]::new));
    ModelLoader.setCustomMeshDefinition(ItemReg.itemMissile, new ItemModelMapperExplosive(missileModelMap, missileModelMap.get(ICBMExplosives.CONDENSED)));
}
Also used : ItemModelMapperExplosive(icbm.classic.client.mapper.ItemModelMapperExplosive) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) ResourceLocation(net.minecraft.util.ResourceLocation) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) IExplosiveData(icbm.classic.api.reg.IExplosiveData)

Aggregations

IExplosiveData (icbm.classic.api.reg.IExplosiveData)4 ItemModelMapperExplosive (icbm.classic.client.mapper.ItemModelMapperExplosive)4 ModelResourceLocation (net.minecraft.client.renderer.block.model.ModelResourceLocation)4 ResourceLocation (net.minecraft.util.ResourceLocation)4 ICBMConstants (icbm.classic.ICBMConstants)1 EnumTier (icbm.classic.api.EnumTier)1 ICBMClassicAPI (icbm.classic.api.ICBMClassicAPI)1 ICBMExplosives (icbm.classic.api.refs.ICBMExplosives)1 BlockModelMapperExplosive (icbm.classic.client.mapper.BlockModelMapperExplosive)1 icbm.classic.client.render.entity (icbm.classic.client.render.entity)1 ConfigItems (icbm.classic.config.ConfigItems)1 TESREMPTower (icbm.classic.content.blocks.emptower.TESREMPTower)1 TileEMPTower (icbm.classic.content.blocks.emptower.TileEMPTower)1 TESRLauncherBase (icbm.classic.content.blocks.launcher.base.TESRLauncherBase)1 TileLauncherBase (icbm.classic.content.blocks.launcher.base.TileLauncherBase)1 TESRCruiseLauncher (icbm.classic.content.blocks.launcher.cruise.TESRCruiseLauncher)1 TileCruiseLauncher (icbm.classic.content.blocks.launcher.cruise.TileCruiseLauncher)1 TESRLauncherFrame (icbm.classic.content.blocks.launcher.frame.TESRLauncherFrame)1 TileLauncherFrame (icbm.classic.content.blocks.launcher.frame.TileLauncherFrame)1 TESRLauncherScreen (icbm.classic.content.blocks.launcher.screen.TESRLauncherScreen)1