HudComponent: Now has value saving, Entire project optimize import & code reformat

This commit is contained in:
noil 2020-12-24 14:47:30 -05:00
parent aabb8161d6
commit dc80e6fc3f
14 changed files with 148 additions and 68 deletions

View File

@ -1,5 +1,10 @@
package me.rigamortis.seppuku.api.gui.hud.component; package me.rigamortis.seppuku.api.gui.hud.component;
import me.rigamortis.seppuku.api.value.Value;
import java.util.ArrayList;
import java.util.List;
/** /**
* Author Seth * Author Seth
* 7/25/2019 @ 4:14 AM. * 7/25/2019 @ 4:14 AM.
@ -18,6 +23,8 @@ public class HudComponent {
private boolean visible; private boolean visible;
private List<Value> valueList = new ArrayList<Value>();
public HudComponent() { public HudComponent() {
} }
@ -91,6 +98,21 @@ public class HudComponent {
return collisionX && collisionY; return collisionX && collisionY;
} }
public Value findValue(String alias) {
for (Value v : this.getValueList()) {
for (String s : v.getAlias()) {
if (alias.equalsIgnoreCase(s)) {
return v;
}
}
if (v.getName().equalsIgnoreCase(alias)) {
return v;
}
}
return null;
}
public float getX() { public float getX() {
return x; return x;
} }
@ -154,4 +176,12 @@ public class HudComponent {
public void setVisible(boolean visible) { public void setVisible(boolean visible) {
this.visible = visible; this.visible = visible;
} }
public List<Value> getValueList() {
return valueList;
}
public void setValueList(List<Value> valueList) {
this.valueList = valueList;
}
} }

View File

@ -116,7 +116,7 @@ public class Module {
return msg; return msg;
} }
public Value find(String alias) { public Value findValue(String alias) {
for (Value v : this.getValueList()) { for (Value v : this.getValueList()) {
for (String s : v.getAlias()) { for (String s : v.getAlias()) {
if (alias.equalsIgnoreCase(s)) { if (alias.equalsIgnoreCase(s)) {

View File

@ -1,14 +1,17 @@
package me.rigamortis.seppuku.impl.config; package me.rigamortis.seppuku.impl.config;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import me.rigamortis.seppuku.Seppuku; import me.rigamortis.seppuku.Seppuku;
import me.rigamortis.seppuku.api.config.Configurable; import me.rigamortis.seppuku.api.config.Configurable;
import me.rigamortis.seppuku.api.gui.hud.component.DraggableHudComponent; import me.rigamortis.seppuku.api.gui.hud.component.DraggableHudComponent;
import me.rigamortis.seppuku.api.gui.hud.component.HudComponent; import me.rigamortis.seppuku.api.gui.hud.component.HudComponent;
import me.rigamortis.seppuku.api.util.FileUtil; import me.rigamortis.seppuku.api.util.FileUtil;
import me.rigamortis.seppuku.api.value.Value;
import me.rigamortis.seppuku.impl.gui.hud.anchor.AnchorPoint; import me.rigamortis.seppuku.impl.gui.hud.anchor.AnchorPoint;
import java.io.File; import java.io.File;
import java.util.Map;
/** /**
* @author noil * @author noil
@ -69,6 +72,8 @@ public final class HudConfig extends Configurable {
break; break;
} }
this.loadValues(entry);
}); });
} else { } else {
this.getJsonObject().entrySet().forEach(entry -> { this.getJsonObject().entrySet().forEach(entry -> {
@ -89,6 +94,8 @@ public final class HudConfig extends Configurable {
hudComponent.setVisible(entry.getValue().getAsBoolean()); hudComponent.setVisible(entry.getValue().getAsBoolean());
break; break;
} }
this.loadValues(entry);
}); });
} }
} }
@ -111,6 +118,44 @@ public final class HudConfig extends Configurable {
componentsListJsonObject.addProperty("GlueSide", draggableHudComponent.getGlued() == null ? "NONE" : ((DraggableHudComponent) hudComponent).getGlueSide().name()); componentsListJsonObject.addProperty("GlueSide", draggableHudComponent.getGlued() == null ? "NONE" : ((DraggableHudComponent) hudComponent).getGlueSide().name());
} }
if (hudComponent.getValueList().size() != 0) {
hudComponent.getValueList().forEach(value -> {
if (value.getValue() instanceof Boolean)
componentsListJsonObject.addProperty(value.getName(), (Boolean) value.getValue());
else if (value.getValue() instanceof Number && !(value.getValue() instanceof Enum)) {
if (value.getValue().getClass() == Float.class) {
componentsListJsonObject.addProperty(value.getName(), (Float) value.getValue());
} else if (value.getValue().getClass() == Double.class) {
componentsListJsonObject.addProperty(value.getName(), (Double) value.getValue());
} else if (value.getValue().getClass() == Integer.class) {
componentsListJsonObject.addProperty(value.getName(), (Integer) value.getValue());
}
} else if (value.getValue() instanceof Enum) {
componentsListJsonObject.addProperty(value.getName(), ((Enum) value.getValue()).name());
}
});
}
this.saveJsonObjectToFile(componentsListJsonObject); this.saveJsonObjectToFile(componentsListJsonObject);
} }
private void loadValues(Map.Entry<String, JsonElement> entry) {
for (Value val : hudComponent.getValueList()) {
if (val.getName().equalsIgnoreCase(entry.getKey())) {
if (val.getValue() instanceof Boolean) {
val.setValue(entry.getValue().getAsBoolean());
} else if (val.getValue() instanceof Number && !(val.getValue() instanceof Enum)) {
if (val.getValue().getClass() == Float.class) {
val.setValue(entry.getValue().getAsFloat());
} else if (val.getValue().getClass() == Double.class) {
val.setValue(entry.getValue().getAsDouble());
} else if (val.getValue().getClass() == Integer.class) {
val.setValue(entry.getValue().getAsInt());
}
} else if (val.getValue() instanceof Enum) {
val.setEnumValue(entry.getValue().getAsString());
}
}
}
}
} }

View File

@ -20,7 +20,6 @@ import net.minecraft.entity.item.EntityEnderPearl;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityThrowable; import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.item.ItemShulkerBox;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;

View File

@ -1,15 +1,12 @@
package me.rigamortis.seppuku.impl.gui.hud.component; package me.rigamortis.seppuku.impl.gui.hud.component;
import com.mojang.realmsclient.gui.ChatFormatting;
import me.rigamortis.seppuku.Seppuku; import me.rigamortis.seppuku.Seppuku;
import me.rigamortis.seppuku.api.gui.hud.component.DraggableHudComponent;
import me.rigamortis.seppuku.api.gui.hud.component.ResizableHudComponent; import me.rigamortis.seppuku.api.gui.hud.component.ResizableHudComponent;
import me.rigamortis.seppuku.api.util.ColorUtil;
import me.rigamortis.seppuku.api.util.MathUtil; import me.rigamortis.seppuku.api.util.MathUtil;
import me.rigamortis.seppuku.api.util.RenderUtil; import me.rigamortis.seppuku.api.util.RenderUtil;
import me.rigamortis.seppuku.api.util.Timer; import me.rigamortis.seppuku.api.util.Timer;
import me.rigamortis.seppuku.api.value.Value;
import me.rigamortis.seppuku.impl.gui.hud.GuiHudEditor; import me.rigamortis.seppuku.impl.gui.hud.GuiHudEditor;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.math.Vec2f; import net.minecraft.util.math.Vec2f;
import org.lwjgl.input.Keyboard; import org.lwjgl.input.Keyboard;
@ -23,11 +20,11 @@ import java.util.concurrent.CopyOnWriteArrayList;
*/ */
public final class TpsGraphComponent extends ResizableHudComponent { public final class TpsGraphComponent extends ResizableHudComponent {
public final Value<Float> delay = new Value<Float>("Delay", new String[]{"Del"}, "The amount of delay in milliseconds.", 500.0f, 0.0f, 2500.0f, 100.0f);
private final List<TpsNode> tpsNodes = new CopyOnWriteArrayList<TpsNode>(); private final List<TpsNode> tpsNodes = new CopyOnWriteArrayList<TpsNode>();
private final Timer timer = new Timer(); private final Timer timer = new Timer();
private float timerDelay = 500.0f;
public TpsGraphComponent() { public TpsGraphComponent() {
super("TpsGraph", 60, 27); super("TpsGraph", 60, 27);
this.setW(60); this.setW(60);
@ -43,7 +40,7 @@ public final class TpsGraphComponent extends ResizableHudComponent {
this.tpsNodes.clear(); this.tpsNodes.clear();
} }
if (this.timer.passed(this.timerDelay)) { if (this.timer.passed(this.delay.getValue())) {
if (this.tpsNodes.size() > (this.getW() / 2 - 1)) { if (this.tpsNodes.size() > (this.getW() / 2 - 1)) {
this.tpsNodes.remove(0); // remove oldest this.tpsNodes.remove(0); // remove oldest
} }
@ -87,7 +84,7 @@ public final class TpsGraphComponent extends ResizableHudComponent {
if (this.isMouseInside(mouseX, mouseY)) { if (this.isMouseInside(mouseX, mouseY)) {
// draw delay // draw delay
mc.fontRenderer.drawStringWithShadow(this.timerDelay + "ms", this.getX() + 2, this.getY() + this.getH() - mc.fontRenderer.FONT_HEIGHT - 2, 0xFFAAAAAA); mc.fontRenderer.drawStringWithShadow(this.delay.getValue() + "ms", this.getX() + 2, this.getY() + this.getH() - mc.fontRenderer.FONT_HEIGHT - 2, 0xFFAAAAAA);
} }
// hovered data // hovered data
@ -116,15 +113,15 @@ public final class TpsGraphComponent extends ResizableHudComponent {
super.mouseRelease(mouseX, mouseY, button); super.mouseRelease(mouseX, mouseY, button);
if (this.isMouseInside(mouseX, mouseY) && button == 1/* right click */) { if (this.isMouseInside(mouseX, mouseY) && button == 1/* right click */) {
if (Keyboard.isKeyDown(Keyboard.KEY_LCONTROL)) { if (Keyboard.isKeyDown(Keyboard.KEY_LCONTROL)) {
this.timerDelay += 100.0f; this.delay.setValue(this.delay.getValue() + this.delay.getInc());
} else if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { } else if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
this.timerDelay -= 10.0f; this.delay.setValue(this.delay.getValue() - 10.0f);
} else { } else {
this.timerDelay -= 100.0f; this.delay.setValue(this.delay.getValue() - this.delay.getInc());
} }
if (this.timerDelay <= 0.0f || this.timerDelay > 2500.0f) if (this.delay.getValue() <= this.delay.getMin() || this.delay.getValue() > this.delay.getMax())
this.timerDelay = 1000.0f; this.delay.setValue(1000.0f);
} }
} }

View File

@ -155,7 +155,7 @@ public final class ModuleListComponent extends ResizableHudComponent {
RenderUtil.drawRect(this.getX() + BORDER + TEXT_GAP, this.getY() + offsetY + BORDER + TEXT_GAP - this.scroll, this.getX() + BORDER + TEXT_GAP + this.getW() - BORDER - SCROLL_WIDTH - BORDER - 2, this.getY() + offsetY + BORDER + TEXT_GAP + mc.fontRenderer.FONT_HEIGHT - this.scroll, module.isEnabled() ? 0x451b002a : 0x451F1C22); RenderUtil.drawRect(this.getX() + BORDER + TEXT_GAP, this.getY() + offsetY + BORDER + TEXT_GAP - this.scroll, this.getX() + BORDER + TEXT_GAP + this.getW() - BORDER - SCROLL_WIDTH - BORDER - 2, this.getY() + offsetY + BORDER + TEXT_GAP + mc.fontRenderer.FONT_HEIGHT - this.scroll, module.isEnabled() ? 0x451b002a : 0x451F1C22);
if (module.getValueList().size() != 0) { if (module.getValueList().size() != 0) {
RenderUtil.drawLine(this.getX() + BORDER + TEXT_GAP + this.getW() - BORDER - SCROLL_WIDTH - BORDER - 4, this.getY() + offsetY + BORDER + TEXT_GAP - this.scroll + 1, this.getX() + BORDER + TEXT_GAP + this.getW() - BORDER - SCROLL_WIDTH - BORDER - 4, this.getY() + offsetY + BORDER + TEXT_GAP + mc.fontRenderer.FONT_HEIGHT - this.scroll - 1, 1f,0x45909090); RenderUtil.drawLine(this.getX() + BORDER + TEXT_GAP + this.getW() - BORDER - SCROLL_WIDTH - BORDER - 4, this.getY() + offsetY + BORDER + TEXT_GAP - this.scroll + 1, this.getX() + BORDER + TEXT_GAP + this.getW() - BORDER - SCROLL_WIDTH - BORDER - 4, this.getY() + offsetY + BORDER + TEXT_GAP + mc.fontRenderer.FONT_HEIGHT - this.scroll - 1, 1f, 0x45909090);
} }
final boolean insideModule = mouseX >= (this.getX() + BORDER) && mouseX <= (this.getX() + this.getW() - BORDER - SCROLL_WIDTH) && mouseY >= (this.getY() + BORDER + mc.fontRenderer.FONT_HEIGHT + 1 + offsetY - this.scroll - mc.fontRenderer.FONT_HEIGHT + 1) && mouseY <= (this.getY() + BORDER + (mc.fontRenderer.FONT_HEIGHT) + 1 + offsetY - this.scroll); final boolean insideModule = mouseX >= (this.getX() + BORDER) && mouseX <= (this.getX() + this.getW() - BORDER - SCROLL_WIDTH) && mouseY >= (this.getY() + BORDER + mc.fontRenderer.FONT_HEIGHT + 1 + offsetY - this.scroll - mc.fontRenderer.FONT_HEIGHT + 1) && mouseY <= (this.getY() + BORDER + (mc.fontRenderer.FONT_HEIGHT) + 1 + offsetY - this.scroll);

View File

@ -135,7 +135,7 @@ public final class CommandManager {
final String[] split = input.split(" "); final String[] split = input.split(" ");
final Value v = module.find(split[1]); final Value v = module.findValue(split[1]);
if (v != null) { if (v != null) {
if (v.getValue() instanceof Boolean) { if (v.getValue() instanceof Boolean) {

View File

@ -5,6 +5,7 @@ import me.rigamortis.seppuku.api.event.render.EventRender2D;
import me.rigamortis.seppuku.api.gui.hud.component.HudComponent; import me.rigamortis.seppuku.api.gui.hud.component.HudComponent;
import me.rigamortis.seppuku.api.module.Module; import me.rigamortis.seppuku.api.module.Module;
import me.rigamortis.seppuku.api.util.ReflectionUtil; import me.rigamortis.seppuku.api.util.ReflectionUtil;
import me.rigamortis.seppuku.api.value.Value;
import me.rigamortis.seppuku.impl.gui.hud.GuiHudEditor; import me.rigamortis.seppuku.impl.gui.hud.GuiHudEditor;
import me.rigamortis.seppuku.impl.gui.hud.anchor.AnchorPoint; import me.rigamortis.seppuku.impl.gui.hud.anchor.AnchorPoint;
import me.rigamortis.seppuku.impl.gui.hud.component.*; import me.rigamortis.seppuku.impl.gui.hud.component.*;
@ -15,6 +16,7 @@ import net.minecraft.client.gui.ScaledResolution;
import team.stiff.pomelo.impl.annotated.handler.annotation.Listener; import team.stiff.pomelo.impl.annotated.handler.annotation.Listener;
import java.io.File; import java.io.File;
import java.lang.reflect.Field;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArrayList;
@ -68,46 +70,46 @@ public final class HudManager {
moduleList.setY(moduleList.getY() + moduleListYOffset); moduleList.setY(moduleList.getY() + moduleListYOffset);
} }
this.componentList.add(moduleList); add(moduleList);
moduleListXOffset += moduleList.getW() + 4 /* gap between each list */; moduleListXOffset += moduleList.getW() + 4 /* gap between each list */;
} }
this.componentList.add(new WatermarkComponent()); add(new WatermarkComponent());
this.componentList.add(new EnabledModsComponent(TOP_RIGHT)); // creates the enabled mods component & by default anchors in the top right (to aid new users) add(new EnabledModsComponent(TOP_RIGHT)); // creates the enabled mods component & by default anchors in the top right (to aid new users)
this.componentList.add(new TpsComponent()); add(new TpsComponent());
this.componentList.add(new PotionEffectsComponent()); add(new PotionEffectsComponent());
this.componentList.add(new FpsComponent()); add(new FpsComponent());
this.componentList.add(new CoordsComponent()); add(new CoordsComponent());
this.componentList.add(new NetherCoordsComponent()); add(new NetherCoordsComponent());
this.componentList.add(new SpeedComponent()); add(new SpeedComponent());
this.componentList.add(new ArmorComponent()); add(new ArmorComponent());
this.componentList.add(new PingComponent()); add(new PingComponent());
this.componentList.add(new ServerBrandComponent()); add(new ServerBrandComponent());
this.componentList.add(new BiomeComponent()); add(new BiomeComponent());
this.componentList.add(new DirectionComponent()); add(new DirectionComponent());
this.componentList.add(new PacketTimeComponent()); add(new PacketTimeComponent());
this.componentList.add(new TimeComponent()); add(new TimeComponent());
this.componentList.add(new EnemyPotionsComponent()); add(new EnemyPotionsComponent());
this.componentList.add(new CompassComponent()); add(new CompassComponent());
this.componentList.add(new HubComponent()); add(new HubComponent());
this.componentList.add(new InventoryComponent()); add(new InventoryComponent());
this.componentList.add(new TotemCountComponent()); add(new TotemCountComponent());
this.componentList.add(new TutorialComponent()); add(new TutorialComponent());
this.componentList.add(new HoleOverlayComponent()); add(new HoleOverlayComponent());
this.componentList.add(new PlayerCountComponent()); add(new PlayerCountComponent());
this.componentList.add(new OverViewComponent()); add(new OverViewComponent());
this.componentList.add(new RearViewComponent()); add(new RearViewComponent());
this.componentList.add(new EntityListComponent()); add(new EntityListComponent());
this.componentList.add(new TpsGraphComponent()); add(new TpsGraphComponent());
TrayComponent trayComponent = new TrayComponent(); TrayComponent trayComponent = new TrayComponent();
trayComponent.setAnchorPoint(BOTTOM_CENTER); trayComponent.setAnchorPoint(BOTTOM_CENTER);
this.componentList.add(trayComponent); add(trayComponent);
NotificationsComponent notificationsComponent = new NotificationsComponent(); NotificationsComponent notificationsComponent = new NotificationsComponent();
notificationsComponent.setAnchorPoint(TOP_CENTER); notificationsComponent.setAnchorPoint(TOP_CENTER);
this.componentList.add(notificationsComponent); add(notificationsComponent);
this.loadExternalHudComponents(); this.loadExternalHudComponents();
@ -120,6 +122,29 @@ public final class HudManager {
Seppuku.INSTANCE.getEventManager().addEventListener(this); Seppuku.INSTANCE.getEventManager().addEventListener(this);
} }
/**
* Find all fields within the hud component that are values
* and add them to the list of values inside of the hud component
*
* @param component the HudComponent to add
*/
public void add(HudComponent component) {
try {
for (Field field : component.getClass().getDeclaredFields()) {
if (Value.class.isAssignableFrom(field.getType())) {
if (!field.isAccessible()) {
field.setAccessible(true);
}
final Value val = (Value) field.get(component);
component.getValueList().add(val);
}
}
this.componentList.add(component);
} catch (Exception e) {
e.printStackTrace();
}
}
/** /**
* Update our anchor point positions when we render * Update our anchor point positions when we render
* *

View File

@ -7,7 +7,6 @@ import me.rigamortis.seppuku.api.util.Timer;
import me.rigamortis.seppuku.api.value.Value; import me.rigamortis.seppuku.api.value.Value;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.InventoryEffectRenderer;
import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.init.Enchantments; import net.minecraft.init.Enchantments;
import net.minecraft.init.Items; import net.minecraft.init.Items;

View File

@ -10,7 +10,6 @@ import me.rigamortis.seppuku.api.value.Value;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.network.play.server.SPacketChat; import net.minecraft.network.play.server.SPacketChat;
import net.minecraft.util.StringUtils; import net.minecraft.util.StringUtils;
import net.minecraft.util.math.Vec2f;
import team.stiff.pomelo.impl.annotated.handler.annotation.Listener; import team.stiff.pomelo.impl.annotated.handler.annotation.Listener;
import java.io.File; import java.io.File;
@ -19,7 +18,6 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;

View File

@ -1,9 +1,6 @@
package me.rigamortis.seppuku.impl.module.misc; package me.rigamortis.seppuku.impl.module.misc;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject;
import com.mojang.realmsclient.gui.ChatFormatting; import com.mojang.realmsclient.gui.ChatFormatting;
import me.rigamortis.seppuku.Seppuku; import me.rigamortis.seppuku.Seppuku;
import me.rigamortis.seppuku.api.event.EventStageable; import me.rigamortis.seppuku.api.event.EventStageable;
@ -12,7 +9,6 @@ import me.rigamortis.seppuku.api.module.Module;
import me.rigamortis.seppuku.api.util.FileUtil; import me.rigamortis.seppuku.api.util.FileUtil;
import me.rigamortis.seppuku.api.value.Value; import me.rigamortis.seppuku.api.value.Value;
import me.rigamortis.seppuku.impl.module.hidden.CommandsModule; import me.rigamortis.seppuku.impl.module.hidden.CommandsModule;
import me.rigamortis.seppuku.impl.module.render.LogoutSpotsModule;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.play.server.SPacketChunkData; import net.minecraft.network.play.server.SPacketChunkData;
@ -24,9 +20,7 @@ import net.minecraft.util.text.event.HoverEvent;
import team.stiff.pomelo.impl.annotated.handler.annotation.Listener; import team.stiff.pomelo.impl.annotated.handler.annotation.Listener;
import java.io.File; import java.io.File;
import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.io.Writer;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;

View File

@ -1,18 +1,15 @@
package me.rigamortis.seppuku.impl.module.render; package me.rigamortis.seppuku.impl.module.render;
import me.rigamortis.seppuku.api.event.client.EventSaveConfig; import me.rigamortis.seppuku.api.event.client.EventSaveConfig;
import me.rigamortis.seppuku.api.event.player.EventPlayerDamageBlock;
import me.rigamortis.seppuku.api.event.render.EventRender3D; import me.rigamortis.seppuku.api.event.render.EventRender3D;
import me.rigamortis.seppuku.api.module.Module; import me.rigamortis.seppuku.api.module.Module;
import me.rigamortis.seppuku.api.util.ColorUtil; import me.rigamortis.seppuku.api.util.ColorUtil;
import me.rigamortis.seppuku.api.util.MathUtil; import me.rigamortis.seppuku.api.util.MathUtil;
import me.rigamortis.seppuku.api.util.RenderUtil; import me.rigamortis.seppuku.api.util.RenderUtil;
import me.rigamortis.seppuku.api.value.Value; import me.rigamortis.seppuku.api.value.Value;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.init.Blocks;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.RayTraceResult;

View File

@ -1,14 +1,12 @@
package me.rigamortis.seppuku.impl.module.render; package me.rigamortis.seppuku.impl.module.render;
import me.rigamortis.seppuku.Seppuku; import me.rigamortis.seppuku.Seppuku;
import me.rigamortis.seppuku.api.event.client.EventSaveConfig;
import me.rigamortis.seppuku.api.event.player.EventDestroyBlock; import me.rigamortis.seppuku.api.event.player.EventDestroyBlock;
import me.rigamortis.seppuku.api.event.render.EventRender3D; import me.rigamortis.seppuku.api.event.render.EventRender3D;
import me.rigamortis.seppuku.api.event.render.EventRenderBlockModel; import me.rigamortis.seppuku.api.event.render.EventRenderBlockModel;
import me.rigamortis.seppuku.api.event.world.EventLoadWorld; import me.rigamortis.seppuku.api.event.world.EventLoadWorld;
import me.rigamortis.seppuku.api.module.Module; import me.rigamortis.seppuku.api.module.Module;
import me.rigamortis.seppuku.api.util.ColorUtil; import me.rigamortis.seppuku.api.util.ColorUtil;
import me.rigamortis.seppuku.api.util.MathUtil;
import me.rigamortis.seppuku.api.util.RenderUtil; import me.rigamortis.seppuku.api.util.RenderUtil;
import me.rigamortis.seppuku.api.value.Value; import me.rigamortis.seppuku.api.value.Value;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@ -22,7 +20,6 @@ import net.minecraft.init.Blocks;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.Vec3i;
import team.stiff.pomelo.impl.annotated.handler.annotation.Listener; import team.stiff.pomelo.impl.annotated.handler.annotation.Listener;
import java.util.ArrayList; import java.util.ArrayList;
@ -129,7 +126,7 @@ public final class SearchModule extends Module {
mc.gameSettings.viewBobbing = false; mc.gameSettings.viewBobbing = false;
mc.entityRenderer.setupCameraTransform(event.getPartialTicks(), 0); mc.entityRenderer.setupCameraTransform(event.getPartialTicks(), 0);
final Vec3d forward = new Vec3d(0, 0, 1).rotatePitch(-(float) Math.toRadians(Minecraft.getMinecraft().player.rotationPitch)).rotateYaw(-(float) Math.toRadians(Minecraft.getMinecraft().player.rotationYaw)); final Vec3d forward = new Vec3d(0, 0, 1).rotatePitch(-(float) Math.toRadians(Minecraft.getMinecraft().player.rotationPitch)).rotateYaw(-(float) Math.toRadians(Minecraft.getMinecraft().player.rotationYaw));
RenderUtil.drawLine3D(forward.x, forward.y + mc.player.getEyeHeight(), forward.z, pos.x,pos.y, pos.z, this.width.getValue(), color); RenderUtil.drawLine3D(forward.x, forward.y + mc.player.getEyeHeight(), forward.z, pos.x, pos.y, pos.z, this.width.getValue(), color);
mc.gameSettings.viewBobbing = bobbing; mc.gameSettings.viewBobbing = bobbing;
mc.entityRenderer.setupCameraTransform(event.getPartialTicks(), 0); mc.entityRenderer.setupCameraTransform(event.getPartialTicks(), 0);
} }

View File

@ -1,14 +1,12 @@
package me.rigamortis.seppuku.impl.module.render; package me.rigamortis.seppuku.impl.module.render;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.mojang.realmsclient.gui.ChatFormatting; import com.mojang.realmsclient.gui.ChatFormatting;
import me.rigamortis.seppuku.Seppuku; import me.rigamortis.seppuku.Seppuku;
import me.rigamortis.seppuku.api.event.EventStageable; import me.rigamortis.seppuku.api.event.EventStageable;
import me.rigamortis.seppuku.api.event.network.EventReceivePacket; import me.rigamortis.seppuku.api.event.network.EventReceivePacket;
import me.rigamortis.seppuku.api.event.render.EventRender2D; import me.rigamortis.seppuku.api.event.render.EventRender2D;
import me.rigamortis.seppuku.api.event.render.EventRenderName; import me.rigamortis.seppuku.api.event.render.EventRenderName;
import me.rigamortis.seppuku.api.event.world.EventAddEntity;
import me.rigamortis.seppuku.api.friend.Friend; import me.rigamortis.seppuku.api.friend.Friend;
import me.rigamortis.seppuku.api.module.Module; import me.rigamortis.seppuku.api.module.Module;
import me.rigamortis.seppuku.api.util.*; import me.rigamortis.seppuku.api.util.*;
@ -24,12 +22,10 @@ import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.*; import net.minecraft.entity.item.*;
import net.minecraft.entity.monster.IMob; import net.minecraft.entity.monster.IMob;
import net.minecraft.entity.passive.AbstractHorse; import net.minecraft.entity.passive.AbstractHorse;
import net.minecraft.entity.passive.EntityHorse;
import net.minecraft.entity.passive.EntityTameable; import net.minecraft.entity.passive.EntityTameable;
import net.minecraft.entity.passive.IAnimals; import net.minecraft.entity.passive.IAnimals;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.init.MobEffects;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
@ -45,7 +41,10 @@ import net.minecraft.util.math.Vec3d;
import team.stiff.pomelo.impl.annotated.handler.annotation.Listener; import team.stiff.pomelo.impl.annotated.handler.annotation.Listener;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.*; import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArrayList;
/** /**