Search in sources :

Example 1 with BlockITFluid

use of ferro2000.immersivetech.common.blocks.BlockITFluid in project Immersive-Tech by FerroO2000.

the class ITContent method preInit.

public static void preInit() {
    /*BLOCKS*/
    /*MULTIBLOCKS*/
    blockMetalMultiblock = new BlockMetalMultiblock();
    blockStoneMultiblock = new BlockStoneMultiblock();
    /*CONNECTORS*/
    blockConnectors = new BlockConnectors();
    /*METAL*/
    // blockMetalDevice = new BlockMetalDevice();
    /*STONE*/
    blockStoneDecoration = new BlockStoneDecoration();
    /*FLUIDS*/
    fluidDistWater = new Fluid("dist_water", new ResourceLocation("immersivetech:blocks/fluid/dist_water_still"), new ResourceLocation("immersivetech:blocks/fluid/dist_water_flow")).setDensity(1000).setViscosity(1000);
    if (!FluidRegistry.registerFluid(fluidDistWater)) {
        fluidDistWater = FluidRegistry.getFluid("distwater");
    }
    FluidRegistry.addBucketForFluid(fluidDistWater);
    fluidSteam = new Fluid("steam", new ResourceLocation("immersivetech:blocks/fluid/steam_still"), new ResourceLocation("immersivetech:blocks/fluid/steam_flow")).setDensity(-100).setViscosity(500).setGaseous(true);
    if (!FluidRegistry.registerFluid(fluidSteam)) {
        fluidSteam = FluidRegistry.getFluid("steam");
    }
    FluidRegistry.addBucketForFluid(fluidSteam);
    /*FLUID BLOCKS*/
    blockFluidDistWater = new BlockITFluid("fluidDistWater", fluidDistWater, Material.WATER);
    blockFluidSteam = new BlockITFluid("fluidSteam", fluidSteam, Material.WATER);
    /*ITEMS*/
    /*MATERIALS*/
    itemMaterial = new ItemITBase("material", 64, "salt");
}
Also used : BlockConnectors(ferro2000.immersivetech.common.blocks.metal.BlockConnectors) BlockITFluid(ferro2000.immersivetech.common.blocks.BlockITFluid) BlockStoneMultiblock(ferro2000.immersivetech.common.blocks.stone.BlockStoneMultiblock) Fluid(net.minecraftforge.fluids.Fluid) BlockITFluid(ferro2000.immersivetech.common.blocks.BlockITFluid) ResourceLocation(net.minecraft.util.ResourceLocation) BlockStoneDecoration(ferro2000.immersivetech.common.blocks.stone.BlockStoneDecoration) ItemITBase(ferro2000.immersivetech.common.items.ItemITBase) BlockMetalMultiblock(ferro2000.immersivetech.common.blocks.metal.BlockMetalMultiblock)

Example 2 with BlockITFluid

use of ferro2000.immersivetech.common.blocks.BlockITFluid in project Immersive-Tech by FerroO2000.

the class ClientProxy method registerModels.

/**
 * @author BluSunrize
 */
@SubscribeEvent
public static void registerModels(ModelRegistryEvent evt) {
    WireApi.registerConnectorForRender("conn_timer", new ResourceLocation("immersivetech:block/connector/connectors_timer.obj.ie"), null);
    for (Block block : ITContent.registeredITBlocks) {
        final ResourceLocation loc = Block.REGISTRY.getNameForObject(block);
        Item blockItem = Item.getItemFromBlock(block);
        if (blockItem == null)
            throw new RuntimeException("ITEMBLOCK FOR " + loc + " : " + block + " IS NULL");
        if (block instanceof IIEMetaBlock) {
            IIEMetaBlock ieMetaBlock = (IIEMetaBlock) block;
            if (ieMetaBlock.useCustomStateMapper())
                ModelLoader.setCustomStateMapper(block, IECustomStateMapper.getStateMapper(ieMetaBlock));
            ModelLoader.setCustomMeshDefinition(blockItem, new ItemMeshDefinition() {

                @Override
                public ModelResourceLocation getModelLocation(ItemStack stack) {
                    return new ModelResourceLocation(loc, "inventory");
                }
            });
            for (int meta = 0; meta < ieMetaBlock.getMetaEnums().length; meta++) {
                String location = loc.toString();
                String prop = ieMetaBlock.appendPropertiesToState() ? ("inventory," + ieMetaBlock.getMetaProperty().getName() + "=" + ieMetaBlock.getMetaEnums()[meta].toString().toLowerCase(Locale.US)) : null;
                if (ieMetaBlock.useCustomStateMapper()) {
                    String custom = ieMetaBlock.getCustomStateMapping(meta, true);
                    if (custom != null)
                        location += "_" + custom;
                }
                try {
                    ModelLoader.setCustomModelResourceLocation(blockItem, meta, new ModelResourceLocation(location, prop));
                } catch (NullPointerException npe) {
                    throw new RuntimeException("WELP! apparently " + ieMetaBlock + " lacks an item!", npe);
                }
            }
        } else if (block instanceof BlockITFluid)
            mapFluidState(block, ((BlockITFluid) block).getFluid());
        else
            ModelLoader.setCustomModelResourceLocation(blockItem, 0, new ModelResourceLocation(loc, "inventory"));
    }
    for (Item item : ITContent.registeredITItems) {
        if (item instanceof ItemBlock)
            continue;
        if (item instanceof ItemITBase) {
            ItemITBase ipMetaItem = (ItemITBase) item;
            if (ipMetaItem.registerSubModels && ipMetaItem.getSubNames() != null && ipMetaItem.getSubNames().length > 0) {
                for (int meta = 0; meta < ipMetaItem.getSubNames().length; meta++) {
                    ResourceLocation loc = new ResourceLocation(ImmersiveTech.MODID, ipMetaItem.itemName + "/" + ipMetaItem.getSubNames()[meta]);
                    ModelBakery.registerItemVariants(ipMetaItem, loc);
                    ModelLoader.setCustomModelResourceLocation(ipMetaItem, meta, new ModelResourceLocation(loc, "inventory"));
                }
            } else {
                final ResourceLocation loc = new ResourceLocation(ImmersiveTech.MODID, ipMetaItem.itemName);
                ModelBakery.registerItemVariants(ipMetaItem, loc);
                ModelLoader.setCustomMeshDefinition(ipMetaItem, new ItemMeshDefinition() {

                    @Override
                    public ModelResourceLocation getModelLocation(ItemStack stack) {
                        return new ModelResourceLocation(loc, "inventory");
                    }
                });
            }
        } else {
            final ResourceLocation loc = Item.REGISTRY.getNameForObject(item);
            ModelBakery.registerItemVariants(item, loc);
            ModelLoader.setCustomMeshDefinition(item, new ItemMeshDefinition() {

                @Override
                public ModelResourceLocation getModelLocation(ItemStack stack) {
                    return new ModelResourceLocation(loc, "inventory");
                }
            });
        }
    }
}
Also used : IIEMetaBlock(blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces.IIEMetaBlock) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) ItemBlock(net.minecraft.item.ItemBlock) ItemITBase(ferro2000.immersivetech.common.items.ItemITBase) ItemMeshDefinition(net.minecraft.client.renderer.ItemMeshDefinition) Item(net.minecraft.item.Item) BlockITFluid(ferro2000.immersivetech.common.blocks.BlockITFluid) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) ResourceLocation(net.minecraft.util.ResourceLocation) Block(net.minecraft.block.Block) ItemBlock(net.minecraft.item.ItemBlock) IIEMetaBlock(blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces.IIEMetaBlock) ItemStack(net.minecraft.item.ItemStack) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Aggregations

BlockITFluid (ferro2000.immersivetech.common.blocks.BlockITFluid)2 ItemITBase (ferro2000.immersivetech.common.items.ItemITBase)2 ResourceLocation (net.minecraft.util.ResourceLocation)2 IIEMetaBlock (blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces.IIEMetaBlock)1 BlockConnectors (ferro2000.immersivetech.common.blocks.metal.BlockConnectors)1 BlockMetalMultiblock (ferro2000.immersivetech.common.blocks.metal.BlockMetalMultiblock)1 BlockStoneDecoration (ferro2000.immersivetech.common.blocks.stone.BlockStoneDecoration)1 BlockStoneMultiblock (ferro2000.immersivetech.common.blocks.stone.BlockStoneMultiblock)1 Block (net.minecraft.block.Block)1 ItemMeshDefinition (net.minecraft.client.renderer.ItemMeshDefinition)1 ModelResourceLocation (net.minecraft.client.renderer.block.model.ModelResourceLocation)1 Item (net.minecraft.item.Item)1 ItemBlock (net.minecraft.item.ItemBlock)1 ItemStack (net.minecraft.item.ItemStack)1 Fluid (net.minecraftforge.fluids.Fluid)1 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)1