Search in sources :

Example 1 with ItemBasicStructure

use of com.wuest.prefab.Items.Structures.ItemBasicStructure in project MC-Prefab by Brian-Wuest.

the class ClientModRegistry method RegisterModelMeshers.

/**
 * This method is used to register model meshers for specific items.
 */
public static void RegisterModelMeshers() {
    ItemBasicStructure item = ModRegistry.BasicStructure();
    // Register the model mesher for this item.
    Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, new PrefabModelMesher());
}
Also used : PrefabModelMesher(com.wuest.prefab.Render.PrefabModelMesher) ItemBasicStructure(com.wuest.prefab.Items.Structures.ItemBasicStructure)

Example 2 with ItemBasicStructure

use of com.wuest.prefab.Items.Structures.ItemBasicStructure in project MC-Prefab by Brian-Wuest.

the class ItemRenderRegister method regItem.

/**
 * Registers an item to be rendered. This is needed for textures.
 * @param item The item to register.
 * @param metaData The meta data for the item to register.
 * @param blockName the name of the block.
 */
public static void regItem(Item item, int metaData, String blockName) {
    ModelResourceLocation location = new ModelResourceLocation(blockName, "inventory");
    if (!(item instanceof ItemBasicStructure)) {
        ModelLoader.setCustomModelResourceLocation(item, metaData, location);
    } else {
        ArrayList<ResourceLocation> names = new ArrayList<ResourceLocation>();
        for (EnumBasicStructureName value : EnumBasicStructureName.values()) {
            if (value.getResourceLocation() != null) {
                names.add(value.getResourceLocation());
            }
        }
        ResourceLocation[] resources = new ResourceLocation[names.size()];
        resources = names.toArray(resources);
        ModelLoader.registerItemVariants(item, resources);
    }
}
Also used : EnumBasicStructureName(com.wuest.prefab.Config.Structures.BasicStructureConfiguration.EnumBasicStructureName) ItemBasicStructure(com.wuest.prefab.Items.Structures.ItemBasicStructure) 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)

Example 3 with ItemBasicStructure

use of com.wuest.prefab.Items.Structures.ItemBasicStructure in project MC-Prefab by Brian-Wuest.

the class ModRegistry method RegisterModComponents.

/**
 * This is where all in-game mod components (Items, Blocks) will be registered.
 */
public static void RegisterModComponents() {
    ModRegistry.registerItem(new ItemStartHouse("item_start_house"));
    ModRegistry.registerItem(new ItemWareHouse("item_warehouse"));
    ModRegistry.registerItem(new ItemChickenCoop("item_chicken_coop"));
    ModRegistry.registerItem(new ItemProduceFarm("item_produce_farm"));
    ModRegistry.registerItem(new ItemTreeFarm("item_tree_farm"));
    ModRegistry.registerItem(new ItemCompressedChest("item_compressed_chest"));
    ModRegistry.registerItem(new ItemPileOfBricks("item_pile_of_bricks"));
    ModRegistry.registerItem(new ItemPalletOfBricks("item_pallet_of_bricks"));
    ModRegistry.registerItem(new ItemFishPond("item_fish_pond"));
    ModRegistry.registerItem(new ItemAdvancedWareHouse("item_advanced_warehouse"));
    ModRegistry.registerItem(new ItemMonsterMasher("item_monster_masher"));
    ModRegistry.registerItem(new ItemWarehouseUpgrade("item_warehouse_upgrade"));
    ModRegistry.registerItem(new ItemBundleOfTimber("item_bundle_of_timber"));
    ModRegistry.registerItem(new ItemHorseStable("item_horse_stable"));
    ModRegistry.registerItem(new ItemNetherGate("item_nether_gate"));
    ModRegistry.registerItem(new ItemInstantBridge("item_instant_bridge"));
    // ModRegistry.registerItem(new ItemModularHouse("item_modular_house"));
    ModRegistry.registerItem(new ItemStringOfLanterns("item_string_of_lanterns"));
    ModRegistry.registerItem(new ItemCoilOfLanterns("item_coil_of_lanterns"));
    ModRegistry.registerItem(new ItemModerateHouse("item_moderate_house"));
    ModRegistry.registerItem(new ItemBulldozer("item_bulldozer"));
    // ModRegistry.registerItem(new ItemBogus("item_bogus"));
    // Register all the basic structures here. The resource location is used for the item models and textures.
    // Only the first one in this list should have the last variable set to true.
    ModRegistry.registerItem(new ItemBasicStructure("item_basic_structure"));
    // Create/register the item block with this block as it's needed due to this being a meta data block.
    BlockCompressedStone stone = new BlockCompressedStone();
    ItemBlockMeta meta = new ItemBlockMeta(stone);
    ModRegistry.setItemName(meta, "block_compressed_stone");
    ModRegistry.registerBlock(stone, meta);
    ModRegistry.registerBlock(new BlockPaperLantern("block_paper_lantern"));
    BlockCompressedObsidian obsidian = new BlockCompressedObsidian();
    ItemBlockMeta metaObsidian = new ItemBlockMeta(obsidian);
    ModRegistry.setItemName(metaObsidian, "block_compressed_obsidian");
    ModRegistry.registerBlock(obsidian, metaObsidian);
    ModRegistry.registerItem(new ItemVillagerHouses("item_villager_houses"));
    ModRegistry.registerBlock(new BlockPhasing("block_phasing"));
    ModRegistry.registerBlock(new BlockBoundary("block_boundary"));
    ModRegistry.registerBlock(new BlockGlassStairs("block_glass_stairs"));
    ModRegistry.registerBlock(new BlockAndesiteStairs("block_andesite_stairs"));
    ModRegistry.registerBlock(new BlockDioriteStairs("block_diorite_stairs"));
    ModRegistry.registerBlock(new BlockGraniteStairs("block_granite_stairs"));
    // Glass Slab.
    BlockHalfGlassSlab registeredHalfGlassBlock = new BlockHalfGlassSlab();
    BlockDoubleGlassSlab registeredDoubleGlassSlab = new BlockDoubleGlassSlab();
    ItemBlockGlassSlab itemHalfGlassSlab = new ItemBlockGlassSlab(registeredHalfGlassBlock, registeredHalfGlassBlock, registeredDoubleGlassSlab, true);
    itemHalfGlassSlab = (ItemBlockGlassSlab) itemHalfGlassSlab.setRegistryName("block_half_glass_slab");
    ModRegistry.registerBlock(registeredHalfGlassBlock, itemHalfGlassSlab);
    ModRegistry.registerBlock(registeredDoubleGlassSlab, false);
    // Andesite slab.
    BlockHalfAndesiteSlab registeredHalfAndesiteBlock = new BlockHalfAndesiteSlab();
    BlockDoubleAndesiteSlab registeredDoubleAndesiteSlab = new BlockDoubleAndesiteSlab();
    ItemBlockAndesiteSlab itemHalfAndesiteSlab = new ItemBlockAndesiteSlab(registeredHalfAndesiteBlock, registeredHalfAndesiteBlock, registeredDoubleAndesiteSlab, true);
    itemHalfAndesiteSlab = (ItemBlockAndesiteSlab) itemHalfAndesiteSlab.setRegistryName("block_half_andesite_slab");
    ModRegistry.registerBlock(registeredHalfAndesiteBlock, itemHalfAndesiteSlab);
    ModRegistry.registerBlock(registeredDoubleAndesiteSlab, false);
    // Diorite slab.
    BlockHalfDioriteSlab registeredHalfDioriteBlock = new BlockHalfDioriteSlab();
    BlockDoubleDioriteSlab registeredDoubleDioriteSlab = new BlockDoubleDioriteSlab();
    ItemBlockDioriteSlab itemHalfDioriteSlab = new ItemBlockDioriteSlab(registeredHalfDioriteBlock, registeredHalfDioriteBlock, registeredDoubleDioriteSlab, true);
    itemHalfDioriteSlab = (ItemBlockDioriteSlab) itemHalfDioriteSlab.setRegistryName("block_half_diorite_slab");
    ModRegistry.registerBlock(registeredHalfDioriteBlock, itemHalfDioriteSlab);
    ModRegistry.registerBlock(registeredDoubleDioriteSlab, false);
    // Granite slab.
    BlockHalfGraniteSlab registeredHalfGraniteBlock = new BlockHalfGraniteSlab();
    BlockDoubleGraniteSlab registeredDoubleGraniteSlab = new BlockDoubleGraniteSlab();
    ItemBlockGraniteSlab itemHalfGraniteSlab = new ItemBlockGraniteSlab(registeredHalfGraniteBlock, registeredHalfGraniteBlock, registeredDoubleGraniteSlab, true);
    itemHalfGraniteSlab = (ItemBlockGraniteSlab) itemHalfGraniteSlab.setRegistryName("block_half_granite_slab");
    ModRegistry.registerBlock(registeredHalfGraniteBlock, itemHalfGraniteSlab);
    ModRegistry.registerBlock(registeredDoubleGraniteSlab, false);
    Blocks.STRUCTURE_BLOCK.setCreativeTab(CreativeTabs.BUILDING_BLOCKS);
// BlockDrafter drafter = new BlockDrafter();
// ModRegistry.registerBlock(drafter);
// GameRegistry.registerTileEntity(TileEntityDrafter.class, "Drafter");
}
Also used : ItemInstantBridge(com.wuest.prefab.Items.Structures.ItemInstantBridge) ItemModerateHouse(com.wuest.prefab.Items.Structures.ItemModerateHouse) ItemFishPond(com.wuest.prefab.Items.Structures.ItemFishPond) BlockCompressedObsidian(com.wuest.prefab.Blocks.BlockCompressedObsidian) BlockDoubleGraniteSlab(com.wuest.prefab.Blocks.BlockDoubleGraniteSlab) ItemBlockGraniteSlab(com.wuest.prefab.Items.ItemBlockGraniteSlab) ItemPileOfBricks(com.wuest.prefab.Items.ItemPileOfBricks) ItemBlockGlassSlab(com.wuest.prefab.Items.ItemBlockGlassSlab) BlockHalfGraniteSlab(com.wuest.prefab.Blocks.BlockHalfGraniteSlab) ItemWareHouse(com.wuest.prefab.Items.Structures.ItemWareHouse) ItemProduceFarm(com.wuest.prefab.Items.Structures.ItemProduceFarm) ItemNetherGate(com.wuest.prefab.Items.Structures.ItemNetherGate) BlockPaperLantern(com.wuest.prefab.Blocks.BlockPaperLantern) ItemChickenCoop(com.wuest.prefab.Items.Structures.ItemChickenCoop) ItemMonsterMasher(com.wuest.prefab.Items.Structures.ItemMonsterMasher) BlockHalfAndesiteSlab(com.wuest.prefab.Blocks.BlockHalfAndesiteSlab) BlockDoubleDioriteSlab(com.wuest.prefab.Blocks.BlockDoubleDioriteSlab) BlockDioriteStairs(com.wuest.prefab.Blocks.BlockDioriteStairs) ItemBasicStructure(com.wuest.prefab.Items.Structures.ItemBasicStructure) BlockHalfDioriteSlab(com.wuest.prefab.Blocks.BlockHalfDioriteSlab) ItemBulldozer(com.wuest.prefab.Items.Structures.ItemBulldozer) ItemTreeFarm(com.wuest.prefab.Items.Structures.ItemTreeFarm) BlockBoundary(com.wuest.prefab.Blocks.BlockBoundary) ItemBlockAndesiteSlab(com.wuest.prefab.Items.ItemBlockAndesiteSlab) BlockHalfGlassSlab(com.wuest.prefab.Blocks.BlockHalfGlassSlab) BlockCompressedStone(com.wuest.prefab.Blocks.BlockCompressedStone) BlockGraniteStairs(com.wuest.prefab.Blocks.BlockGraniteStairs) ItemPalletOfBricks(com.wuest.prefab.Items.ItemPalletOfBricks) BlockGlassStairs(com.wuest.prefab.Blocks.BlockGlassStairs) BlockDoubleGlassSlab(com.wuest.prefab.Blocks.BlockDoubleGlassSlab) BlockPhasing(com.wuest.prefab.Blocks.BlockPhasing) ItemBundleOfTimber(com.wuest.prefab.Items.ItemBundleOfTimber) ItemStartHouse(com.wuest.prefab.Items.Structures.ItemStartHouse) ItemVillagerHouses(com.wuest.prefab.Items.Structures.ItemVillagerHouses) ItemCoilOfLanterns(com.wuest.prefab.Items.ItemCoilOfLanterns) ItemStringOfLanterns(com.wuest.prefab.Items.ItemStringOfLanterns) ItemAdvancedWareHouse(com.wuest.prefab.Items.Structures.ItemAdvancedWareHouse) ItemBlockDioriteSlab(com.wuest.prefab.Items.ItemBlockDioriteSlab) ItemBlockMeta(com.wuest.prefab.Items.ItemBlockMeta) BlockAndesiteStairs(com.wuest.prefab.Blocks.BlockAndesiteStairs) ItemCompressedChest(com.wuest.prefab.Items.ItemCompressedChest) BlockDoubleAndesiteSlab(com.wuest.prefab.Blocks.BlockDoubleAndesiteSlab) ItemHorseStable(com.wuest.prefab.Items.Structures.ItemHorseStable) ItemWarehouseUpgrade(com.wuest.prefab.Items.ItemWarehouseUpgrade)

Example 4 with ItemBasicStructure

use of com.wuest.prefab.Items.Structures.ItemBasicStructure in project MC-Prefab by Brian-Wuest.

the class ClientEventHandler method regItem.

/**
 * Registers an item to be rendered. This is needed for textures.
 * @param item The item to register.
 * @param metaData The meta data for the item to register.
 * @param blockName the name of the block.
 */
public static void regItem(Item item, int metaData, String blockName) {
    ModelResourceLocation location = new ModelResourceLocation(blockName, "inventory");
    if (!(item instanceof ItemBasicStructure)) {
        ModelLoader.setCustomModelResourceLocation(item, metaData, location);
    } else {
        ArrayList<ResourceLocation> names = new ArrayList<ResourceLocation>();
        for (EnumBasicStructureName value : EnumBasicStructureName.values()) {
            if (value.getResourceLocation() != null) {
                names.add(value.getResourceLocation());
            }
        }
        ResourceLocation[] resources = new ResourceLocation[names.size()];
        resources = names.toArray(resources);
        ModelLoader.registerItemVariants(item, resources);
    }
}
Also used : EnumBasicStructureName(com.wuest.prefab.Config.Structures.BasicStructureConfiguration.EnumBasicStructureName) ItemBasicStructure(com.wuest.prefab.Items.Structures.ItemBasicStructure) 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)

Aggregations

ItemBasicStructure (com.wuest.prefab.Items.Structures.ItemBasicStructure)4 EnumBasicStructureName (com.wuest.prefab.Config.Structures.BasicStructureConfiguration.EnumBasicStructureName)2 BlockAndesiteStairs (com.wuest.prefab.Blocks.BlockAndesiteStairs)1 BlockBoundary (com.wuest.prefab.Blocks.BlockBoundary)1 BlockCompressedObsidian (com.wuest.prefab.Blocks.BlockCompressedObsidian)1 BlockCompressedStone (com.wuest.prefab.Blocks.BlockCompressedStone)1 BlockDioriteStairs (com.wuest.prefab.Blocks.BlockDioriteStairs)1 BlockDoubleAndesiteSlab (com.wuest.prefab.Blocks.BlockDoubleAndesiteSlab)1 BlockDoubleDioriteSlab (com.wuest.prefab.Blocks.BlockDoubleDioriteSlab)1 BlockDoubleGlassSlab (com.wuest.prefab.Blocks.BlockDoubleGlassSlab)1 BlockDoubleGraniteSlab (com.wuest.prefab.Blocks.BlockDoubleGraniteSlab)1 BlockGlassStairs (com.wuest.prefab.Blocks.BlockGlassStairs)1 BlockGraniteStairs (com.wuest.prefab.Blocks.BlockGraniteStairs)1 BlockHalfAndesiteSlab (com.wuest.prefab.Blocks.BlockHalfAndesiteSlab)1 BlockHalfDioriteSlab (com.wuest.prefab.Blocks.BlockHalfDioriteSlab)1 BlockHalfGlassSlab (com.wuest.prefab.Blocks.BlockHalfGlassSlab)1 BlockHalfGraniteSlab (com.wuest.prefab.Blocks.BlockHalfGraniteSlab)1 BlockPaperLantern (com.wuest.prefab.Blocks.BlockPaperLantern)1 BlockPhasing (com.wuest.prefab.Blocks.BlockPhasing)1 ItemBlockAndesiteSlab (com.wuest.prefab.Items.ItemBlockAndesiteSlab)1