Search in sources :

Example 11 with Identifier

use of net.minecraft.util.Identifier in project MCDoom by AzureDoom.

the class ProjectilesEntityRegister method projectile.

private static <T extends Entity> EntityType<T> projectile(EntityType.EntityFactory<T> factory, String id, boolean itemRender) {
    EntityType<T> type = FabricEntityTypeBuilder.<T>create(SpawnGroup.MISC, factory).dimensions(new EntityDimensions(0.5F, 0.5F, true)).disableSummon().spawnableFarFromPlayer().trackRangeBlocks(90).trackedUpdateRate(4).build();
    Registry.register(Registry.ENTITY_TYPE, new Identifier(DoomMod.MODID, id), type);
    ENTITY_TYPES.add(type);
    if (itemRender) {
        ENTITY_THAT_USE_ITEM_RENDERS.add(type);
    }
    return type;
}
Also used : EntityDimensions(net.minecraft.entity.EntityDimensions) Identifier(net.minecraft.util.Identifier)

Example 12 with Identifier

use of net.minecraft.util.Identifier in project MCDoom by AzureDoom.

the class ClientInit method onInitializeClient.

@Override
public void onInitializeClient() {
    ModelProviderinit.init();
    DoomRenderRegistry.init();
    ScreenRegistry.register(DoomMod.SCREEN_HANDLER_TYPE, GunTableScreen::new);
    GeoItemRenderer.registerItemRenderer(DoomBlocks.TOTEM.asItem(), new TotemItemRender());
    GeoItemRenderer.registerItemRenderer(DoomBlocks.GUN_TABLE.asItem(), new GunCraftingItemRender());
    GeoItemRenderer.registerItemRenderer(DoomItems.BFG, new BFG9000Render());
    GeoItemRenderer.registerItemRenderer(DoomItems.BFG_ETERNAL, new BFGRender());
    GeoItemRenderer.registerItemRenderer(DoomItems.SG, new SGRender());
    GeoItemRenderer.registerItemRenderer(DoomItems.SSG, new SSGRender());
    GeoItemRenderer.registerItemRenderer(DoomItems.CHAINGUN, new ChaingunRender());
    GeoItemRenderer.registerItemRenderer(DoomItems.BALLISTA, new BallistaRender());
    GeoItemRenderer.registerItemRenderer(DoomItems.PLASMAGUN, new PlasmagunRender());
    GeoItemRenderer.registerItemRenderer(DoomItems.HEAVYCANNON, new HeavyCannonRender());
    GeoItemRenderer.registerItemRenderer(DoomItems.CHAINSAW_ETERNAL, new ChainsawRender());
    GeoItemRenderer.registerItemRenderer(DoomItems.PISTOL, new PistolRender());
    GeoItemRenderer.registerItemRenderer(DoomItems.ROCKETLAUNCHER, new RocketLauncherRender());
    GeoItemRenderer.registerItemRenderer(DoomItems.UNMAYKR, new UnmaykrRender());
    GeoItemRenderer.registerItemRenderer(DoomItems.SENTINELHAMMER, new SentinelHammerRender());
    GeoItemRenderer.registerItemRenderer(DoomItems.CRUCIBLESWORD, new SwordCrucibleRender());
    GeoItemRenderer.registerItemRenderer(DoomItems.DARKLORDCRUCIBLE, new DarkLordCrucibleRender());
    GeoItemRenderer.registerItemRenderer(DoomItems.DSG, new DSGRender());
    GeoItemRenderer.registerItemRenderer(DoomItems.DPLASMARIFLE, new DPlamsaRifleRender());
    GeoItemRenderer.registerItemRenderer(DoomItems.DGAUSS, new DGaussRender());
    GeoItemRenderer.registerItemRenderer(DoomItems.GRENADE, new GrenadeItemRender());
    ClientSidePacketRegistry.INSTANCE.register(EntityPacket.ID, (ctx, buf) -> {
        EntityPacketOnClient.onPacket(ctx, buf);
    });
    KeyBindingHelper.registerKeyBinding(reload);
    KeyBindingHelper.registerKeyBinding(yeethook);
    requestParticleTexture(new Identifier("doom:particle/plasma"));
    ParticleFactoryRegistry.getInstance().register(DoomParticles.PLASMA, PlasmaParticle.Factory::new);
    ParticleFactoryRegistry.getInstance().register(DoomParticles.PISTOL, PlasmaParticle.Factory::new);
    ParticleFactoryRegistry.getInstance().register(DoomParticles.UNMAYKR, PlasmaParticle.Factory::new);
}
Also used : SSGRender(mod.azure.doom.client.render.weapons.SSGRender) HeavyCannonRender(mod.azure.doom.client.render.weapons.HeavyCannonRender) DPlamsaRifleRender(mod.azure.doom.client.render.weapons.DPlamsaRifleRender) GrenadeItemRender(mod.azure.doom.client.render.projectiles.GrenadeItemRender) SSGRender(mod.azure.doom.client.render.weapons.SSGRender) SGRender(mod.azure.doom.client.render.weapons.SGRender) DSGRender(mod.azure.doom.client.render.weapons.DSGRender) RocketLauncherRender(mod.azure.doom.client.render.weapons.RocketLauncherRender) ChainsawRender(mod.azure.doom.client.render.weapons.ChainsawRender) PistolRender(mod.azure.doom.client.render.weapons.PistolRender) TotemItemRender(mod.azure.doom.client.render.item.TotemItemRender) PlasmagunRender(mod.azure.doom.client.render.weapons.PlasmagunRender) SentinelHammerRender(mod.azure.doom.client.render.weapons.SentinelHammerRender) DarkLordCrucibleRender(mod.azure.doom.client.render.weapons.DarkLordCrucibleRender) DGaussRender(mod.azure.doom.client.render.weapons.DGaussRender) GunTableScreen(mod.azure.doom.client.gui.GunTableScreen) Identifier(net.minecraft.util.Identifier) ChaingunRender(mod.azure.doom.client.render.weapons.ChaingunRender) DSGRender(mod.azure.doom.client.render.weapons.DSGRender) BFGRender(mod.azure.doom.client.render.weapons.BFGRender) BFG9000Render(mod.azure.doom.client.render.weapons.BFG9000Render) GunCraftingItemRender(mod.azure.doom.client.render.item.GunCraftingItemRender) BallistaRender(mod.azure.doom.client.render.weapons.BallistaRender) SwordCrucibleRender(mod.azure.doom.client.render.weapons.SwordCrucibleRender) UnmaykrRender(mod.azure.doom.client.render.weapons.UnmaykrRender)

Example 13 with Identifier

use of net.minecraft.util.Identifier in project MCDoom by AzureDoom.

the class DoomBlocks method init.

public static void init() {
    Registry.register(Registry.BLOCK, new Identifier(DoomMod.MODID, "gun_table"), GUN_TABLE);
    Registry.register(Registry.ITEM, new Identifier(DoomMod.MODID, "gun_table"), new DoomBlockItem(GUN_TABLE, new Item.Settings().group(DoomMod.DoomWeaponItemGroup)));
    Registry.register(Registry.BLOCK, new Identifier(DoomMod.MODID, "lightblock"), TICKING_LIGHT_BLOCK);
    Registry.register(Registry.BLOCK, new Identifier(DoomMod.MODID, "totem"), TOTEM);
    Registry.register(Registry.ITEM, new Identifier(DoomMod.MODID, "totem"), new DoomBlockItem(TOTEM, new Item.Settings().group(DoomMod.DoomBlockItemGroup)));
    Registry.register(Registry.BLOCK, new Identifier(DoomMod.MODID, "argent_block"), ARGENT_BLOCK);
    Registry.register(Registry.ITEM, new Identifier(DoomMod.MODID, "argent_block"), new BlockItem(ARGENT_BLOCK, new Item.Settings().group(DoomMod.DoomBlockItemGroup)));
    Registry.register(Registry.BLOCK, new Identifier(DoomMod.MODID, "jump_pad"), JUMP_PAD);
    Registry.register(Registry.ITEM, new Identifier(DoomMod.MODID, "jump_pad"), new BlockItem(JUMP_PAD, new Item.Settings().group(DoomMod.DoomBlockItemGroup)));
    Registry.register(Registry.BLOCK, new Identifier(DoomMod.MODID, "doom_sand"), DOOM_SAND);
    Registry.register(Registry.ITEM, new Identifier(DoomMod.MODID, "doom_sand"), new BlockItem(DOOM_SAND, new Item.Settings().group(DoomMod.DoomBlockItemGroup)));
    Registry.register(Registry.BLOCK, new Identifier(DoomMod.MODID, "argent_lamp_block"), ARGENT_LAMP_BLOCK);
    Registry.register(Registry.ITEM, new Identifier(DoomMod.MODID, "argent_lamp_block"), new BlockItem(ARGENT_LAMP_BLOCK, new Item.Settings().group(DoomMod.DoomBlockItemGroup)));
    Registry.register(Registry.BLOCK, new Identifier(DoomMod.MODID, "barrel"), BARREL_BLOCK);
    Registry.register(Registry.ITEM, new Identifier(DoomMod.MODID, "barrel"), new BlockItem(BARREL_BLOCK, new Item.Settings().group(DoomMod.DoomBlockItemGroup)));
    Registry.register(Registry.BLOCK, new Identifier(DoomMod.MODID, "icon_wall1"), ICON_WALL1);
    Registry.register(Registry.BLOCK, new Identifier(DoomMod.MODID, "icon_wall2"), ICON_WALL2);
    Registry.register(Registry.BLOCK, new Identifier(DoomMod.MODID, "icon_wall3"), ICON_WALL3);
    Registry.register(Registry.BLOCK, new Identifier(DoomMod.MODID, "icon_wall4"), ICON_WALL4);
    Registry.register(Registry.BLOCK, new Identifier(DoomMod.MODID, "icon_wall5"), ICON_WALL5);
    Registry.register(Registry.BLOCK, new Identifier(DoomMod.MODID, "icon_wall6"), ICON_WALL6);
    Registry.register(Registry.BLOCK, new Identifier(DoomMod.MODID, "icon_wall7"), ICON_WALL7);
    Registry.register(Registry.BLOCK, new Identifier(DoomMod.MODID, "icon_wall8"), ICON_WALL8);
    Registry.register(Registry.BLOCK, new Identifier(DoomMod.MODID, "icon_wall9"), ICON_WALL9);
    Registry.register(Registry.BLOCK, new Identifier(DoomMod.MODID, "icon_wall10"), ICON_WALL10);
    Registry.register(Registry.BLOCK, new Identifier(DoomMod.MODID, "icon_wall11"), ICON_WALL11);
    Registry.register(Registry.BLOCK, new Identifier(DoomMod.MODID, "icon_wall12"), ICON_WALL12);
    Registry.register(Registry.BLOCK, new Identifier(DoomMod.MODID, "icon_wall13"), ICON_WALL13);
    Registry.register(Registry.BLOCK, new Identifier(DoomMod.MODID, "icon_wall14"), ICON_WALL14);
    Registry.register(Registry.BLOCK, new Identifier(DoomMod.MODID, "icon_wall15"), ICON_WALL15);
    Registry.register(Registry.BLOCK, new Identifier(DoomMod.MODID, "icon_wall16"), ICON_WALL16);
    Registry.register(Registry.ITEM, new Identifier(DoomMod.MODID, "icon_wall1"), new BlockItem(ICON_WALL1, new Item.Settings().group(DoomMod.DoomBlockItemGroup)));
    Registry.register(Registry.ITEM, new Identifier(DoomMod.MODID, "icon_wall2"), new BlockItem(ICON_WALL2, new Item.Settings().group(DoomMod.DoomBlockItemGroup)));
    Registry.register(Registry.ITEM, new Identifier(DoomMod.MODID, "icon_wall3"), new BlockItem(ICON_WALL3, new Item.Settings().group(DoomMod.DoomBlockItemGroup)));
    Registry.register(Registry.ITEM, new Identifier(DoomMod.MODID, "icon_wall4"), new BlockItem(ICON_WALL4, new Item.Settings().group(DoomMod.DoomBlockItemGroup)));
    Registry.register(Registry.ITEM, new Identifier(DoomMod.MODID, "icon_wall5"), new BlockItem(ICON_WALL5, new Item.Settings().group(DoomMod.DoomBlockItemGroup)));
    Registry.register(Registry.ITEM, new Identifier(DoomMod.MODID, "icon_wall6"), new BlockItem(ICON_WALL6, new Item.Settings().group(DoomMod.DoomBlockItemGroup)));
    Registry.register(Registry.ITEM, new Identifier(DoomMod.MODID, "icon_wall7"), new BlockItem(ICON_WALL7, new Item.Settings().group(DoomMod.DoomBlockItemGroup)));
    Registry.register(Registry.ITEM, new Identifier(DoomMod.MODID, "icon_wall8"), new BlockItem(ICON_WALL8, new Item.Settings().group(DoomMod.DoomBlockItemGroup)));
    Registry.register(Registry.ITEM, new Identifier(DoomMod.MODID, "icon_wall9"), new BlockItem(ICON_WALL9, new Item.Settings().group(DoomMod.DoomBlockItemGroup)));
    Registry.register(Registry.ITEM, new Identifier(DoomMod.MODID, "icon_wall10"), new BlockItem(ICON_WALL10, new Item.Settings().group(DoomMod.DoomBlockItemGroup)));
    Registry.register(Registry.ITEM, new Identifier(DoomMod.MODID, "icon_wall11"), new BlockItem(ICON_WALL11, new Item.Settings().group(DoomMod.DoomBlockItemGroup)));
    Registry.register(Registry.ITEM, new Identifier(DoomMod.MODID, "icon_wall12"), new BlockItem(ICON_WALL12, new Item.Settings().group(DoomMod.DoomBlockItemGroup)));
    Registry.register(Registry.ITEM, new Identifier(DoomMod.MODID, "icon_wall13"), new BlockItem(ICON_WALL13, new Item.Settings().group(DoomMod.DoomBlockItemGroup)));
    Registry.register(Registry.ITEM, new Identifier(DoomMod.MODID, "icon_wall14"), new BlockItem(ICON_WALL14, new Item.Settings().group(DoomMod.DoomBlockItemGroup)));
    Registry.register(Registry.ITEM, new Identifier(DoomMod.MODID, "icon_wall15"), new BlockItem(ICON_WALL15, new Item.Settings().group(DoomMod.DoomBlockItemGroup)));
    Registry.register(Registry.ITEM, new Identifier(DoomMod.MODID, "icon_wall16"), new BlockItem(ICON_WALL16, new Item.Settings().group(DoomMod.DoomBlockItemGroup)));
    Registry.register(Registry.BLOCK, new Identifier(DoomMod.MODID, "e1m1_block1"), E1M1_1);
    Registry.register(Registry.ITEM, new Identifier(DoomMod.MODID, "e1m1_block1"), new BlockItem(E1M1_1, new Item.Settings().group(DoomMod.DoomBlockItemGroup)));
    Registry.register(Registry.BLOCK, new Identifier(DoomMod.MODID, "e1m1_block2"), E1M1_2);
    Registry.register(Registry.ITEM, new Identifier(DoomMod.MODID, "e1m1_block2"), new BlockItem(E1M1_2, new Item.Settings().group(DoomMod.DoomBlockItemGroup)));
    Registry.register(Registry.BLOCK, new Identifier(DoomMod.MODID, "e1m1_block3"), E1M1_3);
    Registry.register(Registry.ITEM, new Identifier(DoomMod.MODID, "e1m1_block3"), new BlockItem(E1M1_3, new Item.Settings().group(DoomMod.DoomBlockItemGroup)));
    Registry.register(Registry.BLOCK, new Identifier(DoomMod.MODID, "e1m1_block4"), E1M1_4);
    Registry.register(Registry.ITEM, new Identifier(DoomMod.MODID, "e1m1_block4"), new BlockItem(E1M1_4, new Item.Settings().group(DoomMod.DoomBlockItemGroup)));
    Registry.register(Registry.BLOCK, new Identifier(DoomMod.MODID, "e1m1_block5"), E1M1_5);
    Registry.register(Registry.ITEM, new Identifier(DoomMod.MODID, "e1m1_block5"), new BlockItem(E1M1_5, new Item.Settings().group(DoomMod.DoomBlockItemGroup)));
    Registry.register(Registry.BLOCK, new Identifier(DoomMod.MODID, "e1m1_block6"), E1M1_6);
    Registry.register(Registry.ITEM, new Identifier(DoomMod.MODID, "e1m1_block6"), new BlockItem(E1M1_6, new Item.Settings().group(DoomMod.DoomBlockItemGroup)));
    Registry.register(Registry.BLOCK, new Identifier(DoomMod.MODID, "e1m1_block7"), E1M1_7);
    Registry.register(Registry.ITEM, new Identifier(DoomMod.MODID, "e1m1_block7"), new BlockItem(E1M1_7, new Item.Settings().group(DoomMod.DoomBlockItemGroup)));
    Registry.register(Registry.BLOCK, new Identifier(DoomMod.MODID, "e1m1_block8"), E1M1_8);
    Registry.register(Registry.ITEM, new Identifier(DoomMod.MODID, "e1m1_block8"), new BlockItem(E1M1_8, new Item.Settings().group(DoomMod.DoomBlockItemGroup)));
    Registry.register(Registry.BLOCK, new Identifier(DoomMod.MODID, "e1m1_block9"), E1M1_9);
    Registry.register(Registry.ITEM, new Identifier(DoomMod.MODID, "e1m1_block9"), new BlockItem(E1M1_9, new Item.Settings().group(DoomMod.DoomBlockItemGroup)));
    Registry.register(Registry.BLOCK, new Identifier(DoomMod.MODID, "e1m1_block10"), E1M1_10);
    Registry.register(Registry.ITEM, new Identifier(DoomMod.MODID, "e1m1_block10"), new BlockItem(E1M1_10, new Item.Settings().group(DoomMod.DoomBlockItemGroup)));
    Registry.register(Registry.BLOCK, new Identifier(DoomMod.MODID, "e1m1_block11"), E1M1_11);
    Registry.register(Registry.ITEM, new Identifier(DoomMod.MODID, "e1m1_block11"), new BlockItem(E1M1_11, new Item.Settings().group(DoomMod.DoomBlockItemGroup)));
    Registry.register(Registry.BLOCK, new Identifier(DoomMod.MODID, "e1m1_block12"), E1M1_12);
    Registry.register(Registry.ITEM, new Identifier(DoomMod.MODID, "e1m1_block12"), new BlockItem(E1M1_12, new Item.Settings().group(DoomMod.DoomBlockItemGroup)));
    Registry.register(Registry.BLOCK, new Identifier(DoomMod.MODID, "e1m1_block13"), E1M1_13);
    Registry.register(Registry.ITEM, new Identifier(DoomMod.MODID, "e1m1_block13"), new BlockItem(E1M1_13, new Item.Settings().group(DoomMod.DoomBlockItemGroup)));
    Registry.register(Registry.BLOCK, new Identifier(DoomMod.MODID, "e1m1_block14"), E1M1_14);
    Registry.register(Registry.ITEM, new Identifier(DoomMod.MODID, "e1m1_block14"), new BlockItem(E1M1_14, new Item.Settings().group(DoomMod.DoomBlockItemGroup)));
    Registry.register(Registry.BLOCK, new Identifier(DoomMod.MODID, "e1m1_block15"), E1M1_15);
    Registry.register(Registry.ITEM, new Identifier(DoomMod.MODID, "e1m1_block15"), new BlockItem(E1M1_15, new Item.Settings().group(DoomMod.DoomBlockItemGroup)));
    Registry.register(Registry.BLOCK, new Identifier(DoomMod.MODID, "e1m1_block16"), E1M1_16);
    Registry.register(Registry.ITEM, new Identifier(DoomMod.MODID, "e1m1_block16"), new BlockItem(E1M1_16, new Item.Settings().group(DoomMod.DoomBlockItemGroup)));
    Registry.register(Registry.BLOCK, new Identifier(DoomMod.MODID, "e1m1_block17"), E1M1_17);
    Registry.register(Registry.ITEM, new Identifier(DoomMod.MODID, "e1m1_block17"), new BlockItem(E1M1_17, new Item.Settings().group(DoomMod.DoomBlockItemGroup)));
    Registry.register(Registry.BLOCK, new Identifier(DoomMod.MODID, "e1m1_block18"), E1M1_18);
    Registry.register(Registry.ITEM, new Identifier(DoomMod.MODID, "e1m1_block18"), new BlockItem(E1M1_18, new Item.Settings().group(DoomMod.DoomBlockItemGroup)));
    Registry.register(Registry.BLOCK, new Identifier(DoomMod.MODID, "e1m1_block19"), E1M1_19);
    Registry.register(Registry.ITEM, new Identifier(DoomMod.MODID, "e1m1_block19"), new BlockItem(E1M1_19, new Item.Settings().group(DoomMod.DoomBlockItemGroup)));
    Registry.register(Registry.BLOCK, new Identifier(DoomMod.MODID, "e1m1_block20"), E1M1_20);
    Registry.register(Registry.ITEM, new Identifier(DoomMod.MODID, "e1m1_block20"), new BlockItem(E1M1_20, new Item.Settings().group(DoomMod.DoomBlockItemGroup)));
    Registry.register(Registry.BLOCK, new Identifier(DoomMod.MODID, "e1m1_block21"), E1M1_21);
    Registry.register(Registry.ITEM, new Identifier(DoomMod.MODID, "e1m1_block21"), new BlockItem(E1M1_21, new Item.Settings().group(DoomMod.DoomBlockItemGroup)));
    Registry.register(Registry.BLOCK, new Identifier(DoomMod.MODID, "e1m1_block22"), E1M1_22);
    Registry.register(Registry.ITEM, new Identifier(DoomMod.MODID, "e1m1_block22"), new BlockItem(E1M1_22, new Item.Settings().group(DoomMod.DoomBlockItemGroup)));
    Registry.register(Registry.BLOCK, new Identifier(DoomMod.MODID, "e1m1_block23"), E1M1_23);
    Registry.register(Registry.ITEM, new Identifier(DoomMod.MODID, "e1m1_block23"), new BlockItem(E1M1_23, new Item.Settings().group(DoomMod.DoomBlockItemGroup)));
    Registry.register(Registry.BLOCK, new Identifier(DoomMod.MODID, "e1m1_block24"), E1M1_24);
    Registry.register(Registry.ITEM, new Identifier(DoomMod.MODID, "e1m1_block24"), new BlockItem(E1M1_24, new Item.Settings().group(DoomMod.DoomBlockItemGroup)));
    Registry.register(Registry.BLOCK, new Identifier(DoomMod.MODID, "e1m1_block25"), E1M1_25);
    Registry.register(Registry.ITEM, new Identifier(DoomMod.MODID, "e1m1_block25"), new BlockItem(E1M1_25, new Item.Settings().group(DoomMod.DoomBlockItemGroup)));
    Registry.register(Registry.BLOCK, new Identifier(DoomMod.MODID, "e1m1_block26"), E1M1_26);
    Registry.register(Registry.ITEM, new Identifier(DoomMod.MODID, "e1m1_block26"), new BlockItem(E1M1_26, new Item.Settings().group(DoomMod.DoomBlockItemGroup)));
}
Also used : Item(net.minecraft.item.Item) BlockItem(net.minecraft.item.BlockItem) DoomBlockItem(mod.azure.doom.item.DoomBlockItem) Identifier(net.minecraft.util.Identifier) DoomBlockItem(mod.azure.doom.item.DoomBlockItem) BlockItem(net.minecraft.item.BlockItem) DoomBlockItem(mod.azure.doom.item.DoomBlockItem)

Example 14 with Identifier

use of net.minecraft.util.Identifier in project Polymorph by TheIllusiveC4.

the class PolymorphClientNetwork method sendRecipesList.

private static void sendRecipesList(MinecraftClient pClient, ClientPlayNetworkHandler pHandler, PacketByteBuf pBuf, PacketSender pSender) {
    SortedSet<RecipePair> recipeDataset = new TreeSet<>();
    Identifier selected = null;
    if (pBuf.isReadable()) {
        int size = pBuf.readInt();
        for (int i = 0; i < size; i++) {
            recipeDataset.add(new RecipePairImpl(pBuf.readIdentifier(), pBuf.readItemStack()));
        }
        if (pBuf.isReadable()) {
            selected = pBuf.readIdentifier();
        }
    }
    Identifier finalSelected = selected;
    pClient.execute(() -> {
        ClientPlayerEntity player = pClient.player;
        if (player != null) {
            Optional<RecipesWidget> maybeWidget = RecipesWidgetControl.get();
            maybeWidget.ifPresent(widget -> widget.setRecipesList(recipeDataset, finalSelected));
            if (!maybeWidget.isPresent()) {
                RecipesWidgetControl.enqueueRecipesList(recipeDataset, finalSelected);
            }
        }
    });
}
Also used : Identifier(net.minecraft.util.Identifier) RecipePair(top.theillusivec4.polymorph.api.common.base.RecipePair) TreeSet(java.util.TreeSet) RecipePairImpl(top.theillusivec4.polymorph.common.impl.RecipePairImpl) RecipesWidget(top.theillusivec4.polymorph.api.client.base.RecipesWidget) ClientPlayerEntity(net.minecraft.client.network.ClientPlayerEntity)

Example 15 with Identifier

use of net.minecraft.util.Identifier in project Polymorph by TheIllusiveC4.

the class PolymorphNetwork method handleStackSelect.

private static void handleStackSelect(MinecraftServer pServer, ServerPlayerEntity pPlayer, ServerPlayNetworkHandler pHandler, PacketByteBuf pBuf, PacketSender pResponseSender) {
    Identifier identifier = pBuf.readIdentifier();
    pServer.execute(() -> {
        World world = pPlayer.getEntityWorld();
        Optional<? extends Recipe<?>> maybeRecipe = world.getRecipeManager().get(identifier);
        maybeRecipe.ifPresent(recipe -> {
            ScreenHandler screenHandler = pPlayer.currentScreenHandler;
            PolymorphApi.common().getRecipeDataFromBlockEntity(screenHandler).ifPresent(recipeData -> {
                recipeData.selectRecipe(recipe);
                for (AbstractCompatibilityModule integration : PolymorphIntegrations.get()) {
                    if (integration.selectRecipe(screenHandler, recipe)) {
                        return;
                    }
                }
            });
        });
    });
}
Also used : Identifier(net.minecraft.util.Identifier) ForgingScreenHandler(net.minecraft.screen.ForgingScreenHandler) ScreenHandler(net.minecraft.screen.ScreenHandler) AbstractCompatibilityModule(top.theillusivec4.polymorph.common.integration.AbstractCompatibilityModule) World(net.minecraft.world.World)

Aggregations

Identifier (net.minecraft.util.Identifier)343 NbtList (net.minecraft.nbt.NbtList)36 ItemStack (net.minecraft.item.ItemStack)31 Item (net.minecraft.item.Item)28 NbtCompound (net.minecraft.nbt.NbtCompound)22 NbtElement (net.minecraft.nbt.NbtElement)22 Inject (org.spongepowered.asm.mixin.injection.Inject)22 IOException (java.io.IOException)18 Block (net.minecraft.block.Block)18 MinecraftClient (net.minecraft.client.MinecraftClient)15 BlockItem (net.minecraft.item.BlockItem)15 BlockPos (net.minecraft.util.math.BlockPos)15 Map (java.util.Map)12 BlockState (net.minecraft.block.BlockState)12 ArrayList (java.util.ArrayList)11 VertexConsumer (net.minecraft.client.render.VertexConsumer)11 ResourceManager (net.minecraft.resource.ResourceManager)11 SoundEvent (net.minecraft.sound.SoundEvent)11 ServerPlayerEntity (net.minecraft.server.network.ServerPlayerEntity)10 LiteralText (net.minecraft.text.LiteralText)10