Search in sources :

Example 1 with PlayerDataGui

use of de.rubixdev.rug.gui.PlayerDataGui in project Rug by RubixDev.

the class PeekCommand method showInventory.

public static void showInventory(ServerPlayerEntity executingPlayer, ServerPlayerEntity targetPlayer) {
    PlayerDataGui invScreen = new PlayerDataGui(ScreenHandlerType.GENERIC_9X5, executingPlayer, targetPlayer);
    invScreen.setTitle(Text.of("Inventory of " + targetPlayer.getDisplayName().asString()));
    for (int slot = 0; slot < executingPlayer.getInventory().size(); slot++) {
        invScreen.setSlotRedirect(slot, new Slot(targetPlayer.getInventory(), slot, 0, 0));
    }
    invScreen.open();
}
Also used : PlayerDataGui(de.rubixdev.rug.gui.PlayerDataGui) Slot(net.minecraft.screen.slot.Slot)

Example 2 with PlayerDataGui

use of de.rubixdev.rug.gui.PlayerDataGui in project Rug by RubixDev.

the class PeekCommand method showEnderChest.

public static void showEnderChest(ServerPlayerEntity executingPlayer, ServerPlayerEntity targetPlayer) {
    EnderChestInventory targetEnderChest = targetPlayer.getEnderChestInventory();
    PlayerDataGui invScreen = new PlayerDataGui(ScreenHandlerType.GENERIC_9X3, executingPlayer, targetPlayer);
    invScreen.setTitle(Text.of("EnderChest of " + targetPlayer.getDisplayName().asString()));
    for (int slot = 0; slot < targetEnderChest.size(); slot++) {
        invScreen.setSlotRedirect(slot, new Slot(targetEnderChest, slot, 0, 0));
    }
    invScreen.open();
}
Also used : PlayerDataGui(de.rubixdev.rug.gui.PlayerDataGui) EnderChestInventory(net.minecraft.inventory.EnderChestInventory) Slot(net.minecraft.screen.slot.Slot)

Aggregations

PlayerDataGui (de.rubixdev.rug.gui.PlayerDataGui)2 Slot (net.minecraft.screen.slot.Slot)2 EnderChestInventory (net.minecraft.inventory.EnderChestInventory)1