Search in sources :

Example 6 with ContainerCraftingFurnace

use of com.minecolonies.api.inventory.container.ContainerCraftingFurnace in project minecolonies by ldtteam.

the class TransferRecipeCraftingTeachingMessage method onExecute.

@Override
public void onExecute(final NetworkEvent.Context ctxIn, final boolean isLogicalServer) {
    final PlayerEntity player = ctxIn.getSender();
    if (player.containerMenu instanceof ContainerCrafting) {
        final ContainerCrafting container = (ContainerCrafting) player.containerMenu;
        if (complete) {
            container.handleSlotClick(container.getSlot(1), itemStacks.getOrDefault(0, ItemStackUtils.EMPTY));
            container.handleSlotClick(container.getSlot(2), itemStacks.getOrDefault(1, ItemStackUtils.EMPTY));
            container.handleSlotClick(container.getSlot(3), itemStacks.getOrDefault(2, ItemStackUtils.EMPTY));
            container.handleSlotClick(container.getSlot(4), itemStacks.getOrDefault(3, ItemStackUtils.EMPTY));
            container.handleSlotClick(container.getSlot(5), itemStacks.getOrDefault(4, ItemStackUtils.EMPTY));
            container.handleSlotClick(container.getSlot(6), itemStacks.getOrDefault(5, ItemStackUtils.EMPTY));
            container.handleSlotClick(container.getSlot(7), itemStacks.getOrDefault(6, ItemStackUtils.EMPTY));
            container.handleSlotClick(container.getSlot(8), itemStacks.getOrDefault(7, ItemStackUtils.EMPTY));
            container.handleSlotClick(container.getSlot(9), itemStacks.getOrDefault(8, ItemStackUtils.EMPTY));
        } else {
            container.handleSlotClick(container.getSlot(1), itemStacks.getOrDefault(0, ItemStackUtils.EMPTY));
            container.handleSlotClick(container.getSlot(2), itemStacks.getOrDefault(1, ItemStackUtils.EMPTY));
            container.handleSlotClick(container.getSlot(3), itemStacks.getOrDefault(3, ItemStackUtils.EMPTY));
            container.handleSlotClick(container.getSlot(4), itemStacks.getOrDefault(4, ItemStackUtils.EMPTY));
        }
        container.broadcastChanges();
    } else if (player.containerMenu instanceof ContainerCraftingFurnace) {
        final ContainerCraftingFurnace container = (ContainerCraftingFurnace) player.containerMenu;
        container.setFurnaceInput(itemStacks.getOrDefault(0, ItemStack.EMPTY));
    }
}
Also used : ContainerCraftingFurnace(com.minecolonies.api.inventory.container.ContainerCraftingFurnace) ContainerCrafting(com.minecolonies.api.inventory.container.ContainerCrafting) PlayerEntity(net.minecraft.entity.player.PlayerEntity)

Aggregations

ContainerCraftingFurnace (com.minecolonies.api.inventory.container.ContainerCraftingFurnace)6 PlayerEntity (net.minecraft.entity.player.PlayerEntity)6 ContainerCrafting (com.minecolonies.api.inventory.container.ContainerCrafting)4 NotNull (org.jetbrains.annotations.NotNull)4 ContainerCraftingBrewingstand (com.minecolonies.api.inventory.container.ContainerCraftingBrewingstand)2 Network (com.minecolonies.coremod.Network)2 AbstractCraftingBuildingModule (com.minecolonies.coremod.colony.buildings.modules.AbstractCraftingBuildingModule)2 TransferRecipeCraftingTeachingMessage (com.minecolonies.coremod.network.messages.server.TransferRecipeCraftingTeachingMessage)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 Nullable (javax.annotation.Nullable)2 IRecipeLayout (mezz.jei.api.gui.IRecipeLayout)2 IGuiIngredient (mezz.jei.api.gui.ingredient.IGuiIngredient)2 IRecipeTransferError (mezz.jei.api.recipe.transfer.IRecipeTransferError)2 IRecipeTransferHandler (mezz.jei.api.recipe.transfer.IRecipeTransferHandler)2 IRecipeTransferHandlerHelper (mezz.jei.api.recipe.transfer.IRecipeTransferHandlerHelper)2 PlayerInventory (net.minecraft.entity.player.PlayerInventory)2 ServerPlayerEntity (net.minecraft.entity.player.ServerPlayerEntity)2 Container (net.minecraft.inventory.container.Container)2 INamedContainerProvider (net.minecraft.inventory.container.INamedContainerProvider)2