use of net.minecraft.screen.GenericContainerScreenHandler in project KahzerxMod by otakucraft.
the class SpoofExtension method spoofInv.
public int spoofInv(ServerCommandSource source, String playerE) throws CommandSyntaxException {
int invSize = 54;
int hotBarSize = 9;
int hotBarStartPos = 27;
int invStartPos = 9;
Inventory inventory = new SimpleInventory(invSize);
ServerPlayerEntity player = source.getPlayer();
ServerPlayerEntity player2 = source.getServer().getPlayerManager().getPlayer(playerE);
assert player2 != null;
for (int i = 0; i < player2.getInventory().main.size(); i++) {
if (i < hotBarSize) {
inventory.setStack(i + hotBarStartPos, player2.getInventory().main.get(i));
} else {
inventory.setStack(i - invStartPos, player2.getInventory().main.get(i));
}
}
int armorSlotStartPos = 45;
for (int j = 0; j < player2.getInventory().armor.size(); j++) {
inventory.setStack(j + armorSlotStartPos, player2.getInventory().armor.get(j));
}
int offHandSlotPos = 36;
inventory.setStack(offHandSlotPos, player2.getInventory().offHand.get(0));
ScreenHandlerListener listener = new ScreenHandlerListener() {
@Override
public void onSlotUpdate(ScreenHandler handler, int slotId, ItemStack stack) {
// source.getServer().getPlayerManager().saveAllPlayerData();
}
@Override
public void onPropertyUpdate(ScreenHandler handler, int property, int value) {
}
};
player.openHandledScreen(new SimpleNamedScreenHandlerFactory((i, playerInventory, playerEntity) -> {
GenericContainerScreenHandler invCont = GenericContainerScreenHandler.createGeneric9x6(i, playerInventory, inventory);
invCont.addListener(listener);
return invCont;
}, new LiteralText(String.format("%s stop hax >:(", player.getName().getString()))));
return 1;
}
use of net.minecraft.screen.GenericContainerScreenHandler in project Client by MatHax.
the class EChestMemory method onOpenScreenEvent.
@EventHandler
private static void onOpenScreenEvent(OpenScreenEvent event) {
if (echestOpenedState == 1 && event.screen instanceof GenericContainerScreen) {
echestOpenedState = 2;
return;
}
if (echestOpenedState == 0)
return;
if (!(mc.currentScreen instanceof GenericContainerScreen))
return;
GenericContainerScreenHandler container = ((GenericContainerScreen) mc.currentScreen).getScreenHandler();
if (container == null)
return;
Inventory inv = container.getInventory();
for (int i = 0; i < 27; i++) {
ITEMS.set(i, inv.getStack(i));
}
echestOpenedState = 0;
}
use of net.minecraft.screen.GenericContainerScreenHandler in project KiwiClient by TangyKiwi.
the class EChestMemory method onOpenScreenEvent.
@Subscribe
@AllowConcurrentEvents
private static void onOpenScreenEvent(OpenScreenEvent event) {
if (echestOpenedState == 1 && event.getScreen() instanceof GenericContainerScreen) {
echestOpenedState = 2;
return;
}
if (echestOpenedState == 0)
return;
if (!(Utils.mc.currentScreen instanceof GenericContainerScreen))
return;
GenericContainerScreenHandler container = ((GenericContainerScreen) Utils.mc.currentScreen).getScreenHandler();
if (container == null)
return;
Inventory inv = container.getInventory();
for (int i = 0; i < 27; i++) {
ITEMS.set(i, inv.getStack(i));
}
echestOpenedState = 0;
}
use of net.minecraft.screen.GenericContainerScreenHandler in project meteor-client by MeteorDevelopment.
the class EChestMemory method onOpenScreenEvent.
@EventHandler
private static void onOpenScreenEvent(OpenScreenEvent event) {
if (echestOpenedState == 1 && event.screen instanceof GenericContainerScreen) {
echestOpenedState = 2;
return;
}
if (echestOpenedState == 0)
return;
if (!(mc.currentScreen instanceof GenericContainerScreen))
return;
GenericContainerScreenHandler container = ((GenericContainerScreen) mc.currentScreen).getScreenHandler();
if (container == null)
return;
Inventory inv = container.getInventory();
for (int i = 0; i < 27; i++) {
ITEMS.set(i, inv.getStack(i));
}
echestOpenedState = 0;
}
use of net.minecraft.screen.GenericContainerScreenHandler in project EdenClient by HahaOO7.
the class ContainerInfo method onInventoryChange.
private void onInventoryChange(PlayerInventory playerInventory) {
ScreenHandler sh = playerInventory.player.currentScreenHandler;
if (!(sh instanceof ShulkerBoxScreenHandler) && !(sh instanceof GenericContainerScreenHandler)) {
lastInteractedBlock = null;
return;
}
List<ItemStack> items = sh.getStacks();
items = items.subList(0, items.size() - 36);
if (items.isEmpty())
lastInteractedBlock = null;
else
onOpenInventory(items);
}
Aggregations