Added SearchModule, SearchCommand, heavily optimized configs and client overall

This commit is contained in:
noil 2020-12-09 23:39:14 -05:00
parent 54cb5445e7
commit 8c28704a47
25 changed files with 507 additions and 67 deletions

View File

@ -34,8 +34,7 @@ public abstract class Configurable {
}
protected void saveJsonObjectToFile(JsonObject object) {
File newFile = FileUtil.recreateFile(this.getFile());
FileUtil.saveJsonFile(newFile, object);
FileUtil.saveJsonFile(FileUtil.recreateFile(this.getFile()), object);
}
protected JsonObject convertJsonObjectFromFile() {

View File

@ -1,6 +1,7 @@
package me.rigamortis.seppuku.api.event.module;
import me.rigamortis.seppuku.api.module.Module;
/**
* Author Seth
* 6/10/2019 @ 2:36 PM.

View File

@ -17,7 +17,7 @@ public final class BlockPlacementRequest {
private final EnumFacing placeDirection;
public BlockPlacementRequest(final BlockPos structurePosition,
final EnumFacing placeDirection) {
final EnumFacing placeDirection) {
this.structurePosition = structurePosition;
this.placeDirection = placeDirection;
}

View File

@ -23,7 +23,7 @@ public final class HandSwapContext {
}
public void handleHandSwap(final boolean restore,
final Minecraft minecraft) {
final Minecraft minecraft) {
minecraft.player.inventory.currentItem =
restore ? this.getOldSlot() : this.getNewSlot();
minecraft.playerController.updateController();

View File

@ -54,8 +54,7 @@ public class FileUtil {
* Creates a json file in a directory
*/
public static File createJsonFile(File dir, String name) {
File file = new File(dir, name + ".json");
return file;
return new File(dir, name + ".json");
}
/**
@ -80,7 +79,7 @@ public class FileUtil {
*/
public static void saveJsonFile(File file, JsonObject jsonObject) {
try {
file.createNewFile();
//file.createNewFile();
FileWriter writer = new FileWriter(file);
Throwable throwable = null;
try {

View File

@ -29,8 +29,8 @@ public final class LastInvCommand extends Command {
@Listener
public void render(EventRender2D event) {
final InfEnderChestModule mod = (InfEnderChestModule) Seppuku.INSTANCE.getModuleManager().find(InfEnderChestModule.class);
if(mod != null) {
if(mod.getScreen() != null) {
if (mod != null) {
if (mod.getScreen() != null) {
Minecraft.getMinecraft().displayGuiScreen(mod.getScreen());
Seppuku.INSTANCE.logChat("Opening the last inventory.");
} else {

View File

@ -0,0 +1,179 @@
package me.rigamortis.seppuku.impl.command;
import me.rigamortis.seppuku.Seppuku;
import me.rigamortis.seppuku.api.command.Command;
import me.rigamortis.seppuku.api.util.StringUtil;
import me.rigamortis.seppuku.impl.module.render.SearchModule;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.init.Blocks;
import net.minecraft.util.text.Style;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.event.HoverEvent;
/**
* @author noil
*/
public final class SearchCommand extends Command {
private final String[] addAlias = new String[]{"Add"};
private final String[] removeAlias = new String[]{"Remove", "Rem", "Delete", "Del"};
private final String[] listAlias = new String[]{"List", "Lst"};
private final String[] clearAlias = new String[]{"Clear", "clr"};
public SearchCommand() {
super("Search", new String[]{"find", "locate"}, "Allows you to change what blocks are visible on search",
"Search Add <Block_Name>\n" +
"Search Add <ID>\n" +
"Search Remove <Block_Name>\n" +
"Search Remove <ID>\n" +
"Search List\n" +
"Search Clear");
}
@Override
public void exec(String input) {
if (!this.clamp(input, 2, 3)) {
this.printUsage();
return;
}
final String[] split = input.split(" ");
final SearchModule searchModule = (SearchModule) Seppuku.INSTANCE.getModuleManager().find(SearchModule.class);
if (searchModule != null) {
if (equals(addAlias, split[1])) {
if (!this.clamp(input, 3, 3)) {
this.printUsage();
return;
}
if (StringUtil.isInt(split[2])) {
final int id = Integer.parseInt(split[2]);
if (id > 0) {
final Block block = Block.getBlockById(id);
if (searchModule.contains(Block.getIdFromBlock(block))) {
Seppuku.INSTANCE.logChat("Search already contains " + block.getLocalizedName());
} else {
searchModule.add(Block.getIdFromBlock(block));
if (searchModule.isEnabled()) {
searchModule.updateRenders();
}
Seppuku.INSTANCE.getConfigManager().saveAll();
Seppuku.INSTANCE.logChat("Added " + block.getLocalizedName() + " to search");
}
} else {
Seppuku.INSTANCE.errorChat("Cannot add Air to search");
}
} else {
final Block block = Block.getBlockFromName(split[2].toLowerCase());
if (block != null) {
if (block == Blocks.AIR) {
Seppuku.INSTANCE.errorChat("Cannot add Air to search");
} else {
if (searchModule.contains(Block.getIdFromBlock(block))) {
Seppuku.INSTANCE.logChat("Search already contains " + block.getLocalizedName());
} else {
searchModule.add(Block.getIdFromBlock(block));
if (searchModule.isEnabled()) {
searchModule.updateRenders();
}
Seppuku.INSTANCE.getConfigManager().saveAll();
Seppuku.INSTANCE.logChat("Added " + block.getLocalizedName() + " to search");
}
}
} else {
Seppuku.INSTANCE.logChat("\247c" + split[2] + "\247f is not a valid block");
}
}
} else if (equals(removeAlias, split[1])) {
if (!this.clamp(input, 3, 3)) {
this.printUsage();
return;
}
if (StringUtil.isInt(split[2])) {
final int id = Integer.parseInt(split[2]);
if (id > 0) {
final Block block = Block.getBlockById(id);
if (searchModule.contains(Block.getIdFromBlock(block))) {
searchModule.remove(Block.getIdFromBlock(block));
if (searchModule.isEnabled()) {
searchModule.updateRenders();
}
Seppuku.INSTANCE.getConfigManager().saveAll();
Seppuku.INSTANCE.logChat("Removed " + block.getLocalizedName() + " from search");
} else {
Seppuku.INSTANCE.logChat("Search doesn't contain " + block.getLocalizedName());
}
} else {
Seppuku.INSTANCE.errorChat("Cannot remove Air from search");
}
} else {
final Block block = Block.getBlockFromName(split[2].toLowerCase());
if (block != null) {
if (block == Blocks.AIR) {
Seppuku.INSTANCE.errorChat("Cannot remove Air from search");
} else {
if (searchModule.contains(Block.getIdFromBlock(block))) {
searchModule.remove(Block.getIdFromBlock(block));
if (searchModule.isEnabled()) {
searchModule.updateRenders();
}
Seppuku.INSTANCE.getConfigManager().saveAll();
Seppuku.INSTANCE.logChat("Removed " + block.getLocalizedName() + " from search");
} else {
Seppuku.INSTANCE.logChat("Search doesn't contain " + block.getLocalizedName());
}
}
} else {
Seppuku.INSTANCE.logChat("\247c" + split[2] + "\247f is not a valid block");
}
}
} else if (equals(listAlias, split[1])) {
if (!this.clamp(input, 2, 2)) {
this.printUsage();
return;
}
if (searchModule.getIds().size() > 0) {
final TextComponentString msg = new TextComponentString("\2477Search IDs: ");
for (int i : searchModule.getIds()) {
msg.appendSibling(new TextComponentString("\2477[\247a" + i + "\2477] ")
.setStyle(new Style()
.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponentString(Block.getBlockById(i).getLocalizedName())))));
}
Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage(msg);
} else {
Seppuku.INSTANCE.logChat("You don't have any search ids");
}
} else if (equals(clearAlias, split[1])) {
if (!this.clamp(input, 2, 2)) {
this.printUsage();
return;
}
searchModule.clear();
if (searchModule.isEnabled()) {
searchModule.updateRenders();
}
Seppuku.INSTANCE.getConfigManager().saveAll();
Seppuku.INSTANCE.logChat("Cleared all blocks from search");
} else {
Seppuku.INSTANCE.errorChat("Unknown input " + "\247f\"" + input + "\"");
this.printUsage();
}
} else {
Seppuku.INSTANCE.errorChat("Search not present");
}
}
}

View File

@ -5,7 +5,11 @@ import me.rigamortis.seppuku.api.command.Command;
import me.rigamortis.seppuku.api.util.StringUtil;
import me.rigamortis.seppuku.impl.module.render.XrayModule;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.init.Blocks;
import net.minecraft.util.text.Style;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.event.HoverEvent;
/**
* Author Seth
@ -13,9 +17,10 @@ import net.minecraft.init.Blocks;
*/
public final class XrayCommand extends Command {
private String[] addAlias = new String[]{"Add", "A"};
private String[] removeAlias = new String[]{"Remove", "Rem", "R", "Delete", "Del", "D"};
private String[] clearAlias = new String[]{"Clear", "C"};
private final String[] addAlias = new String[]{"Add", "A"};
private final String[] removeAlias = new String[]{"Remove", "Rem", "R", "Delete", "Del", "D"};
private final String[] listAlias = new String[]{"List", "Lst"};
private final String[] clearAlias = new String[]{"Clear", "C"};
public XrayCommand() {
super("Xray", new String[]{"JadeVision", "Jade"}, "Allows you to change what blocks are visible on xray",
@ -23,6 +28,7 @@ public final class XrayCommand extends Command {
"Xray Add <ID>\n" +
"Xray Remove <Block_Name>\n" +
"Xray Remove <ID>\n" +
"Xray List\n" +
"Xray Clear");
}
@ -140,6 +146,25 @@ public final class XrayCommand extends Command {
Seppuku.INSTANCE.logChat("\247c" + split[2] + "\247f is not a valid block");
}
}
} else if (equals(listAlias, split[1])) {
if (!this.clamp(input, 2, 2)) {
this.printUsage();
return;
}
if (xray.getIds().size() > 0) {
final TextComponentString msg = new TextComponentString("\247Xray IDs: ");
for (int i : xray.getIds()) {
msg.appendSibling(new TextComponentString("\2477[\247a" + i + "\2477] ")
.setStyle(new Style()
.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponentString(Block.getBlockById(i).getLocalizedName())))));
}
Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage(msg);
} else {
Seppuku.INSTANCE.logChat("You don't have any search ids");
}
} else if (equals(clearAlias, split[1])) {
if (!this.clamp(input, 2, 2)) {
this.printUsage();

View File

@ -0,0 +1,61 @@
package me.rigamortis.seppuku.impl.config;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import me.rigamortis.seppuku.Seppuku;
import me.rigamortis.seppuku.api.config.Configurable;
import me.rigamortis.seppuku.api.util.FileUtil;
import me.rigamortis.seppuku.impl.module.render.SearchModule;
import java.io.File;
import java.util.Objects;
/**
* @author noil
*/
public final class SearchConfig extends Configurable {
private final SearchModule searchModule;
public SearchConfig(File dir) {
super(FileUtil.createJsonFile(dir, "SearchIds"));
this.searchModule = (SearchModule) Seppuku.INSTANCE.getModuleManager().find("Search");
}
@Override
public void onLoad() {
super.onLoad();
if (this.searchModule == null)
return;
JsonArray searchIdsJsonArray = null;
final JsonElement blockIds = this.getJsonObject().get("SearchBlockIds");
if (blockIds != null)
searchIdsJsonArray = blockIds.getAsJsonArray();
if (searchIdsJsonArray != null) {
for (JsonElement jsonElement : searchIdsJsonArray) {
((SearchModule) Objects.requireNonNull(Seppuku.INSTANCE.getModuleManager().find("Search"))).add(jsonElement.getAsInt());
}
}
}
@Override
public void onSave() {
if (this.searchModule == null)
return;
JsonObject save = new JsonObject();
JsonArray searchIdsJsonArray = new JsonArray();
for (Integer i : this.searchModule.getIds())
searchIdsJsonArray.add(i);
save.add("SearchBlockIds", searchIdsJsonArray);
this.saveJsonObjectToFile(save);
}
}

View File

@ -9,6 +9,7 @@ import me.rigamortis.seppuku.api.util.FileUtil;
import me.rigamortis.seppuku.impl.module.render.XrayModule;
import java.io.File;
import java.util.Objects;
/**
* @author noil
@ -18,7 +19,7 @@ public final class XrayConfig extends Configurable {
private final XrayModule xrayModule;
public XrayConfig(File dir) {
super(FileUtil.createJsonFile(dir, "Xray"));
super(FileUtil.createJsonFile(dir, "XrayIds"));
this.xrayModule = (XrayModule) Seppuku.INSTANCE.getModuleManager().find("Xray");
}
@ -29,10 +30,16 @@ public final class XrayConfig extends Configurable {
if (this.xrayModule == null)
return;
final JsonArray xrayIdsJsonArray = this.getJsonObject().get("BlockIds").getAsJsonArray();
JsonArray xrayIdsJsonArray = null;
for (JsonElement jsonElement : xrayIdsJsonArray) {
this.xrayModule.add(jsonElement.getAsInt());
final JsonElement blockIds = this.getJsonObject().get("XrayBlockIds");
if (blockIds != null)
xrayIdsJsonArray = blockIds.getAsJsonArray();
if (xrayIdsJsonArray != null) {
for (JsonElement jsonElement : xrayIdsJsonArray) {
((XrayModule) Objects.requireNonNull(Seppuku.INSTANCE.getModuleManager().find("Xray"))).add(jsonElement.getAsInt());
}
}
}
@ -47,7 +54,7 @@ public final class XrayConfig extends Configurable {
for (Integer i : this.xrayModule.getIds())
xrayIdsJsonArray.add(i);
save.add("BlockIds", xrayIdsJsonArray);
save.add("XrayBlockIds", xrayIdsJsonArray);
this.saveJsonObjectToFile(save);
}

View File

@ -246,7 +246,7 @@ public final class ModuleListComponent extends ResizableHudComponent {
scroll -= 10;
}
} else { // not inside scroll bar zone
Seppuku.INSTANCE.getConfigManager().saveAll();
//Seppuku.INSTANCE.getConfigManager().saveAll();
}
}
}

View File

@ -4,9 +4,7 @@ import com.mojang.realmsclient.gui.ChatFormatting;
import me.rigamortis.seppuku.Seppuku;
import me.rigamortis.seppuku.api.event.minecraft.EventDisplayGui;
import me.rigamortis.seppuku.api.texture.Texture;
import me.rigamortis.seppuku.api.util.RenderUtil;
import me.rigamortis.seppuku.impl.fml.SeppukuMod;
import me.rigamortis.seppuku.impl.gui.hud.GuiHudEditor;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.*;
import net.minecraft.client.renderer.GlStateManager;

View File

@ -69,6 +69,7 @@ public final class CommandManager {
this.commandList.add(new GiveCommand());
this.commandList.add(new CalcStrongholdCommand());
this.commandList.add(new LastInvCommand());
this.commandList.add(new SearchCommand());
//create commands for every value within every module
loadValueCommands();

View File

@ -58,6 +58,7 @@ public final class ConfigManager {
this.configurableList.add(new FriendConfig(configDir));
this.configurableList.add(new XrayConfig(configDir));
this.configurableList.add(new SearchConfig(configDir));
this.configurableList.add(new MacroConfig(configDir));
this.configurableList.add(new WaypointsConfig(configDir));
this.configurableList.add(new WorldConfig(configDir));
@ -72,20 +73,16 @@ public final class ConfigManager {
}
public void saveAll() {
new Thread(() -> {
for (Configurable cfg : configurableList) {
cfg.onSave();
}
}).start();
for (Configurable cfg : configurableList) {
cfg.onSave();
}
Seppuku.INSTANCE.getEventManager().dispatchEvent(new EventSaveConfig());
}
public void loadAll() {
new Thread(() -> {
for (Configurable cfg : configurableList) {
cfg.onLoad();
}
}).start();
for (Configurable cfg : configurableList) {
cfg.onLoad();
}
Seppuku.INSTANCE.getEventManager().dispatchEvent(new EventLoadConfig());
}

View File

@ -1,6 +1,5 @@
package me.rigamortis.seppuku.impl.management;
import me.rigamortis.seppuku.Seppuku;
import me.rigamortis.seppuku.api.friend.Friend;
import me.rigamortis.seppuku.api.util.StringUtil;
import net.minecraft.entity.Entity;
@ -33,7 +32,7 @@ public final class FriendManager {
final Friend friend = new Friend(name, alias);
this.friendList.add(friend);
Seppuku.INSTANCE.getConfigManager().saveAll();
//Seppuku.INSTANCE.getConfigManager().saveAll();
if (grabUUID) {
try {
@ -48,7 +47,7 @@ public final class FriendManager {
final JSONObject obj = (JSONObject) JSONValue.parseWithException(json);
final String uuid = obj.get("id").toString();
friend.setUuid(uuid);
Seppuku.INSTANCE.getConfigManager().saveAll();
//Seppuku.INSTANCE.getConfigManager().saveAll();
} catch (ParseException e) {
e.printStackTrace();
} catch (MalformedURLException e) {

View File

@ -10,7 +10,6 @@ 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.module.ModuleListComponent;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiChat;
import net.minecraft.client.gui.ScaledResolution;
import team.stiff.pomelo.impl.annotated.handler.annotation.Listener;

View File

@ -1,6 +1,5 @@
package me.rigamortis.seppuku.impl.management;
import me.rigamortis.seppuku.Seppuku;
import me.rigamortis.seppuku.api.ignore.Ignored;
import java.util.List;
@ -16,8 +15,7 @@ public final class IgnoredManager {
public void add(String name) {
this.ignoredList.add(new Ignored(name));
Seppuku.INSTANCE.getConfigManager().saveAll();
//Seppuku.INSTANCE.getConfigManager().saveAll();
}
public Ignored find(String name) {

View File

@ -159,6 +159,7 @@ public final class ModuleManager {
add(new NoEntityTraceModule());
add(new MultitaskModule());
add(new InfEnderChestModule());
add(new SearchModule());
// p2w experience
if (Seppuku.INSTANCE.getCapeManager().hasCape())

View File

@ -17,7 +17,6 @@ import team.stiff.pomelo.impl.annotated.handler.annotation.Listener;
public final class NoAfkModule extends Module {
public final Value<Integer> yawOffset = new Value<Integer>("Yaw", new String[]{"yaw", "y"}, "The yaw to alternate each tick.", 1, 0, 180, 1);
public final Value<Integer> pitchOffset = new Value<Integer>("Pitch", new String[]{"pitch", "x"}, "The pitch to alternate each tick.", 0, 0, 90, 1);
public NoAfkModule() {
super("NoAFK", new String[]{"AntiAFK"}, "Prevents you from being kicked while idle", "NONE", -1, ModuleType.MISC);
@ -29,12 +28,7 @@ public final class NoAfkModule extends Module {
final Minecraft mc = Minecraft.getMinecraft();
float yaw = mc.player.rotationYaw;
float pitch = mc.player.rotationPitch;
if (this.yawOffset.getValue() > 0) {
yaw += (this.yawOffset.getValue() * Math.sin(mc.player.ticksExisted / Math.PI));
}
if (this.pitchOffset.getValue() > 0) {
pitch += (this.pitchOffset.getValue() * Math.sin(mc.player.ticksExisted / Math.PI));
}
yaw += (this.yawOffset.getValue() * Math.sin(mc.player.ticksExisted / Math.PI));
Seppuku.INSTANCE.getRotationManager().setPlayerRotations(yaw, pitch);
}
}
@ -45,12 +39,7 @@ public final class NoAfkModule extends Module {
if (event.getPacket() instanceof CPacketPlayer.Rotation) {
if (Minecraft.getMinecraft().player.getRidingEntity() != null) {
final CPacketPlayer.Rotation packet = (CPacketPlayer.Rotation) event.getPacket();
if (this.yawOffset.getValue() > 0) {
packet.yaw += (this.yawOffset.getValue() * Math.sin(Minecraft.getMinecraft().player.ticksExisted / Math.PI));
}
if (this.pitchOffset.getValue() > 0) {
packet.pitch += (this.pitchOffset.getValue() * Math.sin(Minecraft.getMinecraft().player.ticksExisted / Math.PI));
}
packet.yaw += (this.yawOffset.getValue() * Math.sin(Minecraft.getMinecraft().player.ticksExisted / Math.PI));
}
}
}

View File

@ -17,7 +17,6 @@ import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.item.EntityTNTPrimed;
import net.minecraft.entity.projectile.EntityWitherSkull;
import net.minecraft.init.SoundEvents;
import net.minecraft.network.play.server.SPacketParticles;
import net.minecraft.network.play.server.SPacketSoundEffect;
import net.minecraft.network.play.server.SPacketSpawnMob;
import net.minecraft.tileentity.TileEntity;

View File

@ -0,0 +1,185 @@
package me.rigamortis.seppuku.impl.module.render;
import me.rigamortis.seppuku.Seppuku;
import me.rigamortis.seppuku.api.event.render.EventRender3D;
import me.rigamortis.seppuku.api.event.render.EventRenderBlockModel;
import me.rigamortis.seppuku.api.event.world.EventLoadWorld;
import me.rigamortis.seppuku.api.module.Module;
import me.rigamortis.seppuku.api.util.ColorUtil;
import me.rigamortis.seppuku.api.util.RenderUtil;
import me.rigamortis.seppuku.api.value.Value;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import team.stiff.pomelo.impl.annotated.handler.annotation.Listener;
import java.util.ArrayList;
import java.util.List;
/**
* @author noil
* <p>
* this will be worked on much more
* just trying to get a smooth working version out
*/
public final class SearchModule extends Module {
private List<Integer> ids = new ArrayList<>();
private List<Vec3d> blocks = new ArrayList<>(512);
public final Value<Integer> range = new Value<Integer>("Range", new String[]{"radius"}, "The range(m) to render search blocks.", 128, 0, 512, 1);
public final Value<Integer> limit = new Value<Integer>("Limit", new String[]{"max"}, "The maximum amount of blocks that can be rendered.", 3000, 0, 9000, 1);
public final Value<Integer> alpha = new Value<Integer>("Alpha", new String[]{"opacity"}, "Alpha value for the search bounding box.", 127, 0, 255, 1);
public final Value<Float> width = new Value<Float>("Width", new String[]{"size"}, "Line width of the search bounding box.", 1.0f, 0.0f, 5.0f, 0.1f);
public SearchModule() {
super("Search", new String[]{"srch", "find", "locate"}, "Search for different types of blocks. Enter the \"search\" command.", "NONE", -1, ModuleType.RENDER);
if (Seppuku.INSTANCE.getConfigManager().isFirstLaunch())
this.add("furnace");
}
@Listener
public void onLoadWorld(EventLoadWorld event) {
if (event.getWorld() != null) {
this.blocks.clear();
}
}
@Listener
public void onDrawWorld(EventRender3D event) {
final Minecraft mc = Minecraft.getMinecraft();
RenderUtil.begin3D();
for (int i = this.blocks.size() - 1; i >= 0; i--) {
Vec3d searchBlock = this.blocks.get(i);
BlockPos blockPos = new BlockPos(searchBlock.x, searchBlock.y, searchBlock.z);
Block block = mc.world.getBlockState(blockPos).getBlock();
if (this.contains(block.getLocalizedName()) && mc.player.getDistance(searchBlock.x, searchBlock.y, searchBlock.z) < this.range.getValue()) {
final AxisAlignedBB bb = this.boundingBoxForBlock(blockPos);
RenderUtil.drawBoundingBox(bb, this.width.getValue(), ColorUtil.changeAlpha(mc.world.getBlockState(blockPos).getMaterial().getMaterialMapColor().colorValue, this.alpha.getValue()));
} else {
this.blocks.remove(searchBlock);
}
}
RenderUtil.end3D();
}
@Listener
public void onRenderBlock(EventRenderBlockModel event) {
final BlockPos pos = event.getBlockPos();
final IBlockState blockState = event.getBlockState();
if (this.contains(blockState.getBlock().getLocalizedName()) && !this.isPosCached(pos.getX(), pos.getY(), pos.getZ()) && this.blocks.size() < this.limit.getValue()) {
this.blocks.add(new Vec3d(pos));
}
}
@Override
public void onEnable() {
this.blocks.clear();
super.onEnable();
}
@Override
public void onToggle() {
super.onToggle();
Minecraft.getMinecraft().renderGlobal.loadRenderers();
}
private boolean isPosCached(int x, int y, int z) {
for (int i = this.blocks.size() - 1; i >= 0; i--) {
Vec3d searchBlock = this.blocks.get(i);
if (searchBlock.x == x && searchBlock.y == y && searchBlock.z == z)
return true;
}
return false;
}
private AxisAlignedBB boundingBoxForBlock(BlockPos blockPos) {
final Minecraft mc = Minecraft.getMinecraft();
return new AxisAlignedBB(
blockPos.getX() - mc.getRenderManager().viewerPosX,
blockPos.getY() - mc.getRenderManager().viewerPosY,
blockPos.getZ() - mc.getRenderManager().viewerPosZ,
blockPos.getX() + 1 - mc.getRenderManager().viewerPosX,
blockPos.getY() + 1 - mc.getRenderManager().viewerPosY,
blockPos.getZ() + 1 - mc.getRenderManager().viewerPosZ);
}
public void updateRenders() {
//mc.renderGlobal.loadRenderers();
final Minecraft mc = Minecraft.getMinecraft();
mc.renderGlobal.markBlockRangeForRenderUpdate(
(int) mc.player.posX - 256,
(int) mc.player.posY - 256,
(int) mc.player.posZ - 256,
(int) mc.player.posX + 256,
(int) mc.player.posY + 256,
(int) mc.player.posZ + 256);
}
public boolean contains(int id) {
return this.ids.contains(id);
}
public boolean contains(String localizedName) {
final Block blockFromName = Block.getBlockFromName(localizedName);
if (blockFromName != null) {
return contains(Block.getIdFromBlock(blockFromName));
}
return false;
}
public void add(int id) {
if (!contains(id)) {
this.ids.add(id);
}
}
public void add(String name) {
final Block blockFromName = Block.getBlockFromName(name);
if (blockFromName != null) {
final int id = Block.getIdFromBlock(blockFromName);
if (!contains(id)) {
this.ids.add(id);
}
}
}
public void remove(int id) {
for (Integer i : this.ids) {
if (id == i) {
this.ids.remove(i);
break;
}
}
}
public void remove(String name) {
final Block blockFromName = Block.getBlockFromName(name);
if (blockFromName != null) {
final int id = Block.getIdFromBlock(blockFromName);
if (contains(id)) {
this.ids.remove(id);
}
}
}
public int clear() {
final int count = this.ids.size();
this.ids.clear();
return count;
}
public List<Integer> getIds() {
return ids;
}
public void setIds(List<Integer> ids) {
this.ids = ids;
}
}

View File

@ -31,7 +31,7 @@ public final class StorageESPModule extends Module {
public final Value<Boolean> nametag = new Value<Boolean>("Nametag", new String[]{"Nametag", "Tag", "Tags", "Ntag", "name", "names"}, "Renders the name of the drawn storage object.", false);
public final Value<Integer> opacity = new Value<Integer>("Opacity", new String[]{"Opacity", "Transparency", "Alpha"}, "Opacity of the rendered esp.", 128, 0, 255, 1);
private ICamera camera = new Frustum();
private final ICamera camera = new Frustum();
public StorageESPModule() {
super("Storage", new String[]{"StorageESP", "ChestFinder", "ChestESP"}, "Highlights different types of storage entities.", "NONE", -1, ModuleType.RENDER);
@ -77,19 +77,21 @@ public final class StorageESPModule extends Module {
if (this.isTileStorage(te)) {
final AxisAlignedBB bb = this.boundingBoxForEnt(te);
if (bb != null) {
RenderUtil.drawFilledBox(bb, ColorUtil.changeAlpha(this.getColor(te), this.opacity.getValue()));
RenderUtil.drawBoundingBox(bb, 1.5f, ColorUtil.changeAlpha(this.getColor(te), this.opacity.getValue()));
/*camera.setPosition(mc.getRenderViewEntity().posX, mc.getRenderViewEntity().posY, mc.getRenderViewEntity().posZ);
//RenderUtil.drawFilledBox(bb, ColorUtil.changeAlpha(this.getColor(te), this.opacity.getValue()));
//RenderUtil.drawBoundingBox(bb, 1.5f, ColorUtil.changeAlpha(this.getColor(te), this.opacity.getValue()));
if (mc.getRenderViewEntity() != null) {
camera.setPosition(mc.getRenderViewEntity().posX, mc.getRenderViewEntity().posY, mc.getRenderViewEntity().posZ);
if (camera.isBoundingBoxInFrustum(new AxisAlignedBB(bb.minX + mc.getRenderManager().viewerPosX,
bb.minY + mc.getRenderManager().viewerPosY,
bb.minZ + mc.getRenderManager().viewerPosZ,
bb.maxX + mc.getRenderManager().viewerPosX,
bb.maxY + mc.getRenderManager().viewerPosY,
bb.maxZ + mc.getRenderManager().viewerPosZ))) {
RenderUtil.drawFilledBox(bb, ColorUtil.changeAlpha(this.getColor(te), this.opacity.getValue()));
RenderUtil.drawBoundingBox(bb, 1.5f, ColorUtil.changeAlpha(this.getColor(te), this.opacity.getValue()));
}*/
if (camera.isBoundingBoxInFrustum(new AxisAlignedBB(bb.minX + mc.getRenderManager().viewerPosX,
bb.minY + mc.getRenderManager().viewerPosY,
bb.minZ + mc.getRenderManager().viewerPosZ,
bb.maxX + mc.getRenderManager().viewerPosX,
bb.maxY + mc.getRenderManager().viewerPosY,
bb.maxZ + mc.getRenderManager().viewerPosZ))) {
RenderUtil.drawFilledBox(bb, ColorUtil.changeAlpha(this.getColor(te), this.opacity.getValue()));
RenderUtil.drawBoundingBox(bb, 1.5f, ColorUtil.changeAlpha(this.getColor(te), this.opacity.getValue()));
}
}
}
}
}

View File

@ -25,7 +25,6 @@ public final class XrayModule extends Module {
public XrayModule() {
super("Xray", new String[]{"JadeVision", "Jade"}, "Allows you to filter what the world renders", "NONE", -1, ModuleType.RENDER);
this.setHidden(true);
if (Seppuku.INSTANCE.getConfigManager().isFirstLaunch())
this.add("diamond_ore");
@ -34,6 +33,7 @@ public final class XrayModule extends Module {
@Override
public void onEnable() {
super.onEnable();
final Minecraft mc = Minecraft.getMinecraft();
lastGamma = mc.gameSettings.gammaSetting;
lastAO = mc.gameSettings.ambientOcclusion;
@ -45,6 +45,7 @@ public final class XrayModule extends Module {
@Override
public void onDisable() {
super.onDisable();
Minecraft.getMinecraft().gameSettings.gammaSetting = lastGamma;
Minecraft.getMinecraft().gameSettings.ambientOcclusion = lastAO;
}
@ -52,6 +53,7 @@ public final class XrayModule extends Module {
@Override
public void onToggle() {
super.onToggle();
Minecraft.getMinecraft().renderGlobal.loadRenderers();
}

View File

@ -3,7 +3,6 @@ package me.rigamortis.seppuku.impl.module.ui;
import me.rigamortis.seppuku.Seppuku;
import me.rigamortis.seppuku.api.module.Module;
import me.rigamortis.seppuku.api.value.Value;
import me.rigamortis.seppuku.impl.gui.hud.GuiHudEditor;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.util.ResourceLocation;

View File

@ -1,8 +1,8 @@
package me.rigamortis.seppuku.impl.patch;
import me.rigamortis.seppuku.Seppuku;
import me.rigamortis.seppuku.api.event.player.EventGetMouseOver;
import me.rigamortis.seppuku.api.event.player.EventFovModifier;
import me.rigamortis.seppuku.api.event.player.EventGetMouseOver;
import me.rigamortis.seppuku.api.event.render.EventHurtCamEffect;
import me.rigamortis.seppuku.api.event.render.EventOrientCamera;
import me.rigamortis.seppuku.api.event.render.EventRender2D;