-
Автор темы
- #1
Код:
@ModuleRegister(name = "FakeLag", category = Category.Misc)
public class FakeLag extends Module {
private final List<EntityPosition> positions = new ArrayList<>();
private int ticks = 0;
private static final int MAX_POSITIONS = 20;
@Subscribe
private void onUpdate(WorldEvent event) {
ticks++;
if (ticks % 2 == 0) {
positions.add(new EntityPosition(
mc.player.getPosX(),
mc.player.getPosY(),
mc.player.getPosZ(),
mc.player.rotationYaw,
mc.player.rotationPitch
));
}
if (positions.size() > MAX_POSITIONS) {
positions.remove(0);
}
}
@Subscribe
private void onRender(WorldEvent event) {
if (positions.isEmpty()) return;
GlStateManager.pushMatrix();
RenderSystem.enableBlend();
RenderSystem.disableTexture();
RenderSystem.disableDepthTest();
for (EntityPosition pos : positions) {
float alpha = (float) positions.indexOf(pos) / positions.size();
renderGhost(pos, alpha, event.getPartialTicks());
}
RenderSystem.enableTexture();
RenderSystem.enableDepthTest();
RenderSystem.disableBlend();
GlStateManager.popMatrix();
}
private void renderGhost(EntityPosition pos, float alpha, float partialTicks) {
GlStateManager.pushMatrix();
RenderSystem.translated(
pos.x - mc.getRenderManager().info.getProjectedView().x,
pos.y - mc.getRenderManager().info.getProjectedView().y,
pos.z - mc.getRenderManager().info.getProjectedView().z
);
RenderSystem.rotatef(-pos.yaw, 0, 1, 0);
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
drawPlayerOutline(0.6f, alpha);
buffer.finishDrawing();
GlStateManager.popMatrix();
}
private void drawPlayerOutline(float width, float alpha) {
buffer.pos(-width, 0, -width).color(1f, 1f, 1f, alpha * 0.3f).endVertex();
buffer.pos(-width, 1.8f, -width).color(1f, 1f, 1f, alpha * 0.3f).endVertex();
buffer.pos(width, 1.8f, -width).color(1f, 1f, 1f, alpha * 0.3f).endVertex();
buffer.pos(width, 0, -width).color(1f, 1f, 1f, alpha * 0.3f).endVertex();
}
private static class EntityPosition {
double x, y, z;
float yaw, pitch;
public EntityPosition(double x, double y, double z, float yaw, float pitch) {
this.x = x;
this.y = y;
this.z = z;
this.yaw = yaw;
this.pitch = pitch;
}
}
}