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) {
|
||||
for (Entity entity : Minecraft.getMinecraft().world.loadedEntityList) {
|
||||
AxisAlignedBB interp = RenderAdapter.getInterpEntityBB(entity, event.getPartialTicks());
|
||||
if(fill) {
|
||||
AxisAlignedBB interp = RenderAdapter.getLiveEntityBB(entity, event.getPartialTicks());
|
||||
if(fill)
|
||||
RenderAdapter.drawAABB(interp, Features.getFeature(Client.class).theme.getGreenColor(), eye);
|
||||
if(wireframe)
|
||||
RenderAdapter.drawAABBLines(interp, Features.getFeature(Client.class).theme.getGreenColor(), eye);
|
||||
}
|
||||
|
||||
if(wireframe) {
|
||||
RenderAdapter.drawAABBLines(interp, Features.getFeature(Client.class).theme.getGreenColor(), eye);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(tileEntities) {
|
||||
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);
|
||||
}
|
||||
|
||||
if(wireframe) {
|
||||
RenderAdapter.drawAABBLines(entity.getRenderBoundingBox(), Features.getFeature(Client.class).theme.getGreenColor(), eye);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package de.com.baseband.client.util.render;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItemFrame;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
@ -225,11 +224,7 @@ public class RenderAdapter {
|
|||
depth(false);
|
||||
begin(GL11.GL_QUADS);
|
||||
|
||||
double entityHalfed = (box.maxX - box.minX) / 2;
|
||||
double entityHeight = (box.maxY - box.minY);
|
||||
Vec3d pos = new Vec3d(box.maxX - entityHalfed, box.minY, box.maxZ - entityHalfed);
|
||||
|
||||
drawAABBNow(pos, entityHalfed, entityHeight);
|
||||
drawAABBNow(box);
|
||||
|
||||
end();
|
||||
} 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
|
||||
put(halfPos.x - entityHalfed, halfPos.y - 0.01, halfPos.z + entityHalfed);
|
||||
put(halfPos.x + entityHalfed, halfPos.y - 0.01, halfPos.z + entityHalfed);
|
||||
put(halfPos.x + entityHalfed, halfPos.y - 0.01, halfPos.z - entityHalfed);
|
||||
put(halfPos.x - entityHalfed, halfPos.y - 0.01, halfPos.z - entityHalfed);
|
||||
put(bb.minX, bb.minY, bb.maxZ);
|
||||
put(bb.maxX, bb.minY, bb.maxZ);
|
||||
put(bb.maxX, bb.minY, bb.minZ);
|
||||
put(bb.minX, bb.minY, bb.minZ);
|
||||
|
||||
// top
|
||||
put(halfPos.x - entityHalfed, halfPos.y + entityHeight, halfPos.z + entityHalfed);
|
||||
put(halfPos.x + entityHalfed, halfPos.y + entityHeight, halfPos.z + entityHalfed);
|
||||
put(halfPos.x + entityHalfed, halfPos.y + entityHeight, halfPos.z - entityHalfed);
|
||||
put(halfPos.x - entityHalfed, halfPos.y + entityHeight, halfPos.z - entityHalfed);
|
||||
put(bb.minX, bb.maxY, bb.maxZ);
|
||||
put(bb.maxX, bb.maxY, bb.maxZ);
|
||||
put(bb.maxX, bb.maxY, bb.minZ);
|
||||
put(bb.minX, bb.maxY, bb.minZ);
|
||||
|
||||
// z -
|
||||
put(halfPos.x - entityHalfed, halfPos.y + entityHeight, halfPos.z - entityHalfed);
|
||||
put(halfPos.x + entityHalfed, halfPos.y + entityHeight, halfPos.z - entityHalfed);
|
||||
put(halfPos.x + entityHalfed, halfPos.y - 0.01, halfPos.z - entityHalfed);
|
||||
put(halfPos.x - entityHalfed, halfPos.y - 0.01, halfPos.z - entityHalfed);
|
||||
put(bb.minX, bb.maxY, bb.minZ);
|
||||
put(bb.maxX, bb.maxY, bb.minZ);
|
||||
put(bb.maxX, bb.minY, bb.minZ);
|
||||
put(bb.minX, bb.minY, bb.minZ);
|
||||
|
||||
// z +
|
||||
put(halfPos.x - entityHalfed, halfPos.y + entityHeight, halfPos.z + entityHalfed);
|
||||
put(halfPos.x + entityHalfed, halfPos.y + entityHeight, halfPos.z + entityHalfed);
|
||||
put(halfPos.x + entityHalfed, halfPos.y - 0.01, halfPos.z + entityHalfed);
|
||||
put(halfPos.x - entityHalfed, halfPos.y - 0.01, halfPos.z + entityHalfed);
|
||||
put(bb.minX, bb.maxY, bb.maxZ);
|
||||
put(bb.maxX, bb.maxY, bb.maxZ);
|
||||
put(bb.maxX, bb.minY, bb.maxZ);
|
||||
put(bb.minX, bb.minY, bb.maxZ);
|
||||
|
||||
// x -
|
||||
put(halfPos.x - entityHalfed, halfPos.y + entityHeight, halfPos.z - entityHalfed);
|
||||
put(halfPos.x - entityHalfed, halfPos.y + entityHeight, halfPos.z + entityHalfed);
|
||||
put(halfPos.x - entityHalfed, halfPos.y - 0.01, halfPos.z + entityHalfed);
|
||||
put(halfPos.x - entityHalfed, halfPos.y - 0.01, halfPos.z - entityHalfed);
|
||||
put(bb.minX, bb.maxY, bb.minZ);
|
||||
put(bb.minX, bb.maxY, bb.maxZ);
|
||||
put(bb.minX, bb.minY, bb.maxZ);
|
||||
put(bb.minX, bb.minY, bb.minZ);
|
||||
|
||||
// y +
|
||||
put(halfPos.x + entityHalfed, halfPos.y + entityHeight, halfPos.z - entityHalfed);
|
||||
put(halfPos.x + entityHalfed, halfPos.y + entityHeight, halfPos.z + entityHalfed);
|
||||
put(halfPos.x + entityHalfed, halfPos.y - 0.01, halfPos.z + entityHalfed);
|
||||
put(halfPos.x + entityHalfed, halfPos.y - 0.01, halfPos.z - entityHalfed);
|
||||
put(bb.maxX, bb.maxY, bb.minZ);
|
||||
put(bb.maxX, bb.maxY, bb.maxZ);
|
||||
put(bb.maxX, bb.minY, bb.maxZ);
|
||||
put(bb.maxX, bb.minY, bb.minZ);
|
||||
}
|
||||
|
||||
|
||||
|
@ -293,62 +288,59 @@ public class RenderAdapter {
|
|||
begin(GL11.GL_LINES);
|
||||
|
||||
|
||||
put(bb.minX, bb.minY, bb.minZ);
|
||||
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);
|
||||
drawAABBLinesNow(bb);
|
||||
|
||||
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:
|
||||
public static AxisAlignedBB getInterpEntityBB(Entity entity, float partialTicks) {
|
||||
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;
|
||||
put(bb.minX, bb.minY, bb.minZ);
|
||||
put(bb.minX, bb.minY, bb.maxZ);
|
||||
|
||||
double xW = entity.getEntityBoundingBox().maxX - entity.getEntityBoundingBox().minX;
|
||||
double yH = entity.getEntityBoundingBox().maxY - entity.getEntityBoundingBox().minY;
|
||||
double zW = entity.getEntityBoundingBox().maxZ - entity.getEntityBoundingBox().minZ;
|
||||
put(bb.maxX, bb.minY, bb.minZ);
|
||||
put(bb.maxX, bb.minY, bb.maxZ);
|
||||
|
||||
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++) {
|
||||
String drawText = codes + split[i] + "§r";
|
||||
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"));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue