1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- package me.km;
- import java.util.List;
- import java.util.stream.Collectors;
- import me.km.blocks.ModBlocks;
- import me.km.fluids.ModFluids;
- import me.km.items.ModItems;
- import me.km.recipes.ModRecipes;
- import me.km.sounds.Sounds;
- import net.minecraft.block.Block;
- import net.minecraft.init.Blocks;
- import net.minecraft.item.Item;
- import net.minecraft.item.crafting.IRecipe;
- import net.minecraft.util.ResourceLocation;
- import net.minecraft.util.SoundEvent;
- import net.minecraftforge.event.RegistryEvent;
- import net.minecraftforge.fml.common.FMLCommonHandler;
- import net.minecraftforge.fml.common.Mod;
- import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
- import net.minecraftforge.fml.common.registry.ForgeRegistries;
- import net.minecraftforge.fml.relauncher.Side;
- import net.minecraftforge.registries.ForgeRegistry;
- @Mod.EventBusSubscriber
- public class ObjectRegistry
- {
- @SubscribeEvent
- public static void onBlockRegistry(RegistryEvent.Register<Block> e)
- {
- ModFluids.init();
- ModBlocks.initBlocks(e.getRegistry());
- }
-
- @SubscribeEvent
- public static void onBlockMissing(RegistryEvent.MissingMappings<Block> e)
- {
- e.getMappings().stream()
- .filter((missing) -> (missing.key.getResourcePath().equals("tallgrass")))
- .forEach((missing) ->
- {
- missing.remap(Blocks.TALLGRASS);
- });
- }
- @SubscribeEvent
- public static void onItemRegistry(RegistryEvent.Register<Item> e)
- {
- ModItems.init(e.getRegistry());
- ModBlocks.initItemBlocks(e.getRegistry());
- }
-
- /*@SubscribeEvent
- public static void onRecipeRegistry(RegistryEvent.Register<IRecipe> e)
- {
- if(FMLCommonHandler.instance().getSide() == Side.SERVER)
- {
- System.out.println("_______________________________________");
- System.out.println("_______________________________________");
- System.out.println("_______________________________________");
- System.out.println("_______________________________________");
- System.out.println("_______________________________________");
- System.out.println("_______________________________________");
- System.out.println("_______________________________________");
- System.out.println("Registering recipes");
- ModRecipes.init(e.getRegistry());
- }
- else
- {
- System.out.println("_______________________________________");
- System.out.println("_______________________________________");
- System.out.println("_______________________________________");
- System.out.println("_______________________________________");
- System.out.println("_______________________________________");
- System.out.println("_______________________________________");
- System.out.println("_______________________________________");
- System.out.println("removing recipes");
- // remove recipes
- ForgeRegistry<IRecipe> recipeRegistry = (ForgeRegistry<IRecipe>) ForgeRegistries.RECIPES;
- List<ResourceLocation> recipes = recipeRegistry.getKeys().stream().collect(Collectors.toList());
- recipes.forEach(key -> recipeRegistry.remove(key));
- }
- }*/
-
- @SubscribeEvent
- public static void onSoundRegistry(RegistryEvent.Register<SoundEvent> e)
- {
- Sounds.init(e.getRegistry());
- }
- }
|