use of net.minecraft.client.gui.inventory.GuiShulkerBox in project 3arthh4ck by 3arthqu4ke.
the class ListenerTick method invoke.
@Override
public void invoke(TickEvent event) {
if (mc.currentScreen instanceof GuiShulkerBox) {
for (int i = 0; i < 36; i++) {
if (module.delayTimer.passed(module.delay.getValue())) {
Setting<?> setting = module.getSettingFromSlot(i);
if (setting == null)
continue;
int itemId = Integer.parseInt(setting.getName().split(":")[1]);
if (itemId == 0)
continue;
Item item = Item.getItemById(itemId);
int shulkerSlot = InventoryUtil.findItem(item, ((GuiShulkerBox) mc.currentScreen).inventorySlots);
ItemStack stackInSlot = ((GuiContainer) mc.currentScreen).inventorySlots.getInventory().get(i + 27);
if (stackInSlot.getMaxStackSize() == 1 || stackInSlot.getMaxStackSize() == stackInSlot.getCount() || stackInSlot.getItem() != item && stackInSlot.getItem() != Items.AIR || shulkerSlot == -1 || shulkerSlot > 26)
continue;
mc.playerController.windowClick(((GuiContainer) mc.currentScreen).inventorySlots.windowId, shulkerSlot, 0, ClickType.PICKUP, mc.player);
mc.playerController.windowClick(((GuiContainer) mc.currentScreen).inventorySlots.windowId, i + 27, 0, ClickType.PICKUP, mc.player);
mc.playerController.windowClick(((GuiContainer) mc.currentScreen).inventorySlots.windowId, shulkerSlot, 0, ClickType.PICKUP, mc.player);
module.delayTimer.reset();
}
}
} else if (mc.currentScreen instanceof GuiChest && module.shouldRegear && module.grabShulker.getValue() && !module.hasKit()) {
int slot = -1;
// TODO: improve method of finding kits in chests
for (int i = 0; i < 28; i++) {
boolean foundExp = false;
boolean foundCrystals = false;
boolean foundGapples = false;
ItemStack stack = ((GuiContainer) mc.currentScreen).inventorySlots.getInventory().get(i);
if (stack.getItem() instanceof ItemShulkerBox) {
NBTTagCompound tagCompound = stack.getTagCompound();
if (tagCompound != null && tagCompound.hasKey("BlockEntityTag", 10)) {
NBTTagCompound blockEntityTag = tagCompound.getCompoundTag("BlockEntityTag");
if (blockEntityTag.hasKey("Items", 9)) {
NonNullList<ItemStack> nonNullList = NonNullList.withSize(27, ItemStack.EMPTY);
ItemStackHelper.loadAllItems(blockEntityTag, nonNullList);
for (ItemStack stack1 : nonNullList) {
if (stack1.getItem() == Items.GOLDEN_APPLE) {
foundGapples = true;
} else if (stack1.getItem() == Items.EXPERIENCE_BOTTLE) {
foundExp = true;
} else if (stack1.getItem() == Items.END_CRYSTAL) {
foundCrystals = true;
}
}
if (foundExp && foundGapples && foundCrystals) {
slot = i;
} else {
if (!module.hasKit() && module.getShulkerBox() == null) {
module.shouldRegear = false;
mc.player.closeScreen();
return;
}
}
}
}
}
}
if (slot != -1) {
int emptySlot = InventoryUtil.findInInventory(stack -> stack.isEmpty() || stack.getItem() == Items.AIR, false);
if (emptySlot != -1) {
mc.playerController.windowClick(((GuiContainer) mc.currentScreen).inventorySlots.windowId, slot, 0, ClickType.QUICK_MOVE, mc.player);
}
}
mc.player.closeScreen();
}
}
use of net.minecraft.client.gui.inventory.GuiShulkerBox in project Spark-Client by Spark-Client-Development.
the class MixinGuiScreen method initGui.
@Inject(method = "initGui", at = @At("HEAD"))
public void initGui(final CallbackInfo callbackInfo) {
Minecraft mc = Minecraft.getMinecraft();
if (mc.currentScreen instanceof GuiShulkerBox || mc.currentScreen instanceof GuiChest) {
GuiContainer screen = (GuiContainer) mc.currentScreen;
InventoryManager instance = InventoryManager.instance;
if (instance.isEnabled() && instance.isAuto(screen))
instance.StartSteal();
if (instance.isEnabled() && !instance.isAuto(screen))
screen.buttonList.add(new GuiButton(66, screen.width / 2 + 5, (screen.height - screen.getYSize()) / 2 - 6, 40, 12, "Steal"));
}
}
use of net.minecraft.client.gui.inventory.GuiShulkerBox in project Spark-Client by Spark-Client-Development.
the class InventoryManager method handleContainer.
void handleContainer() {
if (mc.currentScreen instanceof GuiChest || mc.currentScreen instanceof GuiShulkerBox) {
Container container = ((GuiContainer) mc.currentScreen).inventorySlots;
ArrayList<Integer> list = new ArrayList<>();
int slots = (mc.currentScreen instanceof GuiShulkerBox ? ((GuiShulkerBox) mc.currentScreen).inventory : ((GuiChest) mc.currentScreen).lowerChestInventory).getSizeInventory();
int slot = 0;
while (slot < slots) {
ItemStack l_Stack = container.getSlot(slot).getStack();
if (!l_Stack.isEmpty() && l_Stack.getItem() != Items.AIR) {
if (KeepItemStack(l_Stack)) {
int i = itemNeededInPerfectKit(l_Stack);
if (i >= 0) {
int convert = i;
if (convert < 9)
convert += 27;
else
convert -= 9;
InventoryUtil.moveItemInContainer(slot, convert + slots);
timer.delayRandom(stealDelay.getValue() * 10, stealDelay.getValue() * 3);
return;
} else
list.add(slot);
}
}
slot++;
}
if (!stealKitNeeded.isOn())
while (list.size() > 0) {
mc.playerController.windowClick(container.windowId, list.get(0), 0, ClickType.QUICK_MOVE, mc.player);
timer.delayRandom(stealDelay.getValue() * 10, stealDelay.getValue() * 3);
return;
}
isStealing = false;
slot = 0;
}
}
Aggregations