use of net.minecraft.client.MinecraftClient in project Skyblocker by LifeIsAParadox.
the class ResultButtonWidget method renderButton.
@Override
public void renderButton(MatrixStack matrices, int mouseX, int mouseY, float delta) {
MinecraftClient client = MinecraftClient.getInstance();
RenderSystem.setShader(GameRenderer::getPositionTexShader);
RenderSystem.setShaderTexture(0, BACKGROUND_TEXTURE);
this.drawTexture(matrices, this.x, this.y, 29, 206, this.width, this.height);
client.getItemRenderer().renderInGui(this.itemStack, this.x + 4, this.y + 4);
client.getItemRenderer().renderGuiItemOverlay(client.textRenderer, itemStack, this.x + 4, this.y + 4);
}
use of net.minecraft.client.MinecraftClient in project Skyblocker by LifeIsAParadox.
the class ResultButtonWidget method renderTooltip.
@Override
public void renderTooltip(MatrixStack matrices, int mouseX, int mouseY) {
MinecraftClient client = MinecraftClient.getInstance();
List<Text> tooltip = client.currentScreen.getTooltipFromItem(this.itemStack);
client.currentScreen.renderTooltip(matrices, tooltip, mouseX, mouseY);
}
use of net.minecraft.client.MinecraftClient in project Skyblocker by LifeIsAParadox.
the class ThreeWeirdos method onMatch.
@Override
public boolean onMatch(Text message, Matcher matcher) {
MinecraftClient client = MinecraftClient.getInstance();
assert client.world != null;
assert client.player != null;
client.world.getEntitiesByClass(ArmorStandEntity.class, client.player.getBoundingBox().expand(3), entity -> {
Text customName = entity.getCustomName();
if (customName != null && customName.getString().equals(matcher.group(1))) {
return true;
}
return false;
}).forEach(entity -> entity.setCustomName(Text.of(Formatting.GREEN + matcher.group(1))));
return false;
}
use of net.minecraft.client.MinecraftClient in project Skyblocker by LifeIsAParadox.
the class Utils method sbChecker.
public static void sbChecker() {
MinecraftClient client = MinecraftClient.getInstance();
List<String> sidebar;
if (client.world == null || client.isInSingleplayer() || (sidebar = getSidebar()) == null) {
isOnSkyblock = false;
isInDungeons = false;
return;
}
String string = sidebar.toString();
if (sidebar.isEmpty())
return;
if (sidebar.get(0).contains("SKYBLOCK") && !isOnSkyblock) {
if (!isInjected) {
isInjected = true;
ItemTooltipCallback.EVENT.register(PriceInfoTooltip::onInjectTooltip);
}
Events.onSkyblockJoin();
}
if (!sidebar.get(0).contains("SKYBLOCK") && isOnSkyblock)
Events.onSkyblockDisconnect();
isInDungeons = isOnSkyblock && string.contains("The Catacombs");
}
use of net.minecraft.client.MinecraftClient in project Skyblocker by LifeIsAParadox.
the class DungeonBlaze method update.
public static void update() {
if (!Utils.isInDungeons)
return;
MinecraftClient client = MinecraftClient.getInstance();
if (!renderHooked) {
WorldRenderEvents.END.register(DungeonBlaze::blazeRenderer);
renderHooked = true;
}
assert client.world != null;
Iterable<Entity> entities = client.world.getEntities();
int highestHealth = 0;
int lowestHealth = 99999999;
for (Entity entity : entities) {
if (entity.getName().getString().contains("Blaze") && entity.getName().getString().contains("/")) {
String blazeName = entity.getName().getString();
try {
int health = Integer.parseInt(blazeName.substring(blazeName.indexOf("/") + 1, blazeName.length() - 1));
if (health > highestHealth) {
highestHealth = health;
highestBlaze = entity;
}
if (health < lowestHealth) {
lowestHealth = health;
lowestBlaze = entity;
}
} catch (NumberFormatException ex) {
ex.printStackTrace();
}
}
}
}
Aggregations