Search in sources :

Example 1 with EnderChestInventory

use of net.minecraft.inventory.EnderChestInventory in project KahzerxMod by otakucraft.

the class SpoofExtension method spoofEC.

public int spoofEC(ServerCommandSource source, String playerE) throws CommandSyntaxException {
    ServerPlayerEntity player = source.getPlayer();
    ServerPlayerEntity player2 = source.getServer().getPlayerManager().getPlayer(playerE);
    if (player2 != null) {
        EnderChestInventory enderChestInventory = player2.getEnderChestInventory();
        // Generar la pantalla de enderChest.
        player.openHandledScreen(new SimpleNamedScreenHandlerFactory((i, playerInventory, playerEntity) -> GenericContainerScreenHandler.createGeneric9x3(i, playerInventory, enderChestInventory), new LiteralText(String.format("%s stop hax >:(", player.getName().getString()))));
    } else {
        source.sendFeedback(new LiteralText("player offline"), false);
    }
    return 1;
}
Also used : ExtensionSettings(com.kahzerx.kahzerxmod.extensions.ExtensionSettings) LiteralText(net.minecraft.text.LiteralText) ScreenHandler(net.minecraft.screen.ScreenHandler) CommandDispatcher(com.mojang.brigadier.CommandDispatcher) GenericExtension(com.kahzerx.kahzerxmod.extensions.GenericExtension) EnderChestInventory(net.minecraft.inventory.EnderChestInventory) ServerCommandSource(net.minecraft.server.command.ServerCommandSource) ScreenHandlerListener(net.minecraft.screen.ScreenHandlerListener) SimpleNamedScreenHandlerFactory(net.minecraft.screen.SimpleNamedScreenHandlerFactory) Extensions(com.kahzerx.kahzerxmod.Extensions) Inventory(net.minecraft.inventory.Inventory) SimpleInventory(net.minecraft.inventory.SimpleInventory) ItemStack(net.minecraft.item.ItemStack) ServerPlayerEntity(net.minecraft.server.network.ServerPlayerEntity) CommandSyntaxException(com.mojang.brigadier.exceptions.CommandSyntaxException) GenericContainerScreenHandler(net.minecraft.screen.GenericContainerScreenHandler) SimpleNamedScreenHandlerFactory(net.minecraft.screen.SimpleNamedScreenHandlerFactory) EnderChestInventory(net.minecraft.inventory.EnderChestInventory) ServerPlayerEntity(net.minecraft.server.network.ServerPlayerEntity) LiteralText(net.minecraft.text.LiteralText)

Example 2 with EnderChestInventory

use of net.minecraft.inventory.EnderChestInventory 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

EnderChestInventory (net.minecraft.inventory.EnderChestInventory)2 Extensions (com.kahzerx.kahzerxmod.Extensions)1 ExtensionSettings (com.kahzerx.kahzerxmod.extensions.ExtensionSettings)1 GenericExtension (com.kahzerx.kahzerxmod.extensions.GenericExtension)1 CommandDispatcher (com.mojang.brigadier.CommandDispatcher)1 CommandSyntaxException (com.mojang.brigadier.exceptions.CommandSyntaxException)1 PlayerDataGui (de.rubixdev.rug.gui.PlayerDataGui)1 Inventory (net.minecraft.inventory.Inventory)1 SimpleInventory (net.minecraft.inventory.SimpleInventory)1 ItemStack (net.minecraft.item.ItemStack)1 GenericContainerScreenHandler (net.minecraft.screen.GenericContainerScreenHandler)1 ScreenHandler (net.minecraft.screen.ScreenHandler)1 ScreenHandlerListener (net.minecraft.screen.ScreenHandlerListener)1 SimpleNamedScreenHandlerFactory (net.minecraft.screen.SimpleNamedScreenHandlerFactory)1 Slot (net.minecraft.screen.slot.Slot)1 ServerCommandSource (net.minecraft.server.command.ServerCommandSource)1 ServerPlayerEntity (net.minecraft.server.network.ServerPlayerEntity)1 LiteralText (net.minecraft.text.LiteralText)1