Search in sources :

Example 1 with MinecraftClient

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);
}
Also used : MinecraftClient(net.minecraft.client.MinecraftClient) GameRenderer(net.minecraft.client.render.GameRenderer)

Example 2 with MinecraftClient

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);
}
Also used : MinecraftClient(net.minecraft.client.MinecraftClient) Text(net.minecraft.text.Text)

Example 3 with MinecraftClient

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;
}
Also used : SkyblockerConfig(me.xmrvizzy.skyblocker.config.SkyblockerConfig) Formatting(net.minecraft.util.Formatting) Matcher(java.util.regex.Matcher) ChatFilterResult(me.xmrvizzy.skyblocker.chat.ChatFilterResult) ArmorStandEntity(net.minecraft.entity.decoration.ArmorStandEntity) MinecraftClient(net.minecraft.client.MinecraftClient) Text(net.minecraft.text.Text) ChatPatternListener(me.xmrvizzy.skyblocker.chat.ChatPatternListener) MinecraftClient(net.minecraft.client.MinecraftClient) Text(net.minecraft.text.Text) ArmorStandEntity(net.minecraft.entity.decoration.ArmorStandEntity)

Example 4 with MinecraftClient

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");
}
Also used : MinecraftClient(net.minecraft.client.MinecraftClient) PriceInfoTooltip(me.xmrvizzy.skyblocker.skyblock.item.PriceInfoTooltip)

Example 5 with MinecraftClient

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();
            }
        }
    }
}
Also used : Entity(net.minecraft.entity.Entity) MinecraftClient(net.minecraft.client.MinecraftClient)

Aggregations

MinecraftClient (net.minecraft.client.MinecraftClient)84 ItemStack (net.minecraft.item.ItemStack)12 Text (net.minecraft.text.Text)7 Identifier (net.minecraft.util.Identifier)7 Inject (org.spongepowered.asm.mixin.injection.Inject)7 BlockPos (net.minecraft.util.math.BlockPos)6 BlockEntity (net.minecraft.block.entity.BlockEntity)5 TextRenderer (net.minecraft.client.font.TextRenderer)5 ClientPlayNetworkHandler (net.minecraft.client.network.ClientPlayNetworkHandler)5 BlockHitResult (net.minecraft.util.hit.BlockHitResult)5 List (java.util.List)4 BlockState (net.minecraft.block.BlockState)4 MatrixStack (net.minecraft.client.util.math.MatrixStack)4 Entity (net.minecraft.entity.Entity)4 PlayerEntity (net.minecraft.entity.player.PlayerEntity)4 NbtCompound (net.minecraft.nbt.NbtCompound)4 AreaIsometricRenderScreen (com.glisco.isometricrenders.client.gui.AreaIsometricRenderScreen)3 IsometricRenderScreen (com.glisco.isometricrenders.client.gui.IsometricRenderScreen)3 GameRenderer (net.minecraft.client.render.GameRenderer)3 VertexConsumerProvider (net.minecraft.client.render.VertexConsumerProvider)3