Java Code Examples for net.minecraftforge.registries.IRegistryDelegate

The following examples show how to use net.minecraftforge.registries.IRegistryDelegate. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: CommunityMod   Source File:    License: GNU Lesser General Public License v2.1 5 votes vote down vote up
private static void registerExtendedBlockColor(BlockColors bc, IExtendedBlockColor extColor, Block... blocks) {
	Map<IRegistryDelegate<Block>, IBlockColor> internalMap = ObfuscationReflectionHelper.getPrivateValue(BlockColors.class, bc, "blockColorMap"); //forge-added field in 1.12, no srg name available
	//TODO someone test this in obf lol
	for(Block b : blocks) {
		IRegistryDelegate<Block> delegate = b.delegate;
		IBlockColor regularColor = internalMap.get(delegate);
		bc.registerBlockColorHandler(((state, world, pos, tintIndex) -> extColor.colorMultiplierExt(regularColor, state, world, pos, tintIndex)), b);
Example 2
Source Project: VanillaFix   Source File:    License: MIT License 5 votes vote down vote up
 * @reason Don't get all models during init (with dynamic loading, that would
 * generate them all). Just store location instead.
public void register(Item item, int meta, ModelResourceLocation location) {
    IRegistryDelegate<Item> key = item.delegate;
    TIntObjectHashMap<ModelResourceLocation> locs = locations.get(key);
    if (locs == null) {
        locs = new TIntObjectHashMap<>();
        locations.put(key, locs);
    locs.put(meta, location);