use of net.minecraft.client.gui.screens.inventory.InventoryScreen in project Regeneration by Suff99.
the class TabRegistry method openInventoryGui.
public static void openInventoryGui() {
Minecraft mc = Minecraft.getInstance();
mc.player.connection.send(new ServerboundContainerClosePacket(mc.player.containerMenu.containerId));
InventoryScreen inventory = new InventoryScreen(mc.player);
mc.setScreen(inventory);
}
use of net.minecraft.client.gui.screens.inventory.InventoryScreen in project Tweak-My-Client by Hendrix-Shen.
the class AutoDropUtils method doDrop.
public static void doDrop() {
Minecraft minecraftClient = TweakMyClient.getMinecraftClient();
MultiPlayerGameMode interactionManager = minecraftClient.gameMode;
if (minecraftClient.screen instanceof AbstractContainerScreen && !(minecraftClient.screen instanceof InventoryScreen)) {
return;
}
for (int slot = 9; slot < 45; slot++) {
int adjustedSlot = slot;
if (adjustedSlot >= 36)
adjustedSlot -= 36;
assert minecraftClient.player != null;
ItemStack stack = minecraftClient.player.inventory.getItem(adjustedSlot);
if (stack.isEmpty())
continue;
Configs.AutoDropListType mode = (Configs.AutoDropListType) Configs.List.LIST_AUTO_DROP_TYPE.getOptionListValue();
switch(mode) {
case BLACKLIST:
if (!itemStacksBlackList.contains(stack.getItem())) {
assert interactionManager != null;
interactionManager.handleInventoryMouseClick(0, slot, 1, ClickType.THROW, TweakMyClient.getMinecraftClient().player);
}
break;
case WHITELIST:
if (itemStacksWhitelist.contains(stack.getItem())) {
assert interactionManager != null;
interactionManager.handleInventoryMouseClick(0, slot, 1, ClickType.THROW, TweakMyClient.getMinecraftClient().player);
}
break;
}
}
}
use of net.minecraft.client.gui.screens.inventory.InventoryScreen in project LightmansCurrency by Lightman314.
the class ClientEvents method onInventoryGuiInit.
// Add the wallet button to the gui
@SubscribeEvent
public static void onInventoryGuiInit(ScreenEvent.InitScreenEvent.Post event) {
if (!Config.CLIENT.renderWalletButton.get())
return;
Screen screen = event.getScreen();
if (screen instanceof InventoryScreen || screen instanceof CreativeModeInventoryScreen) {
AbstractContainerScreen<?> gui = (AbstractContainerScreen<?>) screen;
boolean isCreative = screen instanceof CreativeModeInventoryScreen;
int xPos = isCreative ? Config.CLIENT.walletButtonCreativeX.get() : Config.CLIENT.walletButtonX.get();
int yPos = isCreative ? Config.CLIENT.walletButtonCreativeY.get() : Config.CLIENT.walletButtonY.get();
;
event.addListener(new WalletButton(gui, xPos, yPos, button -> LightmansCurrencyPacketHandler.instance.sendToServer(new MessageOpenWallet())));
}
}
use of net.minecraft.client.gui.screens.inventory.InventoryScreen 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));
}
use of net.minecraft.client.gui.screens.inventory.InventoryScreen 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 -> {
}));
}
Aggregations