Search in sources :

Example 1 with ModelFluid

use of net.minecraftforge.client.model.ModelFluid in project BuildCraft by BuildCraft.

the class ComplexRefiningManager method registerModels.

@SideOnly(Side.CLIENT)
public static void registerModels(ModelBakeEvent event) {
    for (FluidDefinition def : allFluids) {
        IModel model = new ModelFluid(def.fluid);
        IBakedModel baked = model.bake(ModelRotation.X0_Y0, DefaultVertexFormats.BLOCK, ModelLoader.defaultTextureGetter());
        ModelResourceLocation loc = ModelHelper.getBlockResourceLocation(def.block);
        event.getModelRegistry().putObject(loc, baked);
    }
}
Also used : FluidDefinition(buildcraft.core.lib.fluids.FluidDefinition) IModel(net.minecraftforge.client.model.IModel) ModelFluid(net.minecraftforge.client.model.ModelFluid) IBakedModel(net.minecraft.client.renderer.block.model.IBakedModel) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 2 with ModelFluid

use of net.minecraftforge.client.model.ModelFluid in project BuildCraft by BuildCraft.

the class BCEnergyModels method onModelBake.

@SubscribeEvent
public static void onModelBake(ModelBakeEvent event) {
    ENGINE_PROGRESS.value = 0.2;
    ENGINE_STAGE.value = EnumPowerStage.BLUE;
    ENGINE_FACING.value = EnumFacing.UP;
    ModelVariableData varData = new ModelVariableData();
    varData.setNodes(ENGINE_STONE.createTickableNodes());
    varData.tick();
    varData.refresh();
    event.getModelRegistry().putObject(new ModelResourceLocation(EnumEngineType.STONE.getItemModelLocation(), "inventory"), new ModelItemSimple(Arrays.stream(ENGINE_STONE.getCutoutQuads()).map(MutableQuad::toBakedItem).collect(Collectors.toList()), ModelItemSimple.TRANSFORM_BLOCK, true));
    varData.setNodes(ENGINE_IRON.createTickableNodes());
    varData.tick();
    varData.refresh();
    event.getModelRegistry().putObject(new ModelResourceLocation(EnumEngineType.IRON.getItemModelLocation(), "inventory"), new ModelItemSimple(Arrays.stream(ENGINE_IRON.getCutoutQuads()).map(MutableQuad::toBakedItem).collect(Collectors.toList()), ModelItemSimple.TRANSFORM_BLOCK, true));
    for (BCFluid fluid : BCEnergyFluids.allFluids) {
        ModelFluid modelFluid = new ModelFluid(fluid);
        event.getModelRegistry().putObject(new ModelResourceLocation("buildcraftenergy:fluid_block_" + fluid.getBlockName()), modelFluid.bake(modelFluid.getDefaultState(), DefaultVertexFormats.ITEM, ModelLoader.defaultTextureGetter()));
    }
}
Also used : ModelVariableData(buildcraft.lib.misc.data.ModelVariableData) BCFluid(buildcraft.lib.fluid.BCFluid) ModelItemSimple(buildcraft.lib.client.model.ModelItemSimple) ModelFluid(net.minecraftforge.client.model.ModelFluid) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 3 with ModelFluid

use of net.minecraftforge.client.model.ModelFluid in project BuildCraft by BuildCraft.

the class BuildCraftEnergy method registerModels.

@SubscribeEvent
@SideOnly(Side.CLIENT)
public void registerModels(ModelBakeEvent event) {
    FluidDefinition[] arr = { oil, fuel, redPlasma };
    if (Loader.isModLoaded("BuildCraft|Factory")) {
        arr[0] = null;
        arr[1] = null;
    }
    if (!BuildCraftCore.DEVELOPER_MODE) {
        arr[2] = null;
    }
    for (FluidDefinition def : arr) {
        if (def == null)
            continue;
        IModel model = new ModelFluid(def.fluid);
        IBakedModel baked = model.bake(ModelRotation.X0_Y0, DefaultVertexFormats.BLOCK, ModelLoader.defaultTextureGetter());
        ModelResourceLocation loc = ModelHelper.getBlockResourceLocation(def.block);
        event.modelRegistry.putObject(loc, baked);
    }
}
Also used : FluidDefinition(buildcraft.core.lib.fluids.FluidDefinition) IModel(net.minecraftforge.client.model.IModel) ModelFluid(net.minecraftforge.client.model.ModelFluid) IBakedModel(net.minecraft.client.renderer.block.model.IBakedModel) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

ModelResourceLocation (net.minecraft.client.renderer.block.model.ModelResourceLocation)3 ModelFluid (net.minecraftforge.client.model.ModelFluid)3 FluidDefinition (buildcraft.core.lib.fluids.FluidDefinition)2 IBakedModel (net.minecraft.client.renderer.block.model.IBakedModel)2 IModel (net.minecraftforge.client.model.IModel)2 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)2 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)2 ModelItemSimple (buildcraft.lib.client.model.ModelItemSimple)1 BCFluid (buildcraft.lib.fluid.BCFluid)1 ModelVariableData (buildcraft.lib.misc.data.ModelVariableData)1