Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Mod("hard_steel")
- public class HardSteel
- {
- private static HardSteel instance;
- public static final String modid = "hard_steel";
- public static IProxy proxy = DistExecutor.runForDist(() -> () -> new ClientProxy(), () -> () -> new ServerProxy());
- public static final Logger logger = LogManager.getLogger(modid);
- public static final ItemGroup hard_steel = new GroupHardSteel();
- public HardSteel()
- {
- instance = this;
- ModLoadingContext.get().registerConfig(ModConfig.Type.SERVER, HardSteelConfig.SERVER_CONFIG);
- HardSteelConfig.loadConfig(HardSteelConfig.SERVER_CONFIG, FMLPaths.CONFIGDIR.get().resolve("hard_steel-general.toml"));
- FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup);
- FMLJavaModLoadingContext.get().getModEventBus().addListener(this::enqueueIMC);
- FMLJavaModLoadingContext.get().getModEventBus().addListener(this::processIMC);
- FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff);
- MinecraftForge.EVENT_BUS.register(this);
- MinecraftForge.EVENT_BUS.register(new LeatherDrops());
- MinecraftForge.EVENT_BUS.register(new CapabilityHandler()); <=== RIGHT HERE
- MinecraftForge.EVENT_BUS.register(new MobEquipEvent());
- }
- public static HardSteel getInstance()
- {
- return instance;
- }
- private void setup(final FMLCommonSetupEvent event)
- {
- OreGenerator.setupOregen();
- CapabilityManager.INSTANCE.register(IReArmer.class, new ReArmerStorage(), ReArmer::new);
- ConfiguredFeature<?> smithingTableReplacement = Biome.createDecoratedFeature(new SmithingTableReplacement(NoFeatureConfig::deserialize), IFeatureConfig.NO_FEATURE_CONFIG, Placement.NOPE , IPlacementConfig.NO_PLACEMENT_CONFIG);
- ForgeRegistries.BIOMES.forEach(biome -> biome.addFeature(GenerationStage.Decoration.TOP_LAYER_MODIFICATION, smithingTableReplacement));
- ConfiguredFeature<?> anvilReplacement = Biome.createDecoratedFeature(new AnvilReplacement(NoFeatureConfig::deserialize), IFeatureConfig.NO_FEATURE_CONFIG, Placement.NOPE , IPlacementConfig.NO_PLACEMENT_CONFIG);
- ForgeRegistries.BIOMES.forEach(biome -> biome.addFeature(GenerationStage.Decoration.TOP_LAYER_MODIFICATION, anvilReplacement));
- ConfiguredFeature<?> blastFurnaceReplacement = Biome.createDecoratedFeature(new BlastFurnaceReplacement(NoFeatureConfig::deserialize), IFeatureConfig.NO_FEATURE_CONFIG, Placement.NOPE , IPlacementConfig.NO_PLACEMENT_CONFIG);
- ForgeRegistries.BIOMES.forEach(biome -> biome.addFeature(GenerationStage.Decoration.TOP_LAYER_MODIFICATION, blastFurnaceReplacement));
- Set<BlockState> smithingTableBlockStates = BlockStateUtilities.getAllStates(SmithingTableRegistryEvents.SMITHING_TABLE);
- Set<BlockState> blastFurnaceBlockStates = BlockStateUtilities.getAllStates(BlastFurnaceRegistryEvents.BLAST_FURNACE);
- Map<BlockState, PointOfInterestType> types = ObfuscationReflectionHelper.getPrivateValue(PointOfInterestType.class, null, "field_221073_u");
- if(types == null) return;
- for(BlockState blockState : smithingTableBlockStates){
- types.put(blockState, PointOfInterestType.TOOLSMITH);
- }
- for(BlockState blockState : blastFurnaceBlockStates){
- types.put(blockState, PointOfInterestType.ARMORER);
- }
- //HardSteel.logger.info("Types are: " + types.toString());
- // smithing table
- Message.registerMessages(HardSteel.modid);
- // anvil
- //com.infamous.hard_steel.anvil.Message.registerMessages(HardSteel.modid);
- proxy.init();
- logger.info("Mod preinit");
- }
- private void doClientStuff(final FMLClientSetupEvent event)
- {
- logger.info("Got game settings {}", event.getMinecraftSupplier().get().gameSettings);
- }
- private void enqueueIMC(final InterModEnqueueEvent event)
- {
- InterModComms.sendTo("hard_steel", "helloworld", () -> { logger.info("Hello world from Hard Steel"); return "Hello world";});
- }
- private void processIMC(final InterModProcessEvent event)
- {
- logger.info("Got IMC {}", event.getIMCStream().
- map(m->m.getMessageSupplier().get()).
- collect(Collectors.toList()));
- }
- @SubscribeEvent
- public void onServerStarting(FMLServerStartingEvent event)
- {
- logger.info("Server starting");
- }
- @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD)
- public static class RegistryEvents
- {
- @SubscribeEvent
- public static void onBlocksRegistry(final RegistryEvent.Register<Block> blockRegistryEvent)
- {
- logger.info("Blocks registered");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement