Search in sources :

Example 16 with IExplosiveData

use of icbm.classic.api.reg.IExplosiveData 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)

Example 17 with IExplosiveData

use of icbm.classic.api.reg.IExplosiveData in project ICBM-Classic by BuiltBrokenModding.

the class ICBMCreativeTab method compareExplosives.

private int compareExplosives(IExplosive explosiveA, IExplosive explosiveB) {
    final IExplosiveData dataA = Optional.ofNullable(explosiveA.getExplosiveData()).orElse(ICBMExplosives.CONDENSED);
    final IExplosiveData dataB = Optional.ofNullable(explosiveB.getExplosiveData()).orElse(ICBMExplosives.CONDENSED);
    final int tierA = dataA.getTier().ordinal();
    final int tierB = dataB.getTier().ordinal();
    // If tiers are the same move to sorting by explosive registry index
    if (tierA == tierB) {
        return dataA.getRegistryID() - dataB.getRegistryID();
    }
    return tierA - tierB;
}
Also used : IExplosiveData(icbm.classic.api.reg.IExplosiveData)

Aggregations

IExplosiveData (icbm.classic.api.reg.IExplosiveData)17 ResourceLocation (net.minecraft.util.ResourceLocation)6 ItemModelMapperExplosive (icbm.classic.client.mapper.ItemModelMapperExplosive)4 ModelResourceLocation (net.minecraft.client.renderer.block.model.ModelResourceLocation)4 EntityMissile (icbm.classic.content.entity.missile.EntityMissile)3 ItemStack (net.minecraft.item.ItemStack)3 EnumTier (icbm.classic.api.EnumTier)2 HashMap (java.util.HashMap)2 IBlockState (net.minecraft.block.state.IBlockState)2 TileEntity (net.minecraft.tileentity.TileEntity)2 ICBMConstants (icbm.classic.ICBMConstants)1 ICBMClassicAPI (icbm.classic.api.ICBMClassicAPI)1 LauncherEvent (icbm.classic.api.events.LauncherEvent)1 BlastState (icbm.classic.api.explosion.BlastState)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