Search in sources :

Example 6 with EventListener

use of net.mine_diver.unsafeevents.listener.EventListener in project StationAPI by ModificationStation.

the class AchievementListener method registerAchievements.

@EventListener
public void registerAchievements(AchievementRegisterEvent event) {
    testAchievementPage = new AchievementPageTest(SLTest.MODID, "testPage");
    testAchievement = new Achievement(69696969, "sltest:testAchievement", 0, 0, ItemListener.testItem, null);
    testAchievementChild = new Achievement(69696970, "sltest:testAchievementChild", 0, 2, ItemBase.goldenApple, testAchievement);
    event.achievements.add(testAchievement);
    event.achievements.add(testAchievementChild);
    testAchievementPage.addAchievements(testAchievement, testAchievementChild);
}
Also used : Achievement(net.minecraft.achievement.Achievement) EventListener(net.mine_diver.unsafeevents.listener.EventListener)

Example 7 with EventListener

use of net.mine_diver.unsafeevents.listener.EventListener in project StationAPI by ModificationStation.

the class ItemRegistryInit method registerItems.

@EventListener(priority = ListenerPriority.HIGH)
private static void registerItems(ItemRegistryEvent event) {
    ItemRegistry r = event.registry;
    r.register(of("iron_shovel"), ironShovel);
    r.register(of("iron_pickaxe"), ironPickaxe);
    r.register(of("iron_axe"), ironAxe);
    r.register(of("flint_and_steel"), flintAndSteel);
    r.register(of("apple"), apple);
    r.register(of("bow"), bow);
    r.register(of("arrow"), arrow);
    r.register(of("coal"), coal);
    r.register(of("diamond"), diamond);
    r.register(of("iron_ingot"), ironIngot);
    r.register(of("gold_ingot"), goldIngot);
    r.register(of("iron_sword"), ironSword);
    r.register(of("wooden_sword"), woodSword);
    r.register(of("wooden_shovel"), woodShovel);
    r.register(of("wooden_pickaxe"), woodPickaxe);
    r.register(of("wooden_axe"), woodAxe);
    r.register(of("stone_sword"), stoneSword);
    r.register(of("stone_shovel"), stoneShovel);
    r.register(of("stone_pickaxe"), stonePickaxe);
    r.register(of("stone_axe"), stoneAxe);
    r.register(of("diamond_sword"), diamondSword);
    r.register(of("diamond_shovel"), diamondShovel);
    r.register(of("diamond_pickaxe"), diamondPickaxe);
    r.register(of("diamond_axe"), diamondAxe);
    r.register(of("stick"), stick);
    r.register(of("bowl"), bowl);
    r.register(of("mushroom_stew"), mushroomStew);
    r.register(of("golden_sword"), goldSword);
    r.register(of("golden_shovel"), goldShovel);
    r.register(of("golden_pickaxe"), goldPickaxe);
    r.register(of("golden_axe"), goldAxe);
    r.register(of("string"), string);
    r.register(of("feather"), feather);
    r.register(of("gunpowder"), gunpowder);
    r.register(of("wooden_hoe"), woodHoe);
    r.register(of("stone_hoe"), stoneHoe);
    r.register(of("iron_hoe"), ironHoe);
    r.register(of("diamond_hoe"), diamondHoe);
    r.register(of("golden_hoe"), goldHoe);
    r.register(of("wheat_seeds"), seeds);
    r.register(of("wheat"), wheat);
    r.register(of("bread"), bread);
    r.register(of("leather_helmet"), leatherHelmet);
    r.register(of("leather_chestplate"), leatherChestplate);
    r.register(of("leather_leggings"), leatherLeggings);
    r.register(of("leather_boots"), leatherBoots);
    r.register(of("chainmail_helmet"), chainHelmet);
    r.register(of("chainmail_chestplate"), chainChestplate);
    r.register(of("chainmail_leggings"), chainLeggings);
    r.register(of("chainmail_boots"), chainBoots);
    r.register(of("iron_helmet"), ironHelmet);
    r.register(of("iron_chestplate"), ironChestplate);
    r.register(of("iron_leggings"), ironLeggings);
    r.register(of("iron_boots"), ironBoots);
    r.register(of("diamond_helmet"), diamondHelmet);
    r.register(of("diamond_chestplate"), diamondChestplate);
    r.register(of("diamond_leggings"), diamondLeggings);
    r.register(of("diamond_boots"), diamondBoots);
    r.register(of("golden_helmet"), goldHelmet);
    r.register(of("golden_chestplate"), goldChestplate);
    r.register(of("golden_leggings"), goldLeggings);
    r.register(of("golden_boots"), goldBoots);
    r.register(of("flint"), flint);
    r.register(of("porkchop"), rawPorkchop);
    r.register(of("cooked_porkchop"), cookedPorkchop);
    r.register(of("painting"), painting);
    r.register(of("golden_apple"), goldenApple);
    r.register(of("sign"), sign);
    r.register(of("oak_door"), woodDoor);
    r.register(of("bucket"), bucket);
    r.register(of("water_bucket"), waterBucket);
    r.register(of("lava_bucket"), lavaBucket);
    r.register(of("minecart"), minecart);
    r.register(of("saddle"), saddle);
    r.register(of("iron_door"), ironDoor);
    r.register(of("redstone"), redstoneDust);
    r.register(of("snowball"), snowball);
    r.register(of("oak_boat"), boat);
    r.register(of("leather"), leather);
    r.register(of("milk_bucket"), milk);
    r.register(of("brick"), brick);
    r.register(of("clay_ball"), clay);
    r.register(of("sugar_cane"), sugarCanes);
    r.register(of("paper"), paper);
    r.register(of("book"), book);
    r.register(of("slime_ball"), slimeball);
    r.register(of("chest_minecart"), minecartChest);
    r.register(of("furnace_minecart"), minecartFurnace);
    r.register(of("egg"), egg);
    r.register(of("compass"), compass);
    r.register(of("fishing_rod"), fishingRod);
    r.register(of("clock"), clock);
    r.register(of("glowstone_dust"), glowstoneDust);
    r.register(of("fish"), rawFish);
    r.register(of("cooked_fish"), cookedFish);
    r.register(of("dye"), dyePowder);
    r.register(of("bone"), bone);
    r.register(of("sugar"), sugar);
    r.register(of("cake"), cake);
    r.register(of("bed"), bed);
    r.register(of("repeater"), redstoneRepeater);
    r.register(of("cookie"), cookie);
    r.register(of("map"), map);
    r.register(of("shears"), shears);
    r.register(of("music_disc_13"), record13);
    r.register(of("music_disc_cat"), recordCat);
    LOGGER.info("Added vanilla items to the registry.");
}
Also used : ItemRegistry(net.modificationstation.stationapi.api.registry.ItemRegistry) EventListener(net.mine_diver.unsafeevents.listener.EventListener)

Example 8 with EventListener

use of net.mine_diver.unsafeevents.listener.EventListener in project StationAPI by ModificationStation.

the class MessagePacketInit method registerPackets.

@EventListener(priority = ListenerPriority.HIGH)
private static void registerPackets(PacketRegisterEvent event) {
    event.register(254, true, true, Message.class);
    StationAPI.EVENT_BUS.post(new MessageListenerRegistryEvent());
}
Also used : MessageListenerRegistryEvent(net.modificationstation.stationapi.api.event.registry.MessageListenerRegistryEvent) EventListener(net.mine_diver.unsafeevents.listener.EventListener)

Example 9 with EventListener

use of net.mine_diver.unsafeevents.listener.EventListener in project StationAPI by ModificationStation.

the class LangLoader method loadLang.

@EventListener(priority = ListenerPriority.HIGH)
private static void loadLang(PreInitEvent event) {
    LOGGER.info("Searching for lang paths...");
    FabricLoader.getInstance().getAllMods().forEach(modContainer -> {
        ModID modID = ModID.of(modContainer);
        String pathName = "/assets/" + modID + "/" + MODID + "/lang";
        URL path = LangLoader.class.getResource(pathName);
        if (path != null) {
            I18n.addLangFolder(modID, pathName);
            LOGGER.info(String.format("Registered lang path for %s.", modID));
        }
    });
}
Also used : ModID(net.modificationstation.stationapi.api.registry.ModID) EventListener(net.mine_diver.unsafeevents.listener.EventListener)

Example 10 with EventListener

use of net.mine_diver.unsafeevents.listener.EventListener in project StationAPI by ModificationStation.

the class VanillaChecker method init.

@EventListener(priority = ListenerPriority.HIGH)
private static void init(PreInitEvent event) {
    LOGGER.info("Adding vanilla checker lang folder...");
    I18n.addLangFolder(StationAPI.MODID, "/assets/" + MODID + "/lang");
    LOGGER.info("Gathering mods that require client verification...");
    String value = StationAPI.MODID + ":verify_client";
    FabricLoader.getInstance().getAllMods().forEach(modContainer -> {
        ModMetadata modMetadata = modContainer.getMetadata();
        if (modMetadata.containsCustomValue(value) && modMetadata.getCustomValue(value).getAsBoolean())
            CLIENT_REQUIRED_MODS.add(modContainer);
    });
}
Also used : ModMetadata(net.fabricmc.loader.api.metadata.ModMetadata) EventListener(net.mine_diver.unsafeevents.listener.EventListener)

Aggregations

EventListener (net.mine_diver.unsafeevents.listener.EventListener)24 Environment (net.fabricmc.api.Environment)2 ModMetadata (net.fabricmc.loader.api.metadata.ModMetadata)2 Achievement (net.minecraft.achievement.Achievement)2 CompoundTag (net.minecraft.util.io.CompoundTag)2 ExpandableAtlas (net.modificationstation.stationapi.api.client.texture.atlas.ExpandableAtlas)2 MessageListenerRegistryEvent (net.modificationstation.stationapi.api.event.registry.MessageListenerRegistryEvent)2 Message (net.modificationstation.stationapi.api.packet.Message)2 DimensionRegistry (net.modificationstation.stationapi.api.registry.DimensionRegistry)2 ModdedPacketHandlerSetter (net.modificationstation.stationapi.impl.network.ModdedPacketHandlerSetter)2 java.util (java.util)1 java.util.stream (java.util.stream)1 ModContainer (net.fabricmc.loader.api.ModContainer)1 EventBus (net.mine_diver.unsafeevents.EventBus)1 ListenerPriority (net.mine_diver.unsafeevents.listener.ListenerPriority)1 Minecraft (net.minecraft.client.Minecraft)1 KeyBinding (net.minecraft.client.options.KeyBinding)1 TexturePack (net.minecraft.client.resource.TexturePack)1 I18n (net.minecraft.client.resource.language.I18n)1 ServerPlayer (net.minecraft.entity.player.ServerPlayer)1