use of net.minecraft.client.gui.screen.ingame.HandledScreen in project Skyblocker by LifeIsAParadox.
the class QuickNavButton method updateCoordinates.
private void updateCoordinates() {
Screen screen = MinecraftClient.getInstance().currentScreen;
if (screen instanceof HandledScreen<?>) {
HandledScreen<?> handledScreen = (HandledScreen<?>) screen;
int x = ((HandledScreenAccessor) handledScreen).getX();
int y = ((HandledScreenAccessor) handledScreen).getY();
int w = ((HandledScreenAccessor) handledScreen).getBackgroundWidth();
int h = ((HandledScreenAccessor) handledScreen).getBackgroundHeight();
// why is this even a thing
if (h > 166)
--h;
this.x = x + this.index % 6 * 28 + 4;
this.y = this.index < 6 ? y - 28 : y + h - 4;
this.u = 28;
this.v = (index < 6 ? 0 : 64) + (toggled ? 32 : 0);
}
}
use of net.minecraft.client.gui.screen.ingame.HandledScreen in project BleachHack by BleachDrinker420.
the class AutoSteal method onOpenScreen.
@BleachSubscribe
public void onOpenScreen(EventOpenScreen event) {
currentSyncId = -1;
if (mc.player != null) {
if (event.getScreen() instanceof HandledScreen) {
ScreenHandler handler = ((HandledScreen<?>) event.getScreen()).getScreenHandler();
if (handler instanceof GenericContainerScreenHandler) {
currentSyncId = handler.syncId;
lastOpen = currentTime;
if (getSetting(0).asMode().getMode() >= 1) {
event.setCancelled(true);
}
} else {
currentItems = null;
mc.player.networkHandler.sendPacket(new CloseHandledScreenC2SPacket(currentSyncId));
}
} else {
currentItems = null;
mc.player.networkHandler.sendPacket(new CloseHandledScreenC2SPacket(currentSyncId));
}
}
}
use of net.minecraft.client.gui.screen.ingame.HandledScreen in project BleachHack by BleachDrinker420.
the class Peek method drawScreen.
@BleachSubscribe
public void drawScreen(EventRenderTooltip event) {
if (!(event.getScreen() instanceof HandledScreen)) {
return;
}
Slot slot = ((HandledScreen<?>) event.getScreen()).focusedSlot;
if (slot == null)
return;
if (slot.x != slotX || slot.y != slotY) {
pageCount = 0;
pages = null;
slotX = slot.x;
slotY = slot.y;
}
event.getMatrix().push();
event.getMatrix().translate(0, 0, 400);
if (getSetting(0).asToggle().getState()) {
List<TooltipComponent> components = drawShulkerToolTip(event.getMatrix(), slot, event.getMouseX(), event.getMouseY());
if (components != null) {
if (components.isEmpty()) {
event.setCancelled(true);
} else {
event.setComponents(components);
}
}
}
if (getSetting(1).asToggle().getState())
drawBookToolTip(event.getMatrix(), slot, event.getMouseX(), event.getMouseY());
if (getSetting(2).asToggle().getState())
drawMapToolTip(event.getMatrix(), slot, event.getMouseX(), event.getMouseY());
event.getMatrix().pop();
}
Aggregations