fix text rtl and draw bounding box
All checks were successful
/ Build BaseBand DSM & Broadway (push) Successful in 2m42s
All checks were successful
/ Build BaseBand DSM & Broadway (push) Successful in 2m42s
This commit is contained in:
parent
556bd1c14e
commit
c58912c0ee
3 changed files with 81 additions and 95 deletions
|
@ -45,26 +45,20 @@ public class ESP extends Feature {
|
||||||
|
|
||||||
if(entities) {
|
if(entities) {
|
||||||
for (Entity entity : Minecraft.getMinecraft().world.loadedEntityList) {
|
for (Entity entity : Minecraft.getMinecraft().world.loadedEntityList) {
|
||||||
AxisAlignedBB interp = RenderAdapter.getInterpEntityBB(entity, event.getPartialTicks());
|
AxisAlignedBB interp = RenderAdapter.getLiveEntityBB(entity, event.getPartialTicks());
|
||||||
if(fill) {
|
if(fill)
|
||||||
|
RenderAdapter.drawAABB(interp, Features.getFeature(Client.class).theme.getGreenColor(), eye);
|
||||||
|
if(wireframe)
|
||||||
RenderAdapter.drawAABBLines(interp, Features.getFeature(Client.class).theme.getGreenColor(), eye);
|
RenderAdapter.drawAABBLines(interp, Features.getFeature(Client.class).theme.getGreenColor(), eye);
|
||||||
}
|
|
||||||
|
|
||||||
if(wireframe) {
|
|
||||||
RenderAdapter.drawAABBLines(interp, Features.getFeature(Client.class).theme.getGreenColor(), eye);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tileEntities) {
|
if(tileEntities) {
|
||||||
for (TileEntity entity : Minecraft.getMinecraft().world.loadedTileEntityList) {
|
for (TileEntity entity : Minecraft.getMinecraft().world.loadedTileEntityList) {
|
||||||
if(fill) {
|
if(fill)
|
||||||
|
RenderAdapter.drawAABB(entity.getRenderBoundingBox(), Features.getFeature(Client.class).theme.getGreenColor(), eye);
|
||||||
|
if(wireframe)
|
||||||
RenderAdapter.drawAABBLines(entity.getRenderBoundingBox(), Features.getFeature(Client.class).theme.getGreenColor(), eye);
|
RenderAdapter.drawAABBLines(entity.getRenderBoundingBox(), Features.getFeature(Client.class).theme.getGreenColor(), eye);
|
||||||
}
|
|
||||||
|
|
||||||
if(wireframe) {
|
|
||||||
RenderAdapter.drawAABBLines(entity.getRenderBoundingBox(), Features.getFeature(Client.class).theme.getGreenColor(), eye);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package de.com.baseband.client.util.render;
|
package de.com.baseband.client.util.render;
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.item.EntityItemFrame;
|
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
@ -225,11 +224,7 @@ public class RenderAdapter {
|
||||||
depth(false);
|
depth(false);
|
||||||
begin(GL11.GL_QUADS);
|
begin(GL11.GL_QUADS);
|
||||||
|
|
||||||
double entityHalfed = (box.maxX - box.minX) / 2;
|
drawAABBNow(box);
|
||||||
double entityHeight = (box.maxY - box.minY);
|
|
||||||
Vec3d pos = new Vec3d(box.maxX - entityHalfed, box.minY, box.maxZ - entityHalfed);
|
|
||||||
|
|
||||||
drawAABBNow(pos, entityHalfed, entityHeight);
|
|
||||||
|
|
||||||
end();
|
end();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -237,42 +232,42 @@ public class RenderAdapter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void drawAABBNow(Vec3d halfPos, double entityHalfed, double entityHeight) {
|
private static void drawAABBNow(AxisAlignedBB bb) {
|
||||||
// bottom
|
// bottom
|
||||||
put(halfPos.x - entityHalfed, halfPos.y - 0.01, halfPos.z + entityHalfed);
|
put(bb.minX, bb.minY, bb.maxZ);
|
||||||
put(halfPos.x + entityHalfed, halfPos.y - 0.01, halfPos.z + entityHalfed);
|
put(bb.maxX, bb.minY, bb.maxZ);
|
||||||
put(halfPos.x + entityHalfed, halfPos.y - 0.01, halfPos.z - entityHalfed);
|
put(bb.maxX, bb.minY, bb.minZ);
|
||||||
put(halfPos.x - entityHalfed, halfPos.y - 0.01, halfPos.z - entityHalfed);
|
put(bb.minX, bb.minY, bb.minZ);
|
||||||
|
|
||||||
// top
|
// top
|
||||||
put(halfPos.x - entityHalfed, halfPos.y + entityHeight, halfPos.z + entityHalfed);
|
put(bb.minX, bb.maxY, bb.maxZ);
|
||||||
put(halfPos.x + entityHalfed, halfPos.y + entityHeight, halfPos.z + entityHalfed);
|
put(bb.maxX, bb.maxY, bb.maxZ);
|
||||||
put(halfPos.x + entityHalfed, halfPos.y + entityHeight, halfPos.z - entityHalfed);
|
put(bb.maxX, bb.maxY, bb.minZ);
|
||||||
put(halfPos.x - entityHalfed, halfPos.y + entityHeight, halfPos.z - entityHalfed);
|
put(bb.minX, bb.maxY, bb.minZ);
|
||||||
|
|
||||||
// z -
|
// z -
|
||||||
put(halfPos.x - entityHalfed, halfPos.y + entityHeight, halfPos.z - entityHalfed);
|
put(bb.minX, bb.maxY, bb.minZ);
|
||||||
put(halfPos.x + entityHalfed, halfPos.y + entityHeight, halfPos.z - entityHalfed);
|
put(bb.maxX, bb.maxY, bb.minZ);
|
||||||
put(halfPos.x + entityHalfed, halfPos.y - 0.01, halfPos.z - entityHalfed);
|
put(bb.maxX, bb.minY, bb.minZ);
|
||||||
put(halfPos.x - entityHalfed, halfPos.y - 0.01, halfPos.z - entityHalfed);
|
put(bb.minX, bb.minY, bb.minZ);
|
||||||
|
|
||||||
// z +
|
// z +
|
||||||
put(halfPos.x - entityHalfed, halfPos.y + entityHeight, halfPos.z + entityHalfed);
|
put(bb.minX, bb.maxY, bb.maxZ);
|
||||||
put(halfPos.x + entityHalfed, halfPos.y + entityHeight, halfPos.z + entityHalfed);
|
put(bb.maxX, bb.maxY, bb.maxZ);
|
||||||
put(halfPos.x + entityHalfed, halfPos.y - 0.01, halfPos.z + entityHalfed);
|
put(bb.maxX, bb.minY, bb.maxZ);
|
||||||
put(halfPos.x - entityHalfed, halfPos.y - 0.01, halfPos.z + entityHalfed);
|
put(bb.minX, bb.minY, bb.maxZ);
|
||||||
|
|
||||||
// x -
|
// x -
|
||||||
put(halfPos.x - entityHalfed, halfPos.y + entityHeight, halfPos.z - entityHalfed);
|
put(bb.minX, bb.maxY, bb.minZ);
|
||||||
put(halfPos.x - entityHalfed, halfPos.y + entityHeight, halfPos.z + entityHalfed);
|
put(bb.minX, bb.maxY, bb.maxZ);
|
||||||
put(halfPos.x - entityHalfed, halfPos.y - 0.01, halfPos.z + entityHalfed);
|
put(bb.minX, bb.minY, bb.maxZ);
|
||||||
put(halfPos.x - entityHalfed, halfPos.y - 0.01, halfPos.z - entityHalfed);
|
put(bb.minX, bb.minY, bb.minZ);
|
||||||
|
|
||||||
// y +
|
// y +
|
||||||
put(halfPos.x + entityHalfed, halfPos.y + entityHeight, halfPos.z - entityHalfed);
|
put(bb.maxX, bb.maxY, bb.minZ);
|
||||||
put(halfPos.x + entityHalfed, halfPos.y + entityHeight, halfPos.z + entityHalfed);
|
put(bb.maxX, bb.maxY, bb.maxZ);
|
||||||
put(halfPos.x + entityHalfed, halfPos.y - 0.01, halfPos.z + entityHalfed);
|
put(bb.maxX, bb.minY, bb.maxZ);
|
||||||
put(halfPos.x + entityHalfed, halfPos.y - 0.01, halfPos.z - entityHalfed);
|
put(bb.maxX, bb.minY, bb.minZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -293,62 +288,59 @@ public class RenderAdapter {
|
||||||
begin(GL11.GL_LINES);
|
begin(GL11.GL_LINES);
|
||||||
|
|
||||||
|
|
||||||
put(bb.minX, bb.minY, bb.minZ);
|
drawAABBLinesNow(bb);
|
||||||
put(bb.maxX, bb.minY, bb.minZ);
|
|
||||||
|
|
||||||
put(bb.minX, bb.minY, bb.minZ);
|
|
||||||
put(bb.minX, bb.minY, bb.maxZ);
|
|
||||||
|
|
||||||
put(bb.maxX, bb.minY, bb.minZ);
|
|
||||||
put(bb.maxX, bb.minY, bb.maxZ);
|
|
||||||
|
|
||||||
put(bb.minX, bb.minY, bb.maxZ);
|
|
||||||
put(bb.maxX, bb.minY, bb.maxZ);
|
|
||||||
|
|
||||||
put(bb.minX, bb.minY, bb.minZ);
|
|
||||||
put(bb.minX, bb.maxY, bb.minZ);
|
|
||||||
|
|
||||||
put(bb.maxX, bb.minY, bb.minZ);
|
|
||||||
put(bb.maxX, bb.maxY, bb.minZ);
|
|
||||||
|
|
||||||
put(bb.minX, bb.minY, bb.maxZ);
|
|
||||||
put(bb.minX, bb.maxY, bb.maxZ);
|
|
||||||
|
|
||||||
put(bb.maxX, bb.minY, bb.maxZ);
|
|
||||||
put(bb.maxX, bb.maxY, bb.maxZ);
|
|
||||||
|
|
||||||
put(bb.maxX, bb.minY, bb.minZ);
|
|
||||||
put(bb.maxX, bb.maxY, bb.minZ);
|
|
||||||
|
|
||||||
put(bb.minX, bb.maxY, bb.minZ);
|
|
||||||
put(bb.maxX, bb.maxY, bb.minZ);
|
|
||||||
|
|
||||||
put(bb.minX, bb.maxY, bb.minZ);
|
|
||||||
put(bb.minX, bb.maxY, bb.maxZ);
|
|
||||||
|
|
||||||
put(bb.maxX, bb.maxY, bb.minZ);
|
|
||||||
put(bb.maxX, bb.maxY, bb.maxZ);
|
|
||||||
|
|
||||||
put(bb.minX, bb.maxY, bb.maxZ);
|
|
||||||
put(bb.maxX, bb.maxY, bb.maxZ);
|
|
||||||
|
|
||||||
end();
|
end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void drawAABBLinesNow(AxisAlignedBB bb) {
|
||||||
|
put(bb.minX, bb.minY, bb.minZ);
|
||||||
|
put(bb.maxX, bb.minY, bb.minZ);
|
||||||
|
|
||||||
//TwelveMod, Less Jitter? Interp even? :smile:
|
put(bb.minX, bb.minY, bb.minZ);
|
||||||
public static AxisAlignedBB getInterpEntityBB(Entity entity, float partialTicks) {
|
put(bb.minX, bb.minY, bb.maxZ);
|
||||||
if(entity instanceof EntityItemFrame) {
|
|
||||||
return entity.getEntityBoundingBox();
|
|
||||||
}
|
|
||||||
double x = entity.prevPosX + (entity.posX - entity.prevPosX) * (double) partialTicks;
|
|
||||||
double y = entity.prevPosY + (entity.posY - entity.prevPosY) * (double) partialTicks;
|
|
||||||
double z = entity.prevPosZ + (entity.posZ - entity.prevPosZ) * (double) partialTicks;
|
|
||||||
|
|
||||||
double xW = entity.getEntityBoundingBox().maxX - entity.getEntityBoundingBox().minX;
|
put(bb.maxX, bb.minY, bb.minZ);
|
||||||
double yH = entity.getEntityBoundingBox().maxY - entity.getEntityBoundingBox().minY;
|
put(bb.maxX, bb.minY, bb.maxZ);
|
||||||
double zW = entity.getEntityBoundingBox().maxZ - entity.getEntityBoundingBox().minZ;
|
|
||||||
|
|
||||||
return new AxisAlignedBB(x, y, z, x + xW, y + yH, z + zW).offset(-xW / 2, 0, -zW / 2);
|
put(bb.minX, bb.minY, bb.maxZ);
|
||||||
|
put(bb.maxX, bb.minY, bb.maxZ);
|
||||||
|
|
||||||
|
put(bb.minX, bb.minY, bb.minZ);
|
||||||
|
put(bb.minX, bb.maxY, bb.minZ);
|
||||||
|
|
||||||
|
put(bb.maxX, bb.minY, bb.minZ);
|
||||||
|
put(bb.maxX, bb.maxY, bb.minZ);
|
||||||
|
|
||||||
|
put(bb.minX, bb.minY, bb.maxZ);
|
||||||
|
put(bb.minX, bb.maxY, bb.maxZ);
|
||||||
|
|
||||||
|
put(bb.maxX, bb.minY, bb.maxZ);
|
||||||
|
put(bb.maxX, bb.maxY, bb.maxZ);
|
||||||
|
|
||||||
|
put(bb.maxX, bb.minY, bb.minZ);
|
||||||
|
put(bb.maxX, bb.maxY, bb.minZ);
|
||||||
|
|
||||||
|
put(bb.minX, bb.maxY, bb.minZ);
|
||||||
|
put(bb.maxX, bb.maxY, bb.minZ);
|
||||||
|
|
||||||
|
put(bb.minX, bb.maxY, bb.minZ);
|
||||||
|
put(bb.minX, bb.maxY, bb.maxZ);
|
||||||
|
|
||||||
|
put(bb.maxX, bb.maxY, bb.minZ);
|
||||||
|
put(bb.maxX, bb.maxY, bb.maxZ);
|
||||||
|
|
||||||
|
put(bb.minX, bb.maxY, bb.maxZ);
|
||||||
|
put(bb.maxX, bb.maxY, bb.maxZ);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AxisAlignedBB getLiveEntityBB(Entity entity, float partialTicks) {
|
||||||
|
AxisAlignedBB bb = entity.getEntityBoundingBox();
|
||||||
|
|
||||||
|
double shiftX = (entity.posX - entity.prevPosX) * (double) partialTicks;
|
||||||
|
double shiftY = (entity.posY - entity.prevPosY) * (double) partialTicks;
|
||||||
|
double shiftZ = (entity.posZ - entity.prevPosZ) * (double) partialTicks;
|
||||||
|
|
||||||
|
return bb.offset(shiftX, shiftY, shiftZ);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class TextSplitter {
|
||||||
for (int i = 0; i < split.length; i++) {
|
for (int i = 0; i < split.length; i++) {
|
||||||
String drawText = codes + split[i] + "§r";
|
String drawText = codes + split[i] + "§r";
|
||||||
int drawX = rtl ? x + width - fontRenderer.getStringWidth(drawText) : x;
|
int drawX = rtl ? x + width - fontRenderer.getStringWidth(drawText) : x;
|
||||||
fontRenderer.drawString(drawText, (float) x, (float) y + fontRenderer.FONT_HEIGHT * i, color, shadow);
|
fontRenderer.drawString(drawText, (float) drawX, (float) y + fontRenderer.FONT_HEIGHT * i, color, shadow);
|
||||||
codes.append(split[i].replaceAll("[^§]*?(§\\w)?[^§]*", "$1"));
|
codes.append(split[i].replaceAll("[^§]*?(§\\w)?[^§]*", "$1"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue