Search in sources :

Example 1 with HorseBaseEntity

use of net.minecraft.entity.passive.HorseBaseEntity in project BleachHack by BleachDrinker420.

the class CmdEntityStats method onCommand.

@Override
public void onCommand(String alias, String[] args) throws Exception {
    if (mc.player.getVehicle() != null) {
        if (mc.player.getVehicle() instanceof HorseBaseEntity) {
            HorseBaseEntity h = (HorseBaseEntity) mc.player.getVehicle();
            BleachLogger.info("Entity Stats:");
            BleachLogger.info("\u00a7cMax Health: \u00a7r" + (int) h.getMaxHealth() + " HP");
            BleachLogger.info("\u00a7cSpeed: \u00a7r" + getSpeed(h) + " m/s");
            BleachLogger.info("\u00a7cJump: \u00a7r" + getJumpHeight(h) + " m");
        } else if (mc.player.getVehicle() instanceof LivingEntity) {
            LivingEntity l = (LivingEntity) mc.player.getVehicle();
            BleachLogger.info("Entity Stats:");
            BleachLogger.info("\u00a7cMax Health: \u00a7r" + (int) l.getMaxHealth() + " HP");
            BleachLogger.info("\u00a7cSpeed: \u00a7r" + getSpeedLiving(l) + " m/s");
        } else {
            BleachLogger.error("Current vehicle doesn't have stats.");
        }
    } else {
        BleachLogger.error("Not riding a living entity.");
    }
}
Also used : LivingEntity(net.minecraft.entity.LivingEntity) HorseBaseEntity(net.minecraft.entity.passive.HorseBaseEntity)

Example 2 with HorseBaseEntity

use of net.minecraft.entity.passive.HorseBaseEntity in project Client by MatHax.

the class EntityOwner method onRender2D.

@EventHandler
private void onRender2D(Render2DEvent event) {
    for (Entity entity : mc.world.getEntities()) {
        UUID ownerUuid;
        if (entity instanceof TameableEntity)
            ownerUuid = ((TameableEntity) entity).getOwnerUuid();
        else if (entity instanceof HorseBaseEntity)
            ownerUuid = ((HorseBaseEntity) entity).getOwnerUuid();
        else if (entity instanceof ProjectileEntity && projectiles.get())
            ownerUuid = ((ProjectileEntityAccessor) entity).getOwnerUuid();
        else
            continue;
        if (ownerUuid != null) {
            pos.set(entity, event.tickDelta);
            pos.add(0, entity.getEyeHeight(entity.getPose()) + 0.75, 0);
            if (NametagUtils.to2D(pos, scale.get())) {
                renderNametag(getOwnerName(ownerUuid));
            }
        }
    }
}
Also used : Entity(net.minecraft.entity.Entity) PlayerEntity(net.minecraft.entity.player.PlayerEntity) ProjectileEntity(net.minecraft.entity.projectile.ProjectileEntity) HorseBaseEntity(net.minecraft.entity.passive.HorseBaseEntity) TameableEntity(net.minecraft.entity.passive.TameableEntity) ProjectileEntity(net.minecraft.entity.projectile.ProjectileEntity) TameableEntity(net.minecraft.entity.passive.TameableEntity) UUID(java.util.UUID) HorseBaseEntity(net.minecraft.entity.passive.HorseBaseEntity) ProjectileEntityAccessor(mathax.client.mixin.ProjectileEntityAccessor) EventHandler(mathax.client.eventbus.EventHandler)

Example 3 with HorseBaseEntity

use of net.minecraft.entity.passive.HorseBaseEntity in project meteor-client by MeteorDevelopment.

the class EntityOwner method onRender2D.

@EventHandler
private void onRender2D(Render2DEvent event) {
    for (Entity entity : mc.world.getEntities()) {
        UUID ownerUuid;
        if (entity instanceof TameableEntity)
            ownerUuid = ((TameableEntity) entity).getOwnerUuid();
        else if (entity instanceof HorseBaseEntity)
            ownerUuid = ((HorseBaseEntity) entity).getOwnerUuid();
        else if (entity instanceof ProjectileEntity && projectiles.get())
            ownerUuid = ((ProjectileEntityAccessor) entity).getOwnerUuid();
        else
            continue;
        if (ownerUuid != null) {
            pos.set(entity, event.tickDelta);
            pos.add(0, entity.getEyeHeight(entity.getPose()) + 0.75, 0);
            if (NametagUtils.to2D(pos, scale.get())) {
                renderNametag(getOwnerName(ownerUuid));
            }
        }
    }
}
Also used : Entity(net.minecraft.entity.Entity) PlayerEntity(net.minecraft.entity.player.PlayerEntity) ProjectileEntity(net.minecraft.entity.projectile.ProjectileEntity) HorseBaseEntity(net.minecraft.entity.passive.HorseBaseEntity) TameableEntity(net.minecraft.entity.passive.TameableEntity) ProjectileEntity(net.minecraft.entity.projectile.ProjectileEntity) TameableEntity(net.minecraft.entity.passive.TameableEntity) UUID(java.util.UUID) HorseBaseEntity(net.minecraft.entity.passive.HorseBaseEntity) ProjectileEntityAccessor(meteordevelopment.meteorclient.mixin.ProjectileEntityAccessor) EventHandler(meteordevelopment.orbit.EventHandler)

Example 4 with HorseBaseEntity

use of net.minecraft.entity.passive.HorseBaseEntity in project BleachHack by BleachDrinker420.

the class Nametags method getAnimalLines.

public List<Text> getAnimalLines(LivingEntity animal) {
    List<Text> lines = new ArrayList<>();
    if (animal instanceof HorseBaseEntity || animal instanceof TameableEntity) {
        boolean tame = animal instanceof HorseBaseEntity ? ((HorseBaseEntity) animal).isTame() : ((TameableEntity) animal).isTamed();
        UUID ownerUUID = animal instanceof HorseBaseEntity ? ((HorseBaseEntity) animal).getOwnerUuid() : ((TameableEntity) animal).getOwnerUuid();
        if (getSetting(2).asToggle().getChild(4).asToggle().getState() && !animal.isBaby() && (getSetting(2).asToggle().getChild(4).asToggle().getChild(0).asMode().getMode() != 1 || tame)) {
            lines.add(0, new LiteralText(tame ? "Tamed: Yes" : "Tamed: No").formatted(tame ? Formatting.GREEN : Formatting.RED));
        }
        if (getSetting(2).asToggle().getChild(5).asToggle().getState() && ownerUUID != null) {
            if (uuidCache.containsKey(ownerUUID)) {
                lines.add(0, new LiteralText("Owner: " + uuidCache.get(ownerUUID)).formatted(Formatting.GREEN));
            } else if (failedUUIDs.contains(ownerUUID)) {
                lines.add(0, new LiteralText("Owner: " + Formatting.GRAY + "Invalid UUID!").formatted(Formatting.GREEN));
            } else {
                // Try to see if the owner is online on the server before calling the mojang api
                Optional<GameProfile> owner = mc.player.networkHandler.getPlayerList().stream().map(PlayerListEntry::getProfile).filter(profile -> profile != null && ownerUUID.equals(profile.getId()) && profile.getName() != null).findFirst();
                if (owner.isPresent()) {
                    uuidCache.put(ownerUUID, owner.get().getName());
                } else if (!uuidQueue.contains(ownerUUID) && !uuidFutures.containsKey(ownerUUID)) {
                    uuidQueue.add(ownerUUID);
                }
                lines.add(0, new LiteralText("Owner: " + Formatting.GRAY + "Loading...").formatted(Formatting.GREEN));
            }
        }
        if (getSetting(2).asToggle().getChild(6).asToggle().getState() && animal instanceof HorseBaseEntity) {
            HorseBaseEntity he = (HorseBaseEntity) animal;
            lines.add(0, new LiteralText(CmdEntityStats.getSpeed(he) + " m/s" + Formatting.GRAY + " | " + Formatting.RESET + CmdEntityStats.getJumpHeight(he) + " Jump").formatted(Formatting.GREEN));
        }
    }
    List<Text> mainText = new ArrayList<>();
    if (getSetting(2).asToggle().getChild(2).asToggle().getState()) {
        // Name
        mainText.add(((MutableText) animal.getName()).formatted(Formatting.GREEN));
    }
    if (getSetting(2).asToggle().getChild(3).asToggle().getState()) {
        // Health
        if (getSetting(0).asMode().getMode() == 2) {
            lines.add(0, getHealthText(animal));
        } else {
            mainText.add(getHealthText(animal));
        }
    }
    if (!mainText.isEmpty())
        lines.add(Texts.join(mainText, new LiteralText(" ")));
    return lines;
}
Also used : TameableEntity(net.minecraft.entity.passive.TameableEntity) HorseBaseEntity(net.minecraft.entity.passive.HorseBaseEntity)

Example 5 with HorseBaseEntity

use of net.minecraft.entity.passive.HorseBaseEntity in project BleachHack by BleachDrinker420.

the class Freecam method onOpenScreen.

@BleachSubscribe
public void onOpenScreen(EventOpenScreen event) {
    if (getSetting(1).asToggle().getState() && riding instanceof HorseBaseEntity) {
        if (event.getScreen() instanceof InventoryScreen) {
            mc.player.networkHandler.sendPacket(new ClientCommandC2SPacket(mc.player, ClientCommandC2SPacket.Mode.OPEN_INVENTORY));
            event.setCancelled(true);
        }
    }
}
Also used : ClientCommandC2SPacket(net.minecraft.network.packet.c2s.play.ClientCommandC2SPacket) HorseBaseEntity(net.minecraft.entity.passive.HorseBaseEntity) InventoryScreen(net.minecraft.client.gui.screen.ingame.InventoryScreen) BleachSubscribe(org.bleachhack.eventbus.BleachSubscribe)

Aggregations

HorseBaseEntity (net.minecraft.entity.passive.HorseBaseEntity)5 TameableEntity (net.minecraft.entity.passive.TameableEntity)3 UUID (java.util.UUID)2 Entity (net.minecraft.entity.Entity)2 PlayerEntity (net.minecraft.entity.player.PlayerEntity)2 ProjectileEntity (net.minecraft.entity.projectile.ProjectileEntity)2 EventHandler (mathax.client.eventbus.EventHandler)1 ProjectileEntityAccessor (mathax.client.mixin.ProjectileEntityAccessor)1 ProjectileEntityAccessor (meteordevelopment.meteorclient.mixin.ProjectileEntityAccessor)1 EventHandler (meteordevelopment.orbit.EventHandler)1 InventoryScreen (net.minecraft.client.gui.screen.ingame.InventoryScreen)1 LivingEntity (net.minecraft.entity.LivingEntity)1 ClientCommandC2SPacket (net.minecraft.network.packet.c2s.play.ClientCommandC2SPacket)1 BleachSubscribe (org.bleachhack.eventbus.BleachSubscribe)1