shadow clickgui, rendermodule class, dragscreen, added something to clickgui, nohurtcam, autoWtap

This commit is contained in:
FatalEagler 2023-08-29 16:55:43 +00:00
parent 8834e133bd
commit e2c9926fd9
28 changed files with 36299 additions and 77 deletions

0
CompileEPK.sh Normal file → Executable file
View File

0
gradlew vendored Normal file → Executable file
View File

BIN
javascript/assets.epk Normal file

Binary file not shown.

35045
javascript/classes.js Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,101 @@
package de.Hero.clickgui;
import java.io.IOException;
import java.util.ArrayList;
import de.Hero.clickgui.component.Component;
import de.Hero.clickgui.component.Frame;
import net.FatalCodes.shadow.module.Category;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
//Your Imports
public class ClickGui extends GuiScreen {
public static ArrayList<Frame> frames;
public static int color = -1;
public ClickGui() {
this.frames = new ArrayList<Frame>();
int frameX = 5;
for(Category category : Category.values()) {
Frame frame = new Frame(category);
frame.setX(frameX);
frames.add(frame);
frameX += frame.getWidth() + 1;
}
}
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
this.drawDefaultBackground();
for(Frame frame : frames) {
frame.renderFrame(this.fontRendererObj);
frame.updatePosition(mouseX, mouseY);
for(Component comp : frame.getComponents()) {
comp.updateComponent(mouseX, mouseY);
}
}
}
@Override
protected void mouseClicked(final int mouseX, final int mouseY, final int mouseButton) {
for(Frame frame : frames) {
if(frame.isWithinHeader(mouseX, mouseY) && mouseButton == 0) {
frame.setDrag(true);
frame.dragX = mouseX - frame.getX();
frame.dragY = mouseY - frame.getY();
}
if(frame.isWithinHeader(mouseX, mouseY) && mouseButton == 1) {
frame.setOpen(!frame.isOpen());
}
if(frame.isOpen()) {
if(!frame.getComponents().isEmpty()) {
for(Component component : frame.getComponents()) {
component.mouseClicked(mouseX, mouseY, mouseButton);
}
}
}
}
}
@Override
protected void keyTyped(char typedChar, int keyCode) {
for(Frame frame : frames) {
if(frame.isOpen() && keyCode != 1) {
if(!frame.getComponents().isEmpty()) {
for(Component component : frame.getComponents()) {
component.keyTyped(typedChar, keyCode);
}
}
}
}
if (keyCode == 1) {
this.mc.displayGuiScreen(null);
}
}
@Override
protected void mouseReleased(int mouseX, int mouseY, int state) {
for(Frame frame : frames) {
frame.setDrag(false);
}
for(Frame frame : frames) {
if(frame.isOpen()) {
if(!frame.getComponents().isEmpty()) {
for(Component component : frame.getComponents()) {
component.mouseReleased(mouseX, mouseY, state);
}
}
}
}
}
@Override
public boolean doesGuiPauseGame() {
return true;
}
}

View File

@ -0,0 +1,35 @@
package de.Hero.clickgui.component;
public class Component {
public void renderComponent() {
}
public void updateComponent(int mouseX, int mouseY) {
}
public void mouseClicked(int mouseX, int mouseY, int button) {
}
public void mouseReleased(int mouseX, int mouseY, int mouseButton) {
}
public int getParentHeight() {
return 0;
}
public void keyTyped(char typedChar, int key) {
}
public void setOff(int newOff) {
}
public int getHeight() {
return 0;
}
}

View File

@ -0,0 +1,127 @@
package de.Hero.clickgui.component;
import java.util.ArrayList;
import de.Hero.clickgui.component.components.Button;
import net.FatalCodes.shadow.Shadow;
import net.FatalCodes.shadow.module.Module;
import net.FatalCodes.shadow.module.Category;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;
//Your Imports
public class Frame {
public ArrayList<Component> components;
public Category category;
private boolean open;
private int width;
private int y;
private int x;
private int barHeight;
private boolean isDragging;
public int dragX;
public int dragY;
public Frame(Category cat) {
this.components = new ArrayList<Component>();
this.category = cat;
this.width = 88;
this.x = 5;
this.y = 5;
this.barHeight = 13;
this.dragX = 0;
this.open = false;
this.isDragging = false;
int tY = this.barHeight;
for(Module mod : Shadow.moduleManager.modsInCategory(category)) {
Button modButton = new Button(mod, this, tY);
this.components.add(modButton);
tY += 12;
}
}
public ArrayList<Component> getComponents() {
return components;
}
public void setX(int newX) {
this.x = newX;
}
public void setY(int newY) {
this.y = newY;
}
public void setDrag(boolean drag) {
this.isDragging = drag;
}
public boolean isOpen() {
return open;
}
public void setOpen(boolean open) {
this.open = open;
}
public void renderFrame(FontRenderer fontRenderer) {
Gui.drawRect(this.x, this.y, this.x + this.width, this.y + this.barHeight, 0xff7A777C);
GlStateManager.pushMatrix();
GlStateManager.scale(0.5f,0.5f, 0.5f);
fontRenderer.drawStringWithShadow(this.category.name(), (this.x + 2) * 2 + 5, (this.y + 2.5f) * 2 + 5, 0xffffffff);
fontRenderer.drawStringWithShadow(this.open ? "-" : "+", (this.x + this.width - 10) * 2 + 5, (this.y + 2.5f) * 2 + 5, 0xffffffff);
GlStateManager.popMatrix();
if(this.open) {
if(!this.components.isEmpty()) {
Gui.drawRect(this.x, this.y + this.barHeight, this.x + 1, this.y + this.barHeight + (12 * components.size()), 0xffA1A1A1);
Gui.drawRect(this.x, this.y + this.barHeight + (12 * components.size()), this.x + this.width, this.y + this.barHeight + (12 * components.size()) + 1, 0xffA1A1A1);
Gui.drawRect(this.x + this.width, this.y + this.barHeight, this.x + this.width - 1, this.y + this.barHeight + (12 * components.size()), 0xffA1A1A1);
for(Component component : components) {
component.renderComponent();
}
}
}
}
public void refresh() {
int off = this.barHeight;
for(Component comp : components) {
comp.setOff(off);
off += comp.getHeight();
}
}
public int getX() {
return x;
}
public int getY() {
return y;
}
public int getWidth() {
return width;
}
public void updatePosition(int mouseX, int mouseY) {
if(this.isDragging) {
this.setX(mouseX - dragX);
this.setY(mouseY - dragY);
}
}
public boolean isWithinHeader(int x, int y) {
if(x >= this.x && x <= this.x + this.width && y >= this.y && y <= this.y + this.barHeight) {
return true;
}
return false;
}
}

View File

@ -0,0 +1,140 @@
package de.Hero.clickgui.component.components;
import java.awt.Color;
import java.util.ArrayList;
import de.Hero.clickgui.component.Component;
import de.Hero.clickgui.component.Frame;
import de.Hero.clickgui.component.components.sub.Checkbox;
import de.Hero.clickgui.component.components.sub.Keybind;
import de.Hero.clickgui.component.components.sub.ModeButton;
import de.Hero.clickgui.component.components.sub.Slider;
import de.Hero.clickgui.component.components.sub.VisibleButton;
import de.Hero.settings.Setting;
import net.FatalCodes.shadow.Shadow;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.FatalCodes.shadow.module.Module;
//Your Imports
public class Button extends Component {
public Module mod;
public Frame parent;
public int offset;
private boolean isHovered;
private ArrayList<Component> subcomponents;
public boolean open;
private int height;
public Button(Module mod, Frame parent, int offset) {
this.mod = mod;
this.parent = parent;
this.offset = offset;
this.subcomponents = new ArrayList<Component>();
this.open = false;
height = 12;
int opY = offset + 12;
if(Shadow.setmgr.getSettingsByMod(mod) != null) {
for(Setting s : Shadow.setmgr.getSettingsByMod(mod)){
if(s.isCombo()){
this.subcomponents.add(new ModeButton(s, this, mod, opY));
opY += 12;
}
if(s.isSlider()){
this.subcomponents.add(new Slider(s, this, opY));
opY += 12;
}
if(s.isCheck()){
this.subcomponents.add(new Checkbox(s, this, opY));
opY += 12;
}
}
}
this.subcomponents.add(new Keybind(this, opY));
this.subcomponents.add(new VisibleButton(this, mod, opY));
}
@Override
public void setOff(int newOff) {
offset = newOff;
int opY = offset + 12;
for(Component comp : this.subcomponents) {
comp.setOff(opY);
opY += 12;
}
}
@Override
public void renderComponent() {
Gui.drawRect(parent.getX(), this.parent.getY() + this.offset, parent.getX() + parent.getWidth(), this.parent.getY() + 12 + this.offset, this.isHovered ? (this.mod.isToggled() ? 0xFF222222 : 0xFF222222) : (this.mod.isToggled() ? 0xFF111111 : 0xFF111111));
GlStateManager.pushMatrix();
GlStateManager.scale(0.5f,0.5f, 0.5f);
Minecraft.getMinecraft().fontRendererObj.drawStringWithShadow(this.mod.getName(), (parent.getX() + 2) * 2, (parent.getY() + offset + 2) * 2 + 4, this.mod.isToggled() ? 0xFF00FF : -1);
if(this.subcomponents.size() > 2)
Minecraft.getMinecraft().fontRendererObj.drawStringWithShadow(this.open ? "-" : "+", (parent.getX() + parent.getWidth() - 10) * 2, (parent.getY() + offset + 2) * 2 + 4, -1);
GlStateManager.popMatrix();
if(this.open) {
if(!this.subcomponents.isEmpty()) {
for(Component comp : this.subcomponents) {
comp.renderComponent();
}
Gui.drawRect(parent.getX() + 2, parent.getY() + this.offset + 12, parent.getX() + 3, parent.getY() + this.offset + ((this.subcomponents.size() + 1) * 12), 0xff68159E);
}
}
}
@Override
public int getHeight() {
if(this.open) {
return (12 * (this.subcomponents.size() + 1));
}
return 12;
}
@Override
public void updateComponent(int mouseX, int mouseY) {
this.isHovered = isMouseOnButton(mouseX, mouseY);
if(!this.subcomponents.isEmpty()) {
for(Component comp : this.subcomponents) {
comp.updateComponent(mouseX, mouseY);
}
}
}
@Override
public void mouseClicked(int mouseX, int mouseY, int button) {
if(isMouseOnButton(mouseX, mouseY) && button == 0) {
this.mod.toggle();
}
if(isMouseOnButton(mouseX, mouseY) && button == 1) {
this.open = !this.open;
this.parent.refresh();
}
for(Component comp : this.subcomponents) {
comp.mouseClicked(mouseX, mouseY, button);
}
}
@Override
public void mouseReleased(int mouseX, int mouseY, int mouseButton) {
for(Component comp : this.subcomponents) {
comp.mouseReleased(mouseX, mouseY, mouseButton);
}
}
@Override
public void keyTyped(char typedChar, int key) {
for(Component comp : this.subcomponents) {
comp.keyTyped(typedChar, key);
}
}
public boolean isMouseOnButton(int x, int y) {
if(x > parent.getX() && x < parent.getX() + parent.getWidth() && y > this.parent.getY() + this.offset && y < this.parent.getY() + 12 + this.offset) {
return true;
}
return false;
}
}

View File

@ -0,0 +1,68 @@
package de.Hero.clickgui.component.components.sub;
import de.Hero.clickgui.component.Component;
import de.Hero.clickgui.component.components.Button;
import de.Hero.settings.Setting;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
//Your Imports
public class Checkbox extends Component {
private boolean hovered;
private Setting op;
private Button parent;
private int offset;
private int x;
private int y;
public Checkbox(Setting option, Button button, int offset) {
this.op = option;
this.parent = button;
this.x = button.parent.getX() + button.parent.getWidth();
this.y = button.parent.getY() + button.offset;
this.offset = offset;
}
@Override
public void renderComponent() {
Gui.drawRect(parent.parent.getX() + 2, parent.parent.getY() + offset, parent.parent.getX() + (parent.parent.getWidth() * 1), parent.parent.getY() + offset + 12, this.hovered ? 0xFF222222 : 0xFF111111);
Gui.drawRect(parent.parent.getX(), parent.parent.getY() + offset, parent.parent.getX() + 2, parent.parent.getY() + offset + 12, 0xFF111111);
GlStateManager.pushMatrix();
GlStateManager.scale(0.5f,0.5f, 0.5f);
Minecraft.getMinecraft().fontRendererObj.drawStringWithShadow(this.op.getName(), (parent.parent.getX() + 10 + 4) * 2 + 5, (parent.parent.getY() + offset + 2) * 2 + 4, -1);
GlStateManager.popMatrix();
Gui.drawRect(parent.parent.getX() + 3 + 4, parent.parent.getY() + offset + 3, parent.parent.getX() + 9 + 4, parent.parent.getY() + offset + 9, 0xFF999999);
if(this.op.isEnabled())
Gui.drawRect(parent.parent.getX() + 4 + 4, parent.parent.getY() + offset + 4, parent.parent.getX() + 8 + 4, parent.parent.getY() + offset + 8, 0xFF666666);
}
@Override
public void setOff(int newOff) {
offset = newOff;
}
@Override
public void updateComponent(int mouseX, int mouseY) {
this.hovered = isMouseOnButton(mouseX, mouseY);
this.y = parent.parent.getY() + offset;
this.x = parent.parent.getX();
}
@Override
public void mouseClicked(int mouseX, int mouseY, int button) {
if(isMouseOnButton(mouseX, mouseY) && button == 0 && this.parent.open) {
this.op.setEnabled(!op.isEnabled());;
}
}
public boolean isMouseOnButton(int x, int y) {
if(x > this.x && x < this.x + 88 && y > this.y && y < this.y + 12) {
return true;
}
return false;
}
}

View File

@ -0,0 +1,73 @@
package de.Hero.clickgui.component.components.sub;
import de.Hero.clickgui.component.Component;
import de.Hero.clickgui.component.components.Button;
import net.FatalCodes.shadow.Shadow;
import net.lax1dude.eaglercraft.v1_8.Keyboard;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
//Your Imports
public class Keybind extends Component {
private boolean hovered;
private boolean binding;
private Button parent;
private int offset;
private int x;
private int y;
public Keybind(Button button, int offset) {
this.parent = button;
this.x = button.parent.getX() + button.parent.getWidth();
this.y = button.parent.getY() + button.offset;
this.offset = offset;
}
@Override
public void setOff(int newOff) {
offset = newOff;
}
@Override
public void renderComponent() {
Gui.drawRect(parent.parent.getX() + 2, parent.parent.getY() + offset, parent.parent.getX() + (parent.parent.getWidth() * 1), parent.parent.getY() + offset + 12, this.hovered ? 0xFF222222 : 0xFF111111);
Gui.drawRect(parent.parent.getX(), parent.parent.getY() + offset, parent.parent.getX() + 2, parent.parent.getY() + offset + 12, 0xFF111111);
GlStateManager.pushMatrix();
GlStateManager.scale(0.5f,0.5f, 0.5f);
Minecraft.getMinecraft().fontRendererObj.drawStringWithShadow(binding ? "Press a key..." : ("Key: " + Keyboard.getKeyName(this.parent.mod.getKey())), (parent.parent.getX() + 7) * 2, (parent.parent.getY() + offset + 2) * 2 + 5, -1);
GlStateManager.popMatrix();
}
@Override
public void updateComponent(int mouseX, int mouseY) {
this.hovered = isMouseOnButton(mouseX, mouseY);
this.y = parent.parent.getY() + offset;
this.x = parent.parent.getX();
}
@Override
public void mouseClicked(int mouseX, int mouseY, int button) {
if(isMouseOnButton(mouseX, mouseY) && button == 0 && this.parent.open) {
this.binding = !this.binding;
}
}
@Override
public void keyTyped(char typedChar, int key) {
if(this.binding) {
this.parent.mod.setKey(key);
this.binding = false;
Shadow.moduleManager.addChatMessage("Shadow >> Bound" + parent.mod + "to" + parent.mod.getKey());
}
}
public boolean isMouseOnButton(int x, int y) {
if(x > this.x && x < this.x + 88 && y > this.y && y < this.y + 12) {
return true;
}
return false;
}
}

View File

@ -0,0 +1,83 @@
package de.Hero.clickgui.component.components.sub;
import de.Hero.clickgui.component.Component;
import de.Hero.clickgui.component.components.Button;
import de.Hero.settings.Setting;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
//Your Imports
public class ModeButton extends Component {
private boolean hovered;
private Button parent;
private Setting set;
private int offset;
private int x;
private int y;
private net.FatalCodes.shadow.module.Module mod;
private int modeIndex;
public ModeButton(Setting set, Button button, net.FatalCodes.shadow.module.Module mod2, int offset) {
this.set = set;
this.parent = button;
this.mod = mod2;
this.x = button.parent.getX() + button.parent.getWidth();
this.y = button.parent.getY() + button.offset;
this.offset = offset;
this.modeIndex = 0;
}
@Override
public void setOff(int newOff) {
offset = newOff;
}
@Override
public void renderComponent() {
Gui.drawRect(parent.parent.getX() + 2, parent.parent.getY() + offset, parent.parent.getX() + (parent.parent.getWidth() * 1), parent.parent.getY() + offset + 12, this.hovered ? 0xFF222222 : 0xFF111111);
Gui.drawRect(parent.parent.getX(), parent.parent.getY() + offset, parent.parent.getX() + 2, parent.parent.getY() + offset + 12, 0xFF111111);
GlStateManager.pushMatrix();
GlStateManager.scale(0.5f,0.5f, 0.5f);
Minecraft.getMinecraft().fontRendererObj.drawStringWithShadow("Mode: " + set.getMode(), (parent.parent.getX() + 7) * 2, (parent.parent.getY() + offset + 2) * 2 + 5, -1);
GlStateManager.popMatrix();
}
@Override
public void updateComponent(int mouseX, int mouseY) {
this.hovered = isMouseOnButton(mouseX, mouseY);
this.y = parent.parent.getY() + offset;
this.x = parent.parent.getX();
}
@Override
public void mouseClicked(int mouseX, int mouseY, int button) {
if(isMouseOnButton(mouseX, mouseY) && button == 0 && this.parent.open) {
int maxIndex = set.getOptions().size();
if(button == 0) {
if(modeIndex + 1 >= maxIndex)
modeIndex = 0;
else
modeIndex++;
} else if(button == 1) {
if(modeIndex <= 0)
modeIndex = maxIndex - 1;
else
modeIndex--;
}
set.setValString(set.getOptions().get(modeIndex));
}
}
public boolean isMouseOnButton(int x, int y) {
if(x > this.x && x < this.x + 88 && y > this.y && y < this.y + 12) {
return true;
}
return false;
}
}

View File

@ -0,0 +1,116 @@
package de.Hero.clickgui.component.components.sub;
import java.math.BigDecimal;
import java.math.RoundingMode;
import de.Hero.clickgui.component.Component;
import de.Hero.clickgui.component.components.Button;
import de.Hero.settings.Setting;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
//Your Imports
public class Slider extends Component {
private boolean hovered;
private Setting set;
private Button parent;
private int offset;
private int x;
private int y;
private boolean dragging = false;
private double renderWidth;
public Slider(Setting value, Button button, int offset) {
this.set = value;
this.parent = button;
this.x = button.parent.getX() + button.parent.getWidth();
this.y = button.parent.getY() + button.offset;
this.offset = offset;
}
@Override
public void renderComponent() {
Gui.drawRect(parent.parent.getX() + 2, parent.parent.getY() + offset, parent.parent.getX() + parent.parent.getWidth(), parent.parent.getY() + offset + 12, this.hovered ? 0xFF222222 : 0xFF111111);
final int drag = (int)(this.set.getValDouble() / this.set.getMax() * this.parent.parent.getWidth());
Gui.drawRect(parent.parent.getX() + 2, parent.parent.getY() + offset, parent.parent.getX() + (int) renderWidth, parent.parent.getY() + offset + 12,hovered ? 0xFF555555 : 0xFF444444);
Gui.drawRect(parent.parent.getX(), parent.parent.getY() + offset, parent.parent.getX() + 2, parent.parent.getY() + offset + 12, 0xFF111111);
GlStateManager.pushMatrix();
GlStateManager.scale(0.5f,0.5f, 0.5f);
Minecraft.getMinecraft().fontRendererObj.drawStringWithShadow(this.set.getName() + ": " + this.set.getValDouble() , (parent.parent.getX()* 2 + 15), (parent.parent.getY() + offset + 2) * 2 + 5, -1);
GlStateManager.popMatrix();
}
@Override
public void setOff(int newOff) {
offset = newOff;
}
@Override
public void updateComponent(int mouseX, int mouseY) {
this.hovered = isMouseOnButtonD(mouseX, mouseY) || isMouseOnButtonI(mouseX, mouseY);
this.y = parent.parent.getY() + offset;
this.x = parent.parent.getX();
double diff = Math.min(88, Math.max(0, mouseX - this.x));
double min = set.getMin();
double max = set.getMax();
renderWidth = (88) * (set.getValDouble() - min) / (max - min);
if (dragging) {
if (diff == 0) {
set.setValDouble(set.getMin());
}
else {
double newValue = roundToPlace(((diff / 88) * (max - min) + min), 2);
set.setValDouble(newValue);
}
}
}
private static double roundToPlace(double value, int places) {
if (places < 0) {
throw new IllegalArgumentException();
}
BigDecimal bd = new BigDecimal(value);
bd = bd.setScale(places, RoundingMode.HALF_UP);
return bd.doubleValue();
}
@Override
public void mouseClicked(int mouseX, int mouseY, int button) {
if(isMouseOnButtonD(mouseX, mouseY) && button == 0 && this.parent.open) {
dragging = true;
}
if(isMouseOnButtonI(mouseX, mouseY) && button == 0 && this.parent.open) {
dragging = true;
}
}
@Override
public void mouseReleased(int mouseX, int mouseY, int mouseButton) {
dragging = false;
}
public boolean isMouseOnButtonD(int x, int y) {
if(x > this.x && x < this.x + (parent.parent.getWidth() / 2 + 1) && y > this.y && y < this.y + 12) {
return true;
}
return false;
}
public boolean isMouseOnButtonI(int x, int y) {
if(x > this.x + parent.parent.getWidth() / 2 && x < this.x + parent.parent.getWidth() && y > this.y && y < this.y + 12) {
return true;
}
return false;
}
}

View File

@ -0,0 +1,66 @@
package de.Hero.clickgui.component.components.sub;
import de.Hero.clickgui.component.Component;
import de.Hero.settings.Setting;
import de.Hero.clickgui.component.components.Button;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.FatalCodes.shadow.module.Module;
//Your Imports
public class VisibleButton extends Component { // Remove this class if you don't want it (it's kinda useless)
private boolean hovered;
private Button parent;
private int offset;
private int x;
private int y;
private Module mod;
public VisibleButton(Button button, Module mod, int offset) {
this.parent = button;
this.mod = mod;
this.x = button.parent.getX() + button.parent.getWidth();
this.y = button.parent.getY() + button.offset;
this.offset = offset;
}
@Override
public void setOff(int newOff) {
offset = newOff;
}
@Override
public void renderComponent() {
Gui.drawRect(parent.parent.getX() + 2, parent.parent.getY() + offset, parent.parent.getX() + (parent.parent.getWidth() * 1), parent.parent.getY() + offset + 12, this.hovered ? 0xFF222222 : 0xFF111111);
Gui.drawRect(parent.parent.getX(), parent.parent.getY() + offset, parent.parent.getX() + 2, parent.parent.getY() + offset + 12, 0xFF111111);
GlStateManager.pushMatrix();
GlStateManager.scale(0.5f,0.5f, 0.5f);
Minecraft.getMinecraft().fontRendererObj.drawStringWithShadow("Visible: " + mod.toggled, (parent.parent.getX() + 7) * 2, (parent.parent.getY() + offset + 2) * 2 + 5, -1);
GlStateManager.popMatrix(); // mod.visible is a public boolean variable in the Module.java class. If it's == false, the mod won't show up in the ArrayList
}
@Override
public void updateComponent(int mouseX, int mouseY) {
this.hovered = isMouseOnButton(mouseX, mouseY);
this.y = parent.parent.getY() + offset;
this.x = parent.parent.getX();
}
@Override
public void mouseClicked(int mouseX, int mouseY, int button) {
if(isMouseOnButton(mouseX, mouseY) && button == 0 && this.parent.open) {
mod.toggled = (!mod.toggled);
}
}
public boolean isMouseOnButton(int x, int y) {
if(x > this.x && x < this.x + 88 && y > this.y && y < this.y + 12) {
return true;
}
return false;
}
}

View File

@ -0,0 +1,124 @@
package de.Hero.settings;
import java.util.ArrayList;
import java.util.Arrays;
//Your Imports
import net.FatalCodes.shadow.module.Module;
/**
* Made by HeroCode
* it's free to use
* but you have to credit him
*
* @author HeroCode
*/
public class Setting {
public String name;
public String description;
private Module parent;
private String mode;
private String sval;
private ArrayList<String> options;
private boolean bval;
private double dval;
private double min;
private double max;
private boolean onlyint = false;
public Setting(String name, Module parent, String... options){
this.name = name;
this.parent = parent;
this.options = new ArrayList<>(Arrays.asList(options));
this.sval = options[0];
this.mode = "Combo";
}
public Setting(String name, Module parent, boolean bval){
this.name = name;
this.parent = parent;
this.bval = bval;
this.mode = "Check";
}
public Setting(String name, Module parent, double dval, double min, double max, boolean onlyint){
this.name = name;
this.parent = parent;
this.dval = dval;
this.min = min;
this.max = max;
this.onlyint = onlyint;
this.mode = "Slider";
}
public void onPress() {}
public String getName(){
return name;
}
public Module getParentMod(){
return parent;
}
public String getMode(){
return this.sval;
}
public void setValString(String in){
this.sval = in;
}
public ArrayList<String> getOptions(){
return this.options;
}
public boolean isEnabled(){
return this.bval;
}
public void setEnabled(boolean in){
this.bval = in;
}
public double getValDouble(){
if(this.onlyint){
this.dval = (int)dval;
}
return this.dval;
}
public void setValDouble(double in){
this.dval = in;
}
public double getMin(){
return this.min;
}
public double getMax(){
return this.max;
}
public boolean isCombo(){
return this.mode.equalsIgnoreCase("Combo") ? true : false;
}
public boolean isCheck(){
return this.mode.equalsIgnoreCase("Check") ? true : false;
}
public boolean isSlider(){
return this.mode.equalsIgnoreCase("Slider") ? true : false;
}
public boolean onlyInt(){
return this.onlyint;
}
}

View File

@ -0,0 +1,55 @@
package de.Hero.settings;
import java.util.ArrayList;
import net.FatalCodes.shadow.module.Module;
//Your Imports
/**
* Made by HeroCode
* it's free to use
* but you have to credit him
*
* @author HeroCode
*/
public class SettingsManager {
private ArrayList<Setting> settings;
public SettingsManager(){
this.settings = new ArrayList<Setting>();
}
public void rSetting(Setting in){
this.settings.add(in);
}
public ArrayList<Setting> getSettings(){
return this.settings;
}
public ArrayList<Setting> getSettingsByMod(Module mod){
ArrayList<Setting> out = new ArrayList<Setting>();
for(Setting s : getSettings()){
if(s.getParentMod().equals(mod)){
out.add(s);
}
}
if(out.isEmpty()){
return null;
}
return out;
}
public Setting getSettingByName(String name){
for(Setting set : getSettings()){
if(set.getName().equalsIgnoreCase(name)){
return set;
}
}
System.err.println("[DragonX] Error Setting NOT found: '" + name +"'!");
return null;
}
}

View File

@ -1,12 +1,20 @@
package net.FatalCodes.shadow; package net.FatalCodes.shadow;
import de.Hero.clickgui.ClickGui;
import de.Hero.settings.SettingsManager;
import net.FatalCodes.shadow.module.ModuleManager; import net.FatalCodes.shadow.module.ModuleManager;
public class Shadow { public class Shadow {
public static ModuleManager moduleManager; public static ModuleManager moduleManager;
public static SettingsManager setmgr;
public static ClickGui clickGui;
public static void ShadowClientStartup() { public static void ShadowClientStartup() {
moduleManager = new ModuleManager(); moduleManager = new ModuleManager();
setmgr = new SettingsManager();
clickGui = new ClickGui();
} }
public final static ClickGui getClickgui() { return clickGui; }
} }

View File

@ -1,5 +1,5 @@
package net.FatalCodes.shadow.module; package net.FatalCodes.shadow.module;
public enum Category { public enum Category {
HUD, ADMIN HUD, PVP, ADMIN
} }

View File

@ -1,5 +1,13 @@
package net.FatalCodes.shadow.module; package net.FatalCodes.shadow.module;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import de.Hero.settings.Setting;
import net.FatalCodes.shadow.Shadow;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.multiplayer.PlayerControllerMP; import net.minecraft.client.multiplayer.PlayerControllerMP;
@ -9,18 +17,27 @@ import net.minecraft.network.Packet;
public class Module { public class Module {
protected Minecraft mc = Minecraft.getMinecraft(); protected Minecraft mc = Minecraft.getMinecraft();
private String name; public String name;
private int key; private int key;
private boolean toggled; public boolean toggled;
private Category category; //if jesus no work change above to private again
Category category;
public boolean blatant;
public Module(String nm, int k, Category c) { public Module(String nm, int k, Category c) {
name = nm; name = nm;
key = k; key = k;
category = c; category = c;
toggled = false; toggled = false;
setup(); }
public Module(String nm, int k, Category c, boolean blatant) {
if(blatant) {
this.blatant = true;
name = "" + nm;
} else
name = nm;
key = k;
category = c;
toggled = false;
} }
public void toggle() { public void toggle() {
@ -30,15 +47,17 @@ public class Module {
}else { }else {
onDisable(); onDisable();
} }
} }
public void onEnable() { } public void onEnable() { }
public void onDisable() { } public void onDisable() { }
public void onUpdate() { } public void onUpdate() { }
public void onRender() { } public void onRender() { }
public void setup() {}
public void addAll(Setting... settings) {
for(Setting s : settings)
Shadow.setmgr.rSetting(s);
}
public Minecraft getMc() { public Minecraft getMc() {
return mc; return mc;
@ -72,14 +91,6 @@ public class Module {
this.toggled = toggled; this.toggled = toggled;
} }
public Category getCategory() {
return category;
}
public void setCategory(Category category) {
this.category = category;
}
protected EntityPlayerSP player() { protected EntityPlayerSP player() {
return mc.thePlayer; return mc.thePlayer;
} }
@ -97,8 +108,4 @@ public class Module {
player().sendQueue.addToSendQueue(p); player().sendQueue.addToSendQueue(p);
} }
} }

View File

@ -2,16 +2,25 @@ package net.FatalCodes.shadow.module;
import java.util.ArrayList; import java.util.ArrayList;
import net.FatalCodes.shadow.module.hud.ClickGui;
import net.FatalCodes.shadow.module.hud.Drag;
import net.FatalCodes.shadow.module.pvp.AutoWtap;
import net.FatalCodes.shadow.module.pvp.NoHurtCam;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.util.ChatComponentText; import net.minecraft.util.ChatComponentText;
public class ModuleManager { public class ModuleManager {
private static ArrayList<Module> mods; public static ArrayList<Module> mods;
public ModuleManager() { public ModuleManager() {
mods = new ArrayList<Module>(); mods = new ArrayList<Module>();
newMod(new ClickGui());
newMod(new Drag());
//PVP
newMod(new NoHurtCam());
newMod(new AutoWtap());
} }
public static void newMod(Module m) { public static void newMod(Module m) {
@ -48,4 +57,13 @@ public class ModuleManager {
Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(message)); Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(message));
} }
public ArrayList<Module> modsInCategory(Category c){
ArrayList<Module> inCategory = new ArrayList<>();
for(Module m : this.mods){
if(m.category == c)
inCategory.add(m);
}
return inCategory;
}
} }

View File

@ -0,0 +1,33 @@
package net.FatalCodes.shadow.module.hud;
import java.util.ArrayList;
import de.Hero.settings.Setting;
import net.FatalCodes.shadow.Shadow;
import net.FatalCodes.shadow.module.Category;
import net.FatalCodes.shadow.module.Module;
import net.lax1dude.eaglercraft.v1_8.internal.KeyboardConstants;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
public class ClickGui extends Module {
public ClickGui clickgui;
public ClickGui() {
super("ClickGui", KeyboardConstants.KEY_RSHIFT, Category.HUD);
}
public void onEnable() {
if(this.clickgui == null)
this.clickgui = new ClickGui();
mc.displayGuiScreen(Shadow.getClickgui());
super.onEnable();
}
public void onDisable() {
super.onDisable();
mc.displayGuiScreen((GuiScreen) null);
mc.setIngameFocus();
}
}

View File

@ -0,0 +1,27 @@
package net.FatalCodes.shadow.module.hud;
import net.FatalCodes.shadow.module.Category;
import net.FatalCodes.shadow.module.Module;
import net.lax1dude.eaglercraft.v1_8.internal.KeyboardConstants;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.FatalCodes.shadow.ui.DragScreen;
public class Drag extends Module {
public DragScreen dragScreen;
public Drag() {
super("DragScreen", KeyboardConstants.KEY_O, Category.HUD);
}
public void onEnable() {
if(this.dragScreen == null)
this.dragScreen = new DragScreen();
mc.displayGuiScreen(new DragScreen());
super.onEnable();
}
public void onDisable() {
super.onDisable();
mc.displayGuiScreen((GuiScreen) null);
mc.setIngameFocus();
}
}

View File

@ -0,0 +1,31 @@
package net.FatalCodes.shadow.module.pvp;
import net.FatalCodes.shadow.module.Category;
import net.FatalCodes.shadow.module.Module;
import net.lax1dude.eaglercraft.v1_8.internal.KeyboardConstants;
import net.minecraft.network.Packet;
public class AutoWtap extends Module {
public AutoWtap() {
super("AutoWtap", KeyboardConstants.KEY_NONE, Category.PVP);
}
private Float coolDown = 0f;
@Override
public void onUpdate() {
if(this.isToggled()) {
coolDown -= 1f;
mc.thePlayer.setSprinting(true);
if (mc.thePlayer.isSwingInProgress)
if (coolDown < 0) {
mc.thePlayer.setSprinting(false);
coolDown = 3f;
}
}
}
}

View File

@ -0,0 +1,18 @@
package net.FatalCodes.shadow.module.pvp;
import net.FatalCodes.shadow.module.Category;
import net.FatalCodes.shadow.module.Module;
import net.lax1dude.eaglercraft.v1_8.internal.KeyboardConstants;
public class NoHurtCam extends Module {
public NoHurtCam() {
super("NoHurtCam", KeyboardConstants.KEY_NONE, Category.PVP);
}
public void onUpdate() {
if(this.isToggled()) {
mc.thePlayer.maxHurtTime = 0;
}
}
}

View File

@ -0,0 +1,36 @@
package net.FatalCodes.shadow.ui;
import net.FatalCodes.shadow.Shadow;
import net.FatalCodes.shadow.module.ModuleManager;
import net.FatalCodes.shadow.module.RenderModule;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.FatalCodes.shadow.module.Module;
public class DragScreen extends GuiScreen {
@Override
public void initGui() {
this.buttonList.add(new GuiButton(1, width/2-100, height/6+148, "Back"));
super.initGui();
}
@Override
public void drawScreen(int i, int j, float var3) {
for(Module m : ModuleManager.mods) {
if(m.isToggled() && m instanceof RenderModule) {
((RenderModule)m).renderLayout(i, j);
}
}
super.drawScreen(i, j, var3);
}
@Override
protected void actionPerformed(GuiButton parGuiButton) {
if(parGuiButton.id == 1) {
mc.displayGuiScreen(Shadow.getClickgui());
}
super.actionPerformed(parGuiButton);
}
}

View File

@ -292,7 +292,7 @@ public class FontRenderer implements IResourceManagerReloadListener {
/**+ /**+
* Draws the specified string. * Draws the specified string.
*/ */
public int drawString(String text, int x, int y, int color) { public int drawString(String text, double x, double y, int color) {
return this.drawString(text, (float) x, (float) y, color, false); return this.drawString(text, (float) x, (float) y, color, false);
} }

View File

@ -64,15 +64,15 @@ public class Gui {
* Draws a solid color rectangle with the specified coordinates * Draws a solid color rectangle with the specified coordinates
* and color (ARGB format). Args: x1, y1, x2, y2, color * and color (ARGB format). Args: x1, y1, x2, y2, color
*/ */
public static void drawRect(int left, int top, int right, int bottom, int color) { public static void drawRect(double left, double top, double right, double bottom, int color) {
if (left < right) { if (left < right) {
int i = left; double i = left;
left = right; left = right;
right = i; right = i;
} }
if (top < bottom) { if (top < bottom) {
int j = top; double j = top;
top = bottom; top = bottom;
bottom = j; bottom = j;
} }

View File

@ -5,6 +5,9 @@ import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import net.FatalCodes.shadow.Shadow;
import net.FatalCodes.shadow.module.RenderModule;
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom; import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
import net.lax1dude.eaglercraft.v1_8.minecraft.EaglerTextureAtlasSprite; import net.lax1dude.eaglercraft.v1_8.minecraft.EaglerTextureAtlasSprite;
@ -48,6 +51,7 @@ import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StringUtils; import net.minecraft.util.StringUtils;
import net.minecraft.world.border.WorldBorder; import net.minecraft.world.border.WorldBorder;
import net.FatalCodes.shadow.module.Module;
/**+ /**+
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code. * This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
@ -305,6 +309,12 @@ public class GuiIngame extends Gui {
this.overlayPlayerList.renderPlayerlist(i, scoreboard, scoreobjective1); this.overlayPlayerList.renderPlayerlist(i, scoreboard, scoreobjective1);
} }
for(Module m : Shadow.moduleManager.mods) {
if(m.isToggled() && m instanceof RenderModule) {
((RenderModule)m).draw();
}
}
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.disableLighting(); GlStateManager.disableLighting();
GlStateManager.enableAlpha(); GlStateManager.enableAlpha();