i need script
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package cedo.modules.render;
import cedo.events.Event;
import cedo.events.listeners.EventRenderGUI;
import cedo.modules.Module;
import cedo.modules.Module.Category;
import cedo.settings.Setting;
import cedo.settings.impl.BooleanSetting;
import cedo.settings.impl.ModeSetting;
import cedo.settings.impl.NumberSetting;
import cedo.util.ColorManager;
import cedo.util.render.EntityUtils;
import cedo.util.render.RenderUtil;
import java.awt.Color;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.vecmath.Vector3d;
import javax.vecmath.Vector4d;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.EntityRenderer;
import net.minecraft.client.renderer.GLAllocation;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.boss.EntityDragon;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.monster.EntityGolem;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.monster.EntitySlime;
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.util.AxisAlignedBB;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.GL11;
import org.lwjgl.util.glu.GLU;
public final class esp2d extends Module {
public final BooleanSetting outline = new BooleanSetting("Rectangles", true);
public final List<Entity> collectedEntities = new ArrayList();
private final IntBuffer viewport = GLAllocation.createDirectIntBuffer(16);
private final FloatBuffer modelview = GLAllocation.createDirectFloatBuffer(16);
private final FloatBuffer projection = GLAllocation.createDirectFloatBuffer(16);
private final FloatBuffer vector = GLAllocation.createDirectFloatBuffer(4);
private final int backgroundColor = (new Color(0, 0, 0, 120)).getRGB();
private final int black;
private final BooleanSetting localPlayer;
private final BooleanSetting mobs;
private final BooleanSetting animals;
private final BooleanSetting armorBar;
public ModeSetting mode;
public ModeSetting theme;
public BooleanSetting healthBar;
public BooleanSetting players;
public BooleanSetting invisibles;
public BooleanSetting entitys;
public BooleanSetting droppedItems;
public NumberSetting rainbowSpeed;
public NumberSetting red;
public NumberSetting green;
public NumberSetting blue;
Color color2;
public esp2d() {
super("2DESP", 24, Category.RENDER);
this.black = Color.BLACK.getRGB();
this.localPlayer = new BooleanSetting("Local Player", true);
this.mobs = new BooleanSetting("Mobs", false);
this.animals = new BooleanSetting("Animals", false);
this.armorBar = new BooleanSetting("Armor bar", false);
this.mode = new ModeSetting("Mode", "Box", new String[]{"Box", "CS:GO"});
this.theme = new ModeSetting("Color", "Chill Rainbow", new String[]{"Custom Color", "Chill Rainbow", "Rainbow"});
this.healthBar = new BooleanSetting("Health bar", true);
this.players = new BooleanSetting("Players", true);
this.invisibles = new BooleanSetting("Invisibles", false);
this.entitys = new BooleanSetting("Entitys", false);
this.droppedItems = new BooleanSetting("Items", false);
this.rainbowSpeed = new NumberSetting("Rainbow Speed", 30.0D, 1.0D, 100.0D, 1.0D);
this.red = new NumberSetting("Red", 1.0D, 1.0D, 255.0D, 1.0D);
this.green = new NumberSetting("Green", 1.0D, 1.0D, 255.0D, 1.0D);
this.blue = new NumberSetting("Blue", 1.0D, 1.0D, 255.0D, 1.0D);
this.addSettings(new Setting[]{this.outline, this.mode, this.healthBar, this.players, this.invisibles, this.entitys, this.droppedItems, this.theme, this.rainbowSpeed, this.red, this.green, this.blue});
}
public void onEvent(Event event) {
if (event instanceof EventRenderGUI) {
GL11.glPushMatrix();
this.collectEntities();
float partialTicks = mc.timer.renderPartialTicks;
ScaledResolution scaledResolution = ((EventRenderGUI)event).sr;
int scaleFactor = scaledResolution.getScaleFactor();
double scaling = (double)scaleFactor / Math.pow((double)scaleFactor, 2.0D);
GL11.glScaled(scaling, scaling, scaling);
int black = this.black;
int background = this.backgroundColor;
float scale = 0.65F;
RenderManager renderMng = mc.getRenderManager();
EntityRenderer entityRenderer = mc.entityRenderer;
boolean outline = this.outline.isEnabled();
boolean health = this.healthBar.isEnabled();
boolean armor = this.armorBar.isEnabled();
if (this.entitys.isEnabled()) {
this.mobs.setEnabled(true);
this.animals.setEnabled(true);
}
List<Entity> collectedEntities = this.collectedEntities;
int i = 0;
for(int collectedEntitiesSize = collectedEntities.size(); i < collectedEntitiesSize; ++i) {
Entity entity = (Entity)collectedEntities.get(i);
if (this.isValid(entity) && RenderUtil.isInViewFrustrum(entity)) {
double x = RenderUtil.interpolate(entity.posX, entity.lastTickPosX, (double)partialTicks);
double y = RenderUtil.interpolate(entity.posY, entity.lastTickPosY, (double)partialTicks);
double z = RenderUtil.interpolate(entity.posZ, entity.lastTickPosZ, (double)partialTicks);
double width = (double)entity.width / 1.5D;
double height = (double)entity.height + (entity.isSneaking() ? -0.3D : 0.2D);
AxisAlignedBB aabb = new AxisAlignedBB(x - width, y, z - width, x + width, y + height, z + width);
List<Vector3d> vectors = Arrays.asList(new Vector3d(aabb.minX, aabb.minY, aabb.minZ), new Vector3d(aabb.minX, aabb.maxY, aabb.minZ), new Vector3d(aabb.maxX, aabb.minY, aabb.minZ), new Vector3d(aabb.maxX, aabb.maxY, aabb.minZ), new Vector3d(aabb.minX, aabb.minY, aabb.maxZ), new Vector3d(aabb.minX, aabb.maxY, aabb.maxZ), new Vector3d(aabb.maxX, aabb.minY, aabb.maxZ), new Vector3d(aabb.maxX, aabb.maxY, aabb.maxZ));
entityRenderer.setupCameraTransform(partialTicks, 0);
Vector4d position = null;
int i1 = 0;
for(int vectorsSize = vectors.size(); i1 < vectorsSize; ++i1) {
Vector3d vector = (Vector3d)vectors.get(i1);
vector = this.project2D(scaleFactor, vector.x - renderMng.viewerPosX, vector.y - renderMng.viewerPosY, vector.z - renderMng.viewerPosZ);
if (vector != null && vector.z >= 0.0D && vector.z < 1.0D) {
if (position == null) {
position = new Vector4d(vector.x, vector.y, vector.z, 0.0D);
}
position.x = Math.min(vector.x, position.x);
position.y = Math.min(vector.y, position.y);
position.z = Math.max(vector.x, position.z);
position.w = Math.max(vector.y, position.w);
}
}
if (position != null) {
entityRenderer.setupOverlayRendering((double)scaledResolution.getScaledWidth(), (double)scaledResolution.getScaledHeight());
double posX = position.x;
double posY = position.y;
double endPosX = position.z;
double endPosY = position.w;
int count = 0;
if (this.theme.is("Custom Color")) {
this.color2 = new Color((int)this.red.getValue(), (int)this.green.getValue(), (int)this.blue.getValue());
}
if (this.theme.is("Chill Rainbow")) {
this.color2 = ColorManager.rainbow(40 * count, (int)this.rainbowSpeed.getValue(), 0.5F, 1.0F, 0.8F);
}
if (this.theme.is("Rainbow")) {
this.color2 = ColorManager.rainbow(40 * count, (double)((int)this.rainbowSpeed.getValue()));
}
int color = this.color2.getRGB();
if (outline) {
if (this.mode.is("Box")) {
Gui.drawRect(posX - 1.0D, posY, posX + 0.5D, endPosY + 0.5D, black);
Gui.drawRect(posX - 1.0D, posY - 0.5D, endPosX + 0.5D, posY + 0.5D + 0.5D, black);
Gui.drawRect(endPosX - 0.5D - 0.5D, posY, endPosX + 0.5D, endPosY + 0.5D, black);
Gui.drawRect(posX - 1.0D, endPosY - 0.5D - 0.5D, endPosX + 0.5D, endPosY + 0.5D, black);
Gui.drawRect(posX - 0.5D, posY, posX + 0.5D - 0.5D, endPosY, color);
Gui.drawRect(posX, endPosY - 0.5D, endPosX, endPosY, color);
Gui.drawRect(posX - 0.5D, posY, endPosX, posY + 0.5D, color);
Gui.drawRect(endPosX - 0.5D, posY, endPosX, endPosY, color);
} else {
Gui.drawRect(posX + 0.5D, posY, posX - 1.0D, posY + (endPosY - posY) / 4.0D + 0.5D, black);
Gui.drawRect(posX - 1.0D, endPosY, posX + 0.5D, endPosY - (endPosY - posY) / 4.0D - 0.5D, black);
Gui.drawRect(posX - 1.0D, posY - 0.5D, posX + (endPosX - posX) / 3.0D + 0.5D, posY + 1.0D, black);
Gui.drawRect(endPosX - (endPosX - posX) / 3.0D - 0.5D, posY - 0.5D, endPosX, posY + 1.0D, black);
Gui.drawRect(endPosX - 1.0D, posY, endPosX + 0.5D, posY + (endPosY - posY) / 4.0D + 0.5D, black);
Gui.drawRect(endPosX - 1.0D, endPosY, endPosX + 0.5D, endPosY - (endPosY - posY) / 4.0D - 0.5D, black);
Gui.drawRect(posX - 1.0D, endPosY - 1.0D, posX + (endPosX - posX) / 3.0D + 0.5D, endPosY + 0.5D, black);
Gui.drawRect(endPosX - (endPosX - posX) / 3.0D - 0.5D, endPosY - 1.0D, endPosX + 0.5D, endPosY + 0.5D, black);
Gui.drawRect(posX, posY, posX - 0.5D, posY + (endPosY - posY) / 4.0D, color);
Gui.drawRect(posX, endPosY, posX - 0.5D, endPosY - (endPosY - posY) / 4.0D, color);
Gui.drawRect(posX - 0.5D, posY, posX + (endPosX - posX) / 3.0D, posY + 0.5D, color);
Gui.drawRect(endPosX - (endPosX - posX) / 3.0D, posY, endPosX, posY + 0.5D, color);
Gui.drawRect(endPosX - 0.5D, posY, endPosX, posY + (endPosY - posY) / 4.0D, color);
Gui.drawRect(endPosX - 0.5D, endPosY, endPosX, endPosY - (endPosY - posY) / 4.0D, color);
Gui.drawRect(posX, endPosY - 0.5D, posX + (endPosX - posX) / 3.0D, endPosY, color);
Gui.drawRect(endPosX - (endPosX - posX) / 3.0D, endPosY - 0.5D, endPosX - 0.5D, endPosY, color);
}
}
int var57 = count + 1;
boolean living = entity instanceof EntityLivingBase;
EntityLivingBase entityLivingBase;
float armorValue;
float itemDurability;
double durabilityWidth;
if (living) {
entityLivingBase = (EntityLivingBase)entity;
if (health) {
armorValue = entityLivingBase.getHealth();
itemDurability = entityLivingBase.getMaxHealth();
if (armorValue > itemDurability) {
armorValue = itemDurability;
}
durabilityWidth = (double)(armorValue / itemDurability);
double hpHeight = (endPosY - posY) * durabilityWidth;
Gui.drawRect(posX - 3.5D, posY - 0.5D, posX - 1.5D, endPosY + 0.5D, background);
if (armorValue > 0.0F) {
int colorrectCode = entityLivingBase.getHealth() > 15.0F ? -11667621 : (entityLivingBase.getHealth() > 10.0F ? -919731 : (entityLivingBase.getHealth() > 7.0F ? -555699 : -568755));
Gui.drawRect(posX - 3.0D, endPosY, posX - 2.0D, endPosY - hpHeight, colorrectCode);
float absorption = entityLivingBase.getAbsorptionAmount();
if (absorption > 0.0F) {
Gui.drawRect(posX - 3.0D, endPosY, posX - 2.0D, endPosY - (endPosY - posY) / 6.0D * (double)absorption / 2.0D, (new Color(Potion.absorption.getLiquidColor())).getRGB());
}
}
}
}
if (armor) {
if (living) {
entityLivingBase = (EntityLivingBase)entity;
armorValue = (float)entityLivingBase.getTotalArmorValue();
double armorWidth = (endPosX - posX) * (double)armorValue / 20.0D;
Gui.drawRect(posX - 0.5D, endPosY + 1.5D, posX - 0.5D + endPosX - posX + 1.0D, endPosY + 1.5D + 2.0D, background);
if (armorValue > 0.0F) {
Gui.drawRect(posX, endPosY + 2.0D, posX + armorWidth, endPosY + 3.0D, 16777215);
}
} else if (entity instanceof EntityItem) {
ItemStack itemStack = ((EntityItem)entity).getEntityItem();
if (itemStack.isItemStackDamageable()) {
int maxDamage = itemStack.getMaxDamage();
itemDurability = (float)(maxDamage - itemStack.getItemDamage());
durabilityWidth = (endPosX - posX) * (double)itemDurability / (double)maxDamage;
Gui.drawRect(posX - 0.5D, endPosY + 1.5D, posX - 0.5D + endPosX - posX + 1.0D, endPosY + 1.5D + 2.0D, background);
Gui.drawRect(posX, endPosY + 2.0D, posX + durabilityWidth, endPosY + 3.0D, 16777215);
}
}
}
}
}
}
GlStateManager.enableBlend();
entityRenderer.setupOverlayRendering((double)scaledResolution.getScaledWidth(), (double)scaledResolution.getScaledHeight());
GL11.glPopMatrix();
}
}
private boolean isFriendly(EntityPlayer player) {
return EntityUtils.isOnSameTeam(player);
}
private void collectEntities() {
this.collectedEntities.clear();
List<Entity> playerEntities = mc.theWorld.loadedEntityList;
int i = 0;
for(int playerEntitiesSize = playerEntities.size(); i < playerEntitiesSize; ++i) {
Entity entity = (Entity)playerEntities.get(i);
if (this.isValid(entity)) {
this.collectedEntities.add(entity);
}
}
}
private Vector3d project2D(int scaleFactor, double x, double y, double z) {
GL11.glGetFloat(2982, this.modelview);
GL11.glGetFloat(2983, this.projection);
GL11.glGetInteger(2978, this.viewport);
return GLU.gluProject((float)x, (float)y, (float)z, this.modelview, this.projection, this.viewport, this.vector) ? new Vector3d((double)(this.vector.get(0) / (float)scaleFactor), (double)(((float)Display.getHeight() - this.vector.get(1)) / (float)scaleFactor), (double)this.vector.get(2)) : null;
}
private boolean isValid(Entity entity) {
if (entity != mc.thePlayer || this.localPlayer.isEnabled() && mc.gameSettings.thirdPersonView != 0) {
if (entity.isDead) {
return false;
} else if (!this.invisibles.isEnabled() && entity.isInvisible()) {
return false;
} else if (this.droppedItems.isEnabled() && entity instanceof EntityItem && mc.thePlayer.getDistanceToEntity(entity) < 10.0F) {
return true;
} else if (this.animals.isEnabled() && entity instanceof EntityAnimal) {
return true;
} else if (this.players.isEnabled() && entity instanceof EntityPlayer) {
return true;
} else {
return this.mobs.isEnabled() && (entity instanceof EntityMob || entity instanceof EntitySlime || entity instanceof EntityDragon || entity instanceof EntityGolem);
}
} else {
return false;
}
}
}