Search in sources :

Example 1 with SwitchInventoryTabPacket

use of net.dries007.tfc.network.SwitchInventoryTabPacket in project TerraFirmaCraft by TerraFirmaCraft.

the class CalendarScreen method init.

@Override
public void init() {
    super.init();
    addRenderableWidget(new PlayerInventoryTabButton(leftPos, topPos, 176, 4, 20, 22, 128, 0, 1, 3, 0, 0, button -> {
        playerInventory.player.containerMenu = playerInventory.player.inventoryMenu;
        Minecraft.getInstance().setScreen(new InventoryScreen(playerInventory.player));
        PacketHandler.send(PacketDistributor.SERVER.noArg(), new SwitchInventoryTabPacket(SwitchInventoryTabPacket.Type.INVENTORY));
    }));
    addRenderableWidget(new PlayerInventoryTabButton(leftPos, topPos, 176 - 3, 27, 20 + 3, 22, 128 + 20, 0, 1, 3, 32, 0, button -> {
    }));
    addRenderableWidget(new PlayerInventoryTabButton(leftPos, topPos, 176, 50, 20, 22, 128, 0, 1, 3, 64, 0, SwitchInventoryTabPacket.Type.NUTRITION));
    addRenderableWidget(new PlayerInventoryTabButton(leftPos, topPos, 176, 73, 20, 22, 128, 0, 1, 3, 96, 0, SwitchInventoryTabPacket.Type.CLIMATE));
}
Also used : ResourceLocation(net.minecraft.resources.ResourceLocation) SwitchInventoryTabPacket(net.dries007.tfc.network.SwitchInventoryTabPacket) Month(net.dries007.tfc.util.calendar.Month) Component(net.minecraft.network.chat.Component) Inventory(net.minecraft.world.entity.player.Inventory) PoseStack(com.mojang.blaze3d.vertex.PoseStack) I18n(net.minecraft.client.resources.language.I18n) Minecraft(net.minecraft.client.Minecraft) Calendars(net.dries007.tfc.util.calendar.Calendars) PacketDistributor(net.minecraftforge.network.PacketDistributor) Container(net.dries007.tfc.common.container.Container) InventoryScreen(net.minecraft.client.gui.screens.inventory.InventoryScreen) PacketHandler(net.dries007.tfc.network.PacketHandler) MOD_ID(net.dries007.tfc.TerraFirmaCraft.MOD_ID) PlayerInventoryTabButton(net.dries007.tfc.client.screen.button.PlayerInventoryTabButton) PlayerInventoryTabButton(net.dries007.tfc.client.screen.button.PlayerInventoryTabButton) SwitchInventoryTabPacket(net.dries007.tfc.network.SwitchInventoryTabPacket) InventoryScreen(net.minecraft.client.gui.screens.inventory.InventoryScreen)

Example 2 with SwitchInventoryTabPacket

use of net.dries007.tfc.network.SwitchInventoryTabPacket in project TerraFirmaCraft by TerraFirmaCraft.

the class ClimateScreen method init.

@Override
public void init() {
    super.init();
    addRenderableWidget(new PlayerInventoryTabButton(leftPos, topPos, 176, 4, 20, 22, 128, 0, 1, 3, 0, 0, button -> {
        playerInventory.player.containerMenu = playerInventory.player.inventoryMenu;
        Minecraft.getInstance().setScreen(new InventoryScreen(playerInventory.player));
        PacketHandler.send(PacketDistributor.SERVER.noArg(), new SwitchInventoryTabPacket(SwitchInventoryTabPacket.Type.INVENTORY));
    }));
    addRenderableWidget(new PlayerInventoryTabButton(leftPos, topPos, 176, 27, 20, 22, 128, 0, 1, 3, 32, 0, SwitchInventoryTabPacket.Type.CALENDAR));
    addRenderableWidget(new PlayerInventoryTabButton(leftPos, topPos, 176, 50, 20, 22, 128, 0, 1, 3, 64, 0, SwitchInventoryTabPacket.Type.NUTRITION));
    addRenderableWidget(new PlayerInventoryTabButton(leftPos, topPos, 176 - 3, 73, 20 + 3, 22, 128 + 20, 0, 1, 3, 96, 0, button -> {
    }));
}
Also used : ResourceLocation(net.minecraft.resources.ResourceLocation) SwitchInventoryTabPacket(net.dries007.tfc.network.SwitchInventoryTabPacket) Component(net.minecraft.network.chat.Component) ClimateRenderCache(net.dries007.tfc.client.ClimateRenderCache) Inventory(net.minecraft.world.entity.player.Inventory) PoseStack(com.mojang.blaze3d.vertex.PoseStack) I18n(net.minecraft.client.resources.language.I18n) Minecraft(net.minecraft.client.Minecraft) KoppenClimateClassification(net.dries007.tfc.util.climate.KoppenClimateClassification) PacketDistributor(net.minecraftforge.network.PacketDistributor) Container(net.dries007.tfc.common.container.Container) InventoryScreen(net.minecraft.client.gui.screens.inventory.InventoryScreen) PacketHandler(net.dries007.tfc.network.PacketHandler) Helpers(net.dries007.tfc.util.Helpers) MOD_ID(net.dries007.tfc.TerraFirmaCraft.MOD_ID) PlayerInventoryTabButton(net.dries007.tfc.client.screen.button.PlayerInventoryTabButton) PlayerInventoryTabButton(net.dries007.tfc.client.screen.button.PlayerInventoryTabButton) SwitchInventoryTabPacket(net.dries007.tfc.network.SwitchInventoryTabPacket) InventoryScreen(net.minecraft.client.gui.screens.inventory.InventoryScreen)

Aggregations

PoseStack (com.mojang.blaze3d.vertex.PoseStack)2 MOD_ID (net.dries007.tfc.TerraFirmaCraft.MOD_ID)2 PlayerInventoryTabButton (net.dries007.tfc.client.screen.button.PlayerInventoryTabButton)2 Container (net.dries007.tfc.common.container.Container)2 PacketHandler (net.dries007.tfc.network.PacketHandler)2 SwitchInventoryTabPacket (net.dries007.tfc.network.SwitchInventoryTabPacket)2 Minecraft (net.minecraft.client.Minecraft)2 InventoryScreen (net.minecraft.client.gui.screens.inventory.InventoryScreen)2 I18n (net.minecraft.client.resources.language.I18n)2 Component (net.minecraft.network.chat.Component)2 ResourceLocation (net.minecraft.resources.ResourceLocation)2 Inventory (net.minecraft.world.entity.player.Inventory)2 PacketDistributor (net.minecraftforge.network.PacketDistributor)2 ClimateRenderCache (net.dries007.tfc.client.ClimateRenderCache)1 Helpers (net.dries007.tfc.util.Helpers)1 Calendars (net.dries007.tfc.util.calendar.Calendars)1 Month (net.dries007.tfc.util.calendar.Month)1 KoppenClimateClassification (net.dries007.tfc.util.climate.KoppenClimateClassification)1