mirror of
https://github.com/kami-blue/client
synced 2025-02-20 23:27:14 +00:00
+ eyefinder
This commit is contained in:
parent
a5d04b374d
commit
4cf8365c7d
@ -0,0 +1,81 @@
|
||||
package me.zeroeightsix.kami.module.modules.render;
|
||||
|
||||
import me.zeroeightsix.kami.event.events.RenderEvent;
|
||||
import me.zeroeightsix.kami.module.Module;
|
||||
import me.zeroeightsix.kami.setting.Setting;
|
||||
import me.zeroeightsix.kami.util.EntityUtil;
|
||||
import me.zeroeightsix.kami.util.GeometryMasks;
|
||||
import me.zeroeightsix.kami.util.KamiTessellator;
|
||||
import net.minecraft.block.BlockPortal;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
/**
|
||||
* @author 086
|
||||
*/
|
||||
@Module.Info(name = "EyeFinder", description = "Draw lines from entity's heads to where they are looking", category = Module.Category.RENDER)
|
||||
public class EyeFinder extends Module {
|
||||
|
||||
@Setting(name = "Players") private boolean players = true;
|
||||
@Setting(name = "Mobs") private boolean mobs = false;
|
||||
@Setting(name = "Animals") private boolean animals = false;
|
||||
|
||||
@Override
|
||||
public void onWorldRender(RenderEvent event) {
|
||||
mc.world.loadedEntityList.stream()
|
||||
.filter(EntityUtil::isLiving)
|
||||
.filter(entity -> mc.player != entity)
|
||||
.map(entity -> (EntityLivingBase) entity)
|
||||
.filter(entityLivingBase -> !entityLivingBase.isDead)
|
||||
.filter(entity -> (players && entity instanceof EntityPlayer) || (EntityUtil.isPassive(entity) ? animals : mobs))
|
||||
.forEach(this::drawLine);
|
||||
}
|
||||
|
||||
private void drawLine(EntityLivingBase e) {
|
||||
RayTraceResult result = e.rayTrace(6, Minecraft.getMinecraft().getRenderPartialTicks());
|
||||
if (result == null) return;
|
||||
Vec3d eyes = e.getPositionEyes(Minecraft.getMinecraft().getRenderPartialTicks());
|
||||
|
||||
GlStateManager.enableDepth();
|
||||
GlStateManager.disableTexture2D();
|
||||
GlStateManager.disableLighting();
|
||||
|
||||
double posx = eyes.x - mc.getRenderManager().renderPosX;
|
||||
double posy = eyes.y - mc.getRenderManager().renderPosY;
|
||||
double posz = eyes.z - mc.getRenderManager().renderPosZ;
|
||||
double posx2 = result.hitVec.x - mc.getRenderManager().renderPosX;
|
||||
double posy2 = result.hitVec.y - mc.getRenderManager().renderPosY;
|
||||
double posz2 = result.hitVec.z - mc.getRenderManager().renderPosZ;
|
||||
GL11.glColor4f(.2f, .1f, .3f, .8f);
|
||||
GlStateManager.glLineWidth(1.5f);
|
||||
|
||||
GL11.glBegin(GL11.GL_LINES);
|
||||
{
|
||||
GL11.glVertex3d(posx, posy, posz);
|
||||
GL11.glVertex3d(posx2, posy2, posz2);
|
||||
GL11.glVertex3d(posx2, posy2, posz2);
|
||||
GL11.glVertex3d(posx2, posy2, posz2);
|
||||
}
|
||||
GL11.glEnd();
|
||||
|
||||
if (result.typeOfHit == RayTraceResult.Type.BLOCK) {
|
||||
KamiTessellator.prepare(GL11.GL_QUADS);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
BlockPos b = result.getBlockPos();
|
||||
float x = b.x - .003f;
|
||||
float y = b.y - .003f;
|
||||
float z = b.z - .003f;
|
||||
KamiTessellator.drawBox(KamiTessellator.getBufferBuilder(), x, y, z, 1.006f, 1.006f, 1.006f, 51, 25, 73, 200, GeometryMasks.Quad.ALL);
|
||||
KamiTessellator.release();
|
||||
}
|
||||
|
||||
GlStateManager.enableTexture2D();
|
||||
GlStateManager.enableLighting();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user