Example usage for net.minecraftforge.fml.common.registry GameRegistry findRegistry

List of usage examples for net.minecraftforge.fml.common.registry GameRegistry findRegistry

Introduction

In this page you can find the example usage for net.minecraftforge.fml.common.registry GameRegistry findRegistry.

Prototype

public static <K extends IForgeRegistryEntry<K>> IForgeRegistry<K> findRegistry(Class<K> registryType) 

Source Link

Document

Retrieves the registry associated with this super class type.

Usage

From source file:blusunrize.immersiveengineering.common.IERecipes.java

public static void initCrusherRecipes() {
    oreOutputSecondaries.put("Iron", new Object[] { "dustNickel", .1f });
    oreOutputSecondaries.put("Gold", new Object[] { "crystalCinnabar", .05f });
    oreOutputSecondaries.put("Copper", new Object[] { "dustGold", .1f });
    oreOutputSecondaries.put("Lead", new Object[] { "dustSilver", .1f });
    oreOutputSecondaries.put("Silver", new Object[] { "dustLead", .1f });
    oreOutputSecondaries.put("Nickel", new Object[] { "dustPlatinum", .1f });

    oreOutputModifier.put("Lapis", new ItemStack(Items.DYE, 9, 4));
    oreOutputSecondaries.put("Lapis", new Object[] { "dustSulfur", .15f });
    oreOutputModifier.put("Diamond", new ItemStack(Items.DIAMOND, 2));
    oreOutputModifier.put("Redstone", new ItemStack(Items.REDSTONE, 6));
    oreOutputSecondaries.put("Redstone", new Object[] { "crystalCinnabar", .25f });
    oreOutputModifier.put("Emerald", new ItemStack(Items.EMERALD, 2));
    oreOutputModifier.put("Quartz", new ItemStack(Items.QUARTZ, 3));
    oreOutputSecondaries.put("Quartz", new Object[] { "dustSulfur", .15f });
    oreOutputModifier.put("Coal", new ItemStack(Items.COAL, 4));

    oreOutputSecondaries.put("Platinum", new Object[] { "dustNickel", .1f });
    oreOutputSecondaries.put("Tungsten", new Object[] { "dustManganese", .1f });
    oreOutputSecondaries.put("Uranium", new Object[] { "dustLead", .1f });
    oreOutputSecondaries.put("Yellorium", new Object[] { "dustLead", .1f });
    oreOutputSecondaries.put("Plutonium", new Object[] { "dustUranium", .1f });
    Item item = GameRegistry.findRegistry(Item.class).getValue(new ResourceLocation("IC2", "itemOreIridium"));
    oreOutputSecondaries.put("Osmium", new Object[] { item, .01f });
    oreOutputSecondaries.put("Iridium", new Object[] { "dustPlatium", .1f });
    oreOutputSecondaries.put("FzDarkIron", new Object[] { "dustIron", .1f });
    item = GameRegistry.findRegistry(Item.class).getValue(new ResourceLocation("Railcraft", "firestone.raw"));
    if (item != null)
        oreOutputModifier.put("Firestone", new ItemStack(item));
    oreOutputSecondaries.put("Nikolite", new Object[] { Items.DIAMOND, .025f });

    addCrusherRecipe(new ItemStack(Blocks.GRAVEL), "cobblestone", 1600);
    addCrusherRecipe(new ItemStack(Blocks.SAND), Blocks.GRAVEL, 1600);
    addCrusherRecipe(new ItemStack(Blocks.SAND), "itemSlag", 1600);
    addCrusherRecipe(new ItemStack(Blocks.SAND), "blockGlass", 3200);
    addCrusherRecipe(new ItemStack(Blocks.SAND, 2), "sandstone", 1600,
            new ItemStack(IEContent.itemMaterial, 1, 24), .5f);
    addCrusherRecipe(new ItemStack(Items.CLAY_BALL, 4), "blockClay", 1600);
    addCrusherRecipe(new ItemStack(Items.QUARTZ, 4), "blockQuartz", 3200);
    addCrusherRecipe(new ItemStack(Items.GLOWSTONE_DUST, 4), "glowstone", 3200);
    addCrusherRecipe(new ItemStack(Items.BLAZE_POWDER, 4), "rodBlaze", 3200,
            new ItemStack(IEContent.itemMaterial, 1, 25), .5f);
    addCrusherRecipe(new ItemStack(Items.DYE, 6, 15), Items.BONE, 3200);
    addCrusherRecipe(new ItemStack(IEContent.itemMaterial, 1, 17), "fuelCoke", 2400);
    addCrusherRecipe(new ItemStack(IEContent.itemMaterial, 9, 17), "blockFuelCoke", 4800);
    addItemToOreDictCrusherRecipe("dustCoal", 1, new ItemStack(Items.COAL), 2400);
    addItemToOreDictCrusherRecipe("dustObsidian", 4, Blocks.OBSIDIAN, 6000);
    for (int i = 0; i < 16; i++) {
        CrusherRecipe r = CrusherRecipe.addRecipe(new ItemStack(Items.STRING, 4),
                new ItemStack(Blocks.WOOL, 1, i), 3200);
        if (i != 0)
            r.addToSecondaryOutput(new ItemStack(Items.DYE, 1, 15 - i), .05f);
    }/*ww  w  .  j ava  2  s.  c  o  m*/
}

From source file:com.buuz135.industrial.proxy.client.event.IFClientEvents.java

License:Open Source License

@SubscribeEvent
public void modelBake(ModelBakeEvent event) {
    boolean isApril = Calendar.getInstance().get(Calendar.MONTH) == Calendar.APRIL
            && Calendar.getInstance().get(Calendar.DAY_OF_MONTH) == 1;
    for (ModelResourceLocation resourceLocation : event.getModelRegistry().getKeys()) {
        if (resourceLocation.getNamespace().equals(Reference.MOD_ID)) {
            if (resourceLocation.getPath().contains("conveyor")
                    && !resourceLocation.getPath().contains("upgrade"))
                event.getModelRegistry().putObject(resourceLocation,
                        new ConveyorBlockModel(event.getModelRegistry().getObject(resourceLocation)));
            if (isApril && CustomConfiguration.enableMultiblockEdition) {
                try {
                    IModel model = ModelLoaderRegistry.getModel(resourceLocation);
                    model.getDependencies().forEach(dep -> {
                        try {
                            ModelLoaderRegistry.getModel(dep).asVanillaModel().ifPresent(modelBlock -> {
                                if (modelBlock.parent != null) {
                                    if (modelBlock.parent.name.equals(
                                            new ResourceLocation(Reference.MOD_ID, "models/block/base_block")
                                                    .toString())) {
                                        try {
                                            ModelLoaderRegistry
                                                    .getModel(new ResourceLocation(Reference.MOD_ID,
                                                            "block/base_block_multiblock"))
                                                    .asVanillaModel().ifPresent(
                                                            modelBlockParent -> modelBlock.parent = modelBlockParent);
                                        } catch (Exception e) {
                                            e.printStackTrace();
                                        }
                                    }/*from  www  .j  a  va2 s.  c  o m*/
                                    if (modelBlock.parent.name.equals(new ResourceLocation(Reference.MOD_ID,
                                            "models/block/base_block_multiblock").toString()))
                                        event.getModelRegistry().putObject(resourceLocation,
                                                model.bake(model.getDefaultState(), DefaultVertexFormats.BLOCK,
                                                        ModelLoader.defaultTextureGetter()));
                                }
                            });
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    });
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }
    }
    for (ConveyorUpgradeFactory conveyorUpgradeFactory : GameRegistry.findRegistry(ConveyorUpgradeFactory.class)
            .getValuesCollection()) {
        for (EnumFacing upgradeFacing : conveyorUpgradeFactory.getValidFacings()) {
            for (EnumFacing conveyorFacing : BlockConveyor.FACING.getAllowedValues()) {
                try {
                    ModelLoaderRegistry
                            .getModel(conveyorUpgradeFactory.getModel(upgradeFacing, conveyorFacing));
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }
    }
}