Search in sources :

Example 1 with AbstractModule

use of net.kyori.violet.AbstractModule in project Almura by AlmuraDev.

the class FeatureModule method configure.

@Override
protected void configure() {
    this.install(new HeadUpDisplayModule());
    this.install(new NickModule());
    this.install(new NotificationModule());
    this.install(new TitleModule());
    this.install(new GuideModule());
    this.install(new ComplexContentModule());
    this.install(new CacheModule());
    this.install(new ExchangeModule());
    this.install(new StoreModule());
    this.install(new DeathModule());
    this.install(new StorageModule());
    this.install(new BiomeModule());
    this.install(new FeaturesModule());
    this.install(new AnimalModule());
    this.facet().add(SignEditFeature.class);
    this.facet().add(ItemReturnHelper.class);
    this.nerfVanillaFood();
    this.install(new ClaimModule());
    this.install(new MembershipModule());
    this.install(new SkillsModule());
    if (SpongeImplHooks.isDeobfuscatedEnvironment()) {
        // Force loading this because it will fail the Platform.Type checks below during normal startup.
        this.loadServerSideModules();
    }
    this.on(Platform.Type.CLIENT, () -> {
        final class ClientModule extends AbstractModule implements ClientBinder {

            @SideOnly(Side.CLIENT)
            @Override
            protected void configure() {
                this.facet().add(OffHandListener.class);
            }
        }
        this.install(new ClientModule());
    });
    this.on(Platform.Type.SERVER, () -> {
        // Dedicated Server Only!
        final class ServerModule extends AbstractModule implements CommonBinder {

            @SideOnly(Side.SERVER)
            @Override
            protected void configure() {
                // This is never touched in single player / de-obfuscated environments.
                loadServerSideModules();
            }
        }
        this.install(new ServerModule());
    });
}
Also used : GuideModule(com.almuradev.almura.feature.guide.GuideModule) StorageModule(com.almuradev.almura.feature.storage.StorageModule) MembershipModule(com.almuradev.almura.feature.membership.MembershipModule) ExchangeModule(com.almuradev.almura.feature.exchange.ExchangeModule) SkillsModule(com.almuradev.almura.feature.skills.SkillsModule) StoreModule(com.almuradev.almura.feature.store.StoreModule) DeathModule(com.almuradev.almura.feature.death.DeathModule) ComplexContentModule(com.almuradev.almura.feature.complex.ComplexContentModule) CacheModule(com.almuradev.almura.feature.cache.CacheModule) BiomeModule(com.almuradev.almura.feature.biome.BiomeModule) FeaturesModule(com.almuradev.almura.feature.menu.ingame.FeaturesModule) AnimalModule(com.almuradev.almura.feature.animal.AnimalModule) CommonBinder(com.almuradev.almura.shared.inject.CommonBinder) AbstractModule(net.kyori.violet.AbstractModule) TitleModule(com.almuradev.almura.feature.title.TitleModule) NotificationModule(com.almuradev.almura.feature.notification.NotificationModule) HeadUpDisplayModule(com.almuradev.almura.feature.hud.HeadUpDisplayModule) ClientBinder(com.almuradev.almura.shared.inject.ClientBinder) NickModule(com.almuradev.almura.feature.nick.NickModule) ClaimModule(com.almuradev.almura.feature.claim.ClaimModule)

Example 2 with AbstractModule

use of net.kyori.violet.AbstractModule in project Almura by AlmuraDev.

the class ExchangeModule method configure.

@Override
protected void configure() {
    this.requestStaticInjection(ExchangeCommandsCreator.class);
    this.packet().bind(ClientboundExchangeRegistryPacket.class, binder -> binder.handler(ClientboundExchangesRegistryPacketHandler.class, Platform.Type.CLIENT)).bind(ServerboundExchangeSpecificOfferRequestPacket.class, binder -> binder.handler(ServerboundExchangeSpecificOfferPacketHandler.class, Platform.Type.SERVER)).bind(ClientboundExchangeGuiResponsePacket.class, binder -> binder.handler(ClientboundExchangeGuiResponsePacketHandler.class, Platform.Type.CLIENT)).bind(ServerboundModifyExchangePacket.class, binder -> binder.handler(ServerboundModifyExchangePacketHandler.class, Platform.Type.SERVER)).bind(ClientboundListItemsResponsePacket.class, binder -> binder.handler(ClientboundListItemsResponsePacketHandler.class, Platform.Type.CLIENT)).bind(ClientboundListItemsSaleStatusPacket.class, binder -> binder.handler(ClientboundListItemsSaleStatusPacketHandler.class, Platform.Type.CLIENT)).bind(ServerboundListItemsRequestPacket.class, binder -> binder.handler(ServerboundListItemsRequestPacketHandler.class, Platform.Type.SERVER)).bind(ClientboundForSaleFilterRequestPacket.class, binder -> binder.handler(ClientboundForSaleFilterRequestPacketHandler.class, Platform.Type.CLIENT)).bind(ServerboundForSaleFilterResponsePacket.class, binder -> binder.handler(ServerboundForSaleFilterResponsePacketHandler.class, Platform.Type.SERVER)).bind(ClientboundForSaleItemsResponsePacket.class, binder -> binder.handler(ClientboundForSaleItemsResponsePacketHandler.class, Platform.Type.CLIENT)).bind(ServerboundModifyForSaleItemListStatusRequestPacket.class, binder -> binder.handler(ServerboundModifyForSaleItemListStatusRequestPacketHandler.class, Platform.Type.SERVER)).bind(ServerboundTransactionRequestPacket.class, binder -> binder.handler(ServerboundTransactionRequestPacketHandler.class, Platform.Type.SERVER)).bind(ClientboundTransactionCompletePacket.class, binder -> binder.handler(ClientboundTransactionCompletePacketHandler.class, Platform.Type.CLIENT));
    this.facet().add(ServerExchangeManager.class);
    this.command().child(ExchangeCommandsCreator.createCommand(), "exchange", "axs");
    FilterRegistry.instance.<ListItem>registerFilter(ID + "_item_display_name", (target, value) -> target.asRealStack().getDisplayName().toLowerCase().contains(value.toLowerCase())).<ListItem>registerFilter(ID + "_seller_name", (target, value) -> target.getSellerName().isPresent() && target.getSellerName().get().toLowerCase().contains(value.toLowerCase())).<ListItem>registerComparator(ID + "_item_display_name", Comparator.comparing(k -> k.asRealStack().getDisplayName().toLowerCase())).<ListItem>registerComparator(ID + "_seller_name", Comparator.comparing(v -> v.getSellerName().orElse("").toLowerCase())).<ListItem>registerComparator(ID + "_price", Comparator.comparing(l -> {
        final ForSaleItem item = l.getForSaleItem().orElse(null);
        if (item == null) {
            return null;
        }
        return item.getPrice();
    })).<ListItem>registerComparator(ID + "_created", Comparator.comparing(l -> {
        final ForSaleItem item = l.getForSaleItem().orElse(null);
        if (item == null) {
            return null;
        }
        return item.getCreated();
    }));
    this.on(Platform.Type.CLIENT, () -> {
        @SideOnly(Side.CLIENT)
        final class ClientModule extends AbstractModule implements ClientBinder {

            @SideOnly(Side.CLIENT)
            @Override
            protected void configure() {
                this.facet().add(ClientExchangeManager.class);
                this.requestStaticInjection(ExchangeBuyQuantityScreen.class);
                this.requestStaticInjection(ExchangeListPriceScreen.class);
                this.requestStaticInjection(ExchangeOfferScreen.class);
                this.requestStaticInjection(ExchangeManagementScreen.class);
                this.requestStaticInjection(ExchangeScreen.class);
            }
        }
        this.install(new ClientModule());
    });
}
Also used : ServerboundTransactionRequestPacketHandler(com.almuradev.almura.feature.exchange.network.handler.ServerboundTransactionRequestPacketHandler) ServerboundListItemsRequestPacketHandler(com.almuradev.almura.feature.exchange.network.handler.ServerboundListItemsRequestPacketHandler) FilterRegistry(com.almuradev.almura.shared.feature.filter.FilterRegistry) ClientboundListItemsSaleStatusPacket(com.almuradev.almura.feature.exchange.network.ClientboundListItemsSaleStatusPacket) ServerboundTransactionRequestPacket(com.almuradev.almura.feature.exchange.network.ServerboundTransactionRequestPacket) ServerboundModifyForSaleItemListStatusRequestPacket(com.almuradev.almura.feature.exchange.network.ServerboundModifyForSaleItemListStatusRequestPacket) ServerboundModifyExchangePacketHandler(com.almuradev.almura.feature.exchange.network.handler.ServerboundModifyExchangePacketHandler) ServerboundExchangeSpecificOfferPacketHandler(com.almuradev.almura.feature.exchange.network.handler.ServerboundExchangeSpecificOfferPacketHandler) ForSaleItem(com.almuradev.almura.feature.exchange.listing.ForSaleItem) ListItem(com.almuradev.almura.feature.exchange.listing.ListItem) Platform(org.spongepowered.api.Platform) ClientboundListItemsResponsePacket(com.almuradev.almura.feature.exchange.network.ClientboundListItemsResponsePacket) ClientboundForSaleFilterRequestPacketHandler(com.almuradev.almura.feature.exchange.network.handler.ClientboundForSaleFilterRequestPacketHandler) ExchangeBuyQuantityScreen(com.almuradev.almura.feature.exchange.client.gui.ExchangeBuyQuantityScreen) ServerboundForSaleFilterResponsePacketHandler(com.almuradev.almura.feature.exchange.network.handler.ServerboundForSaleFilterResponsePacketHandler) Side(net.minecraftforge.fml.relauncher.Side) ServerboundModifyExchangePacket(com.almuradev.almura.feature.exchange.network.ServerboundModifyExchangePacket) ExchangeOfferScreen(com.almuradev.almura.feature.exchange.client.gui.ExchangeOfferScreen) ClientboundTransactionCompletePacketHandler(com.almuradev.almura.feature.exchange.network.handler.ClientboundTransactionCompletePacketHandler) ExchangeScreen(com.almuradev.almura.feature.exchange.client.gui.ExchangeScreen) ClientboundExchangeGuiResponsePacket(com.almuradev.almura.feature.exchange.network.ClientboundExchangeGuiResponsePacket) ClientBinder(com.almuradev.almura.shared.inject.ClientBinder) SideOnly(net.minecraftforge.fml.relauncher.SideOnly) ExchangeListPriceScreen(com.almuradev.almura.feature.exchange.client.gui.ExchangeListPriceScreen) ClientboundForSaleItemsResponsePacket(com.almuradev.almura.feature.exchange.network.ClientboundForSaleItemsResponsePacket) ClientboundExchangesRegistryPacketHandler(com.almuradev.almura.feature.exchange.network.handler.ClientboundExchangesRegistryPacketHandler) ExchangeManagementScreen(com.almuradev.almura.feature.exchange.client.gui.ExchangeManagementScreen) ClientExchangeManager(com.almuradev.almura.feature.exchange.client.ClientExchangeManager) ClientboundForSaleFilterRequestPacket(com.almuradev.almura.feature.exchange.network.ClientboundForSaleFilterRequestPacket) CommonBinder(com.almuradev.almura.shared.inject.CommonBinder) ServerboundListItemsRequestPacket(com.almuradev.almura.feature.exchange.network.ServerboundListItemsRequestPacket) ClientboundTransactionCompletePacket(com.almuradev.almura.feature.exchange.network.ClientboundTransactionCompletePacket) ServerboundForSaleFilterResponsePacket(com.almuradev.almura.feature.exchange.network.ServerboundForSaleFilterResponsePacket) ClientboundListItemsResponsePacketHandler(com.almuradev.almura.feature.exchange.network.handler.ClientboundListItemsResponsePacketHandler) AbstractModule(net.kyori.violet.AbstractModule) ClientboundExchangeRegistryPacket(com.almuradev.almura.feature.exchange.network.ClientboundExchangeRegistryPacket) ClientboundExchangeGuiResponsePacketHandler(com.almuradev.almura.feature.exchange.network.handler.ClientboundExchangeGuiResponsePacketHandler) ClientboundForSaleItemsResponsePacketHandler(com.almuradev.almura.feature.exchange.network.handler.ClientboundForSaleItemsResponsePacketHandler) ServerboundModifyForSaleItemListStatusRequestPacketHandler(com.almuradev.almura.feature.exchange.network.handler.ServerboundModifyForSaleItemListStatusRequestPacketHandler) ServerboundExchangeSpecificOfferRequestPacket(com.almuradev.almura.feature.exchange.network.ServerboundExchangeSpecificOfferRequestPacket) Comparator(java.util.Comparator) ClientboundListItemsSaleStatusPacketHandler(com.almuradev.almura.feature.exchange.network.handler.ClientboundListItemsSaleStatusPacketHandler) ClientboundTransactionCompletePacketHandler(com.almuradev.almura.feature.exchange.network.handler.ClientboundTransactionCompletePacketHandler) ServerboundListItemsRequestPacketHandler(com.almuradev.almura.feature.exchange.network.handler.ServerboundListItemsRequestPacketHandler) ClientboundExchangesRegistryPacketHandler(com.almuradev.almura.feature.exchange.network.handler.ClientboundExchangesRegistryPacketHandler) SideOnly(net.minecraftforge.fml.relauncher.SideOnly) ClientboundForSaleItemsResponsePacket(com.almuradev.almura.feature.exchange.network.ClientboundForSaleItemsResponsePacket) ServerboundTransactionRequestPacket(com.almuradev.almura.feature.exchange.network.ServerboundTransactionRequestPacket) ClientboundExchangeGuiResponsePacketHandler(com.almuradev.almura.feature.exchange.network.handler.ClientboundExchangeGuiResponsePacketHandler) AbstractModule(net.kyori.violet.AbstractModule) ServerboundForSaleFilterResponsePacketHandler(com.almuradev.almura.feature.exchange.network.handler.ServerboundForSaleFilterResponsePacketHandler) ServerboundExchangeSpecificOfferRequestPacket(com.almuradev.almura.feature.exchange.network.ServerboundExchangeSpecificOfferRequestPacket) ForSaleItem(com.almuradev.almura.feature.exchange.listing.ForSaleItem) ServerboundModifyForSaleItemListStatusRequestPacketHandler(com.almuradev.almura.feature.exchange.network.handler.ServerboundModifyForSaleItemListStatusRequestPacketHandler) ClientboundForSaleFilterRequestPacket(com.almuradev.almura.feature.exchange.network.ClientboundForSaleFilterRequestPacket) ClientboundListItemsSaleStatusPacket(com.almuradev.almura.feature.exchange.network.ClientboundListItemsSaleStatusPacket) ListItem(com.almuradev.almura.feature.exchange.listing.ListItem) ClientboundListItemsResponsePacketHandler(com.almuradev.almura.feature.exchange.network.handler.ClientboundListItemsResponsePacketHandler) ClientBinder(com.almuradev.almura.shared.inject.ClientBinder) ServerboundModifyExchangePacket(com.almuradev.almura.feature.exchange.network.ServerboundModifyExchangePacket)

Aggregations

ClientBinder (com.almuradev.almura.shared.inject.ClientBinder)2 CommonBinder (com.almuradev.almura.shared.inject.CommonBinder)2 AbstractModule (net.kyori.violet.AbstractModule)2 AnimalModule (com.almuradev.almura.feature.animal.AnimalModule)1 BiomeModule (com.almuradev.almura.feature.biome.BiomeModule)1 CacheModule (com.almuradev.almura.feature.cache.CacheModule)1 ClaimModule (com.almuradev.almura.feature.claim.ClaimModule)1 ComplexContentModule (com.almuradev.almura.feature.complex.ComplexContentModule)1 DeathModule (com.almuradev.almura.feature.death.DeathModule)1 ExchangeModule (com.almuradev.almura.feature.exchange.ExchangeModule)1 ClientExchangeManager (com.almuradev.almura.feature.exchange.client.ClientExchangeManager)1 ExchangeBuyQuantityScreen (com.almuradev.almura.feature.exchange.client.gui.ExchangeBuyQuantityScreen)1 ExchangeListPriceScreen (com.almuradev.almura.feature.exchange.client.gui.ExchangeListPriceScreen)1 ExchangeManagementScreen (com.almuradev.almura.feature.exchange.client.gui.ExchangeManagementScreen)1 ExchangeOfferScreen (com.almuradev.almura.feature.exchange.client.gui.ExchangeOfferScreen)1 ExchangeScreen (com.almuradev.almura.feature.exchange.client.gui.ExchangeScreen)1 ForSaleItem (com.almuradev.almura.feature.exchange.listing.ForSaleItem)1 ListItem (com.almuradev.almura.feature.exchange.listing.ListItem)1 ClientboundExchangeGuiResponsePacket (com.almuradev.almura.feature.exchange.network.ClientboundExchangeGuiResponsePacket)1 ClientboundExchangeRegistryPacket (com.almuradev.almura.feature.exchange.network.ClientboundExchangeRegistryPacket)1