diff --git a/README.md b/README.md index c0b82b3..53b9c0d 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,30 @@ +![minecraft](https://img.shields.io/badge/Minecraft-1.12.2-blue.svg) +[![discord](https://img.shields.io/badge/Discord-JK2Zz2CDpM-8080c0)](https://discord.gg/AdFEggFXfW) + # Infinity Loop Client ![Logo](https://github.com/KuroHere/InfinityLoop/blob/master/src/main/resources/assets/loop/imgs/logotransparent.png) -~~Everything is CUSTOM!!~~ +## Info: +- Minecraft version: forge 1.12.2 +- Client version: v6.9.4.20 +- Default ClickGui keybind - **"P"** +- Default prefix - **"."** + +## Showcase: +
+ Images + + ![](will have soon!) + + ![](will have soon!) + +
+ +## A couple of words to say: -### **Very good client** +- This is oyvey paste, meme mod was made by me(**Kuro_Here**). +- 90% code is from other opensrc mod. +- Don't expect too much from this mod. -only make render module! \ No newline at end of file +`fck u guys` diff --git a/build.gradle b/build.gradle index 8ca7feb..38a9ccf 100644 --- a/build.gradle +++ b/build.gradle @@ -1,50 +1,50 @@ buildscript { repositories { + mavenCentral() jcenter() - maven { url = "https://files.minecraftforge.net/maven" } - maven { url = "https://repo.spongepowered.org/maven" } + maven { + name = "lukflug" + url = "https://lukflug.github.io/maven/" + } + maven { + name = 'forge' + url = 'https://files.minecraftforge.net/maven' + } + maven { + name = 'SpongePowered' + url = 'https://repo.spongepowered.org/repository/maven-public' + } } dependencies { classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT' classpath 'org.spongepowered:mixingradle:0.6-SNAPSHOT' - classpath 'com.github.jengelman.gradle.plugins:shadow:4.0.3' - classpath group: 'org.jetbrains.kotlin', name: 'kotlin-gradle-plugin', version: "${kotlin_version}" + classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.4' + classpath 'com.peterabeles.gversion:com.peterabeles.gversion.gradle.plugin:1.5.0' } } -apply plugin: 'kotlin' + apply plugin: 'net.minecraftforge.gradle.forge' apply plugin: 'org.spongepowered.mixin' apply plugin: 'com.github.johnrengelman.shadow' +apply plugin: 'com.peterabeles.gversion' apply plugin: 'java' compileJava.options.encoding = 'UTF-8' version project.modVersion group project.modGroup //http://maven.apache.org/guides/mini/guide-naming-conventions.html -archivesBaseName = "loop" +archivesBaseName = "infinityloop" sourceCompatibility = targetCompatibility = '1.8' compileJava { sourceCompatibility = targetCompatibility = '1.8' } -compileKotlin { - kotlinOptions { - jvmTarget = "1.8" - } -} - -compileTestKotlin { - kotlinOptions { - jvmTarget = "1.8" - } -} - minecraft { - version = '1.12.2-14.23.5.2847' + version = project.forgeVersion runDir = 'run' - mappings = 'stable_39' - coreMod = 'com.me.infinity.loop.mixin.LoopMixinLoader' + mappings = project.mcpVersion + coreMod = 'infinityloop.mixin.LoopMixinLoader' makeObfSourceJar = false } @@ -85,14 +85,6 @@ dependencies { compile 'com.github.ionar2:Alpine:1.9f' compile 'club.minnced:java-discord-rpc:2.0.2' compile 'com.googlecode.json-simple:json-simple:1.1.1' - - compile group: "org.jetbrains.kotlin", name: "kotlin-stdlib", version: kotlin_version - compile group: "org.jetbrains.kotlin", name: "kotlin-stdlib-jdk7", version: kotlin_version - compile group: "org.jetbrains.kotlin", name: "kotlin-stdlib-jdk8", version: kotlin_version - compile group: "org.jetbrains.kotlin", name: "kotlin-reflect", version: kotlin_version - - compile group: "org.jetbrains.kotlinx", name: "kotlinx-coroutines-core", version: coroutines_version - compile group: "org.jetbrains.kotlinx", name: "kotlinx-coroutines-jdk8", version: coroutines_version } processResources { @@ -115,13 +107,7 @@ shadowJar { include(dependency('club.minnced:java-discord-rpc')) include(dependency('com.googlecode.json-simple:json-simple:1.1.1')) include(dependency('org.spongepowered:mixin')) - include(dependency("org.jetbrains.kotlin:kotlin-stdlib:${kotlin_version}")) - include(dependency("org.jetbrains.kotlin:kotlin-stdlib-jdk7:${kotlin_version}")) - include(dependency("org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlin_version}")) - include(dependency("org.jetbrains.kotlin:kotlin-reflect:${kotlin_version}")) include(dependency("org.jetbrains:annotations:${annotations_version}")) - include(dependency("org.jetbrains.kotlinx:kotlinx-coroutines-core:${coroutines_version}")) - include(dependency("org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:${coroutines_version}")) } exclude 'dummyThing' exclude 'LICENSE.txt' @@ -130,7 +116,7 @@ shadowJar { mixin { defaultObfuscationEnv searge - add sourceSets.main, 'mixins.loop.refmap.json' + add sourceSets.main, 'mixins.infinityloop.refmap.json' } @@ -144,11 +130,11 @@ reobf { jar { manifest { attributes( - 'MixinConfigs': 'mixins.loop.json', + 'MixinConfigs': 'mixins.infinityloop.json', 'tweakClass': 'org.spongepowered.asm.launch.MixinTweaker', 'TweakOrder': 0, 'FMLCorePluginContainsFMLMod': 'true', - 'FMLCorePlugin': 'com.me.infinity.loop.mixin.LoopMixinLoader', + 'FMLCorePlugin': 'infinityloop.mixin.LoopMixinLoader', 'ForceLoadAsMod': 'true', 'FMLAT': 'loop_at.cfg' ) diff --git a/src/main/java/com/me/infinity/loop/event/Event.java b/src/main/java/com/me/infinity/loop/event/Event.java deleted file mode 100644 index e06b875..0000000 --- a/src/main/java/com/me/infinity/loop/event/Event.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.me.infinity.loop.event; - -public abstract class Event - extends net.minecraftforge.fml.common.eventhandler.Event { - private boolean cancelled; - private Stage stage; - - public Event() { - } - - public Event(Stage stage) { - this.stage = stage; - } - - public Stage getStage() { - return this.stage; - } - - public boolean isCancelled() { - return this.cancelled; - } - - public void setCancelled(final boolean cancel) { - this.cancelled = cancel; - } - - public boolean isPre() { - return this.stage == Stage.PRE; - } - - public boolean isPost() { - return this.stage == Stage.POST; - } - - public static enum Stage { - PRE, - POST - - } - -} - diff --git a/src/main/java/com/me/infinity/loop/event/events/network/EventDeath.java b/src/main/java/com/me/infinity/loop/event/events/network/EventDeath.java deleted file mode 100644 index ac81c03..0000000 --- a/src/main/java/com/me/infinity/loop/event/events/network/EventDeath.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.me.infinity.loop.event.events.network; - -import com.me.infinity.loop.event.Event; -import net.minecraft.entity.player.EntityPlayer; - -public class EventDeath - extends Event { - public EntityPlayer player; - - public EventDeath(EntityPlayer player) { - this.player = player; - } -} - diff --git a/src/main/java/com/me/infinity/loop/event/events/network/EventPacket.java b/src/main/java/com/me/infinity/loop/event/events/network/EventPacket.java deleted file mode 100644 index e23d75f..0000000 --- a/src/main/java/com/me/infinity/loop/event/events/network/EventPacket.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.me.infinity.loop.event.events.network; - -import com.me.infinity.loop.event.Event; -import net.minecraft.network.Packet; - -public class EventPacket - extends Event { - public Packet packet; - - public EventPacket(Event.Stage stage, Packet packet) { - super(stage); - this.packet = packet; - } - public void setPacket(final Packet packet) { - this.packet = packet; - } - - - public Packet getPacket() { - return this.packet; - } - - public static class Receive - extends EventPacket { - public Receive(Event.Stage stage, Packet packet) { - super(stage, packet); - } - } - - public static class Send - extends EventPacket { - public Send(Event.Stage stage, Packet packet) { - super(stage, packet); - } - } -} \ No newline at end of file diff --git a/src/main/java/com/me/infinity/loop/event/events/network/EventReceivePacket.java b/src/main/java/com/me/infinity/loop/event/events/network/EventReceivePacket.java deleted file mode 100644 index 8feff99..0000000 --- a/src/main/java/com/me/infinity/loop/event/events/network/EventReceivePacket.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.me.infinity.loop.event.events.network; - -import com.me.infinity.loop.event.Event; -import net.minecraft.network.Packet; - -public class EventReceivePacket - extends Event { - private Packet packet; - - public EventReceivePacket(Packet packet) { - this.packet = packet; - } - - public Packet getPacket() { - return this.packet; - } - - public void setPacket(Packet packet) { - this.packet = packet; - } -} diff --git a/src/main/java/com/me/infinity/loop/event/events/network/StepEvent.java b/src/main/java/com/me/infinity/loop/event/events/network/StepEvent.java deleted file mode 100644 index a208ad2..0000000 --- a/src/main/java/com/me/infinity/loop/event/events/network/StepEvent.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.me.infinity.loop.event.events.network; - -import com.me.infinity.loop.event.Event; -import net.minecraft.entity.Entity; -import net.minecraftforge.fml.common.eventhandler.Cancelable; - -@Cancelable -public class StepEvent - extends Event { - private final Entity entity; - private float height; - - public StepEvent(Stage stage, Entity entity) { - super(stage); - this.entity = entity; - this.height = entity.stepHeight; - } - - public Entity getEntity() { - return this.entity; - } - - public float getHeight() { - return this.height; - } - - public void setHeight(float height) { - this.height = height; - } -} diff --git a/src/main/java/com/me/infinity/loop/event/events/player/EventEntityMove.java b/src/main/java/com/me/infinity/loop/event/events/player/EventEntityMove.java deleted file mode 100644 index 21e54c7..0000000 --- a/src/main/java/com/me/infinity/loop/event/events/player/EventEntityMove.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.me.infinity.loop.event.events.player; - -import net.minecraft.entity.Entity; -import net.minecraft.util.math.Vec3d; -import net.minecraftforge.fml.common.eventhandler.Event; - -public class EventEntityMove extends Event { - private Entity ctx; - private Vec3d from; - - public EventEntityMove(Entity ctx, Vec3d from) { - this.ctx = ctx; - this.from = from; - } - - public Vec3d from() { - return this.from; - } - - public Entity ctx() { - return this.ctx; - } -} diff --git a/src/main/java/com/me/infinity/loop/event/events/player/EventKey.java b/src/main/java/com/me/infinity/loop/event/events/player/EventKey.java deleted file mode 100644 index b296e19..0000000 --- a/src/main/java/com/me/infinity/loop/event/events/player/EventKey.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.me.infinity.loop.event.events.player; - -import com.me.infinity.loop.event.Event; - -public class EventKey - extends Event { - public boolean info; - public boolean pressed; - - public EventKey(boolean info, boolean pressed) { - this.info = info; - this.pressed = pressed; - } -} diff --git a/src/main/java/com/me/infinity/loop/event/events/player/EventMotionUpdate.java b/src/main/java/com/me/infinity/loop/event/events/player/EventMotionUpdate.java deleted file mode 100644 index 5b38578..0000000 --- a/src/main/java/com/me/infinity/loop/event/events/player/EventMotionUpdate.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.me.infinity.loop.event.events.player; - -import com.me.infinity.loop.event.Event; - -public class EventMotionUpdate - extends Event { - public EventMotionUpdate(Stage stage) { - super(stage); - } -} - diff --git a/src/main/java/com/me/infinity/loop/event/events/player/EventPlayerMove.java b/src/main/java/com/me/infinity/loop/event/events/player/EventPlayerMove.java deleted file mode 100644 index eae1def..0000000 --- a/src/main/java/com/me/infinity/loop/event/events/player/EventPlayerMove.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.me.infinity.loop.event.events.player; - -import com.me.infinity.loop.event.Event; -import net.minecraft.entity.MoverType; - -public class EventPlayerMove extends Event { - public MoverType type; - public double x; - public double y; - public double z; - - public EventPlayerMove(MoverType type, double x, double y, double z) { - this.type = type; - this.x = x; - this.y = y; - this.z = z; - } - - public void setType(final MoverType type) { - this.type = type; - } - - public void setX(final double x) { - this.x = x; - } - - public void setY(final double y) { - this.y = y; - } - - public void setZ(final double z) { - this.z = z; - } - - public MoverType getType() { - return this.type; - } - - public double getX() { - return this.x; - } - - public double getY() { - return this.y; - } - - public double getZ() { - return this.z; - } -} \ No newline at end of file diff --git a/src/main/java/com/me/infinity/loop/event/events/player/EventPlayerUpdate.java b/src/main/java/com/me/infinity/loop/event/events/player/EventPlayerUpdate.java deleted file mode 100644 index ebe9f33..0000000 --- a/src/main/java/com/me/infinity/loop/event/events/player/EventPlayerUpdate.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.me.infinity.loop.event.events.player; - - -import com.me.infinity.loop.event.Event; -public class EventPlayerUpdate - extends Event { -} diff --git a/src/main/java/com/me/infinity/loop/event/events/player/TransformFirstPersonEvent.java b/src/main/java/com/me/infinity/loop/event/events/player/TransformFirstPersonEvent.java deleted file mode 100644 index e2f57dc..0000000 --- a/src/main/java/com/me/infinity/loop/event/events/player/TransformFirstPersonEvent.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.me.infinity.loop.event.events.player; - -import com.me.infinity.loop.event.Event; -import net.minecraft.util.EnumHandSide; - -public class TransformFirstPersonEvent extends Event -{ - private final EnumHandSide enumHandSide; - - public TransformFirstPersonEvent(final Stage stage, final EnumHandSide enumHandSide) { - super(stage); - this.enumHandSide = enumHandSide; - } - - public EnumHandSide getEnumHandSide() { - return this.enumHandSide; - } -} diff --git a/src/main/java/com/me/infinity/loop/event/events/render/EventBlockRender.java b/src/main/java/com/me/infinity/loop/event/events/render/EventBlockRender.java deleted file mode 100644 index 3dd8b18..0000000 --- a/src/main/java/com/me/infinity/loop/event/events/render/EventBlockRender.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.me.infinity.loop.event.events.render; - -import net.minecraft.block.Block; -import net.minecraft.util.math.BlockPos; -import net.minecraftforge.fml.common.eventhandler.Cancelable; -import net.minecraftforge.fml.common.eventhandler.Event; - -@Cancelable -public class EventBlockRender extends Event { - private Block block; - private BlockPos pos; - - public EventBlockRender(Block block, BlockPos pos) { - this.block = block; - this.pos = pos; - } - - public Block getBlock() { - return block; - } - - public BlockPos getPos() { - return pos; - } -} diff --git a/src/main/java/com/me/infinity/loop/event/events/render/PerspectiveEvent.java b/src/main/java/com/me/infinity/loop/event/events/render/PerspectiveEvent.java deleted file mode 100644 index ea226fb..0000000 --- a/src/main/java/com/me/infinity/loop/event/events/render/PerspectiveEvent.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.me.infinity.loop.event.events.render; - -import com.me.infinity.loop.event.Event; - -public class PerspectiveEvent extends Event -{ - private float aspect; - - public PerspectiveEvent(final float aspect) { - this.aspect = aspect; - } - - public float getAspect() { - return this.aspect; - } - - public void setAspect(final float aspect) { - this.aspect = aspect; - } -} diff --git a/src/main/java/com/me/infinity/loop/event/events/render/PreRenderEvent.java b/src/main/java/com/me/infinity/loop/event/events/render/PreRenderEvent.java deleted file mode 100644 index 9538251..0000000 --- a/src/main/java/com/me/infinity/loop/event/events/render/PreRenderEvent.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.me.infinity.loop.event.events.render; - -import net.minecraftforge.fml.common.eventhandler.Event; - -public class PreRenderEvent extends Event { - - - private final float partialTicks; - - public PreRenderEvent(float partialTicks) { - this.partialTicks = partialTicks; - } - - public float getPartialTicks() { - return this.partialTicks; - } -} diff --git a/src/main/java/com/me/infinity/loop/event/events/render/RenderEvent.java b/src/main/java/com/me/infinity/loop/event/events/render/RenderEvent.java deleted file mode 100644 index a42ac9b..0000000 --- a/src/main/java/com/me/infinity/loop/event/events/render/RenderEvent.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.me.infinity.loop.event.events.render; - -import com.me.infinity.loop.event.Event; - -public class RenderEvent extends Event { - - private final float partialTicks; - - public RenderEvent(float partialTicks) { - super(); - this.partialTicks = partialTicks; - } - - public float getPartialTicks() { - return this.partialTicks; - } -} diff --git a/src/main/java/com/me/infinity/loop/event/events/world/DrawBlockDamageEvent.java b/src/main/java/com/me/infinity/loop/event/events/world/DrawBlockDamageEvent.java deleted file mode 100644 index bdbfeb3..0000000 --- a/src/main/java/com/me/infinity/loop/event/events/world/DrawBlockDamageEvent.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.me.infinity.loop.event.events.world; - -import com.me.infinity.loop.event.Event; - -public class DrawBlockDamageEvent extends Event { - //What do you expect to find here? -} diff --git a/src/main/java/com/me/infinity/loop/event/events/world/EventBlock.java b/src/main/java/com/me/infinity/loop/event/events/world/EventBlock.java deleted file mode 100644 index 6aaf48d..0000000 --- a/src/main/java/com/me/infinity/loop/event/events/world/EventBlock.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.me.infinity.loop.event.events.world; - -import com.me.infinity.loop.event.Event; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; - -public class EventBlock - extends Event { - public BlockPos pos; - public EnumFacing facing; - - public EventBlock(BlockPos pos, EnumFacing facing) { - this.pos = pos; - this.facing = facing; - } - - public BlockPos getPos() { - return this.pos; - } -} diff --git a/src/main/java/com/me/infinity/loop/event/events/world/EventClickBlock.java b/src/main/java/com/me/infinity/loop/event/events/world/EventClickBlock.java deleted file mode 100644 index 7206f67..0000000 --- a/src/main/java/com/me/infinity/loop/event/events/world/EventClickBlock.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.me.infinity.loop.event.events.world; - -import com.me.infinity.loop.event.Event; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; - -public class EventClickBlock - extends Event { - public BlockPos pos; - public EnumFacing facing; - - public EventClickBlock(BlockPos pos, EnumFacing facing) { - this.pos = pos; - this.facing = facing; - } - - public BlockPos getPos() { - return this.pos; - } -} diff --git a/src/main/java/com/me/infinity/loop/features/command/commands/SearchCommand.java b/src/main/java/com/me/infinity/loop/features/command/commands/SearchCommand.java deleted file mode 100644 index 13d0872..0000000 --- a/src/main/java/com/me/infinity/loop/features/command/commands/SearchCommand.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.me.infinity.loop.features.command.commands; - -import com.me.infinity.loop.features.command.Command; -import com.me.infinity.loop.features.modules.render.Search; -import com.mojang.realmsclient.gui.ChatFormatting; -import net.minecraft.block.Block; -import net.minecraft.util.ResourceLocation; - -public class SearchCommand extends Command { - - public SearchCommand() { - super("search"); - } - - @Override - public void execute(String[] commands) { - if (commands.length == 1) { - if (Search.defaultBlocks.isEmpty()) { - sendMessage("Search list empty"); - } else { - String f = "Search list: "; - for (Block name : Search.defaultBlocks) { - try { - f = f + name.getRegistryName() + ", "; - } catch (Exception exception) { - } - } - sendMessage(f); - } - return; - } - if (commands.length == 2) { - if ("reset".equals(commands[0])) { - Search.defaultBlocks.clear(); - sendMessage("Search got reset."); - mc.renderGlobal.loadRenderers(); - return; - } - return; - } - - if (commands.length >= 2) { - switch (commands[0]) { - case "add": { - Search.defaultBlocks.add(getRegisteredBlock(commands[1])); - sendMessage(ChatFormatting.GREEN + commands[1] + " added to search"); - mc.renderGlobal.loadRenderers(); - return; - } - case "del": { - Search.defaultBlocks.remove(getRegisteredBlock(commands[1])); - sendMessage(ChatFormatting.RED + commands[1] + " removed from search"); - mc.renderGlobal.loadRenderers(); - return; - } - } - sendMessage("Unknown Command, try search add/del "); - } - - } - - private static Block getRegisteredBlock(String blockName) { - return (Block)Block.REGISTRY.getObject(new ResourceLocation(blockName)); - } -} - diff --git a/src/main/java/com/me/infinity/loop/features/command/commands/loginCommand.java b/src/main/java/com/me/infinity/loop/features/command/commands/loginCommand.java deleted file mode 100644 index d6731cd..0000000 --- a/src/main/java/com/me/infinity/loop/features/command/commands/loginCommand.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.me.infinity.loop.features.command.commands; - -import com.me.infinity.loop.features.command.Command; -import com.me.infinity.loop.util.utils.Util; -import net.minecraft.client.Minecraft; -import net.minecraft.util.Session; - -import java.lang.reflect.Field; - -public class loginCommand extends Command { - - public loginCommand() { - super("login"); - } - - @Override - public void execute(String[] var1) { - try { - login(var1[0]); - Command.sendMessage("\n" + "Account changed to: " + Util.mc.getSession().getUsername()); - } - catch (Exception exception) { - Command.sendMessage("Usage: .login nick"); - } - } - - - public static void login(String string) { - try { - Field field = Minecraft.class.getDeclaredField("field_71449_j"); //session - field.setAccessible(true); - Field field2 = Field.class.getDeclaredField("modifiers"); - field2.setAccessible(true); - field2.setInt(field, field.getModifiers() & 0xFFFFFFEF); - field.set(Util.mc, new Session(string, "", "", "mojang")); - } - catch (Exception exception) { - Command.sendMessage("Wrong name! " + exception); - } - } - -} diff --git a/src/main/java/com/me/infinity/loop/features/csgui/CSClickGui.java b/src/main/java/com/me/infinity/loop/features/csgui/CSClickGui.java deleted file mode 100644 index 1d1a464..0000000 --- a/src/main/java/com/me/infinity/loop/features/csgui/CSClickGui.java +++ /dev/null @@ -1,158 +0,0 @@ -package com.me.infinity.loop.features.csgui; - -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.features.Feature; -import com.me.infinity.loop.features.gui.components.Component; -import com.me.infinity.loop.features.gui.components.items.Item; -import com.me.infinity.loop.features.gui.components.items.buttons.ModuleButton; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.modules.client.CSGui; -import com.me.infinity.loop.util.utils.renders.ColorUtil; -import com.me.infinity.loop.util.utils.renders.RenderUtil; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.gui.ScaledResolution; -import org.lwjgl.input.Mouse; - -import java.awt.*; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Comparator; - -public class CSClickGui - extends GuiScreen { - private static CSClickGui INSTANCE; - private int color; - public boolean drag; - private int x; - private int y; - private int x2; - private int y2; - - static { - INSTANCE = new CSClickGui(); - } - - private final ArrayList components = new ArrayList(); - - public CSClickGui() { - this.setInstance(); - this.load(); - } - - public static CSClickGui getInstance() { - if (INSTANCE == null) { - INSTANCE = new CSClickGui(); - } - return INSTANCE; - } - - public static CSClickGui getCSGui() { - return CSClickGui.getInstance(); - } - - private void setInstance() { - INSTANCE = this; - } - - private void load() { - int x = -85; - for (final ModuleCategory category : InfinityLoop.moduleManager.getCategories()) { - this.components.add(new Component(category.getName(), x += 92, 27, true) { - - @Override - public void setupItems() { - InfinityLoop.moduleManager.getModulesByCategory(category).forEach(module -> { - if (!module.hidden) { - this.addButton(new ModuleButton(module)); - } - }); - } - }); - } - this.components.forEach(components -> components.getItems().sort(Comparator.comparing(Feature::getName))); - } - - public void updateModule(final Module module) { - for (final Component component : this.components) { - for (final Item item : component.getItems()) { - if (item instanceof ModuleButton) { - final ModuleButton button = (ModuleButton) item; - final Module mod = button.getModule(); - if (module != null && module.equals(mod)) { - button.initSettings(); - break; - } - } - } - } - } - - public void drawScreen(int mouseX, int mouseY, float partialTicks) { - this.checkMouseWheel(); - final ScaledResolution sr = new ScaledResolution(this.mc); - if (CSGui.getInstance().background.getValue()) { - if (CSGui.getInstance().dark.getValue()) { - this.drawDefaultBackground(); - } - if (CSGui.getInstance().gradiant.getValue()) { - this.drawGradientRect(0, 0, sr.getScaledWidth(), sr.getScaledHeight() + CSGui.getInstance().gradiantHeight.getValue(), 0, new Color(CSGui.getInstance().red.getValue(), CSGui.getInstance().green.getValue(), CSGui.getInstance().blue.getValue(), CSGui.getInstance().hoverAlpha.getValue() / 2).getRGB()); - if (CSGui.getInstance().gradiant.getValue() || CSGui.getInstance().rainbow.getValue()) { - this.drawGradientRect(0, 0, sr.getScaledWidth(), sr.getScaledHeight() + CSGui.getInstance().gradiantHeight.getValue().intValue(), 0, (CSGui.getInstance()).rainbow.getValue().booleanValue() ? (((CSGui.getInstance()).rainbowModeA.getValue() == CSGui.rainbowModeArray.Up) ? ColorUtil.rainbow((CSGui.getInstance()).rainbowHue.getValue().intValue()).getRGB() : ColorUtil.rainbow((CSGui.getInstance()).rainbowHue.getValue().intValue(), CSGui.getInstance().hoverAlpha.getValue()).getRGB()) : this.color); - } - } - if (CSGui.getInstance().blur.getValue()) { - RenderUtil.drawBlurryRect(0, 0, sr.getScaledWidth(), sr.getScaledHeight(), CSGui.getInstance().blurAmount.getValue(), CSGui.getInstance().blurSize.getValue()); - } - } - this.components.forEach(components -> components.drawScreen(mouseX, mouseY, partialTicks)); - } - - public void mouseClicked(int mouseX, int mouseY, int clickedButton) { - this.components.forEach(components -> components.mouseClicked(mouseX, mouseY, clickedButton)); - } - - public void mouseReleased(int mouseX, int mouseY, int releaseButton) { - this.components.forEach(components -> components.mouseReleased(mouseX, mouseY, releaseButton)); - } - - public boolean doesGuiPauseGame() { - return false; - } - - public final ArrayList getComponents() { - return this.components; - } - - public void checkMouseWheel() { - int dWheel = Mouse.getDWheel(); - if (dWheel < 0) { - this.components.forEach(component -> component.setY(component.getY() - 10)); - } else if (dWheel > 0) { - this.components.forEach(component -> component.setY(component.getY() + 10)); - } - } - - public int getTextOffset() { - return -6; - } - - public Component getComponentByName(String name) { - for (Component component : this.components) { - if (!component.getName().equalsIgnoreCase(name)) continue; - return component; - } - return null; - } - - public void keyTyped(char typedChar, int keyCode) throws IOException { - super.keyTyped(typedChar, keyCode); - this.components.forEach(component -> component.onKeyTyped(typedChar, keyCode)); - } - - static { - CSClickGui.INSTANCE = new CSClickGui(); - } -} - - diff --git a/src/main/java/com/me/infinity/loop/features/csgui/components/CSComponent.java b/src/main/java/com/me/infinity/loop/features/csgui/components/CSComponent.java deleted file mode 100644 index acfbe11..0000000 --- a/src/main/java/com/me/infinity/loop/features/csgui/components/CSComponent.java +++ /dev/null @@ -1,180 +0,0 @@ -package com.me.infinity.loop.features.csgui.components; - -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.features.Feature; -import com.me.infinity.loop.features.csgui.CSClickGui; -import com.me.infinity.loop.features.gui.components.items.Item; -import com.me.infinity.loop.features.gui.components.items.buttons.Button; -import com.me.infinity.loop.features.modules.client.CSGui; -import com.me.infinity.loop.features.modules.client.Colors; -import com.me.infinity.loop.util.utils.renders.ColorUtil; -import com.me.infinity.loop.util.utils.renders.RenderUtil; -import net.minecraft.client.audio.PositionedSoundRecord; -import net.minecraft.client.gui.Gui; -import net.minecraft.init.SoundEvents; - -import java.awt.*; -import java.util.ArrayList; - -public class CSComponent - extends Feature { - public static int[] counter1 = new int[]{1}; - private final ArrayList items = new ArrayList(); - public boolean drag; - private int x; - private int y; - private int x2; - private int y2; - private int width; - private int height; - private boolean open; - private boolean hidden = false; - - - public CSComponent(String name, int x, int y, boolean open) { - super(name); - this.x = x; - this.y = y; - this.width = 88; - this.height = 18; - this.open = open; - this.setupItems(); - } - - public void setupItems() { - } - - private void drag(int mouseX, int mouseY) { - if (!this.drag) { - return; - } - this.x = this.x2 + mouseX; - this.y = this.y2 + mouseY; - } - - public void drawScreen(int mouseX, int mouseY, float partialTicks) { - this.drag(mouseX, mouseY); - float totalItemHeight = this.open ? this.getTotalItemHeight() - 2.0f : 0.0f; - int color = ColorUtil.toARGB(CSGui.getInstance().topRed.getValue(), CSGui.getInstance().topGreen.getValue(), CSGui.getInstance().topBlue.getValue(), 255); - Gui.drawRect(this.x, this.y + height + 2, this.x + this.width, this.y + this.height - 6, new Color(0xFFFFFF).getRGB()); - Gui.drawRect(this.x, this.y - 1, this.x + this.width, this.y + this.height - 7, Colors.getInstance().rainbow.getValue() ? ColorUtil.rainbow(Colors.getInstance().rainbowHue.getValue()).getRGB() : color); - Gui.drawRect(this.x, this.y + height - 5, this.x + this.width, this.y + this.height - 6, new Color(0xFFFFFF).getRGB()); - InfinityLoop.textManager.drawStringWithShadow(this.getName(), (float) this.x + 3.0f, (float) this.y - 4.0f - (float) CSClickGui.getCSGui().getTextOffset(), -1); - if (this.open) { - RenderUtil.drawRect(this.x, (float) this.y + 12.5f, this.x + this.width, (float) (this.y + this.height) + totalItemHeight, 0x77000000); - float y = (float) (this.getY() + this.getHeight()) - 3.0f; - for (Item item : this.getItems()) { - CSComponent.counter1[0] = counter1[0] + 1; - if (item.isHidden()) continue; - item.setLocation((float) this.x + 2.0f, y); - item.setWidth(this.getWidth() - 4); - item.drawScreen(mouseX, mouseY, partialTicks); - y += (float) item.getHeight() + 1.5f; - } - } - } - - public void mouseClicked(int mouseX, int mouseY, int mouseButton) { - if (mouseButton == 0 && this.isHovering(mouseX, mouseY)) { - this.x2 = this.x - mouseX; - this.y2 = this.y - mouseY; - CSClickGui.getCSGui().getComponents().forEach(component -> { - if (component.drag) { - component.drag = false; - } - }); - this.drag = true; - return; - } - if (mouseButton == 1 && this.isHovering(mouseX, mouseY)) { - this.open = !this.open; - mc.getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0f)); - return; - } - if (!this.open) { - return; - } - this.getItems().forEach(item -> item.mouseClicked(mouseX, mouseY, mouseButton)); - } - - public void mouseReleased(int mouseX, int mouseY, int releaseButton) { - if (releaseButton == 0) { - this.drag = false; - } - if (!this.open) { - return; - } - this.getItems().forEach(item -> item.mouseReleased(mouseX, mouseY, releaseButton)); - } - - public void onKeyTyped(char typedChar, int keyCode) { - if (!this.open) { - return; - } - this.getItems().forEach(item -> item.onKeyTyped(typedChar, keyCode)); - } - - public void addButton(Button button) { - this.items.add(button); - } - - public int getX() { - return this.x; - } - - public void setX(int x) { - this.x = x; - } - - public int getY() { - return this.y; - } - - public void setY(int y) { - this.y = y; - } - - public int getWidth() { - return this.width; - } - - public void setWidth(int width) { - this.width = width; - } - - public int getHeight() { - return this.height; - } - - public void setHeight(int height) { - this.height = height; - } - - public boolean isHidden() { - return this.hidden; - } - - public void setHidden(boolean hidden) { - this.hidden = hidden; - } - - public boolean isOpen() { - return this.open; - } - - public final ArrayList getItems() { - return this.items; - } - - private boolean isHovering(int mouseX, int mouseY) { - return mouseX >= this.getX() && mouseX <= this.getX() + this.getWidth() && mouseY >= this.getY() && mouseY <= this.getY() + this.getHeight() - (this.open ? 2 : 0); - } - - private float getTotalItemHeight() { - float height = 0.0f; - for (Item item : this.getItems()) { - height += (float) item.getHeight() + 1.5f; - } - return height; - } - } diff --git a/src/main/java/com/me/infinity/loop/features/csgui/components/items/Item.java b/src/main/java/com/me/infinity/loop/features/csgui/components/items/Item.java deleted file mode 100644 index e1ac38b..0000000 --- a/src/main/java/com/me/infinity/loop/features/csgui/components/items/Item.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.me.infinity.loop.features.csgui.components.items; - -public class Item { -} diff --git a/src/main/java/com/me/infinity/loop/features/csgui/components/items/buttons/ColorPicker.java b/src/main/java/com/me/infinity/loop/features/csgui/components/items/buttons/ColorPicker.java deleted file mode 100644 index 7e21a60..0000000 --- a/src/main/java/com/me/infinity/loop/features/csgui/components/items/buttons/ColorPicker.java +++ /dev/null @@ -1,248 +0,0 @@ -package com.me.infinity.loop.features.csgui.components.items.buttons; - -import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.GuiScreen; -import org.lwjgl.input.Keyboard; -import org.lwjgl.opengl.GL11; - -import java.awt.*; -import java.io.IOException; - -public class ColorPicker extends GuiScreen { - - private final float[] color; - private boolean pickingColor; - private boolean pickingHue; - private boolean pickingAlpha; - private int pickerX, pickerY, pickerWidth, pickerHeight; - private int hueSliderX, hueSliderY, hueSliderWidth, hueSliderHeight; - private int alphaSliderX, alphaSliderY, alphaSliderWidth, alphaSliderHeight; - private float rainbowSpeed = 20.0f; - private boolean rainbowState = false; - - public ColorPicker() { - this.color = new float[] {0.4f, 1.0f, 1.0f, 1.0f}; - this.pickingColor = false; - } - - @Override - public void initGui() { - this.pickerWidth = 120; - this.pickerHeight = 100; - this.pickerX = this.width / 2 - pickerWidth/2; - this.pickerY = this.height / 2 - pickerHeight/2; - this.hueSliderX = pickerX; - this.hueSliderY = pickerY + pickerHeight + 6; - this.hueSliderWidth = pickerWidth; - this.hueSliderHeight = 10; - this.alphaSliderX = pickerX + pickerWidth + 6; - this.alphaSliderY = pickerY; - this.alphaSliderWidth = 10; - this.alphaSliderHeight = pickerHeight; - } - - @Override - public void drawScreen(int mouseX, int mouseY, float partialTicks) { - if (this.rainbowState) { - double rainbowState = Math.ceil((System.currentTimeMillis() + 200) / 20.0); - rainbowState %= 360.0; - this.color[0] = (float) (rainbowState / 360.0); - } - this.drawDefaultBackground(); - if (this.pickingHue) { - if (this.hueSliderWidth > this.hueSliderHeight) { - float restrictedX = (float) Math.min(Math.max(hueSliderX, mouseX), hueSliderX + hueSliderWidth); - this.color[0] = (restrictedX - (float) hueSliderX) / hueSliderWidth; - } else { - float restrictedY = (float) Math.min(Math.max(hueSliderY, mouseY), hueSliderY + hueSliderHeight); - this.color[0] = (restrictedY - (float) hueSliderY) / hueSliderHeight; - } - } - if (this.pickingAlpha) { - if (this.alphaSliderWidth > this.alphaSliderHeight) { - float restrictedX = (float) Math.min(Math.max(alphaSliderX, mouseX), alphaSliderX + alphaSliderWidth); - this.color[3] = 1 - (restrictedX - (float) alphaSliderX) / alphaSliderWidth; - } else { - float restrictedY = (float) Math.min(Math.max(alphaSliderY, mouseY), alphaSliderY + alphaSliderHeight); - this.color[3] = 1 - (restrictedY - (float) alphaSliderY) / alphaSliderHeight; - } - } - if (this.pickingColor) { - float restrictedX = (float) Math.min(Math.max(pickerX, mouseX), pickerX + pickerWidth); - float restrictedY = (float) Math.min(Math.max(pickerY, mouseY), pickerY + pickerHeight); - this.color[1] = (restrictedX - (float) pickerX) / pickerWidth; - this.color[2] = 1 - (restrictedY - (float) pickerY) / pickerHeight; - } - int selectedX = pickerX + pickerWidth + 6; - int selectedY = pickerY + pickerHeight + 6; - int selectedWidth = 10; - int selectedHeight = 10; - Gui.drawRect(pickerX - 2, pickerY - 2, pickerX + pickerWidth + 2, pickerY + pickerHeight + 2, 0xFC000000); - Gui.drawRect(hueSliderX - 2, hueSliderY - 2, hueSliderX + hueSliderWidth + 2, hueSliderY + hueSliderHeight + 2, 0xFC000000); - Gui.drawRect(alphaSliderX - 2, alphaSliderY - 2, alphaSliderX + alphaSliderWidth + 2, alphaSliderY + alphaSliderHeight + 2, 0xFC000000); - int selectedColor = Color.HSBtoRGB(this.color[0], 1.0f, 1.0f); - float selectedRed = (selectedColor >> 16 & 0xFF) / 255.0f; - float selectedGreen = (selectedColor >> 8 & 0xFF) / 255.0f; - float selectedBlue = (selectedColor & 0xFF) / 255.0f; - this.drawPickerBase(pickerX, pickerY, pickerWidth, pickerHeight, selectedRed, selectedGreen, selectedBlue, this.color[3]); - this.drawHueSlider(hueSliderX, hueSliderY, hueSliderWidth, hueSliderHeight, this.color[0]); - this.drawAlphaSlider(alphaSliderX, alphaSliderY, alphaSliderWidth, alphaSliderHeight, selectedRed, selectedGreen, selectedBlue, this.color[3]); - final int selectedColorFinal = alpha(new Color(Color.HSBtoRGB(this.color[0], this.color[1], this.color[2])), this.color[3]); - Gui.drawRect(selectedX - 2, selectedY - 2, selectedX + selectedWidth + 2, selectedY + selectedHeight + 2, 0xFC000000); - Gui.drawRect(selectedX, selectedY, selectedX + selectedWidth, selectedY + selectedHeight, selectedColorFinal); - { - final int cursorX = (int) (pickerX + color[1]*pickerWidth); - final int cursorY = (int) ((pickerY + pickerHeight) - color[2]*pickerHeight); - Gui.drawRect(cursorX - 2, cursorY - 2, cursorX + 2, cursorY + 2, -1); - } -// for (int i = 1; i < pickerHeight/10; i++) { -// Gui.drawRect(selectedX - 2, pickerY + i * 14, selectedX + 12, pickerY + i * 14, 0xFC000000); -// } - } - - final int alpha(Color color, float alpha) { - final float red = (float) color.getRed() / 255; - final float green = (float) color.getGreen() / 255; - final float blue = (float) color.getBlue() / 255; - return new Color(red, green, blue, alpha).getRGB(); - } - - @Override - protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { - this.pickingColor = check(pickerX, pickerY, pickerX + pickerWidth, pickerY + pickerHeight, mouseX, mouseY); - this.pickingHue = check(hueSliderX, hueSliderY, hueSliderX + hueSliderWidth, hueSliderY + hueSliderHeight, mouseX, mouseY); - this.pickingAlpha = check(alphaSliderX, alphaSliderY, alphaSliderX + alphaSliderWidth, alphaSliderY + alphaSliderHeight, mouseX, mouseY); - } - - @Override - protected void mouseReleased(int mouseX, int mouseY, int state) { - this.pickingColor = this.pickingHue = this.pickingAlpha = false; - } - - private void drawHueSlider(int x, int y, int width, int height, float hue) { - int step = 0; - if (height > width) { - Gui.drawRect(x, y, x + width, y + 4, 0xFFFF0000); - y += 4; - for (int colorIndex = 0; colorIndex < 6; colorIndex++) { - int previousStep = Color.HSBtoRGB((float) step/6, 1.0f, 1.0f); - int nextStep = Color.HSBtoRGB((float) (step+1)/6, 1.0f, 1.0f); - this.drawGradientRect(x, y + step * (height/6), x + width, y + (step+1) * (height/6), previousStep, nextStep); - step++; - } - final int sliderMinY = (int) (y + (height*hue)) - 4; - Gui.drawRect(x, sliderMinY - 1, x+width, sliderMinY + 1, -1); - } else { - for (int colorIndex = 0; colorIndex < 6; colorIndex++) { - int previousStep = Color.HSBtoRGB((float) step/6, 1.0f, 1.0f); - int nextStep = Color.HSBtoRGB((float) (step+1)/6, 1.0f, 1.0f); - this.gradient(x + step * (width/6), y, x + (step+1) * (width/6), y + height, previousStep, nextStep, true); - step++; - } - final int sliderMinX = (int) (x + (width*hue)); - Gui.drawRect(sliderMinX - 1, y, sliderMinX + 1, y + height, -1); - } - } - - private void drawAlphaSlider(int x, int y, int width, int height, float red, float green, float blue, float alpha) { - boolean left = true; - int checkerBoardSquareSize = width/2; - for (int squareIndex = -checkerBoardSquareSize; squareIndex < height; squareIndex += checkerBoardSquareSize) { - if (!left) { - Gui.drawRect(x, y + squareIndex, x + width, y + squareIndex + checkerBoardSquareSize, 0xFFFFFFFF); - Gui.drawRect(x + checkerBoardSquareSize, y + squareIndex, x + width, y + squareIndex + checkerBoardSquareSize, 0xFF909090); - if (squareIndex < height - checkerBoardSquareSize) { - int minY = y + squareIndex + checkerBoardSquareSize; - int maxY = Math.min(y + height, y + squareIndex + checkerBoardSquareSize*2); - Gui.drawRect(x, minY, x + width, maxY, 0xFF909090); - Gui.drawRect(x + checkerBoardSquareSize, minY, x + width, maxY, 0xFFFFFFFF); - } - } - left = !left; - } - this.gradient(x, y, x + width, y + height, new Color(red, green, blue, alpha).getRGB(), 0, false); - final int sliderMinY = (int) (y + height - (height*alpha)); - Gui.drawRect(x, sliderMinY - 1, x+width, sliderMinY + 1, -1); - } - - private void drawPickerBase(int pickerX, int pickerY, int pickerWidth, int pickerHeight, float red, float green, float blue, float alpha) { - GL11.glEnable(GL11.GL_BLEND); - GL11.glDisable(GL11.GL_TEXTURE_2D); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glShadeModel(GL11.GL_SMOOTH); - GL11.glBegin(GL11.GL_POLYGON); - { - GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - GL11.glVertex2f(pickerX, pickerY); - GL11.glVertex2f(pickerX, pickerY + pickerHeight); - GL11.glColor4f(red, green, blue, alpha); - GL11.glVertex2f(pickerX + pickerWidth, pickerY + pickerHeight); - GL11.glVertex2f(pickerX + pickerWidth, pickerY); - } - GL11.glEnd(); - GL11.glDisable(GL11.GL_ALPHA_TEST); - GL11.glBegin(GL11.GL_POLYGON); - { - GL11.glColor4f(0.0f, 0.0f, 0.0f, 0.0f); - GL11.glVertex2f(pickerX, pickerY); - GL11.glColor4f(0.0f, 0.0f, 0.0f, 1.0f); - GL11.glVertex2f(pickerX, pickerY + pickerHeight); - GL11.glVertex2f(pickerX + pickerWidth, pickerY + pickerHeight); - GL11.glColor4f(0.0f, 0.0f, 0.0f, 0.0f); - GL11.glVertex2f(pickerX + pickerWidth, pickerY); - } - GL11.glEnd(); - GL11.glEnable(GL11.GL_ALPHA_TEST); - GL11.glShadeModel(GL11.GL_FLAT); - GL11.glEnable(GL11.GL_TEXTURE_2D); - GL11.glDisable(GL11.GL_BLEND); - } - - protected void gradient(int minX, int minY, int maxX, int maxY, int startColor, int endColor, boolean left) { - if (left) { - - final float startA = (startColor >> 24 & 0xFF) / 255.0f; - final float startR = (startColor >> 16 & 0xFF) / 255.0f; - final float startG= (startColor >> 8 & 0xFF) / 255.0f; - final float startB = (startColor & 0xFF) / 255.0f; - - final float endA = (endColor >> 24 & 0xFF) / 255.0f; - final float endR = (endColor >> 16 & 0xFF) / 255.0f; - final float endG = (endColor >> 8 & 0xFF) / 255.0f; - final float endB = (endColor & 0xFF) / 255.0f; - - GL11.glEnable(GL11.GL_BLEND); - GL11.glDisable(GL11.GL_TEXTURE_2D); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glShadeModel(GL11.GL_SMOOTH); - GL11.glBegin(GL11.GL_POLYGON); - { - GL11.glColor4f(startR, startG, startB, startA); - GL11.glVertex2f(minX, minY); - GL11.glVertex2f(minX, maxY); - GL11.glColor4f(endR, endG, endB, endA); - GL11.glVertex2f(maxX, maxY); - GL11.glVertex2f(maxX, minY); - } - GL11.glEnd(); - GL11.glShadeModel(GL11.GL_FLAT); - GL11.glEnable(GL11.GL_TEXTURE_2D); - GL11.glDisable(GL11.GL_BLEND); - } else drawGradientRect(minX, minY, maxX, maxY, startColor, endColor); - } - - protected boolean check(int minX, int minY, int maxX, int maxY, int curX, int curY) { - return curX >= minX && curY >= minY && curX < maxX && curY < maxY; - } - - @Override - protected void keyTyped(char typedChar, int keyCode) throws IOException { - super.keyTyped(typedChar, keyCode); - if (keyCode == Keyboard.KEY_R) { - this.rainbowState = !this.rainbowState; - } - if (keyCode == Keyboard.KEY_LEFT) { - this.rainbowSpeed -= 0.1; - } else if (keyCode == Keyboard.KEY_RIGHT) this.rainbowSpeed += 0.1; - } -} diff --git a/src/main/java/com/me/infinity/loop/features/gui/components/items/buttons/EnumButton.java b/src/main/java/com/me/infinity/loop/features/gui/components/items/buttons/EnumButton.java deleted file mode 100644 index 7f1f7ed..0000000 --- a/src/main/java/com/me/infinity/loop/features/gui/components/items/buttons/EnumButton.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.me.infinity.loop.features.gui.components.items.buttons; - -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.features.modules.client.ClickGui.ClickGui; -import com.me.infinity.loop.features.setting.Setting; -import com.mojang.realmsclient.gui.ChatFormatting; -import com.me.infinity.loop.features.gui.InfinityLoopGui; -import com.me.infinity.loop.util.utils.renders.RenderUtil; -import net.minecraft.client.audio.PositionedSoundRecord; -import net.minecraft.init.SoundEvents; - -public class EnumButton - extends Button { - public Setting setting; - - public EnumButton(Setting setting) { - super(setting.getName()); - this.setting = setting; - this.width = 15; - } - - @Override - public void drawScreen(int mouseX, int mouseY, float partialTicks) { - RenderUtil.drawRect(this.x, this.y, this.x + (float) this.width + 7.4f, this.y + (float) this.height - 0.5f, this.getState() ? (!this.isHovering(mouseX, mouseY) ? InfinityLoop.colorManager.getColorWithAlpha(InfinityLoop.moduleManager.getModuleByClass(ClickGui.class).hoverAlpha.getValue()) : InfinityLoop.colorManager.getColorWithAlpha(InfinityLoop.moduleManager.getModuleByClass(ClickGui.class).alpha.getValue())) : (!this.isHovering(mouseX, mouseY) ? 0x11555555 : -2007673515)); - InfinityLoop.textManager.drawStringWithShadow(this.setting.getName() + " " + ChatFormatting.GRAY + (this.setting.currentEnumName().equalsIgnoreCase("ABC") ? "ABC" : this.setting.currentEnumName()), this.x + 2.3f, this.y - 1.7f - (float) InfinityLoopGui.getClickGui().getTextOffset(), this.getState() ? -1 : -5592406); - //RenderUtil.drawRect(this.x, this.y, this.x - 2.0f, this.y + (float) this.height - 0.5f, -1); - } - - @Override - public void update() { - this.setHidden(!this.setting.isVisible()); - } - - @Override - public void mouseClicked(int mouseX, int mouseY, int mouseButton) { - super.mouseClicked(mouseX, mouseY, mouseButton); - if (this.isHovering(mouseX, mouseY)) { - mc.getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0f)); - } - } - - @Override - public int getHeight() { - return 14; - } - - @Override - public void toggle() { - this.setting.increaseEnum(); - } - - @Override - public boolean getState() { - return true; - } -} - diff --git a/src/main/java/com/me/infinity/loop/features/gui/components/items/buttons/Slider.java b/src/main/java/com/me/infinity/loop/features/gui/components/items/buttons/Slider.java deleted file mode 100644 index 2c8a6d3..0000000 --- a/src/main/java/com/me/infinity/loop/features/gui/components/items/buttons/Slider.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.me.infinity.loop.features.gui.components.items.buttons; - -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.features.modules.client.ClickGui.ClickGui; -import com.me.infinity.loop.features.setting.Setting; -import com.mojang.realmsclient.gui.ChatFormatting; -import com.me.infinity.loop.features.gui.InfinityLoopGui; -import com.me.infinity.loop.features.gui.components.Component; -import com.me.infinity.loop.util.utils.renders.RenderUtil; -import org.lwjgl.input.Mouse; - -import java.awt.*; - -public class Slider - extends Button { - private final Number min; - private final Number max; - private final int difference; - public Setting setting; - - public Slider(Setting setting) { - super(setting.getName()); - this.setting = setting; - this.min = (Number) setting.getMin(); - this.max = (Number) setting.getMax(); - this.difference = this.max.intValue() - this.min.intValue(); - this.width = 15; - } - - @Override - public void drawScreen(int mouseX, int mouseY, float partialTicks) { - this.dragSetting(mouseX, mouseY); - RenderUtil.drawRect(this.x, this.y + 5.0f, this.x + (float) this.width + 7.4f, this.y + (float) this.height - 1.5f, !this.isHovering(mouseX, mouseY) ? new Color(0xC0282828, true).getRGB() : new Color(0xB51E1E1E, true).getRGB()); - RenderUtil.drawRect(this.x, this.y + 5.0f, ((Number) this.setting.getValue()).floatValue() <= this.min.floatValue() ? this.x : this.x + ((float) this.width + 7.4f) * this.partialMultiplier(), this.y + (float) this.height - 1.5f, !this.isHovering(mouseX, mouseY) ? InfinityLoop.colorManager.getColorWithAlpha(InfinityLoop.moduleManager.getModuleByClass(ClickGui.class).hoverAlpha.getValue()) : InfinityLoop.colorManager.getColorWithAlpha(InfinityLoop.moduleManager.getModuleByClass(ClickGui.class).alpha.getValue())); - InfinityLoop.textManager.drawStringWithShadow(this.getName() + " " + ChatFormatting.GRAY + (this.setting.getValue() instanceof Float ? this.setting.getValue() : Double.valueOf(((Number) this.setting.getValue()).doubleValue())), (x + 4), (float) (y + 4), -1); - } - - @Override - public void mouseClicked(int mouseX, int mouseY, int mouseButton) { - super.mouseClicked(mouseX, mouseY, mouseButton); - if (this.isHovering(mouseX, mouseY)) { - this.setSettingFromX(mouseX); - } - } - - @Override - public boolean isHovering(int mouseX, int mouseY) { - for (Component component : InfinityLoopGui.getClickGui().getComponents()) { - if (!component.drag) continue; - return false; - } - return (float) mouseX >= this.getX() && (float) mouseX <= this.getX() + (float) this.getWidth() + 8.0f && (float) mouseY >= this.getY() && (float) mouseY <= this.getY() + (float) this.height; - } - - @Override - public void update() { - this.setHidden(!this.setting.isVisible()); - } - - private void dragSetting(int mouseX, int mouseY) { - if (this.isHovering(mouseX, mouseY) && Mouse.isButtonDown(0)) { - this.setSettingFromX(mouseX); - } - } - - @Override - public int getHeight() { - return 14; - } - - private void setSettingFromX(int mouseX) { - float percent = ((float) mouseX - this.x) / ((float) this.width + 7.4f); - if (this.setting.getValue() instanceof Double) { - double result = (Double) this.setting.getMin() + (double) ((float) this.difference * percent); - this.setting.setValue((double) Math.round(10.0 * result) / 10.0); - } else if (this.setting.getValue() instanceof Float) { - float result = ((Float) this.setting.getMin()).floatValue() + (float) this.difference * percent; - this.setting.setValue(Float.valueOf((float) Math.round(10.0f * result) / 10.0f)); - } else if (this.setting.getValue() instanceof Integer) { - this.setting.setValue((Integer) this.setting.getMin() + (int) ((float) this.difference * percent)); - } - } - - private float middle() { - return this.max.floatValue() - this.min.floatValue(); - } - - private float part() { - return ((Number) this.setting.getValue()).floatValue() - this.min.floatValue(); - } - - private float partialMultiplier() { - return this.part() / this.middle(); - } -} - diff --git a/src/main/java/com/me/infinity/loop/features/modules/ModuleCategory.java b/src/main/java/com/me/infinity/loop/features/modules/ModuleCategory.java deleted file mode 100644 index 7e3aca4..0000000 --- a/src/main/java/com/me/infinity/loop/features/modules/ModuleCategory.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.me.infinity.loop.features.modules; - -public enum ModuleCategory { - COMBAT("Combat"), - MISC("Misc"), - RENDER("Render"), - MOVEMENT("Movement"), - PLAYER("Player"), - CLIENT("Client"), - TEST("Test"); - - public String name; - - ModuleCategory(String name) { - this.name = name; - } - - public String getName() { - return this.name; - } -} diff --git a/src/main/java/com/me/infinity/loop/features/modules/client/CSGui.java b/src/main/java/com/me/infinity/loop/features/modules/client/CSGui.java deleted file mode 100644 index 5d8008e..0000000 --- a/src/main/java/com/me/infinity/loop/features/modules/client/CSGui.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.me.infinity.loop.features.modules.client; - -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.event.events.client.ClientEvent; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.mojang.realmsclient.gui.ChatFormatting; -import com.me.infinity.loop.features.command.Command; -import com.me.infinity.loop.features.csgui.CSClickGui; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.setting.Setting; -import net.minecraft.client.settings.GameSettings; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; - -public class CSGui - extends Module { - private static CSGui INSTANCE = new CSGui(); - public Setting prefix = this.register(new Setting<>("Prefix", ".")); - public Setting description= this.register(new Setting("Description", true)); - public Setting bindText = register(new Setting("ShowBind",false)); - public Setting openCloseChange = register(new Setting("Open/Close",true)); - public Setting moduleButton = register(new Setting("Buttons: ", " ", v -> !this.openCloseChange.getValue()).setRenderName(true)); - public Setting open = register(new Setting("Open: ", "+", v -> this.openCloseChange.getValue()).setRenderName(true)); - public Setting close = register(new Setting("Close: ", "-", v -> this.openCloseChange.getValue()).setRenderName(true)); - public Setting background= this.register(new Setting("Background", true)); - public Setting blur = this.register(new Setting("Blur", false, v -> this.background.getValue())); - public Setting blurAmount = this.register(new Setting<>("BlurAmount", 2, 0, 20, v -> this.background.getValue())); - public Setting blurSize = this.register(new Setting<>("BlurSize", 0, 0, 20, v -> this.background.getValue())); - public Setting dark = this.register(new Setting("Dark", false, v -> this.background.getValue())); - public Setting gradiant = this.register(new Setting("Gradiant", false, v -> this.background.getValue())); - public Setting gradiantHeight = this.register(new Setting("GradiantHeight", 0, 0, 255, v -> this.background.getValue())); - public Setting customFov = this.register(new Setting("CustomFov", false)); - public Setting fov = this.register(new Setting<>("Fov", Float.valueOf(150.0f), Float.valueOf(-180.0f), Float.valueOf(180.0f))); - public Setting colorSync = this.register(new Setting<>("ColorSync", false)); - public Setting red = this.register(new Setting<>("Red", 230, 0, 255)); - public Setting green = this.register(new Setting<>("Green", 0, 0, 255)); - public Setting blue = this.register(new Setting<>("Blue", 0, 0, 255)); - public Setting hoverAlpha = this.register(new Setting<>("Alpha", 170, 0, 255)); - public Setting topRed = this.register(new Setting<>("SecondRed", 230, 0, 255)); - public Setting topGreen = this.register(new Setting<>("SecondGreen", 0, 0, 255)); - public Setting topBlue = this.register(new Setting<>("SecondBlue", 0, 0, 255)); - public Setting alpha = this.register(new Setting<>("HoverAlpha", 240, 0, 255)); - public Setting rainbow = this.register(new Setting<>("Rainbow", false)); - public Setting rainbowModeHud = this.register(new Setting("HRainbowMode", rainbowMode.Static, v -> this.rainbow.getValue())); - public Setting rainbowModeA = this.register(new Setting("ARainbowMode", rainbowModeArray.Static, v -> this.rainbow.getValue())); - public Setting rainbowHue = this.register(new Setting("Delay", Integer.valueOf(240), Integer.valueOf(0), Integer.valueOf(600), v -> this.rainbow.getValue())); - public Setting rainbowBrightness = this.register(new Setting("Brightness ", Float.valueOf(150.0f), Float.valueOf(1.0f), Float.valueOf(255.0f), v -> this.rainbow.getValue())); - public Setting rainbowSaturation = this.register(new Setting("Saturation", Float.valueOf(150.0f), Float.valueOf(1.0f), Float.valueOf(255.0f), v -> this.rainbow.getValue())); - private CSClickGui click; - - public CSGui() { - super("CSGui", "Opens the CSGui", ModuleCategory.CLIENT); - this.setInstance(); - } - - public static CSGui getInstance() { - if (INSTANCE == null) { - INSTANCE = new CSGui(); - } - return INSTANCE; - } - - private void setInstance() { - INSTANCE = this; - } - - @Override - public void onUpdate() { - if (this.customFov.getValue().booleanValue()) { - CSGui.mc.gameSettings.setOptionFloatValue(GameSettings.Options.FOV, this.fov.getValue().floatValue()); - } - } - - @SubscribeEvent - public void onSettingChange(ClientEvent event) { - if (event.isPre() && event.getSetting().getFeature().equals(this)) { - if (event.getSetting().equals(this.prefix)) { - InfinityLoop.commandManager.setPrefix(this.prefix.getPlannedValue()); - Command.sendMessage("Prefix set to " + ChatFormatting.DARK_GRAY + InfinityLoop.commandManager.getPrefix()); - } - InfinityLoop.colorManager.setColor(this.red.getPlannedValue(), this.green.getPlannedValue(), this.blue.getPlannedValue(), this.hoverAlpha.getPlannedValue()); - } - } - - @Override - public void onEnable() { - mc.displayGuiScreen(new CSClickGui()); - } - - @Override - public void onLoad() { - if (this.colorSync.getValue()) { - InfinityLoop.colorManager.setColor(Colors.getInstance().getCurrentColor().getRed(), Colors.getInstance().getCurrentColor().getGreen(), Colors.getInstance().getCurrentColor().getBlue(), this.alpha.getValue()); - } else { - InfinityLoop.colorManager.setColor(this.red.getValue(), this.green.getValue(), this.blue.getValue(), this.hoverAlpha.getValue()); - } - InfinityLoop.commandManager.setPrefix(this.prefix.getValue()); - } - - @Override - public void onTick() { - if (!(CSGui.mc.currentScreen instanceof CSClickGui)) { - this.disable(); - } - } - - public enum rainbowModeArray { - Static, - Up - - } - - public enum rainbowMode { - Static, - Sideway - - } -} - - diff --git a/src/main/java/com/me/infinity/loop/features/modules/client/ClickGui/ClickGui.java b/src/main/java/com/me/infinity/loop/features/modules/client/ClickGui/ClickGui.java deleted file mode 100644 index 6149b48..0000000 --- a/src/main/java/com/me/infinity/loop/features/modules/client/ClickGui/ClickGui.java +++ /dev/null @@ -1,178 +0,0 @@ -package com.me.infinity.loop.features.modules.client.ClickGui; - -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.event.events.client.ClientEvent; -import com.me.infinity.loop.features.gui.InfinityLoopGui; -import com.me.infinity.loop.features.gui.screen.anchor.AnchorPoint; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.modules.client.Colors; -import com.me.infinity.loop.features.setting.Setting; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; - -import java.awt.*; -import java.util.ArrayList; -import java.util.List; - -public class ClickGui - extends Module { - private static ClickGui INSTANCE = new ClickGui(); - public Setting description = this.register(new Setting("Description", ClickguiEnum.Mode.Frame)); - public Setting moduleiconmode = register(new Setting("ModuleIcon",true)); - //public Setting guiGlow= this.register(new Setting("Glow", true)); - //public Setting glowOffset = this.register(new Setting<>("GlowOffset", 2, 0, 20, v -> this.guiGlow.getValue())); - public Setting butonIcon = register(new Setting("ButtonIcon", ClickguiEnum.Icon.OpenColse)); - public Setting open = register(new Setting("Open: ", "+", v -> this.butonIcon.getValue() == ClickguiEnum.Icon.OpenColse).setRenderName(true)); - public Setting close = register(new Setting("Close: ", "-", v -> this.butonIcon.getValue() == ClickguiEnum.Icon.OpenColse).setRenderName(true)); - public Setting background= this.register(new Setting("Background", true)); - public Setting particles = this.register(new Setting("Particles", true, v -> this.background.getValue())); - public Setting particleLength = this.register(new Setting<>("ParticlesLength", 80, 0, 300, v -> this.background.getValue() && this.particles.getValue())); - //public Setting shader = this.register(new Setting("ShaderBG", BGShader.none, v -> this.background.getValue())); - public Setting blur = this.register(new Setting("Blur", false, v -> this.background.getValue())); - public Setting blurAmount = this.register(new Setting<>("BlurAmount", 2, 0, 20, v -> this.background.getValue() && this.blur.getValue())); - public Setting blurSize = this.register(new Setting<>("BlurSize", 0, 0, 20, v -> this.background.getValue() && this.blur.getValue())); - public Setting dark = this.register(new Setting("Dark", true, v -> this.background.getValue())); - public Setting gradiant = this.register(new Setting("Gradiant", false, v -> this.background.getValue())); - public Setting gradiantHeight = this.register(new Setting("GradiantHeight", 0, 0, 255, v -> this.background.getValue() && this.gradiant.getValue())); - public Setting gradiantAlpha = this.register(new Setting<>("GradiantAlpha", 230, 0, 255, v -> this.background.getValue() && this.gradiant.getValue())); - public Setting red = this.register(new Setting<>("Red", 160, 0, 255)); - public Setting green = this.register(new Setting<>("Green", 10, 0, 255)); - public Setting blue = this.register(new Setting<>("Blue", 255, 0, 255)); - public Setting hoverAlpha = this.register(new Setting<>("Alpha", 170, 0, 255)); - public Setting colorSync = this.register(new Setting<>("ColorSync", false)); - public Setting sizeWidth = this.register(new Setting("Width", 20, 0, 50 )); - public Setting olWidth = this.register(new Setting("Outline Width", 0.0f, 1f, 5f)); - public Setting alpha = this.register(new Setting<>("HoverAlpha", 240, 0, 255)); - public Setting sideSettings = this.register(new Setting<>("SideSettings", false)); - public Setting sideLineC = this.register(new Setting<>("SideLine", new Color(0xFFFFFF))); - - private List anchorPoints = new ArrayList<>(); - public ClickGui() { - super("ClickGui", "Opens the ClickGui", ModuleCategory.CLIENT); - this.setInstance(); - } - - public static ClickGui getInstance() { - if (INSTANCE == null) { - INSTANCE = new ClickGui(); - } - return INSTANCE; - } - - private void setInstance() { - INSTANCE = this; - } - - @SubscribeEvent - public void onSettingChange(ClientEvent event) { - InfinityLoop.colorManager.setColor(this.red.getPlannedValue(), this.green.getPlannedValue(), this.blue.getPlannedValue(), this.hoverAlpha.getPlannedValue()); - } - - @Override - public void onEnable() { - mc.displayGuiScreen(new InfinityLoopGui()); - } - - @Override - public void onLoad() { - if (this.colorSync.getValue()) { - InfinityLoop.colorManager.setColor(Colors.getInstance().getCurrentColor().getRed(), Colors.getInstance().getCurrentColor().getGreen(), Colors.getInstance().getCurrentColor().getBlue(), this.alpha.getValue()); - } else { - InfinityLoop.colorManager.setColor(this.red.getValue(), this.green.getValue(), this.blue.getValue(), this.hoverAlpha.getValue()); - } - } - - @Override - public void onTick() { - if (!(ClickGui.mc.currentScreen instanceof InfinityLoopGui)) { - this.disable(); - } - } - - - public float getOutlineWidth() { - return olWidth.getValue(); - } - - public float getSizeWidth() { - return sizeWidth.getValue(); - } - - - /*@Override - public void onUpdate() { - if (ClickGui.mc.world == null) return; - if (!(ClickGui.getInstance().blur.getValue() || ClickGui.mc.currentScreen instanceof GuiContainer || ClickGui.mc.currentScreen instanceof GuiChat || ClickGui.mc.currentScreen instanceof GuiConfirmOpenLink)) { - if (!(ClickGui.mc.currentScreen instanceof GuiEditSign)) { - if (!(ClickGui.mc.currentScreen instanceof GuiGameOver)) { - if (!(ClickGui.mc.currentScreen instanceof GuiOptions)) { - if (!(ClickGui.mc.currentScreen instanceof GuiIngameMenu)) { - if (!(ClickGui.mc.currentScreen instanceof GuiVideoSettings)) { - if (!(ClickGui.mc.currentScreen instanceof GuiScreenOptionsSounds)) { - if (!(ClickGui.mc.currentScreen instanceof GuiControls)) { - if (!(ClickGui.mc.currentScreen instanceof GuiCustomizeSkin)) { - if (!(ClickGui.mc.currentScreen instanceof GuiModList)) { - if (ClickGui.mc.entityRenderer.getShaderGroup() == null) return; - ClickGui.mc.entityRenderer.getShaderGroup().deleteShaderGroup(); - return; - } - } - } - } - } - } - } - } - } - } - if (OpenGlHelper.shadersSupported && mc.getRenderViewEntity() instanceof EntityPlayer) { - if (ClickGui.mc.entityRenderer.getShaderGroup() != null) { - ClickGui.mc.entityRenderer.getShaderGroup().deleteShaderGroup(); - } - try { - ClickGui.mc.entityRenderer.loadShader(new ResourceLocation("shaders/post/blur.json")); - return; - } - catch (Exception e) { - e.printStackTrace(); - return; - } - } - if (ClickGui.mc.entityRenderer.getShaderGroup() == null) return; - if (ClickGui.mc.entityRenderer != null) return; - ClickGui.mc.entityRenderer.getShaderGroup().deleteShaderGroup(); - } - - @Override - public void onDisable() { - if (ClickGui.mc.entityRenderer.getShaderGroup() != null) { - ClickGui.mc.entityRenderer.getShaderGroup().deleteShaderGroup(); - } - } - - @Override - public void onUpdate() { - if(fullNullCheck()) return; - if(shader.getValue() != BGShader.none) { - - if (OpenGlHelper.shadersSupported && ClickGui.mc.getRenderViewEntity() instanceof EntityPlayer) { - if (ClickGui.mc.entityRenderer.getShaderGroup() != null) { - ClickGui.mc.entityRenderer.getShaderGroup().deleteShaderGroup(); - } - try { - ClickGui.mc.entityRenderer.loadShader(new ResourceLocation("shaders/post/" + this.shader.getValue() + ".json")); - } catch (Exception e) { - e.printStackTrace(); - } - } else if (ClickGui.mc.entityRenderer.getShaderGroup() != null && ClickGui.mc.currentScreen == null) { - ClickGui.mc.entityRenderer.getShaderGroup().deleteShaderGroup(); - } - } - }*/ - - public List getAnchorPoints() { - return anchorPoints; - } - -} - diff --git a/src/main/java/com/me/infinity/loop/features/modules/client/ClickGui/ClickguiEnum.java b/src/main/java/com/me/infinity/loop/features/modules/client/ClickGui/ClickguiEnum.java deleted file mode 100644 index 3e03630..0000000 --- a/src/main/java/com/me/infinity/loop/features/modules/client/ClickGui/ClickguiEnum.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.me.infinity.loop.features.modules.client.ClickGui; - -public class ClickguiEnum { - - public enum Icon { - None, ShowBind, OpenColse - } - - public enum Mode { - Frame, - Folow, - None - } -} diff --git a/src/main/java/com/me/infinity/loop/features/modules/client/GameChanger.java b/src/main/java/com/me/infinity/loop/features/modules/client/GameChanger.java deleted file mode 100644 index 333287e..0000000 --- a/src/main/java/com/me/infinity/loop/features/modules/client/GameChanger.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.me.infinity.loop.features.modules.client; - -import com.me.infinity.loop.event.events.render.PerspectiveEvent; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.setting.Setting; -import net.minecraft.client.settings.GameSettings; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; - -public class GameChanger - extends Module { - - private static GameChanger INSTANCE = new GameChanger(); - public Setting modelFlip = this.register(new Setting<>("ModelFlip", false)); - public Setting aspect = this.register(new Setting<>("Aspect", false)); - public final Setting aspectValue = this.register(new Setting<>("AspectValue", mc.displayWidth / mc.displayHeight + 0.0, 0.0, 3.0,v -> this.aspect.getValue())); - public Setting customFov = this.register(new Setting<>("CustomFov", false)); - public final Setting fov = this.register(new Setting<>("Fov", Float.valueOf(150.0f), Float.valueOf(-180.0f), Float.valueOf(180.0f), v -> customFov.getValue())); - public Setting customGamma = this.register(new Setting<>("CustomGamma", false)); - public final Setting gamma = this.register(new Setting<>("Gamma", Float.valueOf(1000.0f), Float.valueOf(1.0f), Float.valueOf(1000.0f), v -> customGamma.getValue())); - public Setting customAmbience = this.register(new Setting<>("CustomAmbience", false)); - public final Setting ambienceRed = this.register(new Setting<>("A-Red",255,0,255, v -> customAmbience.getValue())); - public final Setting ambienceGreen = this.register(new Setting<>("A-Green",255,0,255, v -> customAmbience.getValue())); - public final Setting ambienceBlue = this.register(new Setting<>("A-Blue",255,0,255, v -> customAmbience.getValue())); - public final Setting ambienceAlpha = this.register(new Setting<>("A-Alpha",255,0,255, v -> customAmbience.getValue())); - - public GameChanger() { - super("GameChanger", "Change Some Minecraft Parameter", ModuleCategory.CLIENT); - this.setInstance(); - } - - public static GameChanger getInstance() { - if (INSTANCE == null) { - INSTANCE = new GameChanger(); - } - return INSTANCE; - } - - private void setInstance() { - INSTANCE = this; - } - - @Override - public void onUpdate() { - if (this.customFov.getValue().booleanValue()) { - this.mc.gameSettings.setOptionFloatValue(GameSettings.Options.FOV, this.fov.getValue().floatValue()); - } - if (this.customGamma.getValue().booleanValue()) { - this.mc.gameSettings.setOptionFloatValue(GameSettings.Options.GAMMA, this.gamma.getValue().floatValue()); - } - } - - @Override - public void onDisable() { - mc.entityRenderer.stopUseShader(); - } - - @SubscribeEvent - public void onPerspectiveEvent(final PerspectiveEvent perspectiveEvent) { - if (GameChanger.getInstance().aspect.getValue()) { - perspectiveEvent.setAspect(this.aspectValue.getValue().floatValue()); - } - } - -} diff --git a/src/main/java/com/me/infinity/loop/features/modules/combat/Surround.java b/src/main/java/com/me/infinity/loop/features/modules/combat/Surround.java deleted file mode 100644 index 5d0fce9..0000000 --- a/src/main/java/com/me/infinity/loop/features/modules/combat/Surround.java +++ /dev/null @@ -1,219 +0,0 @@ -package com.me.infinity.loop.features.modules.combat; - -import com.me.infinity.loop.features.command.Command; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.setting.Setting; -import com.me.infinity.loop.util.utils.maths.MathUtil; -import com.me.infinity.loop.util.utils.minecraft.BlockUtil; -import com.me.infinity.loop.util.utils.minecraft.InventoryUtil; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.IBlockAccess; - -import java.util.ArrayList; -import java.util.List; - -public class Surround - extends Module { - public int placements; - public BlockPos startPosition; - public int tries; - public Setting mode = this.register(new Setting<>("Mode", Modes.Normal)); - public Setting item = this.register(new Setting<>("Item", InventoryUtil.The_Item.Obsidian)); - public Setting switchMode = this.register(new Setting<>("Switch", InventoryUtil.Switch.NORMAL)); - public Setting blocks = this.register(new Setting<>("Blocks", 8, 1, 40)); - public Setting supportBlocks = this.register(new Setting<>("SupportBlocks", Supports.Dynamic)); - public Setting retries = this.register(new Setting<>("Retries", 5, 0, 20)); - public Setting dynamic = this.register(new Setting<>("Dynamic", true)); - public Setting center = this.register(new Setting<>("Center", false)); - public Setting rotate = this.register(new Setting<>("Rotate", false)); - public Setting floor = this.register(new Setting<>("Floor", false)); - - public Surround() { - super("Surround", "Places blocks around your feet to protect you from crystals.", ModuleCategory.COMBAT); - } - - @Override - public void onMotionUpdate() { - block8: { - if ((double)this.startPosition.getY() != MathUtil.roundToPlaces(Surround.mc.player.posY, 0) && this.mode.getValue().equals((Object)Modes.Normal)) { - this.disable(); - return; - } - int slot = InventoryUtil.getCombatBlock(this.item.getValue().toString()); - int lastSlot = Surround.mc.player.inventory.currentItem; - if (slot == -1) { - Command.sendMessage("No blocks could be found."); - this.disable(); - return; - } - if (!this.getUnsafeBlocks().isEmpty()) { - InventoryUtil.switchSlot(slot, this.switchMode.getValue().equals((Object)InventoryUtil.Switch.SILENT)); - for (BlockPos position : this.getUnsafeBlocks()) { - if (!this.supportBlocks.getValue().equals((Object)Supports.None)) { - if ((BlockUtil.getPlaceableSide(position) == null || this.supportBlocks.getValue().equals((Object)Supports.Static)) && BlockUtil.isPositionPlaceable(position.down(), true, true)) { - this.placeBlock(position.down()); - } - } - if (!BlockUtil.isPositionPlaceable(position, true, true, this.tries <= this.retries.getValue().intValue())) continue; - this.placeBlock(position); - ++this.tries; - } - if (!this.switchMode.getValue().equals((Object)InventoryUtil.Switch.NONE)) { - InventoryUtil.switchSlot(lastSlot, this.switchMode.getValue().equals((Object)InventoryUtil.Switch.SILENT)); - } - } - this.placements = 0; - if (!this.getUnsafeBlocks().isEmpty()) break block8; - this.tries = 0; - if (this.mode.getValue().equals((Object)Modes.Toggle)) { - this.disable(); - } - } - } - - public List getOffsets() { - ArrayList offsets = new ArrayList(); - if (this.dynamic.getValue()) { - int z; - int x; - double decimalX = Math.abs(Surround.mc.player.posX) - Math.floor(Math.abs(Surround.mc.player.posX)); - double decimalZ = Math.abs(Surround.mc.player.posZ) - Math.floor(Math.abs(Surround.mc.player.posZ)); - int lengthX = this.calculateLength(decimalX, false); - int negativeLengthX = this.calculateLength(decimalX, true); - int lengthZ = this.calculateLength(decimalZ, false); - int negativeLengthZ = this.calculateLength(decimalZ, true); - ArrayList tempOffsets = new ArrayList(); - offsets.addAll(this.getOverlapPositions()); - for (x = 1; x < lengthX + 1; ++x) { - tempOffsets.add(this.addToPosition(this.getPlayerPosition(), x, 1 + lengthZ)); - tempOffsets.add(this.addToPosition(this.getPlayerPosition(), x, -(1 + negativeLengthZ))); - } - for (x = 0; x <= negativeLengthX; ++x) { - tempOffsets.add(this.addToPosition(this.getPlayerPosition(), -x, 1 + lengthZ)); - tempOffsets.add(this.addToPosition(this.getPlayerPosition(), -x, -(1 + negativeLengthZ))); - } - for (z = 1; z < lengthZ + 1; ++z) { - tempOffsets.add(this.addToPosition(this.getPlayerPosition(), 1 + lengthX, z)); - tempOffsets.add(this.addToPosition(this.getPlayerPosition(), -(1 + negativeLengthX), z)); - } - for (z = 0; z <= negativeLengthZ; ++z) { - tempOffsets.add(this.addToPosition(this.getPlayerPosition(), 1 + lengthX, -z)); - tempOffsets.add(this.addToPosition(this.getPlayerPosition(), -(1 + negativeLengthX), -z)); - } - offsets.addAll(tempOffsets); - } else { - for (EnumFacing side : EnumFacing.HORIZONTALS) { - } - } - return offsets; - } - - public BlockPos getPlayerPosition() { - return new BlockPos(Surround.mc.player.posX, Surround.mc.player.posY - Math.floor(Surround.mc.player.posY) > Double.longBitsToDouble(Double.doubleToLongBits(19.39343307331816) ^ 0x7FDAFD219E3E896DL) ? Math.floor(Surround.mc.player.posY) + Double.longBitsToDouble(Double.doubleToLongBits(4.907271931218261) ^ 0x7FE3A10BE4A4A510L) : Math.floor(Surround.mc.player.posY), Surround.mc.player.posZ); - } - - public List getOverlapPositions() { - ArrayList positions = new ArrayList(); - int offsetX = this.calculateOffset(Surround.mc.player.posX - Math.floor(Surround.mc.player.posX)); - int offsetZ = this.calculateOffset(Surround.mc.player.posZ - Math.floor(Surround.mc.player.posZ)); - positions.add(this.getPlayerPosition()); - for (int x = 0; x <= Math.abs(offsetX); ++x) { - for (int z = 0; z <= Math.abs(offsetZ); ++z) { - int properX = x * offsetX; - int properZ = z * offsetZ; - positions.add(this.getPlayerPosition().add(properX, -1, properZ)); - } - } - return positions; - } - - public BlockPos addToPosition(final BlockPos position, double x, double z) { - if (position.getX() < 0) { - x = -x; - } - if (position.getZ() < 0) { - z = -z; - } - return position.add(x, Double.longBitsToDouble(Double.doubleToLongBits(1.4868164896774578E308) ^ 0x7FEA7759ABE7F7C1L), z); - } - - - /* - * WARNING - void declaration - */ - public int calculateOffset(double d) { - double dec = 0; - return dec >= Double.longBitsToDouble(Double.doubleToLongBits(22.19607388697261) ^ 0x7FD05457839243F9L) ? 1 : (dec <= Double.longBitsToDouble(Double.doubleToLongBits(7.035587642812949) ^ 0x7FCF1742257B24DBL) ? -1 : 0); - } - - /* - * WARNING - void declaration - */ - public int calculateLength(double d, boolean bl) { - double decimal = 0; - double negative = 0; - if (negative != 1) { - return decimal <= Double.longBitsToDouble(Double.doubleToLongBits(30.561776836994962) ^ 0x7FEDBCE3A865B81CL) ? 1 : 0; - } - return decimal >= Double.longBitsToDouble(Double.doubleToLongBits(22.350511399288944) ^ 0x7FD03FDD7B12B45DL) ? 1 : 0; - } - - @Override - public void onEnable() { - super.onEnable(); - if (Surround.mc.player == null || Surround.mc.world == null) { - this.disable(); - return; - } - this.startPosition = new BlockPos(MathUtil.roundVector(Surround.mc.player.getPositionVector(), 0)); - } - - /* - * WARNING - void declaration - */ - public void placeBlock(BlockPos blockPos) { - if (this.placements < this.blocks.getValue().intValue()) { - BlockUtil.placeBlock((BlockPos) blockPos, EnumHand.MAIN_HAND, true); - ++this.placements; - } - } - - public List getUnsafeBlocks() { - ArrayList positions = new ArrayList(); - for (BlockPos position : this.getOffsets()) { - if (this.isSafe(position)) continue; - positions.add(position); - } - return positions; - } - - /* - * WARNING - void declaration - */ - public boolean isSafe(BlockPos blockPos) { - return !Surround.mc.world.getBlockState((BlockPos)blockPos).getBlock().isReplaceable((IBlockAccess)Surround.mc.world, (BlockPos)blockPos); - } - - @Override - public String getHudInfo() { - return " " + this.tries + "/" + this.retries.getValue().intValue(); - } - - public enum Supports { - None, - Dynamic, - Static; - - } - - public enum Modes { - Normal, - Persistent, - Toggle, - Shift; - - } -} \ No newline at end of file diff --git a/src/main/java/com/me/infinity/loop/features/modules/misc/BlockTweaks.java b/src/main/java/com/me/infinity/loop/features/modules/misc/BlockTweaks.java deleted file mode 100644 index 0e9ac87..0000000 --- a/src/main/java/com/me/infinity/loop/features/modules/misc/BlockTweaks.java +++ /dev/null @@ -1,180 +0,0 @@ -package com.me.infinity.loop.features.modules.misc; - -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.event.events.network.EventPacket; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.setting.Setting; -import com.me.infinity.loop.manager.InventoryManager; -import com.me.infinity.loop.util.utils.EntityUtil; -import net.minecraft.block.state.IBlockState; -import net.minecraft.enchantment.EnchantmentHelper; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.EnumCreatureAttribute; -import net.minecraft.init.Blocks; -import net.minecraft.init.Enchantments; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ItemSword; -import net.minecraft.item.ItemTool; -import net.minecraft.network.play.client.CPacketHeldItemChange; -import net.minecraft.network.play.client.CPacketUseEntity; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; -import net.minecraftforge.event.entity.player.AttackEntityEvent; -import net.minecraftforge.event.world.BlockEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; - -public class BlockTweaks - extends Module { - public Setting autoTool = this.register(new Setting("AutoTool", false)); - public Setting autoWeapon = this.register(new Setting("AutoWeapon", false)); - public Setting noFriendAttack = this.register(new Setting("NoFriendAttack", false)); - public Setting pickaxe = this.register(new Setting("Pickaxe", true)); - public Setting noGhost = this.register(new Setting("NoGlitchBlocks", false)); - public Setting destroy = this.register(new Setting("Destroy", Boolean.valueOf(false), v -> this.noGhost.getValue())); - private static BlockTweaks INSTANCE = new BlockTweaks(); - private int lastHotbarSlot = -1; - private int currentTargetSlot = -1; - private boolean switched = false; - public int currentPlayerItem; - - public BlockTweaks() { - super("BlockTweaks", "Some tweaks for blocks.", ModuleCategory.PLAYER); - this.setInstance(); - } - - private void setInstance() { - INSTANCE = this; - } - - public static BlockTweaks getINSTANCE() { - if (INSTANCE == null) { - INSTANCE = new BlockTweaks(); - } - return INSTANCE; - } - - @Override - public void onDisable() { - if (this.switched) { - this.equip(this.lastHotbarSlot, false); - } - this.lastHotbarSlot = -1; - this.currentTargetSlot = -1; - } - - @SubscribeEvent - public void onBreak(BlockEvent.BreakEvent event) { - if (BlockTweaks.fullNullCheck() || !this.noGhost.getValue().booleanValue() || !this.destroy.getValue().booleanValue()) { - return; - } - if (!(BlockTweaks.mc.player.getHeldItemMainhand().getItem() instanceof ItemBlock)) { - BlockPos pos = BlockTweaks.mc.player.getPosition(); - this.removeGlitchBlocks(pos); - } - } - - - - @SubscribeEvent - public void onAttack(AttackEntityEvent event) { - if (this.autoWeapon.getValue().booleanValue() && !BlockTweaks.fullNullCheck() && event.getTarget() != null) { - this.equipBestWeapon(event.getTarget()); - } - } - - @SubscribeEvent - public void onPacketSend(EventPacket.Send event) { - CPacketUseEntity packet; - Entity entity; - if (BlockTweaks.fullNullCheck()) { - return; - } - if (this.noFriendAttack.getValue().booleanValue() && event.getPacket() instanceof CPacketUseEntity && (entity = (packet = (CPacketUseEntity) event.getPacket()).getEntityFromWorld(BlockTweaks.mc.world)) != null && InfinityLoop.friendManager.isFriend(entity.getName())) { - event.setCanceled(true); - } - } - - @Override - public void onUpdate() { - if (!BlockTweaks.fullNullCheck()) { - if (BlockTweaks.mc.player.inventory.currentItem != this.lastHotbarSlot && BlockTweaks.mc.player.inventory.currentItem != this.currentTargetSlot) { - this.lastHotbarSlot = BlockTweaks.mc.player.inventory.currentItem; - } - if (!BlockTweaks.mc.gameSettings.keyBindAttack.isKeyDown() && this.switched) { - this.equip(this.lastHotbarSlot, false); - } - } - } - - private void removeGlitchBlocks(BlockPos pos) { - for (int dx = -4; dx <= 4; ++dx) { - for (int dy = -4; dy <= 4; ++dy) { - for (int dz = -4; dz <= 4; ++dz) { - BlockPos blockPos = new BlockPos(pos.getX() + dx, pos.getY() + dy, pos.getZ() + dz); - if (!BlockTweaks.mc.world.getBlockState(blockPos).getBlock().equals(Blocks.AIR)) continue; - BlockTweaks.mc.playerController.processRightClickBlock(BlockTweaks.mc.player, BlockTweaks.mc.world, blockPos, EnumFacing.DOWN, new Vec3d(0.5, 0.5, 0.5), EnumHand.MAIN_HAND); - } - } - } - } - - private void equipBestTool(IBlockState blockState) { - int bestSlot = -1; - double max = 0.0; - for (int i = 0; i < 9; ++i) { - int eff; - float speed; - ItemStack stack = BlockTweaks.mc.player.inventory.getStackInSlot(i); - if (stack.isEmpty || !((speed = stack.getDestroySpeed(blockState)) > 1.0f) || !((double)(speed = (float)((double)speed + ((eff = EnchantmentHelper.getEnchantmentLevel(Enchantments.EFFICIENCY, stack)) > 0 ? Math.pow(eff, 2.0) + 1.0 : 0.0))) > max)) continue; - max = speed; - bestSlot = i; - } - this.equip(bestSlot, true); - } - - public void equipBestWeapon(Entity entity) { - int bestSlot = -1; - double maxDamage = 0.0; - EnumCreatureAttribute creatureAttribute = EnumCreatureAttribute.UNDEFINED; - if (EntityUtil.isLiving(entity)) { - EntityLivingBase base = (EntityLivingBase)entity; - creatureAttribute = base.getCreatureAttribute(); - } - for (int i = 0; i < 9; ++i) { - double damage; - ItemStack stack = BlockTweaks.mc.player.inventory.getStackInSlot(i); - if (stack.isEmpty) continue; - if (stack.getItem() instanceof ItemTool) { - damage = (double)((ItemTool)stack.getItem()).attackDamage + (double)EnchantmentHelper.getModifierForCreature(stack, creatureAttribute); - if (!(damage > maxDamage)) continue; - maxDamage = damage; - bestSlot = i; - continue; - } - if (!(stack.getItem() instanceof ItemSword) || !((damage = (double)((ItemSword)stack.getItem()).getAttackDamage() + (double)EnchantmentHelper.getModifierForCreature(stack, creatureAttribute)) > maxDamage)) continue; - maxDamage = damage; - bestSlot = i; - } - this.equip(bestSlot, true); - } - - private void equip(int slot, boolean equipTool) { - if (slot != -1) { - if (slot != BlockTweaks.mc.player.inventory.currentItem) { - this.lastHotbarSlot = BlockTweaks.mc.player.inventory.currentItem; - } - this.currentTargetSlot = slot; - BlockTweaks.mc.player.inventory.currentItem = slot; - int i = InventoryManager.mc.player.inventory.currentItem; - this.currentPlayerItem = i; - InventoryManager.mc.player.connection.sendPacket(new CPacketHeldItemChange(this.currentPlayerItem)); - this.switched = equipTool; - } - } -} - diff --git a/src/main/java/com/me/infinity/loop/features/modules/misc/ExtraTab.java b/src/main/java/com/me/infinity/loop/features/modules/misc/ExtraTab.java deleted file mode 100644 index 143a4d5..0000000 --- a/src/main/java/com/me/infinity/loop/features/modules/misc/ExtraTab.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.me.infinity.loop.features.modules.misc; - -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.mojang.realmsclient.gui.ChatFormatting; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.setting.Setting; -import net.minecraft.client.network.NetworkPlayerInfo; -import net.minecraft.scoreboard.ScorePlayerTeam; - -public class ExtraTab - extends Module { - private static ExtraTab INSTANCE = new ExtraTab(); - public Setting size = this.register(new Setting("Size", 250, 1, 1000)); - - public ExtraTab() { - super("ExtraTab", "Extends Tab.", ModuleCategory.MISC); - this.setInstance(); - } - - public static String getPlayerName(NetworkPlayerInfo networkPlayerInfoIn) { - String name; - String string = name = networkPlayerInfoIn.getDisplayName() != null ? networkPlayerInfoIn.getDisplayName().getFormattedText() : ScorePlayerTeam.formatPlayerName(networkPlayerInfoIn.getPlayerTeam(), networkPlayerInfoIn.getGameProfile().getName()); - if (InfinityLoop.friendManager.isFriend(name)) { - return ChatFormatting.AQUA + name; - } - return name; - } - - public static ExtraTab getINSTANCE() { - if (INSTANCE == null) { - INSTANCE = new ExtraTab(); - } - return INSTANCE; - } - - private void setInstance() { - INSTANCE = this; - } -} - diff --git a/src/main/java/com/me/infinity/loop/features/modules/movement/NoSlow.java b/src/main/java/com/me/infinity/loop/features/modules/movement/NoSlow.java deleted file mode 100644 index dbd107a..0000000 --- a/src/main/java/com/me/infinity/loop/features/modules/movement/NoSlow.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.me.infinity.loop.features.modules.movement; - -import com.me.infinity.loop.event.events.player.EventKey; -import com.me.infinity.loop.features.gui.InfinityLoopGui; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.setting.Setting; -import net.minecraft.client.gui.*; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.settings.KeyBinding; -import net.minecraft.item.Item; -import net.minecraftforge.client.event.InputUpdateEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import org.lwjgl.input.Keyboard; - -public class NoSlow extends Module { - public Setting guiMove = this.register(new Setting("GuiMove", true)); - public Setting noSlow = this.register(new Setting("NoSlow", true)); - public boolean sneaking = false; - public static KeyBinding[] keys = new KeyBinding[]{NoSlow.mc.gameSettings.keyBindForward, NoSlow.mc.gameSettings.keyBindBack, NoSlow.mc.gameSettings.keyBindLeft, NoSlow.mc.gameSettings.keyBindRight, NoSlow.mc.gameSettings.keyBindJump, NoSlow.mc.gameSettings.keyBindSprint}; - - public NoSlow() { - super("NoSlow", "No Slow", ModuleCategory.MOVEMENT); - } - - @Override - public void onMotionUpdate() { - if (guiMove.getValue()) { - if (NoSlow.mc.currentScreen instanceof GuiOptions || NoSlow.mc.currentScreen instanceof GuiVideoSettings || NoSlow.mc.currentScreen instanceof GuiScreenOptionsSounds || NoSlow.mc.currentScreen instanceof GuiContainer || NoSlow.mc.currentScreen instanceof GuiIngameMenu || NoSlow.mc.currentScreen instanceof InfinityLoopGui) { - for (KeyBinding bind : keys) { - KeyBinding.setKeyBindState((int)bind.getKeyCode(), (boolean)Keyboard.isKeyDown((int)bind.getKeyCode())); - } - } else if (NoSlow.mc.currentScreen == null) { - for (KeyBinding bind : keys) { - if (Keyboard.isKeyDown((int)bind.getKeyCode())) continue; - KeyBinding.setKeyBindState((int)bind.getKeyCode(), (boolean)false); - } - } - } - Item item = NoSlow.mc.player.getActiveItemStack().getItem(); - } - - @SubscribeEvent - public void onInput(InputUpdateEvent inputUpdateEvent) { - if (noSlow.getValue() && NoSlow.mc.player.isHandActive() && !NoSlow.mc.player.isRiding()) { - inputUpdateEvent.getMovementInput().moveStrafe *= Float.intBitsToFloat(Float.floatToIntBits(1.5738807f) ^ 0x7F6974EC); - inputUpdateEvent.getMovementInput().moveForward *= Float.intBitsToFloat(Float.floatToIntBits(0.3323823f) ^ 0x7E0A2E03); - } - } - - /* - * WARNING - void declaration - */ - @SubscribeEvent - public void onKeyEvent(EventKey eventKey) { - if (guiMove.getValue() && !(NoSlow.mc.currentScreen instanceof GuiChat)) { - eventKey.info = eventKey.pressed; - } - } -} \ No newline at end of file diff --git a/src/main/java/com/me/infinity/loop/features/modules/movement/Step.java b/src/main/java/com/me/infinity/loop/features/modules/movement/Step.java deleted file mode 100644 index 633b8d8..0000000 --- a/src/main/java/com/me/infinity/loop/features/modules/movement/Step.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.me.infinity.loop.features.modules.movement; - -import com.me.infinity.loop.event.events.network.StepEvent; -import com.me.infinity.loop.features.modules.Module; - -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.setting.Setting; -import net.minecraft.block.material.Material; -import net.minecraft.network.play.client.CPacketPlayer; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; - -public class Step - extends Module { - public Setting vanilla = this.register(new Setting("Vanilla", false)); - public Setting stepHeight = this.register(new Setting("Height", 2, 1, 2)); - public Setting turnOff = this.register(new Setting("Disable", false)); - private static Step instance; - - public Step() { - super("Step", "Allows you to step up blocks", ModuleCategory.MOVEMENT); - instance = this; - } - - public static Step getInstance() { - if (instance == null) { - instance = new Step(); - } - return instance; - } - - @SubscribeEvent - public void onStep(StepEvent event) { - if (Step.mc.player.onGround && !Step.mc.player.isInsideOfMaterial(Material.WATER) && !Step.mc.player.isInsideOfMaterial(Material.LAVA) && Step.mc.player.collidedVertically && Step.mc.player.fallDistance == 0.0f && !Step.mc.gameSettings.keyBindJump.pressed && !Step.mc.player.isOnLadder()) { - event.setHeight(this.stepHeight.getValue().intValue()); - double rheight = Step.mc.player.getEntityBoundingBox().minY - Step.mc.player.posY; - if (rheight >= 0.625) { - if (!this.vanilla.getValue().booleanValue()) { - this.ncpStep(rheight); - } - if (this.turnOff.getValue().booleanValue()) { - this.disable(); - } - } - } else { - event.setHeight(0.6f); - } - } - - private void ncpStep(double height) { - block12: { - double y; - double posZ; - double posX; - block11: { - posX = Step.mc.player.posX; - posZ = Step.mc.player.posZ; - y = Step.mc.player.posY; - if (!(height < 1.1)) break block11; - double first = 0.42; - double second = 0.75; - if (height != 1.0) { - first *= height; - second *= height; - if (first > 0.425) { - first = 0.425; - } - if (second > 0.78) { - second = 0.78; - } - if (second < 0.49) { - second = 0.49; - } - } - Step.mc.player.connection.sendPacket(new CPacketPlayer.Position(posX, y + first, posZ, false)); - if (!(y + second < y + height)) break block12; - Step.mc.player.connection.sendPacket(new CPacketPlayer.Position(posX, y + second, posZ, false)); - break block12; - } - if (height < 1.6) { - double[] offset; - for (double off : offset = new double[]{0.42, 0.33, 0.24, 0.083, -0.078}) { - Step.mc.player.connection.sendPacket(new CPacketPlayer.Position(posX, y += off, posZ, false)); - } - } else if (height < 2.1) { - double[] heights; - for (double off : heights = new double[]{0.425, 0.821, 0.699, 0.599, 1.022, 1.372, 1.652, 1.869}) { - Step.mc.player.connection.sendPacket(new CPacketPlayer.Position(posX, y + off, posZ, false)); - } - } else { - double[] heights; - for (double off : heights = new double[]{0.425, 0.821, 0.699, 0.599, 1.022, 1.372, 1.652, 1.869, 2.019, 1.907}) { - Step.mc.player.connection.sendPacket(new CPacketPlayer.Position(posX, y + off, posZ, false)); - } - } - } - } -} - diff --git a/src/main/java/com/me/infinity/loop/features/modules/movement/TimerSpeed.java b/src/main/java/com/me/infinity/loop/features/modules/movement/TimerSpeed.java deleted file mode 100644 index 73ad6a0..0000000 --- a/src/main/java/com/me/infinity/loop/features/modules/movement/TimerSpeed.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.me.infinity.loop.features.modules.movement; - -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.setting.Setting; -import com.me.infinity.loop.util.utils.worlds.Timer; - -public class TimerSpeed - extends Module { - public Setting autoOff = this.register(new Setting("AutoOff", false)); - public Setting timeLimit = this.register(new Setting("Limit", Integer.valueOf(250), Integer.valueOf(1), Integer.valueOf(2500), v -> this.autoOff.getValue())); - public Setting mode = this.register(new Setting("Mode", TimerMode.NORMAL)); - public Setting timerSpeed = this.register(new Setting("Speed", Float.valueOf(4.0f), Float.valueOf(0.1f), Float.valueOf(20.0f))); - public Setting fastSpeed = this.register(new Setting("Fast", Float.valueOf(10.0f), Float.valueOf(0.1f), Float.valueOf(100.0f), v -> this.mode.getValue() == TimerMode.SWITCH, "Fast Speed for switch.")); - public Setting fastTime = this.register(new Setting("FastTime", 20, 1, 500, v -> this.mode.getValue() == TimerMode.SWITCH, "How long you want to go fast.(ms * 10)")); - public Setting slowTime = this.register(new Setting("SlowTime", 20, 1, 500, v -> this.mode.getValue() == TimerMode.SWITCH, "Recover from too fast.(ms * 10)")); - public Setting startFast = this.register(new Setting("StartFast", Boolean.valueOf(false), v -> this.mode.getValue() == TimerMode.SWITCH)); - public float speed = 1.0f; - private final Timer timer = new Timer(); - private final Timer turnOffTimer = new Timer(); - private boolean fast = false; - - public TimerSpeed() { - super("Timer", "Will speed up the game.", ModuleCategory.MOVEMENT); - } - - @Override - public void onEnable() { - this.turnOffTimer.reset(); - this.speed = this.timerSpeed.getValue().floatValue(); - if (!this.startFast.getValue().booleanValue()) { - this.timer.reset(); - } - } - - @Override - public void onUpdate() { - if (this.autoOff.getValue().booleanValue() && this.turnOffTimer.passedMs(this.timeLimit.getValue().intValue())) { - this.disable(); - return; - } - if (this.mode.getValue() == TimerMode.NORMAL) { - this.speed = this.timerSpeed.getValue().floatValue(); - return; - } - if (!this.fast && this.timer.passedDms(this.slowTime.getValue().intValue())) { - this.fast = true; - this.speed = this.fastSpeed.getValue().floatValue(); - this.timer.reset(); - } - if (this.fast && this.timer.passedDms(this.fastTime.getValue().intValue())) { - this.fast = false; - this.speed = this.timerSpeed.getValue().floatValue(); - this.timer.reset(); - } - } - - @Override - public void onDisable() { - this.speed = 1.0f; - InfinityLoop.timerManager.reset(); - this.fast = false; - } - - @Override - public String getDisplayInfo() { - return this.timerSpeed.getValueAsString(); - } - - public enum TimerMode { - NORMAL, - SWITCH - - } -} diff --git a/src/main/java/com/me/infinity/loop/features/modules/player/AutoDoSmth.java b/src/main/java/com/me/infinity/loop/features/modules/player/AutoDoSmth.java deleted file mode 100644 index dabe551..0000000 --- a/src/main/java/com/me/infinity/loop/features/modules/player/AutoDoSmth.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.me.infinity.loop.features.modules.player; - -import com.me.infinity.loop.event.events.network.MoveEvent; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.setting.Setting; -import net.minecraft.client.settings.KeyBinding; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; - -public class AutoDoSmth extends Module { - - private static AutoDoSmth INSTANCE = new AutoDoSmth(); - public Setting autoSprint = this.register(new Setting<>("AutoSprint", Sprint.Legit)); - public Setting autoWalk = this.register(new Setting<>("AutoWalk", false)); - public Setting autoSneak = this.register(new Setting<>("AutoSneak", false)); - public Setting autoJump = this.register(new Setting<>("AutoJump", false)); - public Setting autoSpin = this.register(new Setting<>("AutoSpin", false)); - // yaw - public Setting yawAnimation = this.register(new Setting("YawAnimation", false , v -> this.autoSpin.getValue())); - public final Setting yaw = this.register(new Setting("Yaw", Float.valueOf(1.0f), Float.valueOf(-10.0f), Float.valueOf(10.0f), v -> this.autoSpin.getValue() && yawAnimation.getValue())); - // pitch - public Setting pitchAnimation = this.register(new Setting("PitchAnimation", false , v -> this.autoSpin.getValue())); - public final Setting pitch = this.register(new Setting("Pitch", Float.valueOf(1.0f), Float.valueOf(-10.0f), Float.valueOf(10.0f), v -> this.autoSpin.getValue() && pitchAnimation.getValue())); - - public AutoDoSmth() { - super("AutoDoSmth", "I dont know why I'm made that", ModuleCategory.PLAYER); - this.setInstance(); - } - - public static AutoDoSmth getINSTANCE() { - if (INSTANCE == null) { - INSTANCE = new AutoDoSmth(); - } - return INSTANCE; - } - - private void setInstance() { - INSTANCE = this; - } - - @SubscribeEvent - public void onSprint(MoveEvent event) { - if (event.isPre() && this.autoSprint.getValue() == Sprint.Rage && (mc.player.movementInput.moveForward != 0.0f || mc.player.movementInput.moveStrafe != 0.0f)) { - event.setCanceled(true); - } - } - - public void onUpdate() { - if (!nullCheck()) { - } - if (autoSprint.getValue() == Sprint.Rage) { - if (!mc.gameSettings.keyBindForward.isKeyDown() && !mc.gameSettings.keyBindBack.isKeyDown() && !mc.gameSettings.keyBindLeft.isKeyDown() && !mc.gameSettings.keyBindRight.isKeyDown() || mc.player.isSneaking() || mc.player.collidedHorizontally || (float) mc.player.getFoodStats().getFoodLevel() <= 6.0f) - mc.player.setSprinting(true); - } - if (autoSprint.getValue() == Sprint.Legit) { - if (!mc.gameSettings.keyBindForward.isKeyDown() || mc.player.isSneaking() || mc.player.isHandActive() || mc.player.collidedHorizontally || (float) mc.player.getFoodStats().getFoodLevel() <= 6.0f || mc.currentScreen != null) - KeyBinding.setKeyBindState(mc.gameSettings.keyBindSprint.getKeyCode(), true); - } - if (autoSpin.getValue() && yawAnimation.getValue()) { - mc.player.rotationYaw = (mc.player.rotationYaw + yaw.getValue()); - } - if (autoSpin.getValue() && pitchAnimation.getValue()) { - mc.player.rotationPitch = (mc.player.rotationPitch + pitch.getValue()); - } - if (autoWalk.getValue()) { - KeyBinding.setKeyBindState(mc.gameSettings.keyBindForward.getKeyCode(), true); - } - if (autoSneak.getValue()) { - KeyBinding.setKeyBindState(mc.gameSettings.keyBindSneak.getKeyCode(), true); - } - if (autoJump.getValue()) { - KeyBinding.setKeyBindState(mc.gameSettings.keyBindJump.getKeyCode(), true); - } - } - - public void onDisable() { - if (!autoSprint.nullCheck()) { - mc.player.setSprinting(false); - } - if (autoWalk.getValue()) { - KeyBinding.setKeyBindState(mc.gameSettings.keyBindForward.getKeyCode(), false); - } - if (autoSneak.getValue()) { - KeyBinding.setKeyBindState(mc.gameSettings.keyBindSneak.getKeyCode(), false); - } - if (autoJump.getValue()) { - KeyBinding.setKeyBindState(mc.gameSettings.keyBindJump.getKeyCode(), false); - } - } - public enum Sprint { - Rage, - Legit, - None - } -} - diff --git a/src/main/java/com/me/infinity/loop/features/modules/player/FakePlayer.java b/src/main/java/com/me/infinity/loop/features/modules/player/FakePlayer.java deleted file mode 100644 index 7b78015..0000000 --- a/src/main/java/com/me/infinity/loop/features/modules/player/FakePlayer.java +++ /dev/null @@ -1,176 +0,0 @@ -package com.me.infinity.loop.features.modules.player; - -import com.me.infinity.loop.event.events.network.EventPacket; -import com.me.infinity.loop.event.events.player.EventPlayerUpdate; -import com.me.infinity.loop.features.command.Command; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.setting.Setting; -import com.me.infinity.loop.util.utils.DamageUtil; -import com.mojang.authlib.GameProfile; -import com.mojang.realmsclient.gui.ChatFormatting; -import net.minecraft.client.entity.EntityOtherPlayerMP; -import net.minecraft.enchantment.EnchantmentHelper; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.MoverType; -import net.minecraft.init.Items; -import net.minecraft.init.SoundEvents; -import net.minecraft.item.ItemStack; -import net.minecraft.network.play.server.SPacketExplosion; -import net.minecraft.util.EnumParticleTypes; -import net.minecraft.util.math.MathHelper; -import net.minecraft.world.World; -import net.minecraftforge.client.event.RenderWorldLastEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; - -import java.util.UUID; - -public class FakePlayer extends Module -{ - private static FakePlayer INSTANCE; - private final Setting pops; - private final Setting totemPopParticle; - private final Setting totemPopSound; - public Setting move; - public Setting type; - public Setting chaseX; - public Setting chaseY; - public Setting chaseZ; - public EntityOtherPlayerMP fakePlayer; - - public FakePlayer() { - super("FakePlayer", "Spawns a FakePlayer for testing.", ModuleCategory.PLAYER); - this.pops = (Setting)this.register(new Setting("TotemPops", true)); - this.totemPopParticle = (Setting)this.register(new Setting("TotemPopParticle", true)); - this.totemPopSound = (Setting)this.register(new Setting("TotemPopSound", true)); - this.move = (Setting)this.register(new Setting("Move", true)); - this.type = (Setting)this.register(new Setting("MovementMode", Type.NONE, v -> this.move.getValue())); - this.chaseX = (Setting)this.register(new Setting("ChaseX", 4, 1, 120, v -> this.move.getValue() && this.type.getValue() == Type.CHASE)); - this.chaseY = (Setting)this.register(new Setting("ChaseY", 4, 1, 120, v -> this.move.getValue() && this.type.getValue() == Type.CHASE)); - this.chaseZ = (Setting)this.register(new Setting("ChaseZ", 4, 1, 120, v -> this.move.getValue() && this.type.getValue() == Type.CHASE)); - } - - public static FakePlayer getInstance() { - if (FakePlayer.INSTANCE == null) { - FakePlayer.INSTANCE = new FakePlayer(); - } - return FakePlayer.INSTANCE; - } - - public void onEnable() { - if (FakePlayer.mc.world == null || FakePlayer.mc.player == null) { - this.disable(); - } - else { - final UUID playerUUID = FakePlayer.mc.player.getUniqueID(); - (this.fakePlayer = new EntityOtherPlayerMP((World)FakePlayer.mc.world, new GameProfile(UUID.fromString(playerUUID.toString()), FakePlayer.mc.player.getDisplayNameString()))).copyLocationAndAnglesFrom((Entity)FakePlayer.mc.player); - this.fakePlayer.inventory.copyInventory(FakePlayer.mc.player.inventory); - FakePlayer.mc.world.addEntityToWorld(-7777, (Entity)this.fakePlayer); - Command.sendMessage(ChatFormatting.GREEN + "FakePlayer name KuroHere was born in the world"); - } - } - - @SubscribeEvent - public void onTick(final EventPlayerUpdate event) { - if (this.pops.getValue()) { - if (this.fakePlayer != null) { - this.fakePlayer.inventory.offHandInventory.set(0,(ItemStack) new ItemStack(Items.TOTEM_OF_UNDYING)); - if (this.fakePlayer.getHealth() <= 0.0f) { - this.fakePop((Entity)this.fakePlayer); - this.fakePlayer.setHealth(20.0f); - //final InfinityLoop infinityLoop = this.infinityLoop; - //InfinityLoop.popListener.handlePop((EntityPlayer)this.fakePlayer); - } - } - if (this.move.getValue() && !this.type.getValue().equals(Type.CHASE)) { - this.travel(this.fakePlayer.moveStrafing, this.fakePlayer.moveVertical, this.fakePlayer.moveForward); - } - } - } - - @SubscribeEvent - public void onRender(final RenderWorldLastEvent event) { - if (this.type.getValue().equals(Type.CHASE)) { - this.fakePlayer.posX = FakePlayer.mc.player.posX + this.chaseX.getValue(); - this.fakePlayer.posY = this.chaseY.getValue(); - this.fakePlayer.posZ = FakePlayer.mc.player.posZ + this.chaseZ.getValue(); - } - } - - @SubscribeEvent - public void onPacketReceive(final EventPacket.Receive event) { - if (this.fakePlayer == null) { - return; - } - if (event.getPacket() instanceof SPacketExplosion) { - final SPacketExplosion explosion = (SPacketExplosion)event.getPacket(); - if (this.fakePlayer.getDistance(explosion.getX(), explosion.getY(), explosion.getZ()) <= 15.0) { - final double damage = DamageUtil.calculateDamage(explosion.getX(), explosion.getY(), explosion.getZ(), (Entity)this.fakePlayer); - if (damage > 0.0 && this.pops.getValue()) { - this.fakePlayer.setHealth((float)(this.fakePlayer.getHealth() - MathHelper.clamp(damage, 0.0, 999.0))); - } - } - } - } - - public void travel(final float strafe, final float vertical, final float forward) { - final double d0 = this.fakePlayer.posY; - float f1 = 0.8f; - float f2 = 0.02f; - float f3 = (float)EnchantmentHelper.getDepthStriderModifier((EntityLivingBase)this.fakePlayer); - if (f3 > 3.0f) { - f3 = 3.0f; - } - if (!this.fakePlayer.onGround) { - f3 *= 0.5f; - } - if (f3 > 0.0f) { - f1 += (0.54600006f - f1) * f3 / 3.0f; - f2 += (this.fakePlayer.getAIMoveSpeed() - f2) * f3 / 4.0f; - } - this.fakePlayer.moveRelative(strafe, vertical, forward, f2); - this.fakePlayer.move(MoverType.SELF, this.fakePlayer.motionX, this.fakePlayer.motionY, this.fakePlayer.motionZ); - final EntityOtherPlayerMP fakePlayer = this.fakePlayer; - fakePlayer.motionX *= f1; - final EntityOtherPlayerMP fakePlayer2 = this.fakePlayer; - fakePlayer2.motionY *= 0.800000011920929; - final EntityOtherPlayerMP fakePlayer3 = this.fakePlayer; - fakePlayer3.motionZ *= f1; - if (!this.fakePlayer.hasNoGravity()) { - final EntityOtherPlayerMP fakePlayer4 = this.fakePlayer; - fakePlayer4.motionY -= 0.02; - } - if (this.fakePlayer.collidedHorizontally && this.fakePlayer.isOffsetPositionInLiquid(this.fakePlayer.motionX, this.fakePlayer.motionY + 0.6000000238418579 - this.fakePlayer.posY + d0, this.fakePlayer.motionZ)) { - this.fakePlayer.motionY = 0.30000001192092896; - } - } - - public void onDisable() { - if (this.fakePlayer != null && FakePlayer.mc.world != null) { - FakePlayer.mc.world.removeEntityFromWorld(-7777); - Command.sendMessage(ChatFormatting.GREEN + "FakePlayer name KuroHere got remove"); - this.fakePlayer = null; - } - } - - private void fakePop(final Entity entity) { - if (this.totemPopParticle.getValue()) { - FakePlayer.mc.effectRenderer.emitParticleAtEntity(entity, EnumParticleTypes.TOTEM, 30); - } - if (this.totemPopSound.getValue()) { - FakePlayer.mc.world.playSound(entity.posX, entity.posY, entity.posZ, SoundEvents.ITEM_TOTEM_USE, entity.getSoundCategory(), 1.0f, 1.0f, false); - } - } - - static { - FakePlayer.INSTANCE = new FakePlayer(); - } - - public enum Type - { - NONE, - CHASE, - STATIC; - } -} \ No newline at end of file diff --git a/src/main/java/com/me/infinity/loop/features/modules/player/LiquidInteract.java b/src/main/java/com/me/infinity/loop/features/modules/player/LiquidInteract.java deleted file mode 100644 index 5cdcd06..0000000 --- a/src/main/java/com/me/infinity/loop/features/modules/player/LiquidInteract.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.me.infinity.loop.features.modules.player; - -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; - -public class LiquidInteract - extends Module { - private static LiquidInteract INSTANCE = new LiquidInteract(); - - public LiquidInteract() { - super("LiquidInteract", "Interact with liquids", ModuleCategory.PLAYER); - this.setInstance(); - } - - public static LiquidInteract getInstance() { - if (INSTANCE == null) { - INSTANCE = new LiquidInteract(); - } - return INSTANCE; - } - - private void setInstance() { - INSTANCE = this; - } -} - diff --git a/src/main/java/com/me/infinity/loop/features/modules/render/Animation.java b/src/main/java/com/me/infinity/loop/features/modules/render/Animation.java deleted file mode 100644 index 1488ab3..0000000 --- a/src/main/java/com/me/infinity/loop/features/modules/render/Animation.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.me.infinity.loop.features.modules.render; - -import com.me.infinity.loop.event.events.network.EventPacket; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.setting.Setting; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemSword; -import net.minecraft.network.play.client.CPacketAnimation; -import net.minecraft.util.EnumHand; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; - -public class Animation extends Module { - private static Animation INSTANCE = new Animation(); - public Setting playersDisableAnimations = register(new Setting<>("DisableAnimations", false)); - - public Setting mode = this.register(new Setting("OldAnimations", Mode.NoDelay)); - public Setting whatHand = this.register(new Setting<>("Swing", WhatHand.Mainhand)); - public Setting swing = register(new Setting<>("customSwingAnimation", false)); - public Setting speed = register(new Setting<>("Speed", 13, 1, 20,v -> this.swing.getValue())); - - public Animation() { - super("Animation", "Change animations.", ModuleCategory.RENDER); - this.setInstance(); - } - - public static Animation getInstance() { - if (INSTANCE == null) { - INSTANCE = new Animation(); - } - return INSTANCE; - } - - private void setInstance() { - INSTANCE = this; - } - - public void onUpdate() { - if (nullCheck()) { - return; - } - if (playersDisableAnimations.getValue()) { - for (EntityPlayer player : Animation.mc.world.playerEntities) { - player.limbSwing = Float.intBitsToFloat(Float.floatToIntBits(1.8755627E38f) ^ 0x7F0D1A06); - player.limbSwingAmount = Float.intBitsToFloat(Float.floatToIntBits(6.103741E37f) ^ 0x7E37AD83); - player.prevLimbSwingAmount = Float.intBitsToFloat(Float.floatToIntBits(4.8253957E37f) ^ 0x7E11357F); - } - } - if (this.whatHand.getValue() == WhatHand.Offhand) { - Animation.mc.player.swingingHand = EnumHand.OFF_HAND; - } - if (this.mode.getValue() == Mode.NoDelay && Animation.mc.entityRenderer.itemRenderer.prevEquippedProgressMainHand >= 0.9) { - Animation.mc.entityRenderer.itemRenderer.equippedProgressMainHand = 1.0f; - Animation.mc.entityRenderer.itemRenderer.itemStackMainHand = Animation.mc.player.getHeldItemMainhand(); - } - if (this.whatHand.getValue().equals((Object) WhatHand.PacketSwing) && Animation.mc.player.getHeldItemMainhand().getItem() instanceof ItemSword && (double) Animation.mc.entityRenderer.itemRenderer.prevEquippedProgressMainHand >= 0.9) { - Animation.mc.entityRenderer.itemRenderer.equippedProgressMainHand = 1.0f; - Animation.mc.entityRenderer.itemRenderer.itemStackMainHand = Animation.mc.player.getHeldItemMainhand(); - } - } - - @SubscribeEvent - public void onPacketSend(final EventPacket.Send send) { - final Object t = send.getPacket(); - if (t instanceof CPacketAnimation && this.whatHand.getValue() == WhatHand.Disable) { - send.setCanceled(true); - } - } - - private enum Mode - { - Normal, - NoDelay - } - - private enum WhatHand - { - Mainhand, - Offhand, - Disable, - PacketSwing - } -} - diff --git a/src/main/java/com/me/infinity/loop/features/modules/render/BreadCrumbs.java b/src/main/java/com/me/infinity/loop/features/modules/render/BreadCrumbs.java deleted file mode 100644 index fb1f59a..0000000 --- a/src/main/java/com/me/infinity/loop/features/modules/render/BreadCrumbs.java +++ /dev/null @@ -1,153 +0,0 @@ -package com.me.infinity.loop.features.modules.render; - -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.event.events.render.Render3DEvent; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.setting.Setting; -import com.me.infinity.loop.manager.AccessorRenderManager; -import com.me.infinity.loop.util.utils.maths.MathUtil; -import com.me.infinity.loop.util.utils.worlds.Timer; -import net.minecraft.util.EnumParticleTypes; -import net.minecraft.util.math.Vec3d; -import org.lwjgl.opengl.GL11; - -import java.awt.*; -import java.util.ArrayList; - -public class BreadCrumbs extends Module { - - private static BreadCrumbs INSTANCE = new BreadCrumbs(); - ArrayList bcs = new ArrayList<>(); - - public Setting mode = this.register(new Setting<>("Mode", Mode.DEFAULT)); - public Setting lineWidht = register(new Setting<>("LineWidth", Float.valueOf(1.0f), Float.valueOf(0.1f), Float.valueOf(5.0f), v -> this.mode.getValue() == Mode.DEFAULT)); - public Setting tickClear = register(new Setting<>("TickClear", 25, 1, 45)); - public Setting fadeSpeed = register(new Setting<>("FadeSpeed", Float.valueOf(0.4f), Float.valueOf(0.1f), Float.valueOf(2.0f))); - public Setting color = register(new Setting<>("Alpha", new Color(-1), v -> this.mode.getValue() == Mode.DEFAULT)); - - public BreadCrumbs() { - super("BreadCumbs", "Draw Line behind u(Will fix crash on enable soon)", ModuleCategory.RENDER); - this.setInstance(); - } - - public static BreadCrumbs getInstance() { - if (INSTANCE == null) { - INSTANCE = new BreadCrumbs(); - } - return INSTANCE; - } - - private void setInstance() { - INSTANCE = this; - } - - public enum Mode { - DEFAULT, - PARTICLE - } - - @Override - public void onTick() { - if (nullCheck()) return; - if (BreadCrumbs.getInstance().mode.getValue() == Mode.PARTICLE) - mc.world.spawnParticle(EnumParticleTypes.DRIP_WATER, mc.player.posX, mc.player.posY, mc.player.posZ, mc.player.motionX, mc.player.motionY, mc.player.motionZ, 2); - } - - public static void putVertex3d(Vec3d vec) { - GL11.glVertex3d(vec.x, vec.y, vec.z); - } - - public Vec3d getRenderPos(double x, double y, double z) { - AccessorRenderManager renderManager = (AccessorRenderManager) mc.getRenderManager( ); - x = x - renderManager.getRenderPosX(); - y = y - renderManager.getRenderPosY(); - z = z - renderManager.getRenderPosZ(); - return new Vec3d(x, y, z); - } - - @Override - public void toggle() { - bcs.clear(); - } - - @Override - public void onRender3D(Render3DEvent event) { - if (BreadCrumbs.getInstance().mode.getValue() == Mode.DEFAULT) { - double interpolatedX = MathUtil.interpolate(mc.player.lastTickPosX, mc.player.posX, mc.getRenderPartialTicks()); - double interpolatedY = MathUtil.interpolate(mc.player.lastTickPosY, mc.player.posY, mc.getRenderPartialTicks()); - double interpolatedZ = MathUtil.interpolate(mc.player.lastTickPosZ, mc.player.posZ, mc.getRenderPartialTicks()); - bcs.add(new BreadCrumb(new Vec3d(interpolatedX, interpolatedY, interpolatedZ))); - int time = this.tickClear.getValue() * 50; - GL11.glPushAttrib(1048575); - GL11.glPushMatrix(); - GL11.glDisable(3008); - GL11.glEnable(3042); - GL11.glBlendFunc(770, 771); - GL11.glDisable(3553); - GL11.glDisable(2929); - GL11.glDepthMask(false); - GL11.glEnable(2884); - GL11.glEnable(2848); - GL11.glHint(3154, 4353); - GL11.glDisable(2896); - GL11.glLineWidth(this.lineWidht.getValue()); - GL11.glBegin(3); - for (int i = 0; i < bcs.size(); i++) { - BreadCrumb crumb = bcs.get(i); - if (crumb.getTimer().passed(time)) { - crumb.update(bcs); - } - GL11.glColor4f(color.getValue().getRed() / 255.0F, color.getValue().getGreen() / 255.0f, color.getValue().getBlue() / 255.0f, ( float ) (crumb.getAlpha() / 255f)); - putVertex3d(getRenderPos(crumb.getVector().x, crumb.getVector().y + 0.3, crumb.getVector().z)); - } - GL11.glEnd(); - GL11.glEnable(2896); - GL11.glDisable(2848); - GL11.glEnable(3553); - GL11.glEnable(2929); - GL11.glDisable(3042); - GL11.glEnable(3008); - GL11.glDepthMask(true); - GL11.glCullFace(1029); - GL11.glPopMatrix(); - GL11.glPopAttrib(); - } - } - - public class BreadCrumb { - - Vec3d vector; - Timer timer; - double alpha; - - public BreadCrumb(Vec3d vector) { - timer = new Timer(); - timer.reset(); - this.vector = vector; - this.alpha = color.getValue().getAlpha(); - } - - public Timer getTimer() { - return timer; - } - - public Vec3d getVector() { - return vector; - } - - public double getAlpha() { - return alpha; - } - - public void update(ArrayList arrayList) { - if (alpha <= 0) { - alpha = 0; - arrayList.remove(this); - } - this.alpha -= color.getValue().getAlpha() / fadeSpeed.getValue() * InfinityLoop.getFpsManagement().getFrametime(); - } - - } - -} diff --git a/src/main/java/com/me/infinity/loop/features/modules/render/BreakESPtest.java b/src/main/java/com/me/infinity/loop/features/modules/render/BreakESPtest.java deleted file mode 100644 index ae509dd..0000000 --- a/src/main/java/com/me/infinity/loop/features/modules/render/BreakESPtest.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.me.infinity.loop.features.modules.render; - -public class BreakESPtest { -} diff --git a/src/main/java/com/me/infinity/loop/features/modules/render/BurrowESP.java b/src/main/java/com/me/infinity/loop/features/modules/render/BurrowESP.java deleted file mode 100644 index 30c4b49..0000000 --- a/src/main/java/com/me/infinity/loop/features/modules/render/BurrowESP.java +++ /dev/null @@ -1,128 +0,0 @@ -package com.me.infinity.loop.features.modules.render; - -import com.me.infinity.loop.event.events.render.Render3DEvent; -import com.me.infinity.loop.features.command.Command; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.modules.client.Colors; -import com.me.infinity.loop.features.setting.Setting; -import com.me.infinity.loop.util.utils.renders.ColorUtil; -import com.me.infinity.loop.util.utils.renders.RenderUtil; -import com.mojang.realmsclient.gui.ChatFormatting; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.util.math.BlockPos; - -import java.awt.*; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.ConcurrentHashMap; -import java.util.stream.Collectors; - -public class BurrowESP extends Module { - - private static BurrowESP INSTANCE = new BurrowESP(); - public Setting burrowAlert = register(new Setting("BurrowAlert", true)); - - public Setting range = register(new Setting("Range", 20, 5, 50)); - public Setting self = register(new Setting("Self", true)); - public Setting text = register(new Setting("Text", true)); - public Setting customText = register(new Setting("CustomText", false, v -> this.text.getValue())); - public Setting textString = register(new Setting("TextString", "BURROW", v -> this.text.getValue() && this.customText.getValue())); - public Setting rainbow = register(new Setting("Rainbow", false)); - public Setting red = register(new Setting("Red", 0, 0, 255, v -> !this.rainbow.getValue())); - public Setting green = register(new Setting("Green", 255, 0, 255, v -> !this.rainbow.getValue())); - public Setting blue = register(new Setting("Blue", 0, 0, 255, v -> !this.rainbow.getValue())); - public Setting alpha = register(new Setting("Alpha", 130, 0, 255)); - public Setting outlineAlpha = register(new Setting("OL-Alpha", 250, 0, 255)); - private final ConcurrentHashMap players = new ConcurrentHashMap(); - List anti_spam = new ArrayList(); - List burrowedPlayers = new ArrayList(); - private final List posList = new ArrayList<>(); - private final RenderUtil renderUtil = new RenderUtil(); - - public BurrowESP() { - super("BurrowESP", "BURROWESP", ModuleCategory.RENDER); - this.setInstance(); - } - - public static BurrowESP getInstance() { - if (INSTANCE == null) { - INSTANCE = new BurrowESP(); - } - return INSTANCE; - } - - private void setInstance() { - INSTANCE = this; - } - - @Override - public void onEnable() { - this.players.clear(); - this.anti_spam.clear(); - } - - public void onTick() { - posList.clear(); - for (EntityPlayer player : mc.world.playerEntities) { - BlockPos blockPos = new BlockPos(Math.floor(player.posX), Math.floor(player.posY + 0.2), Math.floor(player.posZ)); - if ((mc.world.getBlockState(blockPos).getBlock() == Blocks.ENDER_CHEST || mc.world.getBlockState(blockPos).getBlock() == Blocks.OBSIDIAN) && blockPos.distanceSq(mc.player.posX, mc.player.posY, mc.player.posZ) <= this.range.getValue()) { - if (!(blockPos.distanceSq(mc.player.posX, mc.player.posY, mc.player.posZ) <= 1.5) || this.self.getValue()) { - posList.add(blockPos); - } - - } - } - } - - @Override - public void onUpdate() { - if (BurrowESP.mc.player == null || BurrowESP.mc.world == null) { - return; - } - if (burrowAlert.getValue().booleanValue()) { - for (Entity entity : BurrowESP.mc.world.loadedEntityList.stream().filter(e -> e instanceof EntityPlayer).collect(Collectors.toList())) { - if (!(entity instanceof EntityPlayer)) continue; - if (!this.burrowedPlayers.contains(entity) && this.isBurrowed(entity)) { - this.burrowedPlayers.add(entity); - Command.sendMessage(ChatFormatting.RED + entity.getName() + " has just burrowed!"); - continue; - } - if (!this.burrowedPlayers.contains(entity) || this.isBurrowed(entity)) continue; - this.burrowedPlayers.remove(entity); - Command.sendMessage(ChatFormatting.GREEN + entity.getName() + " is no longer burrowed!"); - } - } - } - - private boolean isBurrowed(Entity entity) { - BlockPos entityPos = new BlockPos(this.roundValueToCenter(entity.posX), entity.posY + 0.2, this.roundValueToCenter(entity.posZ)); - return BurrowESP.mc.world.getBlockState(entityPos).getBlock() == Blocks.OBSIDIAN || BurrowESP.mc.world.getBlockState(entityPos).getBlock() == Blocks.ENDER_CHEST; - } - - private double roundValueToCenter(double inputVal) { - double roundVal = Math.round(inputVal); - if (roundVal > inputVal) { - roundVal -= 0.5; - } else if (roundVal <= inputVal) { - roundVal += 0.5; - } - return roundVal; - } - - - @Override - public void onRender3D(Render3DEvent event) { - for (BlockPos bp : posList) { - String text = textString.getValue().toUpperCase(); - if (this.text.getValue().booleanValue() && customText.getValue()) { - renderUtil.drawText(bp, text, rainbow.getValue() ? ColorUtil.rainbow(Colors.getInstance().rainbowHue.getValue()) : new Color(red.getValue(), green.getValue(), blue.getValue(), outlineAlpha.getValue())); - } else { - RenderUtil.drawText(bp, mc.player.getGameProfile().getName()); - } - RenderUtil.drawBoxESP(bp, rainbow.getValue() ? ColorUtil.rainbow(Colors.getInstance().rainbowHue.getValue()) : new Color(red.getValue(), green.getValue(), blue.getValue(), outlineAlpha.getValue()), 1.5F, true, true, alpha.getValue()); - } - } -} diff --git a/src/main/java/com/me/infinity/loop/features/modules/render/CameraClip.java b/src/main/java/com/me/infinity/loop/features/modules/render/CameraClip.java deleted file mode 100644 index 275424f..0000000 --- a/src/main/java/com/me/infinity/loop/features/modules/render/CameraClip.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.me.infinity.loop.features.modules.render; - -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.setting.Setting; - -public class CameraClip - extends Module { - private static CameraClip INSTANCE = new CameraClip(); - public Setting extend = this.register(new Setting<>("Extend", false)); - public Setting distance = this.register(new Setting<>("Distance", 10.0, 0.0, 50.0, v -> this.extend.getValue(), "By how much you want to extend the distance.")); - - public CameraClip() { - super("CameraClip", "Makes your Camera clip.", ModuleCategory.RENDER); - this.setInstance(); - } - - public static CameraClip getInstance() { - if (INSTANCE == null) { - INSTANCE = new CameraClip(); - } - return INSTANCE; - } - - private void setInstance() { - INSTANCE = this; - } -} diff --git a/src/main/java/com/me/infinity/loop/features/modules/render/Dismemberment.java b/src/main/java/com/me/infinity/loop/features/modules/render/Dismemberment.java deleted file mode 100644 index 1764e85..0000000 --- a/src/main/java/com/me/infinity/loop/features/modules/render/Dismemberment.java +++ /dev/null @@ -1,225 +0,0 @@ -package com.me.infinity.loop.features.modules.render; - -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.setting.Setting; -import com.me.infinity.loop.util.utils.renders.helper.dism.EntityGib; -import net.minecraft.client.Minecraft; -import net.minecraft.client.multiplayer.WorldClient; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.item.EntityEnderCrystal; -import net.minecraft.entity.item.EntityMinecartTNT; -import net.minecraft.entity.item.EntityTNTPrimed; -import net.minecraft.entity.monster.EntityCreeper; -import net.minecraft.entity.monster.EntitySkeleton; -import net.minecraft.entity.monster.EntityZombie; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.math.MathHelper; -import net.minecraft.world.World; -import net.minecraftforge.event.entity.living.LivingDeathEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.common.gameevent.TickEvent; -import net.minecraftforge.fml.common.network.FMLNetworkEvent; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map.Entry; -public class Dismemberment extends Module { - - public Dismemberment() { - super("Blood", "Dismemberment(Not Work!)",ModuleCategory.RENDER); - } - - public Setting blood = this.register(new Setting("Blood", false)); - public Setting gibGroundTime = this.register(new Setting("OnGroundTime", 425, 0, 2000)); - public Setting gibTime = this.register(new Setting("LiveTime", 425, 0, 2000)); - public Setting bcount = this.register(new Setting("BloodCount", 425, 0, 2000)); - - public HashMap dismemberTimeout = new HashMap<>(); - public HashMap exploTime = new HashMap<>(); - public ArrayList explosionSources = new ArrayList<>(); - - @SubscribeEvent - public void onLivingDeath(LivingDeathEvent event) - { - if(event.getEntity().world.isRemote && (event.getEntityLiving() instanceof EntityZombie || event.getEntityLiving() instanceof EntityPlayer || event.getEntityLiving() instanceof EntitySkeleton || event.getEntityLiving() instanceof EntityCreeper) && !event.getEntityLiving().isChild()) - { - dismemberTimeout.put(event.getEntityLiving(), 2); - } - } - - - - @SubscribeEvent - public void onClientConnection(FMLNetworkEvent.ClientConnectedToServerEvent event) - { - exploTime.clear(); - dismemberTimeout.clear(); - explosionSources.clear(); - } - - @SubscribeEvent - public void worldTick(TickEvent.ClientTickEvent event) - { - if(event.phase == TickEvent.Phase.END && Minecraft.getMinecraft().world != null) - { - Minecraft mc = Minecraft.getMinecraft(); - WorldClient world = mc.world; - - if(!mc.isGamePaused()) - { - for(int i = 0; i < world.loadedEntityList.size(); i++) - { - Entity ent = world.loadedEntityList.get(i); - if(ent instanceof EntityCreeper || ent instanceof EntityTNTPrimed || ent instanceof EntityMinecartTNT || ent instanceof EntityEnderCrystal) - { - if(!explosionSources.contains(ent)) - { - explosionSources.add(ent); - } - } - if((ent instanceof EntityZombie || ent instanceof EntityPlayer || ent instanceof EntitySkeleton || ent instanceof EntityCreeper) && !ent.isEntityAlive() && !dismemberTimeout.containsKey(ent)) - { - dismemberTimeout.put((EntityLivingBase)ent, 2); - } - } - for(int i = explosionSources.size() - 1; i >= 0; i--) - { - Entity ent = explosionSources.get(i); - if(ent.isDead) - { - if(ent instanceof EntityTNTPrimed || ent instanceof EntityMinecartTNT) - { - if(!exploTime.containsKey(ent)) - { - int time = ticks % 24000; - if(time > 23959L) - { - time -= 23999L; - } - exploTime.put(ent, time); - } - } - - explosionSources.remove(i); - } - } - - Iterator> ite = dismemberTimeout.entrySet().iterator(); - if(ite.hasNext()) - { - Entry e = ite.next(); - - e.setValue(e.getValue() - 1); - - e.getKey().hurtTime = 0; - e.getKey().deathTime = 0; - - Entity explo = null; - double dist = 1000D; - for(Entry e1 : exploTime.entrySet()) - { - double mobDist = e1.getKey().getDistance(e.getKey()); - if(mobDist < 10D && mobDist < dist) - { - dist = mobDist; - explo = e1.getKey(); - e.setValue(0); - } - } - - if(e.getValue() <= 0) - { - if(dismember(e.getKey().world, e.getKey(), explo)) - { - e.getKey().setDead(); - } - ite.remove(); - } - } - - Iterator> ite1 = exploTime.entrySet().iterator(); - int worldTime = ticks % 24000; - while(ite1.hasNext()) - { - Entry e = ite1.next(); - if(e.getValue() + 40L < worldTime) - { - ite1.remove(); - } - } - } - } - } - - public boolean dismember(World world, EntityLivingBase living, Entity explo) - { - if(living.isChild()) - { - return false; - } - if(living instanceof EntityCreeper) - { - world.spawnEntity(new EntityGib(world, living, 0, explo)); - world.spawnEntity(new EntityGib(world, living, 3, explo)); - world.spawnEntity(new EntityGib(world, living, 6, explo)); - world.spawnEntity(new EntityGib(world, living, 7, explo)); - world.spawnEntity(new EntityGib(world, living, 8, explo)); - world.spawnEntity(new EntityGib(world, living, 9, explo)); - } - else - { - if(living instanceof EntityPlayer) { - for (int i = -1; i < 6; i++) { - world.spawnEntity(new EntityGib(world, living, i, explo)); - } - } else { - for (int i = 0; i < 6; i++) { - world.spawnEntity(new EntityGib(world, living, i, explo)); - } - } - - if(living instanceof EntityZombie || living instanceof EntityPlayer && blood.getValue()) - { - for(int k = 0; k < (explo != null ? bcount.getValue() * 10 : bcount.getValue()); k++) - { - float var4 = 0.3F; - double mX = (double)(-MathHelper.sin(living.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(living.rotationPitch / 180.0F * (float)Math.PI) * var4); - double mZ = (double)(MathHelper.cos(living.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(living.rotationPitch / 180.0F * (float)Math.PI) * var4); - double mY = (double)(-MathHelper.sin(living.rotationPitch / 180.0F * (float)Math.PI) * var4 + 0.1F); - var4 = 0.02F; - float var5 = living.getRNG().nextFloat() * (float)Math.PI * 2.0F; - var4 *= living.getRNG().nextFloat(); - - if(explo != null) - { - var4 *= 100D; - } - - mX += Math.cos((double)var5) * (double)var4; - mY += (double)((living.getRNG().nextFloat() - living.getRNG().nextFloat()) * 0.1F); - mZ += Math.sin((double)var5) * (double)var4; - - //RendererHelper.spawnParticle(new ParticleBlood(living.world, living.posX, living.posY + 0.5D + (living.getRNG().nextDouble() * 0.7D), living.posZ, living.motionX + mX, living.motionY + mY, living.motionZ + mZ, false)); - } - } - } - return true; - } - public static int ticks; - - @SubscribeEvent - public void onClientTick(TickEvent.ClientTickEvent event) - { - if(event.phase == TickEvent.Phase.END) - { - ticks++; - } - } - - public HashMap amputationMap = new HashMap<>(); - - -} diff --git a/src/main/java/com/me/infinity/loop/features/modules/render/FogColor.java b/src/main/java/com/me/infinity/loop/features/modules/render/FogColor.java deleted file mode 100644 index 0810a83..0000000 --- a/src/main/java/com/me/infinity/loop/features/modules/render/FogColor.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.me.infinity.loop.features.modules.render; - -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.setting.Setting; -import net.minecraftforge.client.event.*; -import net.minecraftforge.fml.common.eventhandler.*; -import net.minecraftforge.common.*; -import java.awt.*; - -public class FogColor extends Module -{ - private static FogColor INSTANCE = new FogColor(); - private final Setting red = this.register(new Setting<>("Red", 0, 0, 255)); - private final Setting green = this.register(new Setting<>("Green", 255, 0, 255)); - private final Setting blue = this.register(new Setting<>("Blue", 0, 0, 255)); - private final Setting rainbow = this.register(new Setting<>("Rainbow", false)); - public Setting delay = this.register(new Setting("Delay", Integer.valueOf(160), Integer.valueOf(0), Integer.valueOf(600), v -> this.rainbow.getValue())); - private final Setting fog = this.register(new Setting<>("Fog", true)); - public FogColor() { - super("FogColor", "Changes the color of the sky", ModuleCategory.RENDER); - } - - private void setInstance() { - FogColor.INSTANCE = this; - } - - public static FogColor getInstance() { - if (FogColor.INSTANCE == null) { - FogColor.INSTANCE = new FogColor(); - } - return FogColor.INSTANCE; - } - - @SubscribeEvent - public void fogColors(final EntityViewRenderEvent.FogColors event) { - event.setRed(this.red.getValue() / 255.0f); - event.setGreen(this.green.getValue() / 255.0f); - event.setBlue(this.blue.getValue() / 255.0f); - } - - @SubscribeEvent - public void fog_density(final EntityViewRenderEvent.FogDensity event) { - if (this.fog.getValue()) { - event.setDensity(0.0f); - event.setCanceled(true); - } - } - - public void onEnable() { - MinecraftForge.EVENT_BUS.register(this); - } - - public void onDisable() { - MinecraftForge.EVENT_BUS.unregister(this); - } - - public void onUpdate() { - if (this.rainbow.getValue()) { - this.doRainbow(); - } - } - - public void doRainbow() { - final float[] tick_color = {delay.getValue() + System.currentTimeMillis() % 11520L / 11520.0f }; - final int color_rgb_o = Color.HSBtoRGB(tick_color[0], 0.8f, 0.8f); - this.red.setValue(color_rgb_o >> 16 & 0xFF); - this.green.setValue(color_rgb_o >> 8 & 0xFF); - this.blue.setValue(color_rgb_o & 0xFF); - } - - static { - FogColor.INSTANCE = new FogColor(); - } -} diff --git a/src/main/java/com/me/infinity/loop/features/modules/render/HoleESP.java b/src/main/java/com/me/infinity/loop/features/modules/render/HoleESP.java deleted file mode 100644 index 97db130..0000000 --- a/src/main/java/com/me/infinity/loop/features/modules/render/HoleESP.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.me.infinity.loop.features.modules.render; - -import com.me.infinity.loop.event.events.render.Render3DEvent; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.modules.client.Colors; -import com.me.infinity.loop.features.setting.Setting; -import com.me.infinity.loop.util.utils.HoleUtil; -import com.me.infinity.loop.util.utils.minecraft.BlockUtil; -import com.me.infinity.loop.util.utils.renders.ColorUtil; -import com.me.infinity.loop.util.utils.renders.RenderUtil; -import net.minecraft.init.Blocks; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3i; - -import java.awt.*; - -public class HoleESP - extends Module { - private static HoleESP INSTANCE = new HoleESP(); - private final Setting rangeX = this.register(new Setting("RangeX", 5, 0, 30)); - private final Setting rangeY = this.register(new Setting("RangeY", 3, 0, 30)); - public Setting fov = this.register(new Setting("InFov", false)); - public Setting ownHole = this.register(new Setting("OwnHole", false)); - public Setting box = this.register(new Setting("Box", true)); - public Setting boxs = this.register(new Setting("Double Hole", true)); - public Setting gradientBox = this.register(new Setting("GradientBox", Boolean.valueOf(false), v -> this.box.getValue())); - public Setting invertGradientBox = this.register(new Setting("ReverseGradientBox", Boolean.valueOf(false), v -> this.gradientBox.getValue())); - public Setting outline = this.register(new Setting("Outline", true)); - public Setting gradientOutline = this.register(new Setting("GradientOutline", Boolean.valueOf(false), v -> this.outline.getValue())); - public Setting invertGradientOutline = this.register(new Setting("ReverseGradientOutline", Boolean.valueOf(false), v -> this.gradientOutline.getValue() && this.outline.getValue())); - public Setting height = this.register(new Setting("Height", 0.0, -2.0, 2.0)); - public Setting safeColor = this.register(new Setting("SafeColor", false)); - public Setting customOutline = this.register(new Setting("CustomLine", Boolean.valueOf(false), v -> this.outline.getValue())); - private final Setting rainbow = this.register(new Setting("Rainbow", false)); - private final Setting red = this.register(new Setting("Red", 0, 0, 255)); - private final Setting green = this.register(new Setting("Green", 255, 0, 255)); - private final Setting blue = this.register(new Setting("Blue", 0, 0, 255)); - private final Setting alpha = this.register(new Setting("Alpha", 255, 0, 255)); - private final Setting boxAlpha = this.register(new Setting("BoxAlpha", Integer.valueOf(125), Integer.valueOf(0), Integer.valueOf(255), v -> this.box.getValue())); - private final Setting lineWidth = this.register(new Setting("LineWidth", Float.valueOf(1.0f), Float.valueOf(0.1f), Float.valueOf(5.0f), v -> this.outline.getValue())); - private final Setting safeRed = this.register(new Setting("SafeRed", Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(255), v -> this.safeColor.getValue())); - private final Setting safeGreen = this.register(new Setting("SafeGreen", Integer.valueOf(255), Integer.valueOf(0), Integer.valueOf(255), v -> this.safeColor.getValue())); - private final Setting safeBlue = this.register(new Setting("SafeBlue", Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(255), v -> this.safeColor.getValue())); - private final Setting safeAlpha = this.register(new Setting("SafeAlpha", Integer.valueOf(255), Integer.valueOf(0), Integer.valueOf(255), v -> this.safeColor.getValue())); - private final Setting cRed = this.register(new Setting("OL-Red", Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(255), v -> this.customOutline.getValue() && this.outline.getValue())); - private final Setting cGreen = this.register(new Setting("OL-Green", Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(255), v -> this.customOutline.getValue() && this.outline.getValue())); - private final Setting cBlue = this.register(new Setting("OL-Blue", Integer.valueOf(255), Integer.valueOf(0), Integer.valueOf(255), v -> this.customOutline.getValue() && this.outline.getValue())); - private final Setting cAlpha = this.register(new Setting("OL-Alpha", Integer.valueOf(255), Integer.valueOf(0), Integer.valueOf(255), v -> this.customOutline.getValue() && this.outline.getValue())); - private final Setting safecRed = this.register(new Setting("OL-SafeRed", Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(255), v -> this.customOutline.getValue() && this.outline.getValue() && this.safeColor.getValue())); - private final Setting safecGreen = this.register(new Setting("OL-SafeGreen", Integer.valueOf(255), Integer.valueOf(0), Integer.valueOf(255), v -> this.customOutline.getValue() && this.outline.getValue() && this.safeColor.getValue())); - private final Setting safecBlue = this.register(new Setting("OL-SafeBlue", Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(255), v -> this.customOutline.getValue() && this.outline.getValue() && this.safeColor.getValue())); - private final Setting safecAlpha = this.register(new Setting("OL-SafeAlpha", Integer.valueOf(255), Integer.valueOf(0), Integer.valueOf(255), v -> this.customOutline.getValue() && this.outline.getValue() && this.safeColor.getValue())); - private int currentAlpha = 0; - - public HoleESP() { - super("HoleESP", "Shows safe spots.", ModuleCategory.RENDER); - this.setInstance(); - } - - public static HoleESP getInstance() { - if (INSTANCE == null) { - INSTANCE = new HoleESP(); - } - return INSTANCE; - } - - private void setInstance() { - INSTANCE = this; - } - - @Override - public void onRender3D(Render3DEvent event) { - assert (HoleESP.mc.renderViewEntity != null); - - Vec3i playerPos = new Vec3i(HoleESP.mc.renderViewEntity.posX, HoleESP.mc.renderViewEntity.posY, HoleESP.mc.renderViewEntity.posZ); - - for (int x = playerPos.getX() - this.rangeX.getValue(); x < playerPos.getX() + this.rangeX.getValue(); ++x) { - for (int z = playerPos.getZ() - this.rangeX.getValue(); z < playerPos.getZ() + this.rangeX.getValue(); ++z) { - for (int y = playerPos.getY() + this.rangeY.getValue(); y > playerPos.getY() - this.rangeY.getValue(); --y) { - BlockPos pos = new BlockPos(x, y, z); - if ((Boolean) this.boxs.getValue()) { - if (HoleUtil.is2securityHole(pos) && (mc.world.getBlockState(new BlockPos(pos.getX(), pos.getY() + 1, pos.getZ())).getBlock() == Blocks.AIR || mc.world.getBlockState(new BlockPos(HoleUtil.is2Hole(pos).getX(), HoleUtil.is2Hole(pos).getY() + 1, HoleUtil.is2Hole(pos).getZ())).getBlock() == Blocks.AIR) && mc.world.getBlockState(new BlockPos(pos.getX(), pos.getY() - 1, pos.getZ())).getBlock() == Blocks.BEDROCK && mc.world.getBlockState(new BlockPos(HoleUtil.is2Hole(pos).getX(), HoleUtil.is2Hole(pos).getY() - 1, HoleUtil.is2Hole(pos).getZ())).getBlock() == Blocks.BEDROCK) { - RenderUtil.drawBoxESP(pos, (Boolean) this.rainbow.getValue() ? ColorUtil.rainbow((Integer) Colors.getInstance().rainbowHue.getValue()) : new Color((Integer) this.safeRed.getValue(), (Integer) this.safeGreen.getValue(), (Integer) this.safeBlue.getValue(), (Integer) this.safeAlpha.getValue()), (Boolean) this.customOutline.getValue(), new Color((Integer) this.safecRed.getValue(), (Integer) this.safecGreen.getValue(), (Integer) this.safecBlue.getValue(), (Integer) this.safecAlpha.getValue()), (Float) this.lineWidth.getValue(), (Boolean) this.outline.getValue(), (Boolean) this.box.getValue(), (Integer) this.boxAlpha.getValue(), true, (Double) this.height.getValue(), (Boolean) this.gradientBox.getValue(), (Boolean) this.gradientOutline.getValue(), (Boolean) this.invertGradientBox.getValue(), (Boolean) this.invertGradientOutline.getValue(), this.currentAlpha); - RenderUtil.drawBoxESP(HoleUtil.is2Hole(pos), (Boolean) this.rainbow.getValue() ? ColorUtil.rainbow((Integer) Colors.getInstance().rainbowHue.getValue()) : new Color((Integer) this.safeRed.getValue(), (Integer) this.safeGreen.getValue(), (Integer) this.safeBlue.getValue(), (Integer) this.safeAlpha.getValue()), (Boolean) this.customOutline.getValue(), new Color((Integer) this.safecRed.getValue(), (Integer) this.safecGreen.getValue(), (Integer) this.safecBlue.getValue(), (Integer) this.safecAlpha.getValue()), (Float) this.lineWidth.getValue(), (Boolean) this.outline.getValue(), (Boolean) this.box.getValue(), (Integer) this.boxAlpha.getValue(), true, (Double) this.height.getValue(), (Boolean) this.gradientBox.getValue(), (Boolean) this.gradientOutline.getValue(), (Boolean) this.invertGradientBox.getValue(), (Boolean) this.invertGradientOutline.getValue(), this.currentAlpha); - continue; - } - - if (HoleUtil.is2Hole(pos) != null && (mc.world.getBlockState(new BlockPos(pos.getX(), pos.getY() + 1, pos.getZ())).getBlock() == Blocks.AIR || mc.world.getBlockState(new BlockPos(HoleUtil.is2Hole(pos).getX(), HoleUtil.is2Hole(pos).getY() + 1, HoleUtil.is2Hole(pos).getZ())).getBlock() == Blocks.AIR) && (mc.world.getBlockState(new BlockPos(pos.getX(), pos.getY() - 1, pos.getZ())).getBlock() == Blocks.BEDROCK || mc.world.getBlockState(new BlockPos(pos.getX(), pos.getY() - 1, pos.getZ())).getBlock() == Blocks.BEDROCK) && (mc.world.getBlockState(new BlockPos(HoleUtil.is2Hole(pos).getX(), HoleUtil.is2Hole(pos).getY() - 1, HoleUtil.is2Hole(pos).getZ())).getBlock() == Blocks.BEDROCK || mc.world.getBlockState(new BlockPos(HoleUtil.is2Hole(pos).getX(), HoleUtil.is2Hole(pos).getY() - 1, HoleUtil.is2Hole(pos).getZ())).getBlock() == Blocks.OBSIDIAN)) { - RenderUtil.drawBoxESP(pos, (Boolean) this.rainbow.getValue() ? ColorUtil.rainbow((Integer) Colors.getInstance().rainbowHue.getValue()) : new Color((Integer) this.red.getValue(), (Integer) this.green.getValue(), (Integer) this.blue.getValue(), (Integer) this.alpha.getValue()), (Boolean) this.customOutline.getValue(), new Color((Integer) this.cRed.getValue(), (Integer) this.cGreen.getValue(), (Integer) this.cBlue.getValue(), (Integer) this.cAlpha.getValue()), (Float) this.lineWidth.getValue(), (Boolean) this.outline.getValue(), (Boolean) this.box.getValue(), (Integer) this.boxAlpha.getValue(), true, (Double) this.height.getValue(), (Boolean) this.gradientBox.getValue(), (Boolean) this.gradientOutline.getValue(), (Boolean) this.invertGradientBox.getValue(), (Boolean) this.invertGradientOutline.getValue(), this.currentAlpha); - RenderUtil.drawBoxESP(HoleUtil.is2Hole(pos), (Boolean) this.rainbow.getValue() ? ColorUtil.rainbow((Integer) Colors.getInstance().rainbowHue.getValue()) : new Color((Integer) this.red.getValue(), (Integer) this.green.getValue(), (Integer) this.blue.getValue(), (Integer) this.alpha.getValue()), (Boolean) this.customOutline.getValue(), new Color((Integer) this.cRed.getValue(), (Integer) this.cGreen.getValue(), (Integer) this.cBlue.getValue(), (Integer) this.cAlpha.getValue()), (Float) this.lineWidth.getValue(), (Boolean) this.outline.getValue(), (Boolean) this.box.getValue(), (Integer) this.boxAlpha.getValue(), true, (Double) this.height.getValue(), (Boolean) this.gradientBox.getValue(), (Boolean) this.gradientOutline.getValue(), (Boolean) this.invertGradientBox.getValue(), (Boolean) this.invertGradientOutline.getValue(), this.currentAlpha); - continue; - } - } - if (mc.world.getBlockState(pos).getBlock().equals(Blocks.AIR) && mc.world.getBlockState(pos.add(0, 1, 0)).getBlock().equals(Blocks.AIR) && mc.world.getBlockState(pos.add(0, 2, 0)).getBlock().equals(Blocks.AIR) && (!pos.equals(new BlockPos(mc.player.posX, mc.player.posY, mc.player.posZ)) || (Boolean) this.ownHole.getValue()) && (BlockUtil.isPosInFov(pos) || !(Boolean) this.fov.getValue())) { - if (mc.world.getBlockState(pos.north()).getBlock() == Blocks.BEDROCK && mc.world.getBlockState(pos.west()).getBlock() == Blocks.BEDROCK && mc.world.getBlockState(pos.east()).getBlock() == Blocks.BEDROCK && mc.world.getBlockState(pos.south()).getBlock() == Blocks.BEDROCK && mc.world.getBlockState(pos.down()).getBlock() == Blocks.BEDROCK) { - RenderUtil.drawBoxESP(pos, (Boolean) this.rainbow.getValue() ? ColorUtil.rainbow((Integer) Colors.getInstance().rainbowHue.getValue()) : new Color((Integer) this.safeRed.getValue(), (Integer) this.safeGreen.getValue(), (Integer) this.safeBlue.getValue(), (Integer) this.safeAlpha.getValue()), (Boolean) this.customOutline.getValue(), new Color((Integer) this.safecRed.getValue(), (Integer) this.safecGreen.getValue(), (Integer) this.safecBlue.getValue(), (Integer) this.safecAlpha.getValue()), (Float) this.lineWidth.getValue(), (Boolean) this.outline.getValue(), (Boolean) this.box.getValue(), (Integer) this.boxAlpha.getValue(), true, (Double) this.height.getValue(), (Boolean) this.gradientBox.getValue(), (Boolean) this.gradientOutline.getValue(), (Boolean) this.invertGradientBox.getValue(), (Boolean) this.invertGradientOutline.getValue(), this.currentAlpha); - } else if (BlockUtil.isBlockUnSafe(mc.world.getBlockState(pos.down()).getBlock()) && BlockUtil.isBlockUnSafe(mc.world.getBlockState(pos.east()).getBlock()) && BlockUtil.isBlockUnSafe(mc.world.getBlockState(pos.west()).getBlock()) && BlockUtil.isBlockUnSafe(mc.world.getBlockState(pos.south()).getBlock()) && BlockUtil.isBlockUnSafe(mc.world.getBlockState(pos.north()).getBlock())) { - RenderUtil.drawBoxESP(pos, (Boolean) this.rainbow.getValue() ? ColorUtil.rainbow((Integer) Colors.getInstance().rainbowHue.getValue()) : new Color((Integer) this.red.getValue(), (Integer) this.green.getValue(), (Integer) this.blue.getValue(), (Integer) this.alpha.getValue()), (Boolean) this.customOutline.getValue(), new Color((Integer) this.cRed.getValue(), (Integer) this.cGreen.getValue(), (Integer) this.cBlue.getValue(), (Integer) this.cAlpha.getValue()), (Float) this.lineWidth.getValue(), (Boolean) this.outline.getValue(), (Boolean) this.box.getValue(), (Integer) this.boxAlpha.getValue(), true, (Double) this.height.getValue(), (Boolean) this.gradientBox.getValue(), (Boolean) this.gradientOutline.getValue(), (Boolean) this.invertGradientBox.getValue(), (Boolean) this.invertGradientOutline.getValue(), this.currentAlpha); - } - } - } - } - } - } -} \ No newline at end of file diff --git a/src/main/java/com/me/infinity/loop/features/modules/render/ItemPhysics.java b/src/main/java/com/me/infinity/loop/features/modules/render/ItemPhysics.java deleted file mode 100644 index 050b583..0000000 --- a/src/main/java/com/me/infinity/loop/features/modules/render/ItemPhysics.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.me.infinity.loop.features.modules.render; - -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.setting.Setting; - -public class ItemPhysics extends Module { - public static ItemPhysics INSTANCE; - - public final Setting Scaling = this.register(new Setting("Scaling", Float.valueOf(0.5f), Float.valueOf(0.0f), Float.valueOf(10.0f))); - - public ItemPhysics() { - super("ItemPhysics", "Apply physics to items.", ModuleCategory.RENDER); - this.setInstance(); - } - - public static ItemPhysics getInstance() { - if (INSTANCE == null) { - INSTANCE = new ItemPhysics(); - } - return INSTANCE; - } - - private void setInstance() { - INSTANCE = this; - } -} diff --git a/src/main/java/com/me/infinity/loop/features/modules/render/NoCluster.java b/src/main/java/com/me/infinity/loop/features/modules/render/NoCluster.java deleted file mode 100644 index 48868e3..0000000 --- a/src/main/java/com/me/infinity/loop/features/modules/render/NoCluster.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.me.infinity.loop.features.modules.render; - -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; - -public class NoCluster extends Module -{ - public NoCluster() { - super("NoCluster", "Stops larpers from taking up your whole screen when they're in your hole", ModuleCategory.RENDER); - } -} diff --git a/src/main/java/com/me/infinity/loop/features/modules/render/PearlRender.java b/src/main/java/com/me/infinity/loop/features/modules/render/PearlRender.java deleted file mode 100644 index 16d8d94..0000000 --- a/src/main/java/com/me/infinity/loop/features/modules/render/PearlRender.java +++ /dev/null @@ -1,169 +0,0 @@ -package com.me.infinity.loop.features.modules.render; - -import java.awt.Color; -import java.util.HashMap; -import java.util.UUID; - -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.event.events.render.Render3DEvent; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.util.utils.EntityUtil; -import com.mojang.realmsclient.gui.ChatFormatting; -import com.me.infinity.loop.features.command.Command; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.setting.Setting; -import com.me.infinity.loop.util.utils.maths.MathUtil; -import com.me.infinity.loop.util.utils.renders.RenderUtil; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.RenderGlobal; -import net.minecraft.entity.Entity; -import net.minecraft.entity.item.EntityEnderPearl; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; -import org.lwjgl.opengl.GL11; - -public class PearlRender - extends Module { - private final HashMap list; - private Entity enderPearl; - private boolean flag; - public Setting notify = this.register(new Setting("Notify", false)); - - public PearlRender() { - super("PearlRender", "Renders where pearls will go", ModuleCategory.RENDER); - this.list = new HashMap(); - } - - @Override - public void onEnable() { - if (this.notify.getValue()) { - this.flag = true; - } - } - - @Override - public void onUpdate() { - if (notify.getValue().booleanValue()) { - if (PearlRender.mc.world == null || PearlRender.mc.player == null) { - return; - } - this.enderPearl = null; - for (final Entity e : PearlRender.mc.world.loadedEntityList) { - if (e instanceof EntityEnderPearl) { - this.enderPearl = e; - break; - } - } - if (this.enderPearl == null) { - this.flag = true; - return; - } - EntityPlayer closestPlayer = null; - for (final EntityPlayer entity : PearlRender.mc.world.playerEntities) { - if (closestPlayer == null) { - closestPlayer = entity; - } else { - if (closestPlayer.getDistance(this.enderPearl) <= entity.getDistance(this.enderPearl)) { - continue; - } - closestPlayer = entity; - } - } - if (closestPlayer == PearlRender.mc.player) { - this.flag = false; - } - if (closestPlayer != null && this.flag) { - String faceing = this.enderPearl.getHorizontalFacing().toString(); - if (faceing.equals("west")) { - faceing = "east"; - } else if (faceing.equals("east")) { - faceing = "west"; - } - Command.sendMessage(InfinityLoop.friendManager.isFriend(closestPlayer.getName()) ? (ChatFormatting.AQUA + closestPlayer.getName() + ChatFormatting.DARK_GRAY + " has just thrown a pearl heading " + faceing + "!") : (ChatFormatting.RED + closestPlayer.getName() + ChatFormatting.DARK_GRAY + " has just thrown a pearl heading " + faceing + "!")); - this.flag = false; - } - } - } - - - public double interpolate(double now, double then) { - return then + (now - then) * (double)mc.getRenderPartialTicks(); - } - - public double[] interpolate(Entity entity) { - double posX = this.interpolate(entity.posX, entity.lastTickPosX) - PearlRender.mc.getRenderManager().renderPosX; - double posY = this.interpolate(entity.posY, entity.lastTickPosY) - PearlRender.mc.getRenderManager().renderPosY; - double posZ = this.interpolate(entity.posZ, entity.lastTickPosZ) - PearlRender.mc.getRenderManager().renderPosZ; - return new double[]{posX, posY, posZ}; - } - - public void drawLineToEntity(Entity e, float red, float green, float blue, float opacity) { - double[] xyz = this.interpolate(e); - this.drawLine(xyz[0], xyz[1], xyz[2], red, green, blue, opacity); - } - - public void drawLine(double posx, double posy, double posz, float red, float green, float blue, float opacity) { - Vec3d eyes = new Vec3d(0.0, 0.0, 1.0).rotatePitch(-((float)Math.toRadians(PearlRender.mc.player.rotationPitch))).rotateYaw(-((float)Math.toRadians(PearlRender.mc.player.rotationYaw))); - this.drawLineFromPosToPos(eyes.x, eyes.y + (double)PearlRender.mc.player.getEyeHeight(), eyes.z, posx, posy, posz, red, green, blue, opacity); - } - - public void drawLineFromPosToPos(double posx, double posy, double posz, double posx2, double posy2, double posz2, float red, float green, float blue, float opacity) { - GL11.glBlendFunc(770, 771); - GL11.glEnable(3042); - GL11.glLineWidth(1.0f); - GL11.glDisable(3553); - GL11.glDisable(2929); - GL11.glDepthMask(false); - GL11.glColor4f(red, green, blue, opacity); - GL11.glEnable(2848); - GL11.glHint(3154, 4354); - GL11.glLoadIdentity(); - boolean bobbing = PearlRender.mc.gameSettings.viewBobbing; - PearlRender.mc.gameSettings.viewBobbing = false; - PearlRender.mc.entityRenderer.orientCamera(mc.getRenderPartialTicks()); - GL11.glBegin(1); - GL11.glVertex3d(posx, posy, posz); - GL11.glVertex3d(posx2, posy2, posz2); - GL11.glEnd(); - GL11.glEnable(3553); - GL11.glEnable(2929); - GL11.glDepthMask(true); - GL11.glDisable(3042); - GL11.glDisable(2848); - GL11.glColor3d(1.0, 1.0, 1.0); - PearlRender.mc.gameSettings.viewBobbing = bobbing; - } - - @Override - public void onRender3D(Render3DEvent event) { - int i = 0; - for (Entity entity : PearlRender.mc.world.loadedEntityList) { - if (!(entity instanceof EntityEnderPearl) || !(PearlRender.mc.player.getDistanceSq(entity) < 2500.0)) continue; - Vec3d interp = EntityUtil.getInterpolatedRenderPos(entity, mc.getRenderPartialTicks()); - AxisAlignedBB bb = new AxisAlignedBB(entity.getEntityBoundingBox().minX - 0.05 - entity.posX + interp.x, entity.getEntityBoundingBox().minY - 0.0 - entity.posY + interp.y, entity.getEntityBoundingBox().minZ - 0.05 - entity.posZ + interp.z, entity.getEntityBoundingBox().maxX + 0.05 - entity.posX + interp.x, entity.getEntityBoundingBox().maxY + 0.1 - entity.posY + interp.y, entity.getEntityBoundingBox().maxZ + 0.05 - entity.posZ + interp.z); - GlStateManager.pushMatrix(); - GlStateManager.enableBlend(); - GlStateManager.disableDepth(); - GlStateManager.tryBlendFuncSeparate(770, 771, 0, 1); - GlStateManager.disableTexture2D(); - GlStateManager.depthMask(false); - GL11.glEnable(2848); - GL11.glHint(3154, 4354); - GL11.glLineWidth(1.0f); - RenderGlobal.renderFilledBox(bb, 255.0f, 255.0f, 255.0f, 255.0f); - GL11.glDisable(2848); - GlStateManager.depthMask(true); - GlStateManager.enableDepth(); - GlStateManager.enableTexture2D(); - GlStateManager.disableBlend(); - GlStateManager.popMatrix(); - RenderUtil.drawBlockOutline(bb, new Color(255, 255, 255), 1.0f); - this.drawLineToEntity(entity, 255.0f, 255.0f, 255.0f, 255.0f); - BlockPos posEntity = entity.getPosition(); - RenderUtil.drawText(posEntity, "X: " + MathUtil.round(entity.posX, 0) + " Y: " + MathUtil.round(entity.posY, 0) + " Z:" + MathUtil.round(entity.posZ, 2)); - if (++i < 50) continue; - } - } -} diff --git a/src/main/java/com/me/infinity/loop/features/modules/render/PlayerTrails.java b/src/main/java/com/me/infinity/loop/features/modules/render/PlayerTrails.java deleted file mode 100644 index 4f6c9b3..0000000 --- a/src/main/java/com/me/infinity/loop/features/modules/render/PlayerTrails.java +++ /dev/null @@ -1,454 +0,0 @@ -package com.me.infinity.loop.features.modules.render; - -import com.me.infinity.loop.event.events.player.EventEntityMove; -import com.me.infinity.loop.event.events.render.PreRenderEvent; -import com.me.infinity.loop.event.events.render.Render3DEvent; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.setting.Setting; -import com.me.infinity.loop.util.utils.maths.AstolfoAnimation; -import net.minecraft.client.entity.EntityPlayerSP; -import net.minecraft.client.renderer.GlStateManager; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.math.Vec3d; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import org.lwjgl.opengl.GL11; - -import java.awt.*; -import java.util.*; -import java.util.List; - -public class PlayerTrails extends Module { - - public Setting down = register(new Setting("Down", 0.5F, 0.0F, 2.0F)); - public Setting width = register(new Setting("Height", 1.3F, 0.1F, 2.0F)); - private final Setting shfix =this.register( new Setting<>("ShaderFix", false)); - - public Setting mode = register(new Setting<>("ColorMode", modeEn.Ukraine)); - private final Setting color = this.register(new Setting<>("Color", new Color(0x8800FF00))); - Map > entAndTrail = new HashMap<>(); - - public PlayerTrails() { - super("PlayerTrails", "Render Line Behind U", ModuleCategory.RENDER); - } - - public enum modeEn{ - Default, - Ukraine, - RUSSIA - } - public static AstolfoAnimation astolfo = new AstolfoAnimation(); - - @SubscribeEvent - public void onRender3D(Render3DEvent event) { - if(shfix.getValue()){ - return; - } - - for (EntityPlayer entity : mc.world.playerEntities) { - List trails22 = new ArrayList<>(); - - entAndTrail.putIfAbsent(entity, trails22); - - if (entity instanceof EntityPlayerSP && mc.gameSettings.thirdPersonView == 0) { - continue; - } - - - float alpha = color.getValue().getAlpha() / 255f; - mc.entityRenderer.updateCameraAndRender(mc.getRenderPartialTicks(), 2); - if (entAndTrail.get(entity).size() > 0) { - GL11.glPushMatrix(); - GL11.glEnable(GL11.GL_BLEND); - GL11.glDisable(GL11.GL_ALPHA_TEST); - GL11.glDisable(GL11.GL_CULL_FACE); - GL11.glDisable(GL11.GL_TEXTURE_2D); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glShadeModel(GL11.GL_SMOOTH); - GL11.glEnable(GL11.GL_LINE_SMOOTH); - GL11.glBegin(GL11.GL_QUAD_STRIP); - - if(mode.getValue() == modeEn.Default) { - for (int i = 0; i < entAndTrail.get(entity).size(); i++) { - Vec3d c = entAndTrail.get(entity).get(i).color(); - Trail ctx = entAndTrail.get(entity).get(i); - Vec3d pos = ctx.interpolate(mc.getRenderPartialTicks()); - GL11.glColor4d(c.x, c.y, c.z, alpha * ctx.animation(mc.getRenderPartialTicks())); - GL11.glVertex3d(pos.x, pos.y + down.getValue(), pos.z); - GL11.glVertex3d(pos.x, pos.y + width.getValue() + down.getValue(), pos.z); - } - - - GL11.glEnd(); - GL11.glLineWidth(1f); - - - GL11.glBegin(GL11.GL_LINE_STRIP); - for (int i = 0; i < entAndTrail.get(entity).size(); i++) { - Vec3d c = entAndTrail.get(entity).get(i).color(); - Trail ctx = entAndTrail.get(entity).get(i); - Vec3d pos = ctx.interpolate(mc.getRenderPartialTicks()); - GL11.glColor4d(c.x, c.y, c.z, (alpha + 0.15f) * ctx.animation(mc.getRenderPartialTicks())); - GL11.glVertex3d(pos.x, pos.y + width.getValue() + down.getValue(), pos.z); - } - - - GL11.glEnd(); - GL11.glBegin(GL11.GL_LINE_STRIP); - - - for (int i = 0; i < entAndTrail.get(entity).size(); i++) { - Vec3d c = entAndTrail.get(entity).get(i).color(); - Trail ctx = entAndTrail.get(entity).get(i); - Vec3d pos = ctx.interpolate(mc.getRenderPartialTicks()); - GL11.glColor4d(c.x, c.y, c.z, (alpha + 0.15f) * ctx.animation(mc.getRenderPartialTicks())); - GL11.glVertex3d(pos.x, pos.y + down.getValue(), pos.z); - } - } else if(mode.getValue() == modeEn.Ukraine ){ - for (int i = 0; i < entAndTrail.get(entity).size(); i++) { - Trail ctx = entAndTrail.get(entity).get(i); - Vec3d pos = ctx.interpolate(mc.getRenderPartialTicks()); - GL11.glColor4d(245f/255f, 227f/255f, 66f/255f, alpha * ctx.animation(mc.getRenderPartialTicks())); - GL11.glVertex3d(pos.x, pos.y + down.getValue(), pos.z); - GL11.glVertex3d(pos.x, pos.y + down.getValue() + (width.getValue()/2f), pos.z); - } - GL11.glEnd(); - GL11.glBegin(GL11.GL_QUAD_STRIP); - - for (int i = 0; i < entAndTrail.get(entity).size(); i++) { - Trail ctx = entAndTrail.get(entity).get(i); - Vec3d pos = ctx.interpolate(mc.getRenderPartialTicks()); - GL11.glColor4d(66f/255f, 102f/255f, 245f/255f, alpha * ctx.animation(mc.getRenderPartialTicks())); - GL11.glVertex3d(pos.x, pos.y + down.getValue() + (width.getValue()/2f), pos.z); - GL11.glVertex3d(pos.x, pos.y + down.getValue() + width.getValue(), pos.z); - } - - GL11.glEnd(); - GL11.glLineWidth(1f); - - - GL11.glBegin(GL11.GL_LINE_STRIP); - for (int i = 0; i < entAndTrail.get(entity).size(); i++) { - Vec3d c = entAndTrail.get(entity).get(i).color(); - Trail ctx = entAndTrail.get(entity).get(i); - Vec3d pos = ctx.interpolate(mc.getRenderPartialTicks()); - GL11.glColor4d(66f/255f, 102f/255f, 245f/255f, (alpha + 0.15f) * ctx.animation(mc.getRenderPartialTicks())); - GL11.glVertex3d(pos.x, pos.y + width.getValue() + down.getValue(), pos.z); - } - - - GL11.glEnd(); - GL11.glBegin(GL11.GL_LINE_STRIP); - - - for (int i = 0; i < entAndTrail.get(entity).size(); i++) { - Vec3d c = entAndTrail.get(entity).get(i).color(); - Trail ctx = entAndTrail.get(entity).get(i); - Vec3d pos = ctx.interpolate(mc.getRenderPartialTicks()); - GL11.glColor4d(245f/255f, 227f/255f, 66f/255f, (alpha + 0.15f) * ctx.animation(mc.getRenderPartialTicks())); - GL11.glVertex3d(pos.x, pos.y + down.getValue(), pos.z); - } - } else if(mode.getValue() == modeEn.RUSSIA ){ - for (int i = 0; i < entAndTrail.get(entity).size(); i++) { - Trail ctx = entAndTrail.get(entity).get(i); - Vec3d pos = ctx.interpolate(mc.getRenderPartialTicks()); - GL11.glColor4d(1f, 0f, 0f, alpha * ctx.animation(mc.getRenderPartialTicks())); - GL11.glVertex3d(pos.x, pos.y + down.getValue(), pos.z); - GL11.glVertex3d(pos.x, pos.y + down.getValue() + (width.getValue()/3f), pos.z); - } - GL11.glEnd(); - GL11.glBegin(GL11.GL_QUAD_STRIP); - - for (int i = 0; i < entAndTrail.get(entity).size(); i++) { - Trail ctx = entAndTrail.get(entity).get(i); - Vec3d pos = ctx.interpolate(mc.getRenderPartialTicks()); - GL11.glColor4d(0f, 0f, 1f, alpha * ctx.animation(mc.getRenderPartialTicks())); - GL11.glVertex3d(pos.x, pos.y + down.getValue() + (width.getValue()/3f), pos.z); - GL11.glVertex3d(pos.x, pos.y + down.getValue() + (width.getValue() * (2f/3f)), pos.z); - } - - GL11.glEnd(); - GL11.glBegin(GL11.GL_QUAD_STRIP); - for (int i = 0; i < entAndTrail.get(entity).size(); i++) { - Trail ctx = entAndTrail.get(entity).get(i); - Vec3d pos = ctx.interpolate(mc.getRenderPartialTicks()); - GL11.glColor4d(1f, 1f, 1f, alpha * ctx.animation(mc.getRenderPartialTicks())); - GL11.glVertex3d(pos.x, pos.y + down.getValue() + (width.getValue() * (2f/3f)), pos.z); - GL11.glVertex3d(pos.x, pos.y + down.getValue() + (width.getValue()), pos.z); - } - - GL11.glEnd(); - GL11.glLineWidth(1f); - - - GL11.glBegin(GL11.GL_LINE_STRIP); - for (int i = 0; i < entAndTrail.get(entity).size(); i++) { - Trail ctx = entAndTrail.get(entity).get(i); - Vec3d pos = ctx.interpolate(mc.getRenderPartialTicks()); - GL11.glColor4d(1f, 1f, 1f, (alpha + 0.15f) * ctx.animation(mc.getRenderPartialTicks())); - GL11.glVertex3d(pos.x, pos.y + width.getValue() + down.getValue(), pos.z); - } - - - GL11.glEnd(); - GL11.glBegin(GL11.GL_LINE_STRIP); - - - for (int i = 0; i < entAndTrail.get(entity).size(); i++) { - Trail ctx = entAndTrail.get(entity).get(i); - Vec3d pos = ctx.interpolate(mc.getRenderPartialTicks()); - GL11.glColor4d(1f, 0f, 0f, (alpha + 0.15f) * ctx.animation(mc.getRenderPartialTicks())); - GL11.glVertex3d(pos.x, pos.y + down.getValue(), pos.z); - } - } - - - - GL11.glEnd(); - GL11.glDisable(GL11.GL_LINE_SMOOTH); - GL11.glEnable(GL11.GL_TEXTURE_2D); - GL11.glDisable(GL11.GL_BLEND); - GL11.glEnable(GL11.GL_ALPHA_TEST); - GL11.glShadeModel(GL11.GL_FLAT); - GL11.glEnable(GL11.GL_CULL_FACE); - GL11.glPopMatrix(); - } - GlStateManager.resetColor(); - - } - - } - - @SubscribeEvent - public void onRenderPost(PreRenderEvent event) { - if(!shfix.getValue()){ - return; - } - - for (EntityPlayer entity : mc.world.playerEntities) { - List trails22 = new ArrayList<>(); - - entAndTrail.putIfAbsent(entity, trails22); - - if (entity instanceof EntityPlayerSP && mc.gameSettings.thirdPersonView == 0) { - continue; - } - - - float alpha = color.getValue().getAlpha() / 255f; - mc.entityRenderer.updateCameraAndRender(mc.getRenderPartialTicks(), 2); - if (entAndTrail.get(entity).size() > 0) { - GL11.glPushMatrix(); - GL11.glEnable(GL11.GL_BLEND); - GL11.glDisable(GL11.GL_ALPHA_TEST); - GL11.glDisable(GL11.GL_CULL_FACE); - GL11.glDisable(GL11.GL_TEXTURE_2D); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glShadeModel(GL11.GL_SMOOTH); - GL11.glEnable(GL11.GL_LINE_SMOOTH); - GL11.glBegin(GL11.GL_QUAD_STRIP); - - if(mode.getValue() == modeEn.Default) { - for (int i = 0; i < entAndTrail.get(entity).size(); i++) { - Vec3d c = entAndTrail.get(entity).get(i).color(); - Trail ctx = entAndTrail.get(entity).get(i); - Vec3d pos = ctx.interpolate(mc.getRenderPartialTicks()); - GL11.glColor4d(c.x, c.y, c.z, alpha * ctx.animation(mc.getRenderPartialTicks())); - GL11.glVertex3d(pos.x, pos.y + down.getValue(), pos.z); - GL11.glVertex3d(pos.x, pos.y + width.getValue() + down.getValue(), pos.z); - } - - - GL11.glEnd(); - GL11.glLineWidth(1f); - - - GL11.glBegin(GL11.GL_LINE_STRIP); - for (int i = 0; i < entAndTrail.get(entity).size(); i++) { - Vec3d c = entAndTrail.get(entity).get(i).color(); - Trail ctx = entAndTrail.get(entity).get(i); - Vec3d pos = ctx.interpolate(mc.getRenderPartialTicks()); - GL11.glColor4d(c.x, c.y, c.z, (alpha + 0.15f) * ctx.animation(mc.getRenderPartialTicks())); - GL11.glVertex3d(pos.x, pos.y + width.getValue() + down.getValue(), pos.z); - } - - - GL11.glEnd(); - GL11.glBegin(GL11.GL_LINE_STRIP); - - - for (int i = 0; i < entAndTrail.get(entity).size(); i++) { - Vec3d c = entAndTrail.get(entity).get(i).color(); - Trail ctx = entAndTrail.get(entity).get(i); - Vec3d pos = ctx.interpolate(mc.getRenderPartialTicks()); - GL11.glColor4d(c.x, c.y, c.z, (alpha + 0.15f) * ctx.animation(mc.getRenderPartialTicks())); - GL11.glVertex3d(pos.x, pos.y + down.getValue(), pos.z); - } - } else if(mode.getValue() == modeEn.Ukraine ){ - for (int i = 0; i < entAndTrail.get(entity).size(); i++) { - Trail ctx = entAndTrail.get(entity).get(i); - Vec3d pos = ctx.interpolate(mc.getRenderPartialTicks()); - GL11.glColor4d(245f/255f, 227f/255f, 66f/255f, alpha * ctx.animation(mc.getRenderPartialTicks())); - GL11.glVertex3d(pos.x, pos.y + down.getValue(), pos.z); - GL11.glVertex3d(pos.x, pos.y + down.getValue() + (width.getValue()/2f), pos.z); - } - GL11.glEnd(); - GL11.glBegin(GL11.GL_QUAD_STRIP); - - for (int i = 0; i < entAndTrail.get(entity).size(); i++) { - Trail ctx = entAndTrail.get(entity).get(i); - Vec3d pos = ctx.interpolate(mc.getRenderPartialTicks()); - GL11.glColor4d(66f/255f, 102f/255f, 245f/255f, alpha * ctx.animation(mc.getRenderPartialTicks())); - GL11.glVertex3d(pos.x, pos.y + down.getValue() + (width.getValue()/2f), pos.z); - GL11.glVertex3d(pos.x, pos.y + down.getValue() + width.getValue(), pos.z); - } - - GL11.glEnd(); - GL11.glLineWidth(1f); - - - GL11.glBegin(GL11.GL_LINE_STRIP); - for (int i = 0; i < entAndTrail.get(entity).size(); i++) { - Vec3d c = entAndTrail.get(entity).get(i).color(); - Trail ctx = entAndTrail.get(entity).get(i); - Vec3d pos = ctx.interpolate(mc.getRenderPartialTicks()); - GL11.glColor4d(66f/255f, 102f/255f, 245f/255f, (alpha + 0.15f) * ctx.animation(mc.getRenderPartialTicks())); - GL11.glVertex3d(pos.x, pos.y + width.getValue() + down.getValue(), pos.z); - } - - - GL11.glEnd(); - GL11.glBegin(GL11.GL_LINE_STRIP); - - - for (int i = 0; i < entAndTrail.get(entity).size(); i++) { - Vec3d c = entAndTrail.get(entity).get(i).color(); - Trail ctx = entAndTrail.get(entity).get(i); - Vec3d pos = ctx.interpolate(mc.getRenderPartialTicks()); - GL11.glColor4d(245f/255f, 227f/255f, 66f/255f, (alpha + 0.15f) * ctx.animation(mc.getRenderPartialTicks())); - GL11.glVertex3d(pos.x, pos.y + down.getValue(), pos.z); - } - } else if(mode.getValue() == modeEn.RUSSIA ){ - for (int i = 0; i < entAndTrail.get(entity).size(); i++) { - Trail ctx = entAndTrail.get(entity).get(i); - Vec3d pos = ctx.interpolate(mc.getRenderPartialTicks()); - GL11.glColor4d(1f, 0f, 0f, alpha * ctx.animation(mc.getRenderPartialTicks())); - GL11.glVertex3d(pos.x, pos.y + down.getValue(), pos.z); - GL11.glVertex3d(pos.x, pos.y + down.getValue() + (width.getValue()/3f), pos.z); - } - GL11.glEnd(); - GL11.glBegin(GL11.GL_QUAD_STRIP); - - for (int i = 0; i < entAndTrail.get(entity).size(); i++) { - Trail ctx = entAndTrail.get(entity).get(i); - Vec3d pos = ctx.interpolate(mc.getRenderPartialTicks()); - GL11.glColor4d(0f, 0f, 1f, alpha * ctx.animation(mc.getRenderPartialTicks())); - GL11.glVertex3d(pos.x, pos.y + down.getValue() + (width.getValue()/3f), pos.z); - GL11.glVertex3d(pos.x, pos.y + down.getValue() + (width.getValue() * (2f/3f)), pos.z); - } - - GL11.glEnd(); - GL11.glBegin(GL11.GL_QUAD_STRIP); - for (int i = 0; i < entAndTrail.get(entity).size(); i++) { - Trail ctx = entAndTrail.get(entity).get(i); - Vec3d pos = ctx.interpolate(mc.getRenderPartialTicks()); - GL11.glColor4d(1f, 1f, 1f, alpha * ctx.animation(mc.getRenderPartialTicks())); - GL11.glVertex3d(pos.x, pos.y + down.getValue() + (width.getValue() * (2f/3f)), pos.z); - GL11.glVertex3d(pos.x, pos.y + down.getValue() + (width.getValue()), pos.z); - } - - GL11.glEnd(); - GL11.glLineWidth(1f); - - - GL11.glBegin(GL11.GL_LINE_STRIP); - for (int i = 0; i < entAndTrail.get(entity).size(); i++) { - Trail ctx = entAndTrail.get(entity).get(i); - Vec3d pos = ctx.interpolate(mc.getRenderPartialTicks()); - GL11.glColor4d(1f, 1f, 1f, (alpha + 0.15f) * ctx.animation(mc.getRenderPartialTicks())); - GL11.glVertex3d(pos.x, pos.y + width.getValue() + down.getValue(), pos.z); - } - - - GL11.glEnd(); - GL11.glBegin(GL11.GL_LINE_STRIP); - - - for (int i = 0; i < entAndTrail.get(entity).size(); i++) { - Trail ctx = entAndTrail.get(entity).get(i); - Vec3d pos = ctx.interpolate(mc.getRenderPartialTicks()); - GL11.glColor4d(1f, 0f, 0f, (alpha + 0.15f) * ctx.animation(mc.getRenderPartialTicks())); - GL11.glVertex3d(pos.x, pos.y + down.getValue(), pos.z); - } - } - GL11.glEnd(); - GL11.glDisable(GL11.GL_LINE_SMOOTH); - GL11.glEnable(GL11.GL_TEXTURE_2D); - GL11.glDisable(GL11.GL_BLEND); - GL11.glEnable(GL11.GL_ALPHA_TEST); - GL11.glShadeModel(GL11.GL_FLAT); - GL11.glEnable(GL11.GL_CULL_FACE); - GL11.glPopMatrix(); - } - GlStateManager.resetColor(); - } - } - - @SubscribeEvent - public void onEntityMove(EventEntityMove e){ - try { - if (e.ctx() instanceof EntityPlayer) { - float red = color.getValue().getRed() / 255f, green = color.getValue().getGreen() / 255f, blue = color.getValue().getBlue() / 255f; - EntityPlayer a = (EntityPlayer) e.ctx(); - entAndTrail.get(a).add(new Trail(e.from(), e.ctx().getPositionVector(), new Vec3d(red, green, blue))); - } - } catch (Exception ex) { - ex.printStackTrace(); - } - } - - @Override - public void onUpdate(){ - astolfo.update(); - - for (EntityPlayer player : mc.world.playerEntities) { - if(entAndTrail.get(player) == null) return; - entAndTrail.get(player).removeIf(Trail::update); - } - } - - public static class Trail { - private Vec3d from, to, color; - private int ticks, prevTicks; - - public Trail(Vec3d from, Vec3d to, Vec3d color) { - this.from = from; - this.to = to; - this.ticks = 10; - this.color = color; - } - - public Vec3d interpolate(float pt) { - double x = from.x + ((to.x - from.x) * pt) - mc.getRenderManager().renderPosX; - double y = from.y + ((to.y - from.y) * pt) - mc.getRenderManager().renderPosY; - double z = from.z + ((to.z - from.z) * pt) - mc.getRenderManager().renderPosZ; - return new Vec3d(x, y, z); - } - - public double animation(float pt) { - return (this.prevTicks + (this.ticks - this.prevTicks) * pt) / 10.; - } - - public boolean update() { - this.prevTicks = this.ticks; - return this.ticks-- <= 0; - } - - public Vec3d color() { - return color; - } - } - - -} \ No newline at end of file diff --git a/src/main/java/com/me/infinity/loop/features/modules/render/Search.java b/src/main/java/com/me/infinity/loop/features/modules/render/Search.java deleted file mode 100644 index bea4e20..0000000 --- a/src/main/java/com/me/infinity/loop/features/modules/render/Search.java +++ /dev/null @@ -1,234 +0,0 @@ -package com.me.infinity.loop.features.modules.render; - -import com.me.infinity.loop.event.events.render.EventBlockRender; -import com.me.infinity.loop.event.events.render.Render3DEvent; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.setting.Setting; -import com.me.infinity.loop.mixin.mixins.IEntityRenderer; -import com.me.infinity.loop.mixin.mixins.IRenderManager; -import com.me.infinity.loop.util.utils.renders.TessellatorUtil; -import net.minecraft.block.Block; -import net.minecraft.block.BlockBarrier; -import net.minecraft.block.BlockCommandBlock; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.init.Blocks; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import org.lwjgl.opengl.GL11; - -import java.awt.*; -import java.util.ArrayList; -import java.util.concurrent.CopyOnWriteArrayList; - -public class Search extends Module { - - public Search() { - super("Search", "Find a block", ModuleCategory.RENDER); - } - - - public static CopyOnWriteArrayList blocks = new CopyOnWriteArrayList<>(); - private Setting range = this.register(new Setting<>("Range", 100f, 1f, 500f)); - private Setting color = this.register( new Setting<>("Color", new Color(0xFF00FFFF))); - private Setting illegals = this.register(new Setting<>("Illegals", true)); - private Setting tracers = this.register(new Setting<>("Tracers", false)); - private Setting fill =this.register( new Setting<>("Fill", true)); - private Setting outline =this.register( new Setting<>("Outline", true)); - public Setting softReload =this.register( new Setting<>("SoftReload", true)); - - - - public void onEnable() { - if (softReload.getValue()) { - doSoftReload(); - } - } - - public static void doSoftReload() { - if (mc.world != null && mc.player != null) { - int posX = (int) mc.player.posX; - int posY = (int) mc.player.posY; - int posZ = (int) mc.player.posZ; - int range = mc.gameSettings.renderDistanceChunks * 16; - mc.renderGlobal.markBlockRangeForRenderUpdate(posX - range, posY - range, posZ - range, posX + range, posY + range, posZ + range); - } - } - - @SubscribeEvent - public void onBlockRender(EventBlockRender event) { - if (mc.world == null || mc.player == null) return; - if (blocks.size() > 100000) { - blocks.clear(); - } - if(shouldAdd(event.getBlock(), event.getPos())) { - BlockVec vec = new BlockVec(event.getPos().getX(), event.getPos().getY(), event.getPos().getZ()); - if (!blocks.contains(vec)) { - blocks.add(vec); - } - } - } - - @SubscribeEvent - public void onRender3D(Render3DEvent event) { - - if (mc.world == null || mc.player == null || blocks.isEmpty()) return; - - if (fill.getValue() || outline.getValue()) { - for (BlockVec vec : blocks) { - if (vec.getDistance(new BlockVec(mc.player.posX, mc.player.posY, mc.player.posZ)) > range.getValue() || !shouldRender(vec)) { - blocks.remove(vec); - continue; - } - - BlockPos pos = new BlockPos(vec.x, vec.y, vec.z); - - AxisAlignedBB axisAlignedBB = mc.world.getBlockState(pos).getBoundingBox(mc.world, pos).offset(pos); - - if (fill.getValue()) { - TessellatorUtil.prepare(); - TessellatorUtil.drawBox(axisAlignedBB, new Color(this.color.getValue().getRGB())); - TessellatorUtil.release(); - } - - if (outline.getValue()) { - TessellatorUtil.prepare(); - TessellatorUtil.drawBoundingBox(axisAlignedBB, 1.5F, new Color(this.color.getValue().getRGB())); - TessellatorUtil.release(); - } - } - } - - if (tracers.getValue()) { - for (BlockVec vec : blocks) { - if (vec.getDistance(new BlockVec(mc.player.posX, mc.player.posY, mc.player.posZ)) > range.getValue() || !shouldRender(vec)) { - blocks.remove(vec); - continue; - } - - Vec3d eyes = new Vec3d(0, 0, 1) - .rotatePitch(-(float) Math - .toRadians(mc.player.rotationPitch)) - .rotateYaw(-(float) Math - .toRadians(mc.player.rotationYaw)); - - renderTracer(eyes.x, eyes.y + mc.player.getEyeHeight(), eyes.z, - vec.x - ((IRenderManager) mc.getRenderManager()).getRenderPosX() + 0.5, - vec.y - ((IRenderManager) mc.getRenderManager()).getRenderPosY() + 0.5, - vec.z - ((IRenderManager) mc.getRenderManager()).getRenderPosZ() + 0.5, - color.getValue().getRGB()); - } - } - } - - private boolean shouldAdd(Block block, BlockPos pos) { - if (defaultBlocks.contains(block)) { - return true; - } - if (illegals.getValue()) { - return isIllegal(block, pos); - } - return false; - } - - - public static ArrayList defaultBlocks = new ArrayList<>(); - - - private boolean shouldRender(BlockVec vec) { - BlockPos pos = new BlockPos(vec.x, vec.y, vec.z); - if (defaultBlocks.contains(mc.world.getBlockState(pos).getBlock())) { - return true; - } - - if (illegals.getValue()) { - return isIllegal(mc.world.getBlockState(pos).getBlock(), pos); - } - - return false; - } - - - private static Block getRegisteredBlock(String blockName) { - Block block = (Block)Block.REGISTRY.getObject(new ResourceLocation(blockName)); - return block; - } - - private boolean isIllegal(Block block, BlockPos pos) { - if (block instanceof BlockCommandBlock || block instanceof BlockBarrier) return true; - - if (block == Blocks.BEDROCK) { - if (mc.player.dimension == 0) { - return pos.getY() > 4; - } else if (mc.player.dimension == -1) { - return pos.getY() > 127 || (pos.getY() < 123 && pos.getY() > 4); - } else { - return true; - } - } - return false; - } - - public static void renderTracer(double x, double y, double z, double x2, double y2, double z2, int color){ - GL11.glBlendFunc(770, 771); - GL11.glEnable(GL11.GL_BLEND); - GL11.glLineWidth(1.5f); - GL11.glDisable(GL11.GL_TEXTURE_2D); - GL11.glDisable(GL11.GL_DEPTH_TEST); - GL11.glDepthMask(false); - - GL11.glColor4f(((color >> 16) & 0xFF) / 255F, ((color >> 8) & 0xFF) / 255F, ((color) & 0xFF) / 255F, ((color >> 24) & 0xFF) / 255F); - GlStateManager.disableLighting(); - GL11.glLoadIdentity(); - - ((IEntityRenderer) mc.entityRenderer).orientCam(mc.getRenderPartialTicks()); - - GL11.glEnable(GL11.GL_LINE_SMOOTH); - - GL11.glBegin(GL11.GL_LINES); - GL11.glVertex3d(x, y, z); - GL11.glVertex3d(x2, y2, z2); - GL11.glVertex3d(x2, y2, z2); - GL11.glEnd(); - - GL11.glDisable(GL11.GL_LINE_SMOOTH); - - GL11.glEnable(GL11.GL_TEXTURE_2D); - GL11.glEnable(GL11.GL_DEPTH_TEST); - GL11.glDepthMask(true); - GL11.glDisable(GL11.GL_BLEND); - GL11.glColor3d(1d,1d,1d); - GlStateManager.enableLighting(); - } - - private static class BlockVec { - public final double x; - public final double y; - public final double z; - - public BlockVec(double x, double y, double z) { - this.x = x; - this.y = y; - this.z = z; - } - - public boolean equals(Object object) { - if (object instanceof BlockVec) { - BlockVec v = (BlockVec) object; - return Double.compare(x, v.x) == 0 && Double.compare(y, v.y) == 0 && Double.compare(z, v.z) == 0; - } - return super.equals(object); - } - - public double getDistance(BlockVec v) { - double dx = x - v.x; - double dy = y - v.y; - double dz = z - v.z; - - return Math.sqrt(dx*dx + dy*dy + dz*dz); - } - } -} diff --git a/src/main/java/com/me/infinity/loop/features/modules/render/ShaderESP.java b/src/main/java/com/me/infinity/loop/features/modules/render/ShaderESP.java deleted file mode 100644 index 3795ee9..0000000 --- a/src/main/java/com/me/infinity/loop/features/modules/render/ShaderESP.java +++ /dev/null @@ -1,196 +0,0 @@ -package com.me.infinity.loop.features.modules.render; - -import com.me.infinity.loop.event.events.render.Render2DEvent; -import com.me.infinity.loop.event.events.render.Render3DEvent; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.setting.Setting; -import com.me.infinity.loop.util.utils.maths.MathUtil; -import com.me.infinity.loop.util.utils.openGL.ShaderUtility; -import com.me.infinity.loop.util.utils.renders.RenderUtil; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.OpenGlHelper; -import net.minecraft.client.renderer.culling.Frustum; -import net.minecraft.client.shader.Framebuffer; -import net.minecraft.entity.Entity; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import org.lwjgl.BufferUtils; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL13; -import org.lwjgl.opengl.GL20; - -import java.awt.*; -import java.nio.FloatBuffer; -import java.util.ArrayList; -import java.util.List; - -public class ShaderESP extends Module { - - public static Framebuffer framebuffer; - - public static Framebuffer outlineFrameBuffer; - - private final Setting radius = this.register(new Setting("Radius", 10.0F, 3.0F, 50.0F)); - - private final List entities = new ArrayList<>(); - - public static boolean renderNameTags = true; - - private final Setting alpha = this.register(new Setting("Alpha", 2.0F, 1.0F, 3.0F)); - - private final Setting colorMode = this.register(new Setting("Color Mode", ListSetting.Client)); - - private final ShaderUtility glowShader = new ShaderUtility("loop/shaders/glow.frag"); - - private final Frustum frustum = new Frustum(); - - private final ShaderUtility outlineShader = new ShaderUtility("loop/shaders/outline.frag"); - - public static Framebuffer glowFrameBuffer; - private final Setting glowColor = this.register(new Setting("Glow Color", new Color(0xFF00FFFF), v -> colorMode.getValue() == ListSetting.Custom)); - - public ShaderESP() { - super("ShaderESP","Shader ESP", ModuleCategory.RENDER); - } - - public enum ListSetting { - Client, - Custom - } - - public static void createFrameBuffers() { - try { - framebuffer = RenderUtil.createFrameBuffer(framebuffer); - outlineFrameBuffer = RenderUtil.createFrameBuffer(outlineFrameBuffer); - glowFrameBuffer = RenderUtil.createFrameBuffer(glowFrameBuffer); - } catch (Exception ex) { - } - } - - public void setupOutlineUniforms(float paramFloat1, float paramFloat2) { - Color color = getColor(); - this.outlineShader.setUniformi("texture", 0); - this.outlineShader.setUniformf("radius", this.radius.getValue() / 1.5F); - this.outlineShader.setUniformf("texelSize", 1.0F / mc.displayWidth, 1.0F / mc.displayHeight); - this.outlineShader.setUniformf("direction", paramFloat1, paramFloat2); - this.outlineShader.setUniformf("color", color.getRed() / 255.0F, color.getGreen() / 255.0F, color.getBlue() / 255.0F); - } - - @SubscribeEvent - public void render(Render3DEvent e) { - createFrameBuffers(); - GlStateManager.pushMatrix(); - collectEntities(); - framebuffer.framebufferClear(); - framebuffer.bindFramebuffer(true); - renderEntities(e.getPartialTicks()); - framebuffer.unbindFramebuffer(); - mc.getFramebuffer().bindFramebuffer(true); - GlStateManager.resetColor(); - GlStateManager.popMatrix(); - } - - public void renderEntities(float paramFloat) { - entities.forEach(entity -> { - renderNameTags = false; - mc.getRenderManager().renderEntityStatic(entity, paramFloat, false); - - renderNameTags = true; - }); - } - - public void setupGlowUniforms(float paramFloat1, float paramFloat2) { - Color color = getColor(); - this.glowShader.setUniformi("texture", 0); - this.glowShader.setUniformf("radius", this.radius.getValue()); - this.glowShader.setUniformf("texelSize", 1.0F / mc.displayWidth, 1.0F / mc.displayHeight); - this.glowShader.setUniformf("direction", paramFloat1, paramFloat2); - this.glowShader.setUniformf("color", color.getRed() / 255.0F, color.getGreen() / 255.0F, color.getBlue() / 255.0F); - this.glowShader.setUniformf("exposure", this.alpha.getValue()); - this.glowShader.setUniformi("avoidTexture", 0); - FloatBuffer floatBuffer = BufferUtils.createFloatBuffer(256); - for (int i = 1; i <= this.radius.getValue(); i++) { - floatBuffer.put(MathUtil.calculateGaussianValue(i, this.radius.getValue() / 2.0F)); - floatBuffer.rewind(); - GL20.glUniform1(this.glowShader.getUniform("weights"), floatBuffer); - } - } - - public void collectEntities() { - this.entities.clear(); - for (Entity entity : mc.world.loadedEntityList) { - if (isInViewFrustum(entity) && (entity != mc.player || mc.gameSettings.thirdPersonView != 0) && entity instanceof net.minecraft.entity.player.EntityPlayer) - this.entities.add(entity); - } - } - - public boolean isInViewFrustum(Entity entity) { - Entity current = Minecraft.getMinecraft().getRenderViewEntity(); - this.frustum.setPosition(current.posX, current.posY, current.posZ); - return this.frustum.isBoundingBoxInFrustum(entity.getEntityBoundingBox()) || entity.ignoreFrustumCheck; - } - - - public void onDisable() { - mc.gameSettings.entityShadows = true; - super.onDisable(); - } - - public void onEnable() { - mc.gameSettings.entityShadows = false; - super.onEnable(); - } - - @SubscribeEvent - public void render(Render2DEvent event) { - if (framebuffer != null && outlineFrameBuffer != null && this.entities.size() > 0) { - GL11.glPushMatrix(); - GlStateManager.enableAlpha(); - GlStateManager.alphaFunc(516, 0.0F); - GlStateManager.enableBlend(); - OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); - outlineFrameBuffer.framebufferClear(); - outlineFrameBuffer.bindFramebuffer(true); - this.outlineShader.init(); - setupOutlineUniforms(0.0F, 1.0F); - GlStateManager.bindTexture(framebuffer.framebufferTexture); - ShaderUtility.drawQuads(); - this.outlineShader.init(); - setupOutlineUniforms(1.0F, 0.0F); - GlStateManager.bindTexture(framebuffer.framebufferTexture); - ShaderUtility.drawQuads(); - this.outlineShader.unload(); - outlineFrameBuffer.unbindFramebuffer(); - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - glowFrameBuffer.framebufferClear(); - glowFrameBuffer.bindFramebuffer(true); - this.glowShader.init(); - setupGlowUniforms(1.0F, 0.0F); - GlStateManager.bindTexture(outlineFrameBuffer.framebufferTexture); - ShaderUtility.drawQuads(); - this.glowShader.unload(); - glowFrameBuffer.unbindFramebuffer(); - mc.getFramebuffer().bindFramebuffer(true); - this.glowShader.init(); - setupGlowUniforms(0.0F, 1.0F); - GL13.glActiveTexture(GL13.GL_TEXTURE0); - GlStateManager.bindTexture(glowFrameBuffer.framebufferTexture); - ShaderUtility.drawQuads(); - this.glowShader.unload(); - GlStateManager.disableAlpha(); - GlStateManager.disableBlend(); - GlStateManager.resetColor(); - GL11.glPopMatrix(); - } - } - private Color getColor() { - return new Color(glowColor.getValue().getRGB()); - } - - private static void renderEntities1(float paramFloat, Entity paramEntity) { - renderNameTags = false; - mc.getRenderManager().renderEntityStatic(paramEntity, paramFloat, false); - renderNameTags = true; - } -} diff --git a/src/main/java/com/me/infinity/loop/features/modules/render/ShadowESP.java b/src/main/java/com/me/infinity/loop/features/modules/render/ShadowESP.java deleted file mode 100644 index c79eaca..0000000 --- a/src/main/java/com/me/infinity/loop/features/modules/render/ShadowESP.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.me.infinity.loop.features.modules.render; - -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; - -public class ShadowESP - extends Module { - public ShadowESP() { - super("ShadowEsp","ShadowEsp", ModuleCategory.RENDER); - } - - @Override - public void onDisable() { - for (EntityPlayer player : ShadowESP.mc.world.playerEntities) { - if (!player.isGlowing()) continue; - player.setGlowing(false); - } - super.onDisable(); - for (Entity entity : ShadowESP.mc.world.playerEntities) { - if (!entity.isGlowing()) continue; - entity.setGlowing(false); - } - super.onDisable(); - } - - @Override - public void onUpdate() { - for (Entity player : ShadowESP.mc.world.loadedEntityList) { - if (!(player instanceof EntityPlayer)) continue; - player.setGlowing(true); - } - for (Entity entity : ShadowESP.mc.world.loadedEntityList) { - if (!(entity instanceof EntityPlayer)) continue; - entity.setGlowing(true); - } - } -} diff --git a/src/main/java/com/me/infinity/loop/features/modules/render/ViewModel.java b/src/main/java/com/me/infinity/loop/features/modules/render/ViewModel.java deleted file mode 100644 index b241b22..0000000 --- a/src/main/java/com/me/infinity/loop/features/modules/render/ViewModel.java +++ /dev/null @@ -1,107 +0,0 @@ -package com.me.infinity.loop.features.modules.render; - -import com.me.infinity.loop.event.events.player.TransformFirstPersonEvent; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.setting.Setting; -import me.zero.alpine.fork.listener.EventHandler; -import me.zero.alpine.fork.listener.Listener; -import net.minecraft.client.settings.GameSettings; -import net.minecraft.util.*; -import net.minecraft.client.renderer.*; - -import java.util.function.Predicate; - -public class ViewModel extends Module { - public final Setting leftPosition = this.register(new Setting<>("LeftPosition", true)); - public Setting leftX = this.register(new Setting("LeftX", Float.valueOf(2.0f), Float.valueOf(0.0f), Float.valueOf(2.0f), v -> this.leftPosition.getValue())); - public Setting leftY = this.register(new Setting("LeftY", Float.valueOf(2.0f), Float.valueOf(0.0f), Float.valueOf(2.0f), v -> this.leftPosition.getValue())); - public Setting leftZ = this.register(new Setting("LeftZ", Float.valueOf(2.0f), Float.valueOf(0.0f), Float.valueOf(2.0f), v -> this.leftPosition.getValue())); - public final Setting rightPosition = this.register(new Setting<>("RightPosition", true)); - public final Setting rightX = this.register(new Setting("rightX", Float.valueOf(2.0f), Float.valueOf(0.0f), Float.valueOf(2.0f), v -> this.rightPosition.getValue())); - public final Setting rightY = this.register(new Setting("rightY", Float.valueOf(2.0f), Float.valueOf(0.0f), Float.valueOf(2.0f), v -> this.rightPosition.getValue())); - public final Setting rightZ = this.register(new Setting("RightZ", Float.valueOf(2.0f), Float.valueOf(0.0f), Float.valueOf(2.0f), v -> this.rightPosition.getValue())); - public final Setting leftRotation = this.register(new Setting("LeftRotation", true)); - public final Setting leftYaw = this.register(new Setting("Yaw", Float.valueOf(-100.0f), Float.valueOf(0.0f), Float.valueOf(100.0f), v -> this.leftRotation.getValue())); - public final Setting leftPitch = this.register(new Setting("Pitch", Float.valueOf(-100.0f), Float.valueOf(0.0f), Float.valueOf(100.0f), v -> this.leftRotation.getValue())); - public final Setting leftRoll = this.register(new Setting("Roll", Float.valueOf(-100.0f), Float.valueOf(0.0f), Float.valueOf(100.0f), v -> this.leftRotation.getValue())); - public final Setting rightRotation = this.register(new Setting("RightRotation", true)); - public final Setting rightYaw = this.register(new Setting("Yaw", Float.valueOf(-100.0f), Float.valueOf(0.0f), Float.valueOf(100.0f), v -> this.rightRotation.getValue())); - public final Setting rightPitch = this.register(new Setting("Pitch", Float.valueOf(-100.0f), Float.valueOf(0.0f), Float.valueOf(100.0f), v -> this.rightRotation.getValue())); - public final Setting rightRoll = this.register(new Setting("Roll", Float.valueOf(-100.0f), Float.valueOf(0.0f), Float.valueOf(100.0f), v -> this.rightRotation.getValue())); - public final Setting Animation = this.register(new Setting("Animation", true)); - public final Setting leftAnimation = this.register(new Setting("LeftAnimation", true, v -> this.Animation.getValue())); - public final Setting leftAnimationSpeed = this.register(new Setting("AnimationSpeed", Float.valueOf(1.0f), Float.valueOf(5.0f), Float.valueOf(10.0f), v -> this.Animation.getValue() && this.leftAnimation.getValue())); - public final Setting rightAnimation = this.register(new Setting("RightAnimation", true, v -> this.Animation.getValue())); - public final Setting rightAnimationSpeed = this.register(new Setting("AnimationSpeed", Float.valueOf(1.0f), Float.valueOf(5.0f), Float.valueOf(10.0f), v -> this.Animation.getValue() && this.rightAnimation.getValue())); - public final Setting customfov = this.register(new Setting("CustomFOV", true)); - public final Setting fov = this.register(new Setting("FOV", Float.valueOf(110.0f), Float.valueOf(130.0f), Float.valueOf(170.0f), v -> this.customfov.getValue())); - public final Setting cancelEating = this.register(new Setting("CancelEating", true)); - - private static ViewModel INSTANCE = new ViewModel(); - @EventHandler - private Listener listener; - @EventHandler - private Listener listener2; - - public ViewModel() { - super("Viewmodel", "Changes to the size and positions of your hands.", ModuleCategory.RENDER); - this.setInstance(); - - } - public void onRender3D(Listener l) { - this.listener = new Listener(event -> { - if (nullCheck()) { - } else { - if (ViewModel.getINSTANCE().leftPosition.getValue() && event.getEnumHandSide() == EnumHandSide.LEFT) { - GlStateManager.translate(ViewModel.getINSTANCE().leftX.getValue(), ViewModel.getINSTANCE().leftY.getValue(), ViewModel.getINSTANCE().leftZ.getValue()); - } - if (ViewModel.getINSTANCE().rightPosition.getValue() && event.getEnumHandSide() == EnumHandSide.RIGHT) { - GlStateManager.translate(ViewModel.getINSTANCE().rightX.getValue(), ViewModel.getINSTANCE().rightY.getValue(), ViewModel.getINSTANCE().rightZ.getValue()); - } - } - }, new Predicate[0]); - this.listener2 = new Listener(event -> { - if (!nullCheck()) { - if (ViewModel.getINSTANCE().leftRotation.getValue() && event.getEnumHandSide() == EnumHandSide.LEFT) { - GlStateManager.rotate(ViewModel.getINSTANCE().leftYaw.getValue(), 0.0f, 1.0f, 0.0f); - GlStateManager.rotate(ViewModel.getINSTANCE().leftPitch.getValue(), 1.0f, 0.0f, 0.0f); - GlStateManager.rotate(ViewModel.getINSTANCE().leftRoll.getValue(), 0.0f, 0.0f, 1.0f); - } - if (ViewModel.getINSTANCE().rightRotation.getValue() && event.getEnumHandSide() == EnumHandSide.RIGHT) { - GlStateManager.rotate(ViewModel.getINSTANCE().rightYaw.getValue(), 0.0f, 1.0f, 0.0f); - GlStateManager.rotate(ViewModel.getINSTANCE().rightPitch.getValue(), 1.0f, 0.0f, 0.0f); - GlStateManager.rotate(ViewModel.getINSTANCE().rightRoll.getValue(), 0.0f, 0.0f, 1.0f); - } - } - }, new Predicate[0]); - } - - - public void onUpdate() { - if (nullCheck()) { - return; - } - if (ViewModel.getINSTANCE().leftAnimation.getValue()) { - ViewModel.getINSTANCE().leftYaw.setValue((float) (ViewModel.getINSTANCE().leftYaw.getValue() + ViewModel.getINSTANCE().leftAnimationSpeed.getValue() % 360.0)); - } - if (ViewModel.getINSTANCE().rightAnimation.getValue()) { - ViewModel.getINSTANCE().rightYaw.setValue((float) (ViewModel.getINSTANCE().rightYaw.getValue() + ViewModel.getINSTANCE().rightAnimationSpeed.getValue() % 360.0)); - } - if (ViewModel.getINSTANCE().customfov.getValue().booleanValue()) { - this.mc.gameSettings.setOptionFloatValue(GameSettings.Options.FOV, this.fov.getValue().floatValue()); - } - } - - - private void setInstance() { - INSTANCE = this; - } - - public static ViewModel getINSTANCE() { - if (INSTANCE == null) { - INSTANCE = new ViewModel(); - } - return INSTANCE; - } -} diff --git a/src/main/java/com/me/infinity/loop/features/modules/render/Wireframe.java b/src/main/java/com/me/infinity/loop/features/modules/render/Wireframe.java deleted file mode 100644 index a919b52..0000000 --- a/src/main/java/com/me/infinity/loop/features/modules/render/Wireframe.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.me.infinity.loop.features.modules.render; - -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.setting.Setting; -import net.minecraftforge.client.event.RenderPlayerEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; - -public class Wireframe - extends Module { - private static Wireframe INSTANCE = new Wireframe(); - public final Setting alpha = this.register(new Setting("PAlpha", Float.valueOf(255.0f), Float.valueOf(0.1f), Float.valueOf(255.0f))); - public final Setting cAlpha = this.register(new Setting("CAlpha", Float.valueOf(255.0f), Float.valueOf(0.1f), Float.valueOf(255.0f))); - public final Setting lineWidth = this.register(new Setting("PLineWidth", Float.valueOf(1.0f), Float.valueOf(0.1f), Float.valueOf(3.0f))); - public final Setting crystalLineWidth = this.register(new Setting("CLineWidth", Float.valueOf(1.0f), Float.valueOf(0.1f), Float.valueOf(3.0f))); - public Setting mode = this.register(new Setting("PMode", RenderMode.SOLID)); - public Setting cMode = this.register(new Setting("CMode", RenderMode.SOLID)); - public Setting players = this.register(new Setting("Players", Boolean.FALSE)); - public Setting playerModel = this.register(new Setting("PlayerModel", Boolean.FALSE)); - public Setting crystals = this.register(new Setting("Crystals", Boolean.FALSE)); - public Setting crystalModel = this.register(new Setting("CrystalModel", Boolean.FALSE)); - - public Wireframe() { - super("Wireframe", "Draws a wireframe esp around other players.", ModuleCategory.RENDER); - this.setInstance(); - } - - public static Wireframe getINSTANCE() { - if (INSTANCE == null) { - INSTANCE = new Wireframe(); - } - return INSTANCE; - } - - private void setInstance() { - INSTANCE = this; - } - - @SubscribeEvent - public void onRenderPlayerEvent(RenderPlayerEvent.Pre event) { - event.getEntityPlayer().hurtTime = 0; - } - - public enum RenderMode { - SOLID, - WIREFRAME - - } -} - diff --git a/src/main/java/com/me/infinity/loop/features/modules/render/deatheffects/DeathEffects.java b/src/main/java/com/me/infinity/loop/features/modules/render/deatheffects/DeathEffects.java deleted file mode 100644 index 31b0837..0000000 --- a/src/main/java/com/me/infinity/loop/features/modules/render/deatheffects/DeathEffects.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.me.infinity.loop.features.modules.render.deatheffects; - -import com.me.infinity.loop.event.events.network.EventDeath; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.setting.Setting; -import com.me.infinity.loop.util.utils.worlds.Timer; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.effect.EntityLightningBolt; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.SoundEvents; -import net.minecraft.util.EnumParticleTypes; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; - - -public class DeathEffects extends Module { - private final Setting sound = this.register(new Setting<>("Sound", false)); - private final Setting particles = this.register(new Setting("Particles", false)); - private final Setting mode = this.register(new Setting("Mode", Moderator.SMOKE)); - private final Setting yOffset = this.register(new Setting("YPos offset", 0.0, 0.0, 2.0, v -> this.particles.getValue().booleanValue())); - - public DeathEffects() { - super("DeathEffects", "Spawn a thunder to the loser", ModuleCategory.RENDER); - - } - - private Timer timer = new Timer(); - - public static void Renderparticle(final EntityLivingBase entity, final String s, final double yoffset) { - try { - switch (s) { - case "HEART": { - DeathEffects.mc.world.spawnParticle(EnumParticleTypes.HEART, entity.posX, entity.posY + 0.01 + yoffset, entity.posZ, entity.motionX * 0.4, entity.motionY * 0.4, entity.motionZ * 0.4, new int[0]); - } - case "SWORD": { - DeathEffects.mc.world.spawnParticle(EnumParticleTypes.FIREWORKS_SPARK, entity.posX, entity.posY + 0.01 + yoffset, entity.posZ, entity.motionX * 0.4, entity.motionY * 0.4, entity.motionZ * 0.4, new int[0]); - DeathEffects.mc.world.spawnParticle(EnumParticleTypes.CRIT, entity.posX, entity.posY + 0.01 + yoffset, entity.posZ, entity.motionX * 0.4, entity.motionY * 0.4, entity.motionZ * 0.4, new int[0]); - DeathEffects.mc.world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, entity.posX, entity.posY + 0.01 + yoffset, entity.posZ, entity.motionX * 0.4, entity.motionY * 0.4, entity.motionZ * 0.4, new int[0]); - DeathEffects.mc.world.spawnParticle(EnumParticleTypes.CRIT_MAGIC, entity.posX, entity.posY + 0.01 + yoffset, entity.posZ, entity.motionX * 0.4, entity.motionY * 0.4, entity.motionZ * 0.4, new int[0]); - DeathEffects.mc.world.spawnParticle(EnumParticleTypes.ENCHANTMENT_TABLE, entity.posX, entity.posY + 0.01 + yoffset, entity.posZ, entity.motionX * 0.4, entity.motionY * 0.4, entity.motionZ * 0.4, new int[0]); - } - case "REDSTONE": { - DeathEffects.mc.world.spawnParticle(EnumParticleTypes.REDSTONE, entity.posX, entity.posY + 0.01 + yoffset, entity.posZ, entity.motionX * 0.4, entity.motionY * 0.4, entity.motionZ * 0.4, new int[0]); - } - case "MAGIC": { - DeathEffects.mc.world.spawnParticle(EnumParticleTypes.ENCHANTMENT_TABLE, entity.posX, entity.posY + 0.01 + yoffset, entity.posZ, entity.motionX * 0.4, entity.motionY * 0.4, entity.motionZ * 0.4, new int[0]); - } - case "LAVA": { - DeathEffects.mc.world.spawnParticle(EnumParticleTypes.LAVA, entity.posX, entity.posY + 0.01 + yoffset, entity.posZ, entity.motionX * 0.4, entity.motionY * 0.4, entity.motionZ * 0.4, new int[0]); - DeathEffects.mc.world.spawnParticle(EnumParticleTypes.DRIP_LAVA, entity.posX, entity.posY + 0.01 + yoffset, entity.posZ, entity.motionX * 0.4, entity.motionY * 0.4, entity.motionZ * 0.4, new int[0]); - } - case "SMOKE": { - DeathEffects.mc.world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, entity.posX, entity.posY + 0.01 + yoffset, entity.posZ, entity.motionX * 0.4, entity.motionY * 0.4, entity.motionZ * 0.4, new int[0]); - } - case "CLOUD": { - DeathEffects.mc.world.spawnParticle(EnumParticleTypes.CLOUD, entity.posX, entity.posY + 0.01 + yoffset, entity.posZ, entity.motionX * 0.4, entity.motionY * 0.4, entity.motionZ * 0.4, new int[0]); - } - case "FLAME": { - DeathEffects.mc.world.spawnParticle(EnumParticleTypes.FLAME, entity.posX, entity.posY + 0.01 + yoffset, entity.posZ, entity.motionX * 0.4, entity.motionY * 0.4, entity.motionZ * 0.4, new int[0]); - } - case "SLIME": { - DeathEffects.mc.world.spawnParticle(EnumParticleTypes.SLIME, entity.posX, entity.posY + 0.01 + yoffset, entity.posZ, entity.motionX * 0.4, entity.motionY * 0.4, entity.motionZ * 0.4, new int[0]); - } - case "EXPLOSION": { - DeathEffects.mc.world.spawnParticle(EnumParticleTypes.EXPLOSION_NORMAL, entity.posX, entity.posY + 0.01 + yoffset, entity.posZ, entity.motionX * 0.4, entity.motionY * 0.4, entity.motionZ * 0.4, new int[0]); - } - case "WATER": { - DeathEffects.mc.world.spawnParticle(EnumParticleTypes.WATER_BUBBLE, entity.posX, entity.posY + 0.01 + yoffset, entity.posZ, entity.motionX * 0.4, entity.motionY * 0.4, entity.motionZ * 0.4, new int[0]); - DeathEffects.mc.world.spawnParticle(EnumParticleTypes.WATER_SPLASH, entity.posX, entity.posY + 0.01 + yoffset, entity.posZ, entity.motionX * 0.4, entity.motionY * 0.4, entity.motionZ * 0.4, new int[0]); - } - case "FIREWORK": { - DeathEffects.mc.world.spawnParticle(EnumParticleTypes.FIREWORKS_SPARK, entity.posX, entity.posY + 0.01 + yoffset, entity.posZ, entity.motionX * 0.4, entity.motionY * 0.4, entity.motionZ * 0.4, new int[0]); - break; - } - } - } catch (Exception ex) { - } - } - - @SubscribeEvent - public void onDeath(EventDeath event) { - if (!nullCheck() && event.player != null) { - Entity entity = event.player; - if (entity != null) { - if (entity.isDead || ((EntityPlayer) entity).getHealth() <= 0 && timer.passedMs(1500)) { - mc.world.spawnEntity(new EntityLightningBolt(mc.world, entity.posX, entity.posY, entity.posZ, true)); - if (sound.getValue()) { - mc.player.playSound(SoundEvents.ENTITY_LIGHTNING_THUNDER, 0.5f, 1.f); - timer.reset(); - } - /*for (int i = 0; i < 5; ++i) { - DeathEffects.Renderparticle((EntityLivingBase) entity, String.valueOf(mode.getValue()), this.yOffset.getValue().floatValue());*/ - - } - } - } - } -} diff --git a/src/main/java/com/me/infinity/loop/features/modules/render/deatheffects/Moderator.java b/src/main/java/com/me/infinity/loop/features/modules/render/deatheffects/Moderator.java deleted file mode 100644 index 8d43c28..0000000 --- a/src/main/java/com/me/infinity/loop/features/modules/render/deatheffects/Moderator.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.me.infinity.loop.features.modules.render.deatheffects; - -public enum Moderator { - NONE, SMOKE, HEART, FIREWORK, FLAME, CLOUD, WATER, LAVA, SLIME, EXPLOSION, MAGIC, REDSTONE, SWORD -} diff --git a/src/main/java/com/me/infinity/loop/features/modules/render/motionblur/MotionBlur.java b/src/main/java/com/me/infinity/loop/features/modules/render/motionblur/MotionBlur.java deleted file mode 100644 index b57d10d..0000000 --- a/src/main/java/com/me/infinity/loop/features/modules/render/motionblur/MotionBlur.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.me.infinity.loop.features.modules.render.motionblur; - -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.setting.Setting; -import net.minecraftforge.fml.common.gameevent.*; -import net.minecraft.client.resources.*; -import net.minecraft.util.*; -import java.lang.reflect.*; -import java.util.Map; - -public class MotionBlur - extends Module { - private static MotionBlur INSTANCE = new MotionBlur(); - public Setting blurAmount = this.register(new Setting("blurAmount", 1.0, 0.0, 10.0)); - boolean Setup; - double old; - private static Map domainResourceManagers; - - public MotionBlur() { - super("MotionBlur", "Motion Blur", ModuleCategory.RENDER); - this.Setup = true; - this.old = 0.0; - this.setInstance(); - } - - public static MotionBlur getInstance() { - if (INSTANCE == null) { - INSTANCE = new MotionBlur(); - } - return INSTANCE; - } - - private void setInstance() { - INSTANCE = this; - } - - - @Override - public void onEnable() { - this.Setup = true; - MotionBlur.domainResourceManagers = null; - } - - @Override - public void onDisable() { - MotionBlur.mc.entityRenderer.getShaderGroup(); - MotionBlur.domainResourceManagers = null; - } - - @Override - public void onClientTick(final TickEvent.ClientTickEvent event) { - if (this.old != blurAmount.getValue()) { - this.old = blurAmount.getValue(); - this.Setup = true; - MotionBlur.domainResourceManagers = null; - return; - } - if (MotionBlur.domainResourceManagers == null) { - try { - final Field[] declaredFields; - final Field[] var2 = declaredFields = SimpleReloadableResourceManager.class.getDeclaredFields(); - for (final Field field : declaredFields) { - if (field.getType() == Map.class) { - field.setAccessible(true); - MotionBlur.domainResourceManagers = (Map)field.get(MotionBlur.mc.getResourceManager()); - break; - } - } - } - catch (Exception var3) { - throw new RuntimeException(var3); - } - } - assert MotionBlur.domainResourceManagers != null; - if (!MotionBlur.domainResourceManagers.containsKey("motionblur")) { - MotionBlur.domainResourceManagers.put("motionblur", new MotionBlurResourceManager()); - } - if (this.Setup) { - MotionBlur.mc.entityRenderer.loadShader(new ResourceLocation("loop", "shaders/motion-blur.json")); - MotionBlur.mc.entityRenderer.getShaderGroup().createBindFramebuffers(MotionBlur.mc.displayWidth, MotionBlur.mc.displayHeight); - this.Setup = false; - } - } -} diff --git a/src/main/java/com/me/infinity/loop/features/modules/render/motionblur/MotionBlurResource.java b/src/main/java/com/me/infinity/loop/features/modules/render/motionblur/MotionBlurResource.java deleted file mode 100644 index d495c45..0000000 --- a/src/main/java/com/me/infinity/loop/features/modules/render/motionblur/MotionBlurResource.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.me.infinity.loop.features.modules.render.motionblur; - -import net.minecraft.client.resources.IResource; -import net.minecraft.client.resources.data.IMetadataSection; -import net.minecraft.util.ResourceLocation; -import org.apache.commons.io.IOUtils; - -import javax.annotation.Nullable; -import java.io.InputStream; -import java.util.Locale; - -class MotionBlurResource implements IResource -{ - - @Override - public ResourceLocation getResourceLocation() { - return null; - } - - public InputStream getInputStream() { - final double amount = 0.7 + MotionBlur.getInstance().blurAmount.getValue() / 100.0 * 3.0 - 0.01; - return IOUtils.toInputStream(String.format(Locale.ENGLISH, "{\"targets\":[\"swap\",\"previous\"],\"passes\":[{\"name\":\"phosphor\",\"intarget\":\"minecraft:main\",\"outtarget\":\"swap\",\"auxtargets\":[{\"name\":\"PrevSampler\",\"id\":\"previous\"}],\"uniforms\":[{\"name\":\"Phosphor\",\"values\":[%.2f, %.2f, %.2f]}]},{\"name\":\"blit\",\"intarget\":\"swap\",\"outtarget\":\"previous\"},{\"name\":\"blit\",\"intarget\":\"swap\",\"outtarget\":\"minecraft:main\"}]}", amount, amount, amount)); - } - - public boolean hasMetadata() { - return false; - } - - @Nullable - public T getMetadata(final String s) { - return null; - } - - @Override - public String getResourcePackName() { - return null; - } - - public void close() { - } -} diff --git a/src/main/java/com/me/infinity/loop/features/modules/render/motionblur/MotionBlurResourceManager.java b/src/main/java/com/me/infinity/loop/features/modules/render/motionblur/MotionBlurResourceManager.java deleted file mode 100644 index 4cd9e33..0000000 --- a/src/main/java/com/me/infinity/loop/features/modules/render/motionblur/MotionBlurResourceManager.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.me.infinity.loop.features.modules.render.motionblur; - -import net.minecraft.util.*; -import net.minecraft.client.resources.*; -import java.util.*; - -class MotionBlurResourceManager implements IResourceManager -{ - public Set getResourceDomains() { - return null; - } - - public IResource getResource(final ResourceLocation resourceLocation) { - return (IResource)new MotionBlurResource(); - } - - public List getAllResources(final ResourceLocation resourceLocation) { - return null; - } -} diff --git a/src/main/java/com/me/infinity/loop/features/modules/test/Test.java b/src/main/java/com/me/infinity/loop/features/modules/test/Test.java deleted file mode 100644 index 930dedb..0000000 --- a/src/main/java/com/me/infinity/loop/features/modules/test/Test.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.me.infinity.loop.features.modules.test; - -import com.me.infinity.loop.features.command.Command; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.setting.Setting; - -import java.awt.*; - -public class Test extends Module { - - public Setting stringTest = this.register(new Setting<>("String", " ")); - public Setting booleanTest = this.register(new Setting<>("Boolean", true)); - public Setting sliderTest = this.register(new Setting<>("Slider", true)); - public Setting intSliderTest = this.register(new Setting<>("IntSliderTest", 150, 0, 255, v -> this.sliderTest.getValue())); - public Setting floatSliderTest = this.register(new Setting<>("FloatSlider", Float.valueOf(150.0f), Float.valueOf(1.0f), Float.valueOf(255.0f), v -> this.sliderTest.getValue())); - public Setting enumTest = this.register(new Setting("EnumTest", enumtesting.Test)); - public Setting color = this.register(new Setting<>("Color", new Color(0x8800FF00))); - public Test() { - super("Test", "description", ModuleCategory.RENDER); - } - - @Override - public void onEnable() { - Command.sendMessage("Just A TestPlace!!"); - this.disable(); - } - public enum enumtesting { - Test, - Test1, - Test2 - - } -} - - diff --git a/src/main/java/com/me/infinity/loop/features/setting/impl/ColorSetting.java b/src/main/java/com/me/infinity/loop/features/setting/impl/ColorSetting.java deleted file mode 100644 index 9421d4f..0000000 --- a/src/main/java/com/me/infinity/loop/features/setting/impl/ColorSetting.java +++ /dev/null @@ -1,49 +0,0 @@ -/*package com.me.infinity.loop.features.setting.impl; - -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.setting.Setting; - -import java.awt.*; -import java.util.function.Predicate; - -public class ColorSetting extends Setting { - - boolean isOpen = false; - boolean isSelected = false; - - public ColorSetting(String name, Color value, Module module) { - super(name, value, module); - } - - public ColorSetting(String name, Color value, Module module, Predicate shown) { - super(name, value, module, shown); - } - - public Color getColor() { - return value; - } - - public void setColor(Color value) { - this.value = value; - } - - public boolean isOpen() { - return isOpen; - } - - public void setOpen(boolean open) { - isOpen = open; - } - - public boolean isSelected() { - return isSelected; - } - - public void setSelected(boolean selected) { - isSelected = selected; - } - - public String getColorAsString() { - return String.valueOf(value.getRGB()); - } -}*/ diff --git a/src/main/java/com/me/infinity/loop/features/setting/impl/Parent.java b/src/main/java/com/me/infinity/loop/features/setting/impl/Parent.java deleted file mode 100644 index 5fa49c3..0000000 --- a/src/main/java/com/me/infinity/loop/features/setting/impl/Parent.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.me.infinity.loop.features.setting.impl; - -public class Parent { - private boolean extended; - - public Parent(boolean extended) { - this.extended = extended; - } - - public boolean isExtended() { - return extended; - } - - public void setExtended(boolean extended) { - this.extended = extended; - } -} diff --git a/src/main/java/com/me/infinity/loop/features/setting/impl/PositionSetting.java b/src/main/java/com/me/infinity/loop/features/setting/impl/PositionSetting.java deleted file mode 100644 index 5b8eb2c..0000000 --- a/src/main/java/com/me/infinity/loop/features/setting/impl/PositionSetting.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.me.infinity.loop.features.setting.impl; - -public class PositionSetting { - public float x; - public float y; - - - public PositionSetting(float x,float y){ - this.x = x; - this.y = y; - } - - public void setX(float posx){ - this.x = posx; - } - - public float getX(){ - return this.x; - } - public void setY(float posy){ - this.y = posy; - } - - public float getY(){ - return this.y; - } - -} \ No newline at end of file diff --git a/src/main/java/com/me/infinity/loop/features/setting/impl/SubBind.java b/src/main/java/com/me/infinity/loop/features/setting/impl/SubBind.java deleted file mode 100644 index 1ca30e8..0000000 --- a/src/main/java/com/me/infinity/loop/features/setting/impl/SubBind.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.me.infinity.loop.features.setting.impl; - -import com.google.common.base.Converter; -import com.google.gson.JsonElement; -import com.google.gson.JsonPrimitive; -import org.lwjgl.input.Keyboard; - -public class SubBind { - private int key; - - public SubBind(int key) { - this.key = key; - } - - public static SubBind none() { - return new SubBind(-1); - } - - public int getKey() { - return this.key; - } - - public void setKey(int key) { - this.key = key; - } - - public boolean isEmpty() { - return this.key < 0; - } - - public String toString() { - return this.isEmpty() ? "None" : (this.key < 0 ? "None" : this.capitalise(Keyboard.getKeyName(this.key))); - } - - public boolean isDown() { - return !this.isEmpty() && Keyboard.isKeyDown(this.getKey()); - } - - private String capitalise(String str) { - if (str.isEmpty()) { - return ""; - } - return Character.toUpperCase(str.charAt(0)) + (str.length() != 1 ? str.substring(1).toLowerCase() : ""); - } - - public static class SubBindConverter - extends Converter { - public JsonElement doForward(SubBind subbind) { - return new JsonPrimitive(subbind.toString()); - } - - public SubBind doBackward(JsonElement jsonElement) { - String s = jsonElement.getAsString(); - if (s.equalsIgnoreCase("None")) { - return SubBind.none(); - } - int key = -1; - try { - key = Keyboard.getKeyIndex(s.toUpperCase()); - } catch (Exception exception) { - // empty catch block - } - if (key == 0) { - return SubBind.none(); - } - return new SubBind(key); - } - } -} diff --git a/src/main/java/com/me/infinity/loop/manager/AccessorRenderManager.java b/src/main/java/com/me/infinity/loop/manager/AccessorRenderManager.java deleted file mode 100644 index cd5b018..0000000 --- a/src/main/java/com/me/infinity/loop/manager/AccessorRenderManager.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.me.infinity.loop.manager; - -import net.minecraft.client.renderer.entity.RenderManager; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -@Mixin( RenderManager.class ) -public interface AccessorRenderManager -{ - @Accessor double getRenderPosX( ); - - @Accessor double getRenderPosY( ); - - @Accessor double getRenderPosZ( ); -} diff --git a/src/main/java/com/me/infinity/loop/manager/FileManager.java b/src/main/java/com/me/infinity/loop/manager/FileManager.java deleted file mode 100644 index 48909e4..0000000 --- a/src/main/java/com/me/infinity/loop/manager/FileManager.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.me.infinity.loop.manager; - -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.features.Feature; -import com.me.infinity.loop.features.modules.ModuleCategory; - -import java.io.File; -import java.io.IOException; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.nio.file.StandardOpenOption; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -public class FileManager - extends Feature { - private final Path base = this.getMkDirectory(this.getRoot(), "loop"); - private final Path config = this.getMkDirectory(this.base, "configs"); - - private final Path shader = this.getMkDirectory(this.base, "shaders"); - - public FileManager() { - this.getMkDirectory(this.base, "pvp"); - for (ModuleCategory category : InfinityLoop.moduleManager.getCategories()) { - this.getMkDirectory(this.config, category.getName()); - } - } - - public static boolean appendTextFile(String data, String file) { - try { - Path path = Paths.get(file); - Files.write(path, Collections.singletonList(data), StandardCharsets.UTF_8, Files.exists(path) ? StandardOpenOption.APPEND : StandardOpenOption.CREATE); - } catch (IOException e) { - System.out.println("WARNING: Unable to write file: " + file); - return false; - } - return true; - } - - public static List readTextFileAllLines(String file) { - try { - Path path = Paths.get(file); - return Files.readAllLines(path, StandardCharsets.UTF_8); - } catch (IOException e) { - System.out.println("WARNING: Unable to read file, creating new file: " + file); - FileManager.appendTextFile("", file); - return Collections.emptyList(); - } - } - - private String[] expandPath(String fullPath) { - return fullPath.split(":?\\\\\\\\|\\/"); - } - - private Stream expandPaths(String... paths) { - return Arrays.stream(paths).map(this::expandPath).flatMap(Arrays::stream); - } - - private Path lookupPath(Path root, String... paths) { - return Paths.get(root.toString(), paths); - } - - private Path getRoot() { - return Paths.get(""); - } - - private void createDirectory(Path dir) { - try { - if (!Files.isDirectory(dir)) { - if (Files.exists(dir)) { - Files.delete(dir); - } - Files.createDirectories(dir); - } - } catch (IOException e) { - e.printStackTrace(); - } - } - - private Path getMkDirectory(Path parent, String... paths) { - if (paths.length < 1) { - return parent; - } - Path dir = this.lookupPath(parent, paths); - this.createDirectory(dir); - return dir; - } - - public Path getBasePath() { - return this.base; - } - - public Path getBaseResolve(String... paths) { - String[] names = this.expandPaths(paths).toArray(String[]::new); - if (names.length < 1) { - throw new IllegalArgumentException("missing path"); - } - return this.lookupPath(this.getBasePath(), names); - } - - public Path getMkBaseResolve(String... paths) { - Path path = this.getBaseResolve(paths); - this.createDirectory(path.getParent()); - return path; - } - - public Path getConfig() { - return this.getBasePath().resolve("config"); - } - - public Path getCache() { - return this.getBasePath().resolve("cache"); - } - - public Path getMkBaseDirectory(String... names) { - return this.getMkDirectory(this.getBasePath(), this.expandPaths(names).collect(Collectors.joining(File.separator))); - } - - public Path getMkConfigDirectory(String... names) { - return this.getMkDirectory(this.getConfig(), this.expandPaths(names).collect(Collectors.joining(File.separator))); - } - -} - diff --git a/src/main/java/com/me/infinity/loop/manager/FpsManagement.java b/src/main/java/com/me/infinity/loop/manager/FpsManagement.java deleted file mode 100644 index b310971..0000000 --- a/src/main/java/com/me/infinity/loop/manager/FpsManagement.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.me.infinity.loop.manager; - -import java.util.LinkedList; - -public final class FpsManagement { - private int fps; - private final LinkedList frames = new LinkedList<>( ); - - public void update( ) { - long time = System.nanoTime( ); - - frames.add( time ); - - while ( true ) { - long f = frames.getFirst( ); - final long ONE_SECOND = 1000000L * 1000L; - if ( time - f > ONE_SECOND ) frames.remove( ); - else break; - } - - fps = frames.size( ); - } - - public int getFPS( ) { - return fps; - } - - public float getFrametime( ) { - return 1.0f / fps; - } - -} \ No newline at end of file diff --git a/src/main/java/com/me/infinity/loop/manager/InventoryManager.java b/src/main/java/com/me/infinity/loop/manager/InventoryManager.java deleted file mode 100644 index 0230dae..0000000 --- a/src/main/java/com/me/infinity/loop/manager/InventoryManager.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.me.infinity.loop.manager; - -import com.me.infinity.loop.util.utils.Util; -import net.minecraft.network.play.client.CPacketHeldItemChange; - -public class InventoryManager - implements Util { - public int currentPlayerItem; - private int recoverySlot = -1; - - public void update() { - if (this.recoverySlot != -1) { - InventoryManager.mc.player.connection.sendPacket(new CPacketHeldItemChange(this.recoverySlot == 8 ? 7 : this.recoverySlot + 1)); - InventoryManager.mc.player.connection.sendPacket(new CPacketHeldItemChange(this.recoverySlot)); - InventoryManager.mc.player.inventory.currentItem = this.recoverySlot; - int i = InventoryManager.mc.player.inventory.currentItem; - if (i != this.currentPlayerItem) { - this.currentPlayerItem = i; - InventoryManager.mc.player.connection.sendPacket(new CPacketHeldItemChange(this.currentPlayerItem)); - } - this.recoverySlot = -1; - } - } - - public void recoverSilent(int slot) { - this.recoverySlot = slot; - } -} - diff --git a/src/main/java/com/me/infinity/loop/manager/ScreenManager.java b/src/main/java/com/me/infinity/loop/manager/ScreenManager.java deleted file mode 100644 index 5c19f97..0000000 --- a/src/main/java/com/me/infinity/loop/manager/ScreenManager.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.me.infinity.loop.manager; - -import com.me.infinity.loop.features.gui.InfinityLoopGui; -import com.me.infinity.loop.features.gui.screen.windows.WindowsGui; -import com.me.infinity.loop.mixin.MixinInterface; -import net.minecraft.client.gui.GuiScreen; - -public class ScreenManager implements MixinInterface { - - public static Screen screen = Screen.ClickGui; - - public static void setScreen(GuiScreen guiScreen) { - mc.displayGuiScreen(guiScreen); - if (guiScreen instanceof InfinityLoopGui) - screen = Screen.ClickGui; - //else if (guiScreen instanceof HUD) - //screen = Screen.Hud; - else if (guiScreen instanceof WindowsGui) - screen = Screen.Windows; - - //mc.entityRenderer.loadShader(new ResourceLocation("shaders/post/blur.json")); - } - - public enum Screen { - ClickGui, - Hud, - Windows - } -} diff --git a/src/main/java/com/me/infinity/loop/manager/TimerManager.java b/src/main/java/com/me/infinity/loop/manager/TimerManager.java deleted file mode 100644 index d8dc68e..0000000 --- a/src/main/java/com/me/infinity/loop/manager/TimerManager.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.me.infinity.loop.manager; - -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.features.Feature; -import com.me.infinity.loop.features.modules.movement.TimerSpeed; - -public class TimerManager - extends Feature { - private float timer = 1.0f; - private TimerSpeed module; - - public void init() { - this.module = InfinityLoop.moduleManager.getModuleByClass(TimerSpeed.class); - } - - public void unload() { - this.timer = 1.0f; - TimerManager.mc.timer.tickLength = 50.0f; - } - - public void update() { - if (this.module != null && this.module.isEnabled()) { - this.timer = this.module.speed; - } - TimerManager.mc.timer.tickLength = 50.0f / (this.timer <= 0.0f ? 0.1f : this.timer); - } - - public void setTimer(float timer) { - if (timer > 0.0f) { - this.timer = timer; - } - } - - public float getTimer() { - return this.timer; - } - - @Override - public void reset() { - this.timer = 1.0f; - } -} diff --git a/src/main/java/com/me/infinity/loop/manager/observable/Observable.java b/src/main/java/com/me/infinity/loop/manager/observable/Observable.java deleted file mode 100644 index c4a0ef6..0000000 --- a/src/main/java/com/me/infinity/loop/manager/observable/Observable.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.me.infinity.loop.manager.observable; - -import java.util.LinkedList; -import java.util.List; - -/** - * A generic {@link java.util.Observable}. - * - * @param the type of object Observers will be notified with. - */ -public class Observable -{ - private final List> observers = new LinkedList<>(); - private boolean deactivated; - - /** - * Notifies all observers about a change. - * - * @param value the value to call the observers with. - * @return the given value for convenience. - */ - public T onChange(T value) - { - if (!deactivated) - { - for (Observer observer : observers) - { - observer.onChange(value); - } - } - - return value; - } - - /** - * Adds an Observer if it's not yet added. - * - * @param observer the observer to add. - */ - public void addObserver(Observer observer) - { - if (observer != null && !observers.contains(observer)) - { - observers.add(observer); - } - } - - /** - * Removes the given observer. - * - * @param observer the observer to remove. - */ - public void removeObserver(Observer observer) - { - observers.remove(observer); - } - - public void setObserversDeactivated(boolean deactivated) - { - this.deactivated = deactivated; - } - -} diff --git a/src/main/java/com/me/infinity/loop/manager/observable/Observer.java b/src/main/java/com/me/infinity/loop/manager/observable/Observer.java deleted file mode 100644 index e3e80c3..0000000 --- a/src/main/java/com/me/infinity/loop/manager/observable/Observer.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.me.infinity.loop.manager.observable; - -public interface Observer -{ - /** - * Should be called by the {@link Observable} this - * Observer is registered in. Notifies this Observer - * about a value change. - * - * @param value the value. - */ - void onChange(T value); - -} diff --git a/src/main/java/com/me/infinity/loop/mixin/MixinInterface.java b/src/main/java/com/me/infinity/loop/mixin/MixinInterface.java deleted file mode 100644 index 14760ff..0000000 --- a/src/main/java/com/me/infinity/loop/mixin/MixinInterface.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.me.infinity.loop.mixin; - -import net.minecraft.client.Minecraft; - -public interface MixinInterface { - - /* - * Generic mixin interface for anything in mixins (or anywhere) that - * you might want to access statically. - * - * This was intended to only be used for mixins but I basically use it - * everywhere else. - */ - - Minecraft mc = Minecraft.getMinecraft(); - boolean nullCheck = (mc.player == null || mc.world == null); -} diff --git a/src/main/java/com/me/infinity/loop/mixin/mixins/IEntityRenderer.java b/src/main/java/com/me/infinity/loop/mixin/mixins/IEntityRenderer.java deleted file mode 100644 index 38f42cd..0000000 --- a/src/main/java/com/me/infinity/loop/mixin/mixins/IEntityRenderer.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.me.infinity.loop.mixin.mixins; - -import net.minecraft.client.renderer.EntityRenderer; -import net.minecraft.client.renderer.texture.DynamicTexture; -import net.minecraft.entity.EntityLivingBase; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; -import org.spongepowered.asm.mixin.gen.Invoker; - -@Mixin(value={EntityRenderer.class}) -public interface IEntityRenderer { - @Invoker(value="orientCamera") - public void orientCam(float var1); - - @Invoker(value="applyBobbing") - public void viewBob(float var1); - - @Accessor(value="lightmapColors") - public int[] getLightmapColors(); - - @Accessor(value="lightmapTexture") - public DynamicTexture getLightmapTexture(); - - @Accessor(value="torchFlickerX") - public float getTorchFlickerX(); - - @Accessor(value="bossColorModifier") - public float getBossColorModifier(); - - @Accessor(value="bossColorModifierPrev") - public float getBossColorModifierPrev(); - - @Invoker(value="getNightVisionBrightness") - public float invokeGetNightVisionBrightness(EntityLivingBase var1, float var2); - - @Invoker(value="setupCameraTransform") - public void invokeSetupCameraTransform(float var1, int var2); - - - @Accessor("rendererUpdateCount") - int getRendererUpdateCount(); - - @Accessor("rainXCoords") - float[] getRainXCoords(); - - @Accessor("rainYCoords") - float[] getRainYCoords(); - - - -} diff --git a/src/main/java/com/me/infinity/loop/mixin/mixins/IRenderManager.java b/src/main/java/com/me/infinity/loop/mixin/mixins/IRenderManager.java deleted file mode 100644 index 2cf951c..0000000 --- a/src/main/java/com/me/infinity/loop/mixin/mixins/IRenderManager.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.me.infinity.loop.mixin.mixins; - -import net.minecraft.client.renderer.entity.RenderManager; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -@Mixin(RenderManager.class) -public interface IRenderManager { - - @Accessor(value = "renderPosX") - double getRenderPosX(); - - @Accessor(value = "renderPosY") - double getRenderPosY(); - - @Accessor(value = "renderPosZ") - double getRenderPosZ(); - -} diff --git a/src/main/java/com/me/infinity/loop/mixin/mixins/MixinBlockLiquid.java b/src/main/java/com/me/infinity/loop/mixin/mixins/MixinBlockLiquid.java deleted file mode 100644 index 8fc88f8..0000000 --- a/src/main/java/com/me/infinity/loop/mixin/mixins/MixinBlockLiquid.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.me.infinity.loop.mixin.mixins; - -import com.me.infinity.loop.features.modules.player.LiquidInteract; -import net.minecraft.block.Block; -import net.minecraft.block.BlockLiquid; -import net.minecraft.block.material.Material; -import net.minecraft.block.properties.IProperty; -import net.minecraft.block.state.IBlockState; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -@Mixin(value = {BlockLiquid.class}) -public class MixinBlockLiquid - extends Block { - protected MixinBlockLiquid(Material materialIn) { - super(materialIn); - } - - @Inject(method = {"canCollideCheck"}, at = {@At(value = "HEAD")}, cancellable = true) - public void canCollideCheckHook(IBlockState blockState, boolean hitIfLiquid, CallbackInfoReturnable info) { - info.setReturnValue(hitIfLiquid && (Integer) blockState.getValue((IProperty) BlockLiquid.LEVEL) == 0 || LiquidInteract.getInstance().isOn()); - } -} - diff --git a/src/main/java/com/me/infinity/loop/mixin/mixins/MixinEntityLivingBase.java b/src/main/java/com/me/infinity/loop/mixin/mixins/MixinEntityLivingBase.java deleted file mode 100644 index 4bacba4..0000000 --- a/src/main/java/com/me/infinity/loop/mixin/mixins/MixinEntityLivingBase.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.me.infinity.loop.mixin.mixins; - -import com.me.infinity.loop.features.modules.render.Animation; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.init.MobEffects; -import net.minecraft.potion.Potion; -import net.minecraft.potion.PotionEffect; -import net.minecraft.world.World; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -import javax.annotation.Nullable; - -@Mixin(value={EntityLivingBase.class}) -public abstract class MixinEntityLivingBase - extends Entity { - @Shadow public abstract boolean isPotionActive(Potion potionIn); - - @Shadow @Nullable public abstract PotionEffect getActivePotionEffect(Potion potionIn); - - public MixinEntityLivingBase(World worldIn) { - super(worldIn); - } - - @Inject(method = "getArmSwingAnimationEnd", at = @At("HEAD"), cancellable = true) - private void yesido(CallbackInfoReturnable cir) { - if(Animation.getInstance().isEnabled() && Animation.getInstance().swing.getValue()) { - if(isPotionActive(MobEffects.HASTE)) cir.setReturnValue(Animation.getInstance().speed.getValue() - (getActivePotionEffect(MobEffects.HASTE).getAmplifier())); - else cir.setReturnValue(isPotionActive(MobEffects.MINING_FATIGUE) ? Animation.getInstance().speed.getValue() + (getActivePotionEffect(MobEffects.MINING_FATIGUE).getAmplifier() + 1) * 2 : Animation.getInstance().speed.getValue()); - } - } -} \ No newline at end of file diff --git a/src/main/java/com/me/infinity/loop/mixin/mixins/MixinEntityRenderer.java b/src/main/java/com/me/infinity/loop/mixin/mixins/MixinEntityRenderer.java deleted file mode 100644 index a9d5d72..0000000 --- a/src/main/java/com/me/infinity/loop/mixin/mixins/MixinEntityRenderer.java +++ /dev/null @@ -1,109 +0,0 @@ -package com.me.infinity.loop.mixin.mixins; - -import com.me.infinity.loop.event.events.render.PerspectiveEvent; -import com.me.infinity.loop.features.modules.client.GameChanger; -import com.me.infinity.loop.features.modules.misc.BlockTweaks; -import com.me.infinity.loop.features.modules.render.CameraClip; -import net.minecraft.client.Minecraft; -import net.minecraft.client.multiplayer.WorldClient; -import net.minecraft.client.renderer.EntityRenderer; -import net.minecraft.entity.Entity; -import net.minecraft.item.ItemPickaxe; -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraftforge.common.MinecraftForge; -import org.lwjgl.util.glu.Project; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.ModifyVariable; -import org.spongepowered.asm.mixin.injection.Redirect; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -import javax.vecmath.Vector3f; -import java.awt.*; -import java.util.ArrayList; -import java.util.List; - - -@Mixin(value = EntityRenderer.class, priority = 1001) -public class MixinEntityRenderer { - private boolean injection = true; - @Shadow - public ItemStack itemActivationItem; - @Shadow - @Final - public int[] lightmapColors; - Minecraft mc = Minecraft.getMinecraft(); - - @Inject(method = "updateLightmap", at = @At( value = "INVOKE", target = "Lnet/minecraft/client/renderer/texture/DynamicTexture;updateDynamicTexture()V", shift = At.Shift.BEFORE )) - private void updateTextureHook(float partialTicks, CallbackInfo ci) { - if (GameChanger.getInstance().isEnabled() && GameChanger.getInstance().customAmbience.getValue()) { - for (int i = 0; i < this.lightmapColors.length; ++i) { - Color ambientColor = new Color(GameChanger.getInstance().ambienceRed.getValue(),GameChanger.getInstance().ambienceGreen.getValue(), GameChanger.getInstance().ambienceBlue.getValue(), GameChanger.getInstance().ambienceAlpha.getValue()); - int alpha = ambientColor.getAlpha(); - float modifier = ( float ) alpha / 255.0f; - int color = this.lightmapColors[ i ]; - int[] bgr = toRGBAArray(color); - Vector3f values = new Vector3f(( float ) bgr[ 2 ] / 255.0f, ( float ) bgr[ 1 ] / 255.0f, ( float ) bgr[ 0 ] / 255.0f); - Vector3f newValues = new Vector3f(( float ) ambientColor.getRed() / 255.0f, ( float ) ambientColor.getGreen() / 255.0f, ( float ) ambientColor.getBlue() / 255.0f); - Vector3f finalValues = mix(values, newValues, modifier); - int red = ( int ) (finalValues.x * 255.0f); - int green = ( int ) (finalValues.y * 255.0f); - int blue = ( int ) (finalValues.z * 255.0f); - this.lightmapColors[ i ] = 0xFF000000 | red << 16 | green << 8 | blue; - } - } - } - - @ModifyVariable(method={"orientCamera"}, ordinal=3, at=@At(value="STORE", ordinal=0), require=1) - public double changeCameraDistanceHook(double range) { - return CameraClip.getInstance().isEnabled() && CameraClip.getInstance().extend.getValue() != false ? CameraClip.getInstance().distance.getValue() : range; - } - - @ModifyVariable(method={"orientCamera"}, ordinal=7, at=@At(value="STORE", ordinal=0), require=1) - public double orientCameraHook(double range) { - return CameraClip.getInstance().isEnabled() && CameraClip.getInstance().extend.getValue() != false ? CameraClip.getInstance().distance.getValue() : (CameraClip.getInstance().isEnabled() && CameraClip.getInstance().extend.getValue() == false ? 4.0 : range); - } - - private int[] toRGBAArray(int colorBuffer) { - return new int[] { colorBuffer >> 16 & 0xFF, colorBuffer >> 8 & 0xFF, colorBuffer & 0xFF }; - } - - private Vector3f mix(Vector3f first, Vector3f second, float factor) { - return new Vector3f(first.x * (1.0f - factor) + second.x * factor, first.y * (1.0f - factor) + second.y * factor, first.z * (1.0f - factor) + first.z * factor); - } - - @Redirect(method = "setupCameraTransform", at = @At(value = "INVOKE", target = "Lorg/lwjgl/util/glu/Project;gluPerspective(FFFF)V")) - private void onSetupCameraTransform(float fovy, float aspect, float zNear, float zFar) { - PerspectiveEvent event = new PerspectiveEvent((float) this.mc.displayWidth / (float) this.mc.displayHeight); - MinecraftForge.EVENT_BUS.post(event); - Project.gluPerspective(fovy, event.getAspect(), zNear, zFar); - } - - @Redirect(method = {"getMouseOver"}, at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/WorldClient;getEntitiesInAABBexcluding(Lnet/minecraft/entity/Entity;Lnet/minecraft/util/math/AxisAlignedBB;Lcom/google/common/base/Predicate;)Ljava/util/List;")) - public List getEntitiesInAABBexcludingHook(WorldClient worldClient, Entity entityIn, AxisAlignedBB boundingBox, com.google.common.base.Predicate predicate) { - if (BlockTweaks.getINSTANCE().isOn() && (!BlockTweaks.getINSTANCE().pickaxe.getValue() || this.mc.player.getHeldItemMainhand().getItem() instanceof ItemPickaxe)) { - return new ArrayList<>(); - } - return worldClient.getEntitiesInAABBexcluding(entityIn, boundingBox, predicate); - } - - @Redirect(method = "renderWorldPass", at = @At(value = "INVOKE", target = "Lorg/lwjgl/util/glu/Project;gluPerspective(FFFF)V")) - private void onRenderWorldPass(float fovy, float aspect, float zNear, float zFar) { - PerspectiveEvent event = new PerspectiveEvent((float) this.mc.displayWidth / (float) this.mc.displayHeight); - MinecraftForge.EVENT_BUS.post(event); - Project.gluPerspective(fovy, event.getAspect(), zNear, zFar); - } - - @Redirect(method = "renderCloudsCheck", at = @At(value = "INVOKE", target = "Lorg/lwjgl/util/glu/Project;gluPerspective(FFFF)V")) - private void onRenderCloudsCheck(float fovy, float aspect, float zNear, float zFar) { - PerspectiveEvent event = new PerspectiveEvent((float) this.mc.displayWidth / (float) this.mc.displayHeight); - MinecraftForge.EVENT_BUS.post(event); - Project.gluPerspective(fovy, event.getAspect(), zNear, zFar); - } - -} - diff --git a/src/main/java/com/me/infinity/loop/mixin/mixins/MixinGuiInventory.java b/src/main/java/com/me/infinity/loop/mixin/mixins/MixinGuiInventory.java deleted file mode 100644 index 413a4b7..0000000 --- a/src/main/java/com/me/infinity/loop/mixin/mixins/MixinGuiInventory.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.me.infinity.loop.mixin.mixins; - -import com.me.infinity.loop.util.utils.renders.RenderUtil; -import com.mojang.realmsclient.gui.ChatFormatting; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.gui.inventory.GuiInventory; -import net.minecraft.entity.EntityLivingBase; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.ModifyArg; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - - -@Mixin(GuiInventory.class) -public class MixinGuiInventory extends MixinGuiScreen { - - private static float prevRotationYaw = 0.0F; - private static float prevRotationPitch = 0.0F; - private static float prevRenderYawOffset = 0.0F; - - private static FontRenderer fr = Minecraft.getMinecraft().fontRenderer; - - private static void drawString(String text, int x, int y, int color) { - fr.drawString(text, x, y, color, true); - } - - private static int getStringWidth(String text) { - return fr.getStringWidth(text); - } - - private static int getFontHeight() { - return fr.FONT_HEIGHT; - } - - @Inject(method={"initGui"}, at={@At(value="RETURN")}) - private void initGui(CallbackInfo ci) { - this.buttonList.add(new GuiButton(998, this.width - 150, 6, 25, 25, ChatFormatting.BOLD + "S")); - } - - @Inject(method={"drawScreen"}, at={@At(value="RETURN")}) - private void drawScreen(int mouseX, int mouseY, float partialTicks, CallbackInfo ci) { - drawString("Profile", this.width - 150, 30, -1); - } - - @Inject(method = "drawEntityOnScreen", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/entity/RenderManager;renderEntity(Lnet/minecraft/entity/Entity;DDDFFZ)V", shift = At.Shift.BEFORE)) - private static void onDrawEntityOnScreenInvokeRenderEntityPre(int posX, int posY, int scale, float mouseX, float mouseY, EntityLivingBase entity, CallbackInfo ci) { - prevRotationYaw = entity.prevRotationYaw; - prevRotationPitch = entity.prevRotationPitch; - prevRenderYawOffset = entity.prevRenderYawOffset; - - entity.prevRotationYaw = entity.rotationYaw; - entity.prevRotationPitch = entity.rotationPitch; - entity.prevRenderYawOffset = entity.renderYawOffset; - } - - @ModifyArg(method = "drawEntityOnScreen", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/entity/RenderManager;renderEntity(Lnet/minecraft/entity/Entity;DDDFFZ)V"), index = 5) - private static float onDrawEntityOnScreenInvokeRenderEntityPartialTicks(float partialTicks) { - return RenderUtil.mc.getRenderPartialTicks(); - } - - @Inject(method = "drawEntityOnScreen", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/entity/RenderManager;renderEntity(Lnet/minecraft/entity/Entity;DDDFFZ)V", shift = At.Shift.AFTER)) - private static void onRenderEntityOnScreenPost(int posX, int posY, int scale, float mouseX, float mouseY, EntityLivingBase entity, CallbackInfo ci) { - entity.prevRotationYaw = prevRotationYaw; - entity.prevRotationPitch = prevRotationPitch; - entity.prevRenderYawOffset = prevRenderYawOffset; - } - - - /*@Redirect(method = "drawScreen", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/inventory/GuiInventory;drawDefaultBackground()V")) - public void drawDefaultBackground(GuiInventory guiInventory) { - - }*/ -} - diff --git a/src/main/java/com/me/infinity/loop/mixin/mixins/MixinGuiMainMenu.java b/src/main/java/com/me/infinity/loop/mixin/mixins/MixinGuiMainMenu.java deleted file mode 100644 index 6aed3b9..0000000 --- a/src/main/java/com/me/infinity/loop/mixin/mixins/MixinGuiMainMenu.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.me.infinity.loop.mixin.mixins; - -import net.minecraft.client.gui.GuiMainMenu; -import net.minecraft.client.gui.GuiScreen; -import org.spongepowered.asm.mixin.Mixin; - -@Mixin( GuiMainMenu.class ) -public class MixinGuiMainMenu extends GuiScreen -{ - -} \ No newline at end of file diff --git a/src/main/java/com/me/infinity/loop/mixin/mixins/MixinGuiPlayerTabOverlay.java b/src/main/java/com/me/infinity/loop/mixin/mixins/MixinGuiPlayerTabOverlay.java deleted file mode 100644 index fb21e1f..0000000 --- a/src/main/java/com/me/infinity/loop/mixin/mixins/MixinGuiPlayerTabOverlay.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.me.infinity.loop.mixin.mixins; - -import com.me.infinity.loop.features.modules.misc.ExtraTab; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.GuiPlayerTabOverlay; -import net.minecraft.client.network.NetworkPlayerInfo; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.Redirect; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -import java.util.List; - -@Mixin({GuiPlayerTabOverlay.class}) -public class MixinGuiPlayerTabOverlay extends Gui { - @Redirect(method = {"renderPlayerlist"}, at = @At(value = "INVOKE", target = "Ljava/util/List;subList(II)Ljava/util/List;")) - public List subListHook(List list, int fromIndex, int toIndex) { - return list.subList(fromIndex, ExtraTab.getINSTANCE().isEnabled() ? Math.min((ExtraTab.getINSTANCE()).size.getValue().intValue(), list.size()) : toIndex); - } - - @Inject(method = {"getPlayerName"}, at = {@At("HEAD")}, cancellable = true) - public void getPlayerNameHook(NetworkPlayerInfo networkPlayerInfoIn, CallbackInfoReturnable info) { - if (ExtraTab.getINSTANCE().isEnabled()) - info.setReturnValue(ExtraTab.getPlayerName(networkPlayerInfoIn)); - } -} diff --git a/src/main/java/com/me/infinity/loop/mixin/mixins/MixinKeyBinding.java b/src/main/java/com/me/infinity/loop/mixin/mixins/MixinKeyBinding.java deleted file mode 100644 index 141c71b..0000000 --- a/src/main/java/com/me/infinity/loop/mixin/mixins/MixinKeyBinding.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.me.infinity.loop.mixin.mixins; - -import com.me.infinity.loop.event.events.player.EventKey; -import net.minecraft.client.settings.KeyBinding; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.fml.common.eventhandler.Event; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -@Mixin(value={KeyBinding.class}) -public class MixinKeyBinding { - @Shadow - private boolean pressed; - - @Inject(method={"isKeyDown"}, at={@At(value="RETURN")}, cancellable=true) - private void isKeyDown(CallbackInfoReturnable info) { - EventKey event = new EventKey(info.getReturnValue(), this.pressed); - MinecraftForge.EVENT_BUS.post((Event)event); - info.setReturnValue(event.info); - } -} diff --git a/src/main/java/com/me/infinity/loop/mixin/mixins/MixinMinecraft.java b/src/main/java/com/me/infinity/loop/mixin/mixins/MixinMinecraft.java deleted file mode 100644 index 9788aee..0000000 --- a/src/main/java/com/me/infinity/loop/mixin/mixins/MixinMinecraft.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.me.infinity.loop.mixin.mixins; - -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.features.gui.mainmenu.InfinityLoopMenu; -import com.me.infinity.loop.features.modules.client.MainSettings; -import com.me.infinity.loop.features.modules.player.MultiTask; -import com.me.infinity.loop.util.utils.minecraft.IMinecraft; -import com.me.infinity.loop.util.utils.renders.RenderUtil; -import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.EntityPlayerSP; -import net.minecraft.client.gui.GuiMainMenu; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.multiplayer.PlayerControllerMP; -import net.minecraft.crash.CrashReport; -import org.lwjgl.Sys; -import org.lwjgl.opengl.Display; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.Redirect; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -import javax.annotation.Nullable; - -import static com.me.infinity.loop.util.utils.Util.mc; - -@Mixin(value = {Minecraft.class}) -public abstract class MixinMinecraft implements IMinecraft { - @Shadow - @Nullable - public GuiScreen currentScreen; - - private long lastFrame = this.getTime(); - - public long getTime() { - return Sys.getTime() * 1000L / Sys.getTimerResolution(); - } - - @Shadow - public abstract void displayGuiScreen(@Nullable GuiScreen var1); - - @Inject(method = {"shutdownMinecraftApplet"}, at = {@At(value = "HEAD")}) - private void stopClient(CallbackInfo callbackInfo) { - this.unload(); - } - - @Redirect(method = {"run"}, at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;displayCrashReport(Lnet/minecraft/crash/CrashReport;)V")) - public void displayCrashReport(Minecraft minecraft, CrashReport crashReport) { - this.unload(); - } - - private void unload() { - InfinityLoop.LOGGER.info("Initiated client shutdown!"); - InfinityLoop.unload(false); - InfinityLoop.LOGGER.info("Finished client shutdown!"); - } - - @Redirect(method = {"sendClickBlockToController"}, at = @At(value = "INVOKE", target = "Lnet/minecraft/client/entity/EntityPlayerSP;isHandActive()Z")) - private boolean isHandActiveWrapper(EntityPlayerSP playerSP) { - return !MultiTask.getInstance().isOn() && playerSP.isHandActive(); - } - - @Redirect(method = {"rightClickMouse"}, at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/PlayerControllerMP;getIsHittingBlock()Z", ordinal = 0)) - private boolean isHittingBlockHook(PlayerControllerMP playerControllerMP) { - return !MultiTask.getInstance().isOn() && playerControllerMP.getIsHittingBlock(); - } - @Inject(method={"runTick()V"}, at={@At(value="RETURN")}) - private void runTick(CallbackInfo callbackInfo) { - if (Minecraft.getMinecraft().currentScreen instanceof GuiMainMenu && InfinityLoop.moduleManager != null && InfinityLoop.moduleManager.getModuleByClass(MainSettings.class).mainMenu.getValue()) { - Minecraft.getMinecraft().displayGuiScreen(new InfinityLoopMenu()); - } - } - - @Inject(method={"runGameLoop"}, at={@At(value="HEAD")}) - private void onRunGameLoopPre(CallbackInfo ci) { - long currentTime = this.getTime(); - int deltaTime = (int)(currentTime - this.lastFrame); - this.lastFrame = currentTime; - RenderUtil.deltaTime = deltaTime; - } - - @Inject(method={"displayGuiScreen"}, at={@At(value="HEAD")}) - private void displayGuiScreenHook(GuiScreen screen, CallbackInfo ci) { - if (screen instanceof GuiMainMenu && InfinityLoop.moduleManager != null && InfinityLoop.moduleManager.getModuleByClass(MainSettings.class).mainMenu.getValue()) { - mc.displayGuiScreen(new InfinityLoopMenu()); - } - } - - @Redirect(method={"createDisplay"}, at=@At(value="INVOKE", target="Lorg/lwjgl/opengl/Display;setTitle(Ljava/lang/String;)V")) - private void createDisplay(String title) { - Display.setTitle((String)"InfinityLoop | There is no infinity here"); - } - -} - diff --git a/src/main/java/com/me/infinity/loop/mixin/mixins/MixinNetworkManager.java b/src/main/java/com/me/infinity/loop/mixin/mixins/MixinNetworkManager.java deleted file mode 100644 index 5de7af6..0000000 --- a/src/main/java/com/me/infinity/loop/mixin/mixins/MixinNetworkManager.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.me.infinity.loop.mixin.mixins; - -import com.me.infinity.loop.event.Event; -import com.me.infinity.loop.event.events.network.EventPacket; -import io.netty.channel.ChannelHandlerContext; -import net.minecraft.network.NetworkManager; -import net.minecraft.network.Packet; -import net.minecraftforge.common.MinecraftForge; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Mixin(value = {NetworkManager.class}) -public class MixinNetworkManager { - @Inject(method={"sendPacket(Lnet/minecraft/network/Packet;)V"}, at={@At(value="HEAD")}, cancellable=true) - private void onSendPacket(Packet packet, CallbackInfo callbackInfo) { - EventPacket.Send event = new EventPacket.Send(Event.Stage.PRE, packet); - MinecraftForge.EVENT_BUS.post((Event)event); - if (event.isCancelled()) { - callbackInfo.cancel(); - } - } - - @Inject(method={"channelRead0"}, at={@At(value="HEAD")}, cancellable=true) - private void onReceivePacket(ChannelHandlerContext channelHandlerContext, Packet packet, CallbackInfo callbackInfo) { - EventPacket.Receive event = new EventPacket.Receive(Event.Stage.POST, packet); - MinecraftForge.EVENT_BUS.post((Event)event); - if (event.isCancelled()) { - callbackInfo.cancel(); - } - } -} - diff --git a/src/main/java/com/me/infinity/loop/mixin/mixins/MixinPlayerControllerMP.java b/src/main/java/com/me/infinity/loop/mixin/mixins/MixinPlayerControllerMP.java deleted file mode 100644 index 6beca93..0000000 --- a/src/main/java/com/me/infinity/loop/mixin/mixins/MixinPlayerControllerMP.java +++ /dev/null @@ -1,87 +0,0 @@ -package com.me.infinity.loop.mixin.mixins; - -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.event.Event; -import com.me.infinity.loop.event.events.player.ProcessRightClickBlockEvent; -import com.me.infinity.loop.event.events.world.EventBlock; -import com.me.infinity.loop.event.events.world.EventClickBlock; -import com.me.infinity.loop.features.modules.misc.BlockTweaks; -import com.me.infinity.loop.features.modules.player.TpsSync; -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.EntityPlayerSP; -import net.minecraft.client.multiplayer.PlayerControllerMP; -import net.minecraft.client.multiplayer.WorldClient; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumActionResult; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; -import net.minecraftforge.common.MinecraftForge; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.Redirect; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -@Mixin(value = {PlayerControllerMP.class}) -public class MixinPlayerControllerMP { - - @Redirect(method = {"onPlayerDamageBlock"}, at = @At(value = "INVOKE", target = "Lnet/minecraft/block/state/IBlockState;getPlayerRelativeBlockHardness(Lnet/minecraft/entity/player/EntityPlayer;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;)F")) - public float getPlayerRelativeBlockHardnessHook(IBlockState state, EntityPlayer player, World worldIn, BlockPos pos) { - return state.getPlayerRelativeBlockHardness(player, worldIn, pos) * (TpsSync.getInstance().isOn() && TpsSync.getInstance().mining.getValue() ? 1.0f / InfinityLoop.serverManager.getTpsFactor() : 1.0f); - } - - @Inject(method={"clickBlock"}, at={@At(value="HEAD")}, cancellable=true) - private void clickBlockHook(BlockPos pos, EnumFacing face, CallbackInfoReturnable info) { - EventClickBlock event = new EventClickBlock(pos, face); - MinecraftForge.EVENT_BUS.post((Event)event); - } - - @Inject(method={"onPlayerDamageBlock"}, at={@At(value="HEAD")}, cancellable=true) - private void onPlayerDamageBlockHook(BlockPos pos, EnumFacing face, CallbackInfoReturnable info) { - EventBlock event = new EventBlock(pos, face); - MinecraftForge.EVENT_BUS.post((Event)event); - if (event.isCancelled()) { - info.cancel(); - } - } - - @Redirect(method={"processRightClickBlock"}, at=@At(value="INVOKE", target="Lnet/minecraft/item/ItemBlock;canPlaceBlockOnSide(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/EnumFacing;Lnet/minecraft/entity/player/EntityPlayer;Lnet/minecraft/item/ItemStack;)Z")) - public boolean canPlaceBlockOnSideHook(ItemBlock itemBlock, World worldIn, BlockPos pos, EnumFacing side, EntityPlayer player, ItemStack stack) { - Block block = worldIn.getBlockState(pos).getBlock(); - if (block == Blocks.SNOW_LAYER && block.isReplaceable(worldIn, pos)) { - side = EnumFacing.UP; - } else if (!block.isReplaceable(worldIn, pos)) { - pos = pos.offset(side); - } - IBlockState iblockstate1 = worldIn.getBlockState(pos); - AxisAlignedBB axisalignedbb = itemBlock.block.getDefaultState().getCollisionBoundingBox(worldIn, pos); - if (axisalignedbb != Block.NULL_AABB && !worldIn.checkNoEntityCollision(axisalignedbb.offset(pos), null)) { - if (BlockTweaks.getINSTANCE().isOff() || !BlockTweaks.getINSTANCE().pickaxe.getValue().booleanValue()) { - return false; - } - } else if (iblockstate1.getMaterial() == Material.CIRCUITS && itemBlock.block == Blocks.ANVIL) { - return true; - } - return iblockstate1.getBlock().isReplaceable(worldIn, pos) && itemBlock.block.canPlaceBlockOnSide(worldIn, pos, side); - } - - @Inject(method = {"processRightClickBlock"}, at = {@At(value = "HEAD")}, cancellable = true) - public void processRightClickBlock(EntityPlayerSP player, WorldClient worldIn, BlockPos pos, EnumFacing direction, Vec3d vec, EnumHand hand, CallbackInfoReturnable cir) { - ProcessRightClickBlockEvent event = new ProcessRightClickBlockEvent(pos, hand, Minecraft.instance.player.getHeldItem(hand)); - MinecraftForge.EVENT_BUS.post(event); - if (event.isCanceled()) { - cir.cancel(); - } - } -} - diff --git a/src/main/java/com/me/infinity/loop/mixin/mixins/MixinRenderEnderCrystal.java b/src/main/java/com/me/infinity/loop/mixin/mixins/MixinRenderEnderCrystal.java deleted file mode 100644 index 9eb8fe9..0000000 --- a/src/main/java/com/me/infinity/loop/mixin/mixins/MixinRenderEnderCrystal.java +++ /dev/null @@ -1,114 +0,0 @@ -package com.me.infinity.loop.mixin.mixins; - -import com.me.infinity.loop.features.modules.client.ClickGui.ClickGui; -import com.me.infinity.loop.features.modules.client.Colors; -import com.me.infinity.loop.features.modules.render.Wireframe; -import com.me.infinity.loop.util.utils.renders.ColorUtil; -import net.minecraft.client.model.ModelBase; -import net.minecraft.client.model.ModelEnderCrystal; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.entity.Render; -import net.minecraft.client.renderer.entity.RenderDragon; -import net.minecraft.client.renderer.entity.RenderEnderCrystal; -import net.minecraft.client.renderer.entity.RenderManager; -import net.minecraft.entity.item.EntityEnderCrystal; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.MathHelper; -import org.lwjgl.opengl.GL11; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Overwrite; -import org.spongepowered.asm.mixin.Shadow; - -import javax.annotation.Nullable; - -@Mixin({RenderEnderCrystal.class}) -public class MixinRenderEnderCrystal extends Render { - @Shadow - private static final ResourceLocation ENDER_CRYSTAL_TEXTURES = new ResourceLocation("textures/entity/endercrystal/endercrystal.png"); - - @Shadow - private final ModelBase modelEnderCrystal = new ModelEnderCrystal(0.0F, true); - - @Shadow - private final ModelBase modelEnderCrystalNoBase = new ModelEnderCrystal(0.0F, false); - - protected MixinRenderEnderCrystal(RenderManager renderManager) { - super(renderManager); - } - - /** - * @author dont know - * @reason who know - */ - @Overwrite - public void doRender(EntityEnderCrystal entity, double x, double y, double z, float entityYaw, float partialTicks) { - float f = entity.innerRotation + partialTicks; - GlStateManager.pushMatrix(); - GlStateManager.translate((float) x, (float) y, (float) z); - bindTexture(ENDER_CRYSTAL_TEXTURES); - float f1 = MathHelper.sin(f * 0.2F) / 2.0F + 0.5F; - f1 += f1 * f1; - if (this.renderOutlines) { - GlStateManager.enableColorMaterial(); - GlStateManager.enableOutlineMode(getTeamColor(entity)); - } - if (Wireframe.getINSTANCE().isOn() && (Wireframe.getINSTANCE()).crystals.getValue().booleanValue()) { - float red = (ClickGui.getInstance()).red.getValue().intValue() / 255.0F; - float green = (ClickGui.getInstance()).green.getValue().intValue() / 255.0F; - float blue = (ClickGui.getInstance()).blue.getValue().intValue() / 255.0F; - if ((Wireframe.getINSTANCE()).cMode.getValue().equals(Wireframe.RenderMode.WIREFRAME) && (Wireframe.getINSTANCE()).crystalModel.getValue().booleanValue()) - this.modelEnderCrystalNoBase.render(entity, 0.0F, f * 3.0F, f1 * 0.2F, 0.0F, 0.0F, 0.0625F); - GlStateManager.pushMatrix(); - GL11.glPushAttrib(1048575); - if ((Wireframe.getINSTANCE()).cMode.getValue().equals(Wireframe.RenderMode.WIREFRAME)) - GL11.glPolygonMode(1032, 6913); - GL11.glDisable(3553); - GL11.glDisable(2896); - if ((Wireframe.getINSTANCE()).cMode.getValue().equals(Wireframe.RenderMode.WIREFRAME)) - GL11.glEnable(2848); - GL11.glEnable(3042); - GL11.glBlendFunc(770, 771); - GL11.glDisable(2929); - GL11.glDepthMask(false); - GL11.glColor4f((Colors.getInstance()).rainbow.getValue().booleanValue() ? (ColorUtil.rainbow((Colors.getInstance()).rainbowHue.getValue().intValue()).getRed() / 255.0F) : red, (Colors.getInstance()).rainbow.getValue().booleanValue() ? (ColorUtil.rainbow((Colors.getInstance()).rainbowHue.getValue().intValue()).getGreen() / 255.0F) : green, (Colors.getInstance()).rainbow.getValue().booleanValue() ? (ColorUtil.rainbow((Colors.getInstance()).rainbowHue.getValue().intValue()).getBlue() / 255.0F) : blue, (Wireframe.getINSTANCE()).cAlpha.getValue().floatValue() / 255.0F); - if ((Wireframe.getINSTANCE()).cMode.getValue().equals(Wireframe.RenderMode.WIREFRAME)) - GL11.glLineWidth((Wireframe.getINSTANCE()).crystalLineWidth.getValue().floatValue()); - this.modelEnderCrystalNoBase.render(entity, 0.0F, f * 3.0F, f1 * 0.2F, 0.0F, 0.0F, 0.0625F); - GL11.glDisable(2896); - GL11.glEnable(2929); - GL11.glDepthMask(true); - GL11.glColor4f((Colors.getInstance()).rainbow.getValue().booleanValue() ? (ColorUtil.rainbow((Colors.getInstance()).rainbowHue.getValue().intValue()).getRed() / 255.0F) : red, (Colors.getInstance()).rainbow.getValue().booleanValue() ? (ColorUtil.rainbow((Colors.getInstance()).rainbowHue.getValue().intValue()).getGreen() / 255.0F) : green, (Colors.getInstance()).rainbow.getValue().booleanValue() ? (ColorUtil.rainbow((Colors.getInstance()).rainbowHue.getValue().intValue()).getBlue() / 255.0F) : blue, (Wireframe.getINSTANCE()).cAlpha.getValue().floatValue() / 255.0F); - if ((Wireframe.getINSTANCE()).cMode.getValue().equals(Wireframe.RenderMode.WIREFRAME)) - GL11.glLineWidth((Wireframe.getINSTANCE()).crystalLineWidth.getValue().floatValue()); - this.modelEnderCrystalNoBase.render(entity, 0.0F, f * 3.0F, f1 * 0.2F, 0.0F, 0.0F, 0.0625F); - GlStateManager.enableDepth(); - GlStateManager.popAttrib(); - GlStateManager.popMatrix(); - } else { - this.modelEnderCrystalNoBase.render(entity, 0.0F, f * 3.0F, f1 * 0.2F, 0.0F, 0.0F, 0.0625F); - } - if (this.renderOutlines) { - GlStateManager.disableOutlineMode(); - GlStateManager.disableColorMaterial(); - } - GlStateManager.popMatrix(); - BlockPos blockpos = entity.getBeamTarget(); - if (blockpos != null) { - bindTexture(RenderDragon.ENDERCRYSTAL_BEAM_TEXTURES); - float f2 = blockpos.getX() + 0.5F; - float f3 = blockpos.getY() + 0.5F; - float f4 = blockpos.getZ() + 0.5F; - double d0 = f2 - entity.posX; - double d1 = f3 - entity.posY; - double d2 = f4 - entity.posZ; - RenderDragon.renderCrystalBeams(x + d0, y - 0.3D + (f1 * 0.4F) + d1, z + d2, partialTicks, f2, f3, f4, entity.innerRotation, entity.posX, entity.posY, entity.posZ); - } - super.doRender(entity, x, y, z, entityYaw, partialTicks); - } - - @Nullable - protected ResourceLocation getEntityTexture(EntityEnderCrystal entityEnderCrystal) { - return null; - } -} diff --git a/src/main/java/com/me/infinity/loop/mixin/mixins/MixinRenderEntityItem.java b/src/main/java/com/me/infinity/loop/mixin/mixins/MixinRenderEntityItem.java deleted file mode 100644 index 7b84f45..0000000 --- a/src/main/java/com/me/infinity/loop/mixin/mixins/MixinRenderEntityItem.java +++ /dev/null @@ -1,326 +0,0 @@ -package com.me.infinity.loop.mixin.mixins; - -import com.me.infinity.loop.features.modules.render.ItemPhysics; -import net.minecraft.block.material.Material; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.client.renderer.RenderItem; -import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.client.renderer.block.model.ItemCameraTransforms; -import net.minecraft.client.renderer.entity.RenderEntityItem; -import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.MathHelper; -import org.lwjgl.opengl.GL11; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Overwrite; -import org.spongepowered.asm.mixin.Shadow; - -import java.util.Random; - -@Mixin(RenderEntityItem.class) -public abstract class MixinRenderEntityItem extends MixinRenderer{ - @Shadow - @Final - private RenderItem itemRenderer; - @Shadow - @Final - private Random random; - - @Shadow - public abstract int getModelCount(ItemStack stack); - - @Shadow - public abstract boolean shouldSpreadItems(); - - @Shadow - public abstract boolean shouldBob(); - - @Shadow - protected abstract ResourceLocation getEntityTexture(EntityItem entity); - - private Minecraft mc = Minecraft.getMinecraft(); - private long tick; - private double rotation; - private double formPositiv(final float rotationPitch) - { - return (rotationPitch > 0.0f) ? rotationPitch : ((double)(-rotationPitch)); - } - - /** - * @author - * @reason - */ - @Overwrite - private int transformModelCount(EntityItem itemIn, double x, double y, double z, float p_177077_8_, IBakedModel p_177077_9_) - { - if (ItemPhysics.INSTANCE.isEnabled()) - { - final ItemStack itemstack = itemIn.getItem(); - final Item item2 = itemstack.getItem(); - if (item2 == null) - return 0; - - final boolean flag = p_177077_9_.isAmbientOcclusion(); - final int i = getModelCount(itemstack); - final float f2 = 0.0f; - GlStateManager.translate((float) x, (float) y + f2 + 0.1f, (float) z); - float f3 = 0.0f; - if (flag || (mc.getRenderManager().options != null && mc.getRenderManager().options.fancyGraphics)) - { - GlStateManager.rotate(f3, 0.0f, 1.0f, 0.0f); - } - if (!flag) - { - f3 = -0.0f * (i - 1) * 0.5f; - final float f4 = -0.0f * (i - 1) * 0.5f; - final float f5 = -0.046875f * (i - 1) * 0.5f; - GlStateManager.translate(f3, f4, f5); - } - GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f); - return i; - } - - ItemStack itemstack = itemIn.getItem(); - Item item = itemstack.getItem(); - - if (item == null) - { - return 0; - } - else - { - boolean flag = p_177077_9_.isGui3d(); - int i = this.getModelCount(itemstack); - float f1 = shouldBob() ? MathHelper.sin(((float)itemIn.getAge() + p_177077_8_) / 10.0F + itemIn.hoverStart) * 0.1F + 0.1F : 0; - float f2 = p_177077_9_.getItemCameraTransforms().getTransform(ItemCameraTransforms.TransformType.GROUND).scale.y; - GlStateManager.translate((float)x, (float)y + f1 + 0.25F * f2, (float)z); - - if (flag || this.renderManager.options != null) - { - float f3 = (((float)itemIn.getAge() + p_177077_8_) / 20.0F + itemIn.hoverStart) * (180F / (float)Math.PI); - GlStateManager.rotate(f3, 0.0F, 1.0F, 0.0F); - } - - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - return i; - } - } - - /** - * @author - * @reason - */ - @Overwrite - public void doRender(EntityItem entity, double x, double y, double z, float entityYaw, float partialTicks) - { - if (ItemPhysics.INSTANCE.isEnabled()) - { - rotation = (System.nanoTime() - tick) / 3000000.0 * 1.0; - if (!mc.inGameHasFocus) { - rotation = 0.0; - } - final EntityItem entityitem = (EntityItem)entity; - final ItemStack itemstack = entityitem.getItem(); - if (itemstack.getItem() != null) { - random.setSeed(187L); - boolean flag = false; - if (TextureMap.LOCATION_BLOCKS_TEXTURE != null) { - mc.getRenderManager().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); - mc.getRenderManager().renderEngine.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false); - flag = true; - } - GlStateManager.enableRescaleNormal(); - GlStateManager.alphaFunc(516, 0.1f); - GlStateManager.enableBlend(); - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); - GlStateManager.pushMatrix(); - final IBakedModel ibakedmodel = itemRenderer.getItemModelMesher().getItemModel(itemstack); - final int i = transformModelCount(entityitem, x, y, z, partialTicks, ibakedmodel); - final BlockPos blockpos = new BlockPos(entityitem); - if (entityitem.rotationPitch > 360.0f) { - entityitem.rotationPitch = 0.0f; - } - if (entityitem != null && !Double.isNaN(entityitem.posX) && !Double.isNaN(entityitem.posY) && !Double.isNaN(entityitem.posZ) && entityitem.world != null) { - if (entityitem.onGround) { - if (entityitem.rotationPitch != 0.0f && entityitem.rotationPitch != 90.0f && entityitem.rotationPitch != 180.0f && entityitem.rotationPitch != 270.0f) { - final double d0 = formPositiv(entityitem.rotationPitch); - final double d2 = formPositiv(entityitem.rotationPitch - 90.0f); - final double d3 = formPositiv(entityitem.rotationPitch - 180.0f); - final double d4 = formPositiv(entityitem.rotationPitch - 270.0f); - if (d0 <= d2 && d0 <= d3 && d0 <= d4) { - if (entityitem.rotationPitch < 0.0f) { - entityitem.rotationPitch += (float)rotation; - } - else { - entityitem.rotationPitch -= (float)rotation; - } - } - if (d2 < d0 && d2 <= d3 && d2 <= d4) { - if (entityitem.rotationPitch - 90.0f < 0.0f) { - entityitem.rotationPitch += (float)rotation; - } - else { - entityitem.rotationPitch -= (float)rotation; - } - } - if (d3 < d2 && d3 < d0 && d3 <= d4) { - if (entityitem.rotationPitch - 180.0f < 0.0f) { - entityitem.rotationPitch += (float)rotation; - } - else { - entityitem.rotationPitch -= (float)rotation; - } - } - if (d4 < d2 && d4 < d3 && d4 < d0) { - if (entityitem.rotationPitch - 270.0f < 0.0f) { - entityitem.rotationPitch += (float)rotation; - } - else { - entityitem.rotationPitch -= (float)rotation; - } - } - } - } - else { - final BlockPos blockpos2 = new BlockPos(entityitem); - blockpos2.add(0, 1, 0); - final Material material = entityitem.world.getBlockState(blockpos2).getMaterial(); - final Material material2 = entityitem.world.getBlockState(blockpos).getMaterial(); - final boolean flag2 = entityitem.isInsideOfMaterial(Material.WATER); - final boolean flag3 = entityitem.isInWater(); - if (flag2 | material == Material.WATER | material2 == Material.WATER | flag3) { - entityitem.rotationPitch += (float)(rotation / 4.0); - } - else { - entityitem.rotationPitch += (float)(rotation * 2.0); - } - } - } - GL11.glRotatef(entityitem.rotationYaw, 0.0f, 1.0f, 0.0f); - GL11.glRotatef(entityitem.rotationPitch + 90.0f, 1.0f, 0.0f, 0.0f); - for (int j = 0; j < i; ++j) { - if (ibakedmodel.isAmbientOcclusion()) { - GlStateManager.pushMatrix(); - GlStateManager.scale(ItemPhysics.INSTANCE.Scaling.getValue(), ItemPhysics.INSTANCE.Scaling.getValue(), ItemPhysics.INSTANCE.Scaling.getValue()); - itemRenderer.renderItem(itemstack, ibakedmodel); - GlStateManager.popMatrix(); - } - else { - GlStateManager.pushMatrix(); - if (j > 0 && shouldSpreadItems()) { - GlStateManager.translate(0.0f, 0.0f, 0.046875f * j); - } - itemRenderer.renderItem(itemstack, ibakedmodel); - if (!shouldSpreadItems()) { - GlStateManager.translate(0.0f, 0.0f, 0.046875f); - } - GlStateManager.popMatrix(); - } - } - GlStateManager.popMatrix(); - GlStateManager.disableRescaleNormal(); - GlStateManager.disableBlend(); - mc.getRenderManager().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); - if (flag) { - mc.getRenderManager().renderEngine.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap(); - } - } - - return; - } - - ItemStack itemstack = entity.getItem(); - int i = itemstack.isEmpty() ? 187 : Item.getIdFromItem(itemstack.getItem()) + itemstack.getMetadata(); - this.random.setSeed((long)i); - boolean flag = false; - - if (this.bindEntityTexture(entity)) - { - this.renderManager.renderEngine.getTexture(this.getEntityTexture(entity)).setBlurMipmap(false, false); - flag = true; - } - - GlStateManager.enableRescaleNormal(); - GlStateManager.alphaFunc(516, 0.1F); - GlStateManager.enableBlend(); - RenderHelper.enableStandardItemLighting(); - GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); - GlStateManager.pushMatrix(); - IBakedModel ibakedmodel = this.itemRenderer.getItemModelWithOverrides(itemstack, entity.world, (EntityLivingBase)null); - int j = this.transformModelCount(entity, x, y, z, partialTicks, ibakedmodel); - boolean flag1 = ibakedmodel.isGui3d(); - - if (!flag1) - { - float f3 = -0.0F * (float)(j - 1) * 0.5F; - float f4 = -0.0F * (float)(j - 1) * 0.5F; - float f5 = -0.09375F * (float)(j - 1) * 0.5F; - GlStateManager.translate(f3, f4, f5); - } - - if (this.renderOutlines) - { - GlStateManager.enableColorMaterial(); - GlStateManager.enableOutlineMode(this.getTeamColor(entity)); - } - - for (int k = 0; k < j; ++k) - { - GlStateManager.pushMatrix(); - if (flag1) - { - - if (k > 0) - { - float f7 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.15F; - float f9 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.15F; - float f6 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.15F; - GlStateManager.translate(shouldSpreadItems() ? f7 : 0, shouldSpreadItems() ? f9 : 0, f6); - } - - IBakedModel transformedModel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ibakedmodel, ItemCameraTransforms.TransformType.GROUND, false); - this.itemRenderer.renderItem(itemstack, transformedModel); - GlStateManager.popMatrix(); - } - else - { - - if (k > 0) - { - float f8 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.15F * 0.5F; - float f10 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.15F * 0.5F; - GlStateManager.translate(f8, f10, 0.0F); - } - - IBakedModel transformedModel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ibakedmodel, ItemCameraTransforms.TransformType.GROUND, false); - this.itemRenderer.renderItem(itemstack, transformedModel); - GlStateManager.popMatrix(); - GlStateManager.translate(0.0F, 0.0F, 0.09375F); - } - } - - if (this.renderOutlines) - { - GlStateManager.disableOutlineMode(); - GlStateManager.disableColorMaterial(); - } - - GlStateManager.popMatrix(); - GlStateManager.disableRescaleNormal(); - GlStateManager.disableBlend(); - this.bindEntityTexture(entity); - - if (flag) - { - this.renderManager.renderEngine.getTexture(this.getEntityTexture(entity)).restoreLastBlurMipmap(); - } - } -} \ No newline at end of file diff --git a/src/main/java/com/me/infinity/loop/mixin/mixins/MixinRenderLivingBase.java b/src/main/java/com/me/infinity/loop/mixin/mixins/MixinRenderLivingBase.java deleted file mode 100644 index 171d0b3..0000000 --- a/src/main/java/com/me/infinity/loop/mixin/mixins/MixinRenderLivingBase.java +++ /dev/null @@ -1,245 +0,0 @@ -package com.me.infinity.loop.mixin.mixins; - -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.features.modules.client.ClickGui.ClickGui; -import com.me.infinity.loop.features.modules.client.Colors; -import com.me.infinity.loop.features.modules.render.NoCluster; -import com.me.infinity.loop.features.modules.render.Wireframe; -import com.me.infinity.loop.mixin.MixinInterface; -import com.me.infinity.loop.util.utils.renders.ColorUtil; -import net.minecraft.client.Minecraft; -import net.minecraft.client.model.ModelBase; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.OpenGlHelper; -import net.minecraft.client.renderer.entity.Render; -import net.minecraft.client.renderer.entity.RenderLivingBase; -import net.minecraft.client.renderer.entity.RenderManager; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.math.MathHelper; -import net.minecraftforge.client.event.RenderLivingEvent; -import net.minecraftforge.common.MinecraftForge; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.lwjgl.opengl.GL11; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Overwrite; -import org.spongepowered.asm.mixin.Shadow; - -@Mixin(value = { RenderLivingBase.class }, priority = 10001) -public abstract class MixinRenderLivingBase extends Render implements MixinInterface { - @Shadow - private static final Logger LOGGER = LogManager.getLogger(); - @Shadow - protected ModelBase mainModel; - @Shadow - protected boolean renderMarker; - - float red; - float green; - float blue; - - /** - * @author - * @reason - */ - protected void mainModel(final T entitylivingbase, final float limbSwing, final float limbSwingAmount, final float ageInTicks, final float netHeadYaw, final float headPitch, final float scaleFactor) { - if (MixinRenderLivingBase.mc.player.getDistance(entitylivingbase) < 1.0f && entitylivingbase != MixinRenderLivingBase.mc.player && InfinityLoop.moduleManager.getModuleByClass(NoCluster.class).isEnabled()) { - GlStateManager.enableBlendProfile(GlStateManager.Profile.TRANSPARENT_MODEL); - } - if (!this.bindEntityTexture((T) entitylivingbase)) { - return; - } - this.mainModel.render((Entity)entitylivingbase, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor); - } - - - protected MixinRenderLivingBase(RenderManager renderManager) { - super(renderManager); - this.red = 0.0F; - this.green = 0.0F; - this.blue = 0.0F; - } - - /** - * @author huh? - * @reason Don't know - */ - @Overwrite - public void doRender(T entity, double x, double y, double z, float entityYaw, float partialTicks) { - if (!MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Pre(entity, RenderLivingBase.class.cast(this), partialTicks, x, y, z))) { - GlStateManager.pushMatrix(); - GlStateManager.disableCull(); - this.mainModel.swingProgress = getSwingProgress(entity, partialTicks); - boolean shouldSit = (entity.isRiding() && entity.getRidingEntity() != null && entity.getRidingEntity().shouldRiderSit()); - this.mainModel.isRiding = shouldSit; - this.mainModel.isChild = entity.isChild(); - try { - float f = interpolateRotation(entity.prevRenderYawOffset, entity.renderYawOffset, partialTicks); - float f1 = interpolateRotation(entity.prevRotationYawHead, entity.rotationYawHead, partialTicks); - float f2 = f1 - f; - if (shouldSit && entity.getRidingEntity() instanceof EntityLivingBase) { - EntityLivingBase entitylivingbase = (EntityLivingBase) entity.getRidingEntity(); - f = interpolateRotation(entitylivingbase.prevRenderYawOffset, entitylivingbase.renderYawOffset, partialTicks); - f2 = f1 - f; - float f3 = MathHelper.wrapDegrees(f2); - if (f3 < -85.0F) - f3 = -85.0F; - if (f3 >= 85.0F) - f3 = 85.0F; - f = f1 - f3; - if (f3 * f3 > 2500.0F) - f += f3 * 0.2F; - f2 = f1 - f; - } - float f7 = entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks; - renderLivingAt(entity, x, y, z); - float f8 = handleRotationFloat(entity, partialTicks); - applyRotations(entity, f8, f, partialTicks); - float f4 = prepareScale(entity, partialTicks); - float f5 = 0.0F; - float f6 = 0.0F; - if (!entity.isRiding()) { - f5 = entity.prevLimbSwingAmount + (entity.limbSwingAmount - entity.prevLimbSwingAmount) * partialTicks; - f6 = entity.limbSwing - entity.limbSwingAmount * (1.0F - partialTicks); - if (entity.isChild()) - f6 *= 3.0F; - if (f5 > 1.0F) - f5 = 1.0F; - f2 = f1 - f; - } - GlStateManager.enableAlpha(); - this.mainModel.setLivingAnimations(entity, f6, f5, partialTicks); - this.mainModel.setRotationAngles(f6, f5, f8, f2, f7, f4, entity); - if (this.renderOutlines) { - boolean flag1 = setScoreTeamColor(entity); - GlStateManager.enableColorMaterial(); - GlStateManager.enableOutlineMode(getTeamColor(entity)); - if (!this.renderMarker) - renderModel(entity, f6, f5, f8, f2, f7, f4); - if (!(entity instanceof EntityPlayer) || !((EntityPlayer) entity).isSpectator()) - renderLayers(entity, f6, f5, partialTicks, f8, f2, f7, f4); - GlStateManager.disableOutlineMode(); - GlStateManager.disableColorMaterial(); - if (flag1) - unsetScoreTeamColor(); - } else { - if (Wireframe.getINSTANCE().isOn() && (Wireframe.getINSTANCE()).players.getValue().booleanValue() && entity instanceof EntityPlayer && (Wireframe.getINSTANCE()).mode.getValue().equals(Wireframe.RenderMode.SOLID)) { - this.red = (ClickGui.getInstance()).red.getValue().intValue() / 255.0F; - this.green = (ClickGui.getInstance()).green.getValue().intValue() / 255.0F; - this.blue = (ClickGui.getInstance()).blue.getValue().intValue() / 255.0F; - GlStateManager.pushMatrix(); - GL11.glPushAttrib(1048575); - GL11.glDisable(3553); - GL11.glDisable(2896); - GL11.glEnable(2848); - GL11.glEnable(3042); - GL11.glBlendFunc(770, 771); - GL11.glDisable(2929); - GL11.glDepthMask(false); - if (InfinityLoop.friendManager.isFriend(entity.getName()) || entity == (Minecraft.getMinecraft()).player) { - GL11.glColor4f(0.0F, 191.0F, 255.0F, (Wireframe.getINSTANCE()).alpha.getValue().floatValue() / 255.0F); - } else { - GL11.glColor4f((Colors.getInstance()).rainbow.getValue().booleanValue() ? (ColorUtil.rainbow((Colors.getInstance()).rainbowHue.getValue().intValue()).getRed() / 255.0F) : this.red, (Colors.getInstance()).rainbow.getValue().booleanValue() ? (ColorUtil.rainbow((Colors.getInstance()).rainbowHue.getValue().intValue()).getGreen() / 255.0F) : this.green, (Colors.getInstance()).rainbow.getValue().booleanValue() ? (ColorUtil.rainbow((Colors.getInstance()).rainbowHue.getValue().intValue()).getBlue() / 255.0F) : this.blue, (Wireframe.getINSTANCE()).alpha.getValue().floatValue() / 255.0F); - } - renderModel(entity, f6, f5, f8, f2, f7, f4); - GL11.glDisable(2896); - GL11.glEnable(2929); - GL11.glDepthMask(true); - if (InfinityLoop.friendManager.isFriend(entity.getName()) || entity == (Minecraft.getMinecraft()).player) { - GL11.glColor4f(0.0F, 191.0F, 255.0F, (Wireframe.getINSTANCE()).alpha.getValue().floatValue() / 255.0F); - } else { - GL11.glColor4f((Colors.getInstance()).rainbow.getValue().booleanValue() ? (ColorUtil.rainbow((Colors.getInstance()).rainbowHue.getValue().intValue()).getRed() / 255.0F) : this.red, (Colors.getInstance()).rainbow.getValue().booleanValue() ? (ColorUtil.rainbow((Colors.getInstance()).rainbowHue.getValue().intValue()).getGreen() / 255.0F) : this.green, (Colors.getInstance()).rainbow.getValue().booleanValue() ? (ColorUtil.rainbow((Colors.getInstance()).rainbowHue.getValue().intValue()).getBlue() / 255.0F) : this.blue, (Wireframe.getINSTANCE()).alpha.getValue().floatValue() / 255.0F); - } - renderModel(entity, f6, f5, f8, f2, f7, f4); - GL11.glEnable(2896); - GlStateManager.popAttrib(); - GlStateManager.popMatrix(); - } - boolean flag1 = setDoRenderBrightness(entity, partialTicks); - if (!(entity instanceof EntityPlayer) || (Wireframe.getINSTANCE().isOn() && (Wireframe.getINSTANCE()).mode.getValue().equals(Wireframe.RenderMode.WIREFRAME) && (Wireframe.getINSTANCE()).playerModel.getValue().booleanValue()) || Wireframe.getINSTANCE().isOff()) - renderModel(entity, f6, f5, f8, f2, f7, f4); - if (flag1) - unsetBrightness(); - GlStateManager.depthMask(true); - if (!(entity instanceof EntityPlayer) || !((EntityPlayer) entity).isSpectator()) - renderLayers(entity, f6, f5, partialTicks, f8, f2, f7, f4); - if (Wireframe.getINSTANCE().isOn() && (Wireframe.getINSTANCE()).players.getValue().booleanValue() && entity instanceof EntityPlayer && (Wireframe.getINSTANCE()).mode.getValue().equals(Wireframe.RenderMode.WIREFRAME)) { - this.red = (ClickGui.getInstance()).red.getValue().intValue() / 255.0F; - this.green = (ClickGui.getInstance()).green.getValue().intValue() / 255.0F; - this.blue = (ClickGui.getInstance()).blue.getValue().intValue() / 255.0F; - GlStateManager.pushMatrix(); - GL11.glPushAttrib(1048575); - GL11.glPolygonMode(1032, 6913); - GL11.glDisable(3553); - GL11.glDisable(2896); - GL11.glDisable(2929); - GL11.glEnable(2848); - GL11.glEnable(3042); - GL11.glBlendFunc(770, 771); - if (InfinityLoop.friendManager.isFriend(entity.getName()) || entity == (Minecraft.getMinecraft()).player) { - GL11.glColor4f(0.0F, 191.0F, 255.0F, (Wireframe.getINSTANCE()).alpha.getValue().floatValue() / 255.0F); - } else { - GL11.glColor4f((Colors.getInstance()).rainbow.getValue().booleanValue() ? (ColorUtil.rainbow((Colors.getInstance()).rainbowHue.getValue().intValue()).getRed() / 255.0F) : this.red, (Colors.getInstance()).rainbow.getValue().booleanValue() ? (ColorUtil.rainbow((Colors.getInstance()).rainbowHue.getValue().intValue()).getGreen() / 255.0F) : this.green, (Colors.getInstance()).rainbow.getValue().booleanValue() ? (ColorUtil.rainbow((Colors.getInstance()).rainbowHue.getValue().intValue()).getBlue() / 255.0F) : this.blue, (Wireframe.getINSTANCE()).alpha.getValue().floatValue() / 255.0F); - } - GL11.glLineWidth((Wireframe.getINSTANCE()).lineWidth.getValue().floatValue()); - renderModel(entity, f6, f5, f8, f2, f7, f4); - GL11.glEnable(2896); - GlStateManager.popAttrib(); - GlStateManager.popMatrix(); - } - } - GlStateManager.disableRescaleNormal(); - } catch (Exception var20) { - LOGGER.error("Couldn't render entity", var20); - } - GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit); - GlStateManager.enableTexture2D(); - GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); - GlStateManager.enableCull(); - GlStateManager.popMatrix(); - super.doRender(entity, x, y, z, entityYaw, partialTicks); - MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Post(entity, RenderLivingBase.class.cast(this), partialTicks, x, y, z)); - } - } - - @Shadow - protected abstract boolean isVisible(EntityLivingBase paramEntityLivingBase); - - @Shadow - protected abstract float getSwingProgress(T paramT, float paramFloat); - - @Shadow - protected abstract float interpolateRotation(float paramFloat1, float paramFloat2, float paramFloat3); - - @Shadow - protected abstract float handleRotationFloat(T paramT, float paramFloat); - - @Shadow - protected abstract void applyRotations(T paramT, float paramFloat1, float paramFloat2, float paramFloat3); - - @Shadow - public abstract float prepareScale(T paramT, float paramFloat); - - @Shadow - protected abstract void unsetScoreTeamColor(); - - @Shadow - protected abstract boolean setScoreTeamColor(T paramT); - - @Shadow - protected abstract void renderLivingAt(T paramT, double paramDouble1, double paramDouble2, double paramDouble3); - - @Shadow - protected abstract void unsetBrightness(); - - @Shadow - protected abstract void renderModel(T paramT, float paramFloat1, float paramFloat2, float paramFloat3, float paramFloat4, float paramFloat5, float paramFloat6); - - @Shadow - protected abstract void renderLayers(T paramT, float paramFloat1, float paramFloat2, float paramFloat3, float paramFloat4, float paramFloat5, float paramFloat6, float paramFloat7); - - @Shadow - protected abstract boolean setDoRenderBrightness(T paramT, float paramFloat); -} diff --git a/src/main/java/com/me/infinity/loop/mixin/mixins/MixinRenderPlayer.java b/src/main/java/com/me/infinity/loop/mixin/mixins/MixinRenderPlayer.java deleted file mode 100644 index 6ced006..0000000 --- a/src/main/java/com/me/infinity/loop/mixin/mixins/MixinRenderPlayer.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.me.infinity.loop.mixin.mixins; - -import com.me.infinity.loop.features.modules.client.GameChanger; -import net.minecraft.client.entity.AbstractClientPlayer; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.entity.RenderPlayer; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Mixin(RenderPlayer.class) -public class MixinRenderPlayer { - - @Inject(method = "preRenderCallback*", at = @At("HEAD")) - public void renderCallback(AbstractClientPlayer entitylivingbaseIn, float partialTickTime, CallbackInfo ci) { - if (GameChanger.getInstance().modelFlip.getValue()) { - GlStateManager.rotate(180, 0, 180, 0); - } - } -} - diff --git a/src/main/java/com/me/infinity/loop/mixin/mixins/MixinRenderer.java b/src/main/java/com/me/infinity/loop/mixin/mixins/MixinRenderer.java deleted file mode 100644 index 9d23a9a..0000000 --- a/src/main/java/com/me/infinity/loop/mixin/mixins/MixinRenderer.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.me.infinity.loop.mixin.mixins; - -import net.minecraft.entity.*; -import net.minecraft.client.renderer.entity.*; -import org.spongepowered.asm.mixin.*; - -@Mixin({ Render.class }) -abstract class MixinRenderer -{ - @Shadow - protected boolean renderOutlines; - @Shadow - @Final - protected RenderManager renderManager; - - @Shadow - protected abstract boolean bindEntityTexture(final T p0); - - @Shadow - protected abstract int getTeamColor(final T p0); -} diff --git a/src/main/java/com/me/infinity/loop/mixin/mixins/MixinShaderGroup.java b/src/main/java/com/me/infinity/loop/mixin/mixins/MixinShaderGroup.java deleted file mode 100644 index 8723c6d..0000000 --- a/src/main/java/com/me/infinity/loop/mixin/mixins/MixinShaderGroup.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.me.infinity.loop.mixin.mixins; - -import com.me.infinity.loop.util.utils.interfaces.IShaderGroup; -import net.minecraft.client.shader.Framebuffer; -import net.minecraft.client.shader.Shader; -import net.minecraft.client.shader.ShaderGroup; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -import java.util.List; - -@Mixin( {ShaderGroup.class} ) -public abstract class MixinShaderGroup implements IShaderGroup { - - @Accessor(value = "listFramebuffers") - - public abstract List getListFramebuffers(); - - @Accessor(value = "listShaders") - public abstract List getListShaders(); -} diff --git a/src/main/java/com/me/infinity/loop/util/utils/CombatUtil.java b/src/main/java/com/me/infinity/loop/util/utils/CombatUtil.java deleted file mode 100644 index 7381973..0000000 --- a/src/main/java/com/me/infinity/loop/util/utils/CombatUtil.java +++ /dev/null @@ -1,659 +0,0 @@ -package com.me.infinity.loop.util.utils; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.CopyOnWriteArrayList; -import java.util.stream.Collectors; - -import com.me.infinity.loop.InfinityLoop; -import net.minecraft.block.Block; -import net.minecraft.block.BlockAir; -import net.minecraft.block.BlockLiquid; -import net.minecraft.client.Minecraft; -import net.minecraft.enchantment.EnchantmentHelper; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.SharedMonsterAttributes; -import net.minecraft.entity.item.EntityEnderCrystal; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.item.EntityXPOrb; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.projectile.EntityArrow; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.init.MobEffects; -import net.minecraft.inventory.ClickType; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.network.Packet; -import net.minecraft.network.play.client.CPacketAnimation; -import net.minecraft.network.play.client.CPacketEntityAction; -import net.minecraft.network.play.client.CPacketHeldItemChange; -import net.minecraft.network.play.client.CPacketPlayer; -import net.minecraft.util.CombatRules; -import net.minecraft.util.DamageSource; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.RayTraceResult; -import net.minecraft.util.math.Vec3d; -import net.minecraft.util.math.Vec3i; -import net.minecraft.world.Explosion; -import net.minecraft.world.World; - -public class CombatUtil { - public static final List blackList = Arrays.asList(Blocks.TALLGRASS, Blocks.ENDER_CHEST, Blocks.CHEST, Blocks.TRAPPED_CHEST, Blocks.CRAFTING_TABLE, Blocks.ANVIL, Blocks.BREWING_STAND, Blocks.HOPPER, Blocks.DROPPER, Blocks.DISPENSER, Blocks.TRAPDOOR); - public static final List shulkerList = Arrays.asList(Blocks.WHITE_SHULKER_BOX, Blocks.ORANGE_SHULKER_BOX, Blocks.MAGENTA_SHULKER_BOX, Blocks.LIGHT_BLUE_SHULKER_BOX, Blocks.YELLOW_SHULKER_BOX, Blocks.LIME_SHULKER_BOX, Blocks.PINK_SHULKER_BOX, Blocks.GRAY_SHULKER_BOX, Blocks.SILVER_SHULKER_BOX, Blocks.CYAN_SHULKER_BOX, Blocks.PURPLE_SHULKER_BOX, Blocks.BLUE_SHULKER_BOX, Blocks.BROWN_SHULKER_BOX, Blocks.GREEN_SHULKER_BOX, Blocks.RED_SHULKER_BOX, Blocks.BLACK_SHULKER_BOX); - private static Minecraft mc = Minecraft.getMinecraft(); - public static final Vec3d[] cityOffsets = new Vec3d[]{new Vec3d(1.0, 0.0, 0.0), new Vec3d(0.0, 0.0, 1.0), new Vec3d(-1.0, 0.0, 0.0), new Vec3d(0.0, 0.0, -1.0), new Vec3d(2.0, 0.0, 0.0), new Vec3d(0.0, 0.0, 2.0), new Vec3d(-2.0, 0.0, 0.0), new Vec3d(0.0, 0.0, -2.0)}; - private static final List invalidSlots = Arrays.asList(0, 5, 6, 7, 8); - - public static int findCrapple() { - if (CombatUtil.mc.player == null) { - return -1; - } - for (int x = 0; x < CombatUtil.mc.player.inventoryContainer.getInventory().size(); ++x) { - ItemStack stack; - if (invalidSlots.contains(x) || (stack = (ItemStack)CombatUtil.mc.player.inventoryContainer.getInventory().get(x)).isEmpty() || !stack.getItem().equals(Items.GOLDEN_APPLE) || stack.getItemDamage() == 1) continue; - return x; - } - return -1; - } - - public static int findItemSlotDamage1(Item i) { - if (CombatUtil.mc.player == null) { - return -1; - } - for (int x = 0; x < CombatUtil.mc.player.inventoryContainer.getInventory().size(); ++x) { - ItemStack stack; - if (invalidSlots.contains(x) || (stack = (ItemStack)CombatUtil.mc.player.inventoryContainer.getInventory().get(x)).isEmpty() || !stack.getItem().equals(i) || stack.getItemDamage() != 1) continue; - return x; - } - return -1; - } - - public static int findItemSlot(Item i) { - if (CombatUtil.mc.player == null) { - return -1; - } - for (int x = 0; x < CombatUtil.mc.player.inventoryContainer.getInventory().size(); ++x) { - ItemStack stack; - if (invalidSlots.contains(x) || (stack = (ItemStack)CombatUtil.mc.player.inventoryContainer.getInventory().get(x)).isEmpty() || !stack.getItem().equals(i)) continue; - return x; - } - return -1; - } - - public static boolean isHoldingCrystal(boolean onlyMainHand) { - if (onlyMainHand) { - return CombatUtil.mc.player.getHeldItemMainhand().getItem() == Items.END_CRYSTAL; - } - return CombatUtil.mc.player.getHeldItemMainhand().getItem() == Items.END_CRYSTAL || CombatUtil.mc.player.getHeldItemOffhand().getItem() == Items.END_CRYSTAL; - } - - public static boolean requiredDangerSwitch(double dangerRange) { - int dangerousCrystals = (int)CombatUtil.mc.world.loadedEntityList.stream().filter(entity -> entity instanceof EntityEnderCrystal).filter(entity -> (double)CombatUtil.mc.player.getDistance(entity) <= dangerRange).filter(entity -> CombatUtil.calculateDamage(entity.posX, entity.posY, entity.posZ, (Entity)CombatUtil.mc.player) >= CombatUtil.mc.player.getHealth() + CombatUtil.mc.player.getAbsorptionAmount()).count(); - return dangerousCrystals > 0; - } - - public static boolean passesOffhandCheck(double requiredHealth, Item item, boolean isCrapple) { - double totalPlayerHealth = CombatUtil.mc.player.getHealth() + CombatUtil.mc.player.getAbsorptionAmount(); - if (!isCrapple ? CombatUtil.findItemSlot(item) == -1 : CombatUtil.findCrapple() == -1) { - return false; - } - return !(totalPlayerHealth < requiredHealth); - } - - public static void switchOffhandStrict(int targetSlot, int step) { - switch (step) { - case 0: { - CombatUtil.mc.playerController.windowClick(CombatUtil.mc.player.inventoryContainer.windowId, targetSlot, 0, ClickType.PICKUP, (EntityPlayer)CombatUtil.mc.player); - break; - } - case 1: { - CombatUtil.mc.playerController.windowClick(CombatUtil.mc.player.inventoryContainer.windowId, 45, 0, ClickType.PICKUP, (EntityPlayer)CombatUtil.mc.player); - break; - } - case 2: { - CombatUtil.mc.playerController.windowClick(CombatUtil.mc.player.inventoryContainer.windowId, targetSlot, 0, ClickType.PICKUP, (EntityPlayer)CombatUtil.mc.player); - CombatUtil.mc.playerController.updateController(); - } - } - } - - public static void switchOffhandTotemNotStrict() { - int targetSlot = CombatUtil.findItemSlot(Items.TOTEM_OF_UNDYING); - if (targetSlot != -1) { - CombatUtil.mc.playerController.windowClick(CombatUtil.mc.player.inventoryContainer.windowId, targetSlot, 0, ClickType.PICKUP, (EntityPlayer)CombatUtil.mc.player); - CombatUtil.mc.playerController.windowClick(CombatUtil.mc.player.inventoryContainer.windowId, 45, 0, ClickType.PICKUP, (EntityPlayer)CombatUtil.mc.player); - CombatUtil.mc.playerController.windowClick(CombatUtil.mc.player.inventoryContainer.windowId, targetSlot, 0, ClickType.PICKUP, (EntityPlayer)CombatUtil.mc.player); - CombatUtil.mc.playerController.updateController(); - } - } - - public static void switchOffhandNonStrict(int targetSlot) { - CombatUtil.mc.playerController.windowClick(CombatUtil.mc.player.inventoryContainer.windowId, targetSlot, 0, ClickType.PICKUP, (EntityPlayer)CombatUtil.mc.player); - CombatUtil.mc.playerController.windowClick(CombatUtil.mc.player.inventoryContainer.windowId, 45, 0, ClickType.PICKUP, (EntityPlayer)CombatUtil.mc.player); - CombatUtil.mc.playerController.windowClick(CombatUtil.mc.player.inventoryContainer.windowId, targetSlot, 0, ClickType.PICKUP, (EntityPlayer)CombatUtil.mc.player); - CombatUtil.mc.playerController.updateController(); - } - - public static boolean canSeeBlock(BlockPos pos) { - return CombatUtil.mc.world.rayTraceBlocks(new Vec3d(CombatUtil.mc.player.posX, CombatUtil.mc.player.posY + (double)CombatUtil.mc.player.getEyeHeight(), CombatUtil.mc.player.posZ), new Vec3d((double)pos.getX(), (double)((float)pos.getY() + 1.0f), (double)pos.getZ()), false, true, false) == null; - } - - public static boolean placeBlock(BlockPos blockPos, boolean offhand, boolean rotate, boolean packetRotate, boolean doSwitch, boolean silentSwitch, int toSwitch) { - if (!CombatUtil.checkCanPlace(blockPos)) { - return false; - } - EnumFacing placeSide = CombatUtil.getPlaceSide(blockPos); - BlockPos adjacentBlock = blockPos.offset(placeSide); - EnumFacing opposingSide = placeSide.getOpposite(); - if (!CombatUtil.mc.world.getBlockState(adjacentBlock).getBlock().canCollideCheck(CombatUtil.mc.world.getBlockState(adjacentBlock), false)) { - return false; - } - if (doSwitch) { - if (silentSwitch) { - CombatUtil.mc.player.connection.sendPacket((Packet)new CPacketHeldItemChange(toSwitch)); - } else if (CombatUtil.mc.player.inventory.currentItem != toSwitch) { - CombatUtil.mc.player.inventory.currentItem = toSwitch; - } - } - boolean isSneak = false; - if (blackList.contains(CombatUtil.mc.world.getBlockState(adjacentBlock).getBlock()) || shulkerList.contains(CombatUtil.mc.world.getBlockState(adjacentBlock).getBlock())) { - CombatUtil.mc.player.connection.sendPacket((Packet)new CPacketEntityAction((Entity)CombatUtil.mc.player, CPacketEntityAction.Action.START_SNEAKING)); - isSneak = true; - } - Vec3d hitVector = CombatUtil.getHitVector(adjacentBlock, opposingSide); - if (rotate) { - float[] angle = CombatUtil.getLegitRotations(hitVector); - CombatUtil.mc.player.connection.sendPacket((Packet)new CPacketPlayer.Rotation(angle[0], angle[1], CombatUtil.mc.player.onGround)); - } - EnumHand actionHand = offhand ? EnumHand.OFF_HAND : EnumHand.MAIN_HAND; - CombatUtil.mc.playerController.processRightClickBlock(CombatUtil.mc.player, CombatUtil.mc.world, adjacentBlock, opposingSide, hitVector, actionHand); - CombatUtil.mc.player.connection.sendPacket((Packet)new CPacketAnimation(actionHand)); - if (isSneak) { - CombatUtil.mc.player.connection.sendPacket((Packet)new CPacketEntityAction((Entity)CombatUtil.mc.player, CPacketEntityAction.Action.STOP_SNEAKING)); - } - return true; - } - - private static Vec3d getHitVector(BlockPos pos, EnumFacing opposingSide) { - return new Vec3d((Vec3i)pos).add(0.5, 0.5, 0.5).add(new Vec3d(opposingSide.getDirectionVec()).scale(0.5)); - } - - public static Vec3d getHitAddition(double x, double y, double z, BlockPos pos, EnumFacing opposingSide) { - return new Vec3d((Vec3i)pos).add(0.5, 0.5, 0.5).add(new Vec3d(opposingSide.getDirectionVec()).scale(0.5)); - } - - public static void betterRotate(BlockPos blockPos, EnumFacing opposite, boolean packetRotate) { - float offsetZ = 0.0f; - float offsetY = 0.0f; - float offsetX = 0.0f; - switch (CombatUtil.getPlaceSide(blockPos)) { - case UP: { - offsetZ = 0.5f; - offsetX = 0.5f; - offsetY = 0.0f; - break; - } - case DOWN: { - offsetZ = 0.5f; - offsetX = 0.5f; - offsetY = -0.5f; - break; - } - case NORTH: { - offsetX = 0.5f; - offsetY = -0.5f; - offsetZ = -0.5f; - break; - } - case EAST: { - offsetX = 0.5f; - offsetY = -0.5f; - offsetZ = 0.5f; - break; - } - case SOUTH: { - offsetX = 0.5f; - offsetY = -0.5f; - offsetZ = 0.5f; - break; - } - case WEST: { - offsetX = -0.5f; - offsetY = -0.5f; - offsetZ = 0.5f; - } - } - float[] angle = CombatUtil.getLegitRotations(CombatUtil.getHitAddition(offsetX, offsetY, offsetZ, blockPos, opposite)); - CombatUtil.mc.player.connection.sendPacket((Packet)new CPacketPlayer.Rotation(angle[0], angle[1], CombatUtil.mc.player.onGround)); - } - - private static EnumFacing getPlaceSide(BlockPos blockPos) { - EnumFacing placeableSide = null; - for (EnumFacing side : EnumFacing.values()) { - BlockPos adjacent = blockPos.offset(side); - if (!CombatUtil.mc.world.getBlockState(adjacent).getBlock().canCollideCheck(CombatUtil.mc.world.getBlockState(adjacent), false) || CombatUtil.mc.world.getBlockState(adjacent).getMaterial().isReplaceable()) continue; - placeableSide = side; - } - return placeableSide; - } - - public static boolean checkCanPlace(BlockPos pos) { - if (!(CombatUtil.mc.world.getBlockState(pos).getBlock() instanceof BlockAir) && !(CombatUtil.mc.world.getBlockState(pos).getBlock() instanceof BlockLiquid)) { - return false; - } - for (Entity entity : CombatUtil.mc.world.getEntitiesWithinAABBExcludingEntity(null, new AxisAlignedBB(pos))) { - if (entity instanceof EntityItem || entity instanceof EntityXPOrb || entity instanceof EntityArrow) continue; - return false; - } - return CombatUtil.getPlaceSide(pos) != null; - } - - public static boolean isInCity(EntityPlayer player, double range, double placeRange, boolean checkFace, boolean topBlock, boolean checkPlace, boolean checkRange) { - BlockPos pos = new BlockPos(player.getPositionVector()); - for (EnumFacing face : EnumFacing.values()) { - if (face == EnumFacing.UP || face == EnumFacing.DOWN) continue; - BlockPos pos1 = pos.offset(face); - BlockPos pos2 = pos1.offset(face); - if (!(CombatUtil.mc.world.getBlockState(pos1).getBlock() == Blocks.AIR && (CombatUtil.mc.world.getBlockState(pos2).getBlock() == Blocks.AIR && CombatUtil.isHard(CombatUtil.mc.world.getBlockState(pos2.up()).getBlock()) || !checkFace) && !checkRange || CombatUtil.mc.player.getDistanceSq(pos2) <= placeRange * placeRange && CombatUtil.mc.player.getDistanceSq((Entity)player) <= range * range && CombatUtil.isHard(CombatUtil.mc.world.getBlockState(pos.up(3)).getBlock())) && topBlock) continue; - return true; - } - return false; - } - - public static boolean isHard(Block block) { - return block == Blocks.OBSIDIAN || block == Blocks.BEDROCK; - } - - public static boolean canLegPlace(EntityPlayer player, double range) { - int safety = 0; - int blocksInRange = 0; - for (Vec3d vec : HoleUtil.cityOffsets) { - BlockPos pos = CombatUtil.getFlooredPosition((Entity)player).add(vec.x, vec.y, vec.z); - if (CombatUtil.mc.world.getBlockState(pos).getBlock() == Blocks.OBSIDIAN || CombatUtil.mc.world.getBlockState(pos).getBlock() == Blocks.BEDROCK) { - ++safety; - } - if (!(CombatUtil.mc.player.getDistanceSq(pos) >= range * range)) continue; - ++blocksInRange; - } - return safety == 4 && blocksInRange >= 1; - } - - public static int getSafetyFactor(BlockPos pos) { - return 0; - } - - public static boolean canPlaceCrystal(BlockPos pos, double range, double wallsRange, boolean raytraceCheck) { - BlockPos up = pos.up(); - BlockPos up1 = up.up(); - AxisAlignedBB bb = new AxisAlignedBB(up).expand(0.0, 1.0, 0.0); - return (CombatUtil.mc.world.getBlockState(pos).getBlock() == Blocks.OBSIDIAN || CombatUtil.mc.world.getBlockState(pos).getBlock() == Blocks.BEDROCK) && CombatUtil.mc.world.getBlockState(up).getBlock() == Blocks.AIR && CombatUtil.mc.world.getBlockState(up1).getBlock() == Blocks.AIR && CombatUtil.mc.world.getEntitiesWithinAABB(Entity.class, bb).isEmpty() && CombatUtil.mc.player.getDistanceSq(pos) <= range * range && !raytraceCheck || CombatUtil.rayTraceRangeCheck(pos, wallsRange, 0.0); - } - - public static int getVulnerability(EntityPlayer player, double range, double placeRange, double wallsRange, double maxSelfDamage, double maxFriendDamage, double minDamage, double friendRange, double facePlaceHP, int minArmor, boolean cityCheck, boolean rayTrace, boolean lowArmorCheck, boolean antiSuicide, boolean antiFriendPop) { - if (CombatUtil.isInCity(player, range, placeRange, true, true, true, false) && cityCheck) { - return 5; - } - if (CombatUtil.getClosestValidPos(player, maxSelfDamage, maxFriendDamage, minDamage, placeRange, wallsRange, friendRange, rayTrace, antiSuicide, antiFriendPop, true) != null) { - return 4; - } - if ((double)(player.getHealth() + player.getAbsorptionAmount()) <= facePlaceHP) { - return 3; - } - if (CombatUtil.isArmorLow(player, minArmor, true) && lowArmorCheck) { - return 2; - } - return 0; - } - - public static Map mapBlockDamage(EntityPlayer player, double maxSelfDamage, double maxFriendDamage, double minDamage, double placeRange, double wallsRange, double friendRange, boolean rayTrace, boolean antiSuicide, boolean antiFriendPop) { - HashMap damageMap = new HashMap(); - for (BlockPos pos : CombatUtil.getSphere(new BlockPos((Vec3i)CombatUtil.getFlooredPosition((Entity)CombatUtil.mc.player)), (float)placeRange, (int)placeRange, false, true, 0)) { - double damage; - if (!CombatUtil.canPlaceCrystal(pos, placeRange, wallsRange, rayTrace) || !CombatUtil.checkFriends(pos, maxFriendDamage, friendRange, antiFriendPop) || !CombatUtil.checkSelf(pos, maxSelfDamage, antiSuicide) || rayTrace && !CombatUtil.rayTraceRangeCheck(pos, wallsRange, 0.0) || (damage = (double)CombatUtil.calculateDamage(pos, (Entity)player)) < minDamage) continue; - damageMap.put(pos, damage); - } - return damageMap; - } - - public static boolean checkFriends(BlockPos pos, double maxFriendDamage, double friendRange, boolean antiFriendPop) { - for (EntityPlayer player : CombatUtil.mc.world.playerEntities) { - if (CombatUtil.mc.player.getDistanceSq((Entity)player) > friendRange * friendRange) continue; - if ((double)CombatUtil.calculateDamage(pos, (Entity)player) > maxFriendDamage) { - return false; - } - if (!(CombatUtil.calculateDamage(pos, (Entity)player) > player.getHealth() + player.getAbsorptionAmount()) || !antiFriendPop) continue; - return false; - } - return true; - } - - public static boolean checkFriends(EntityEnderCrystal crystal, double maxFriendDamage, double friendRange, boolean antiFriendPop) { - for (EntityPlayer player : CombatUtil.mc.world.playerEntities) { - if (CombatUtil.mc.player.getDistanceSq((Entity)player) > friendRange * friendRange) continue; - if ((double)CombatUtil.calculateDamage((Entity)crystal, (Entity)player) > maxFriendDamage) { - return false; - } - if (!(CombatUtil.calculateDamage((Entity)crystal, (Entity)player) > player.getHealth() + player.getAbsorptionAmount()) || !antiFriendPop) continue; - return false; - } - return true; - } - - public static boolean checkSelf(BlockPos pos, double maxSelfDamage, boolean antiSuicide) { - boolean willPopSelf = CombatUtil.calculateDamage(pos, (Entity)CombatUtil.mc.player) > CombatUtil.mc.player.getHealth() + CombatUtil.mc.player.getAbsorptionAmount(); - boolean willDamageSelf = (double)CombatUtil.calculateDamage(pos, (Entity)CombatUtil.mc.player) > maxSelfDamage; - return (!antiSuicide || !willPopSelf) && !willDamageSelf; - } - - public static boolean checkSelf(EntityEnderCrystal crystal, double maxSelfDamage, boolean antiSuicide) { - boolean willPopSelf = CombatUtil.calculateDamage((Entity)crystal, (Entity)CombatUtil.mc.player) > CombatUtil.mc.player.getHealth() + CombatUtil.mc.player.getAbsorptionAmount(); - boolean willDamageSelf = (double)CombatUtil.calculateDamage((Entity)crystal, (Entity)CombatUtil.mc.player) > maxSelfDamage; - return (!antiSuicide || !willPopSelf) && !willDamageSelf; - } - - public static boolean isPosValid(EntityPlayer player, BlockPos pos, double maxSelfDamage, double maxFriendDamage, double minDamage, double placeRange, double wallsRange, double friendRange, boolean rayTrace, boolean antiSuicide, boolean antiFriendPop) { - if (pos == null) { - return false; - } - if (!CombatUtil.isHard(CombatUtil.mc.world.getBlockState(pos).getBlock())) { - return false; - } - if (!CombatUtil.canPlaceCrystal(pos, placeRange, wallsRange, rayTrace)) { - return false; - } - if (!CombatUtil.checkFriends(pos, maxFriendDamage, friendRange, antiFriendPop)) { - return false; - } - if (!CombatUtil.checkSelf(pos, maxSelfDamage, antiSuicide)) { - return false; - } - double damage = CombatUtil.calculateDamage(pos, (Entity)player); - if (damage < minDamage) { - return false; - } - return !rayTrace || CombatUtil.rayTraceRangeCheck(pos, wallsRange, 0.0); - } - - public static BlockPos getClosestValidPos(EntityPlayer player, double maxSelfDamage, double maxFriendDamage, double minDamage, double placeRange, double wallsRange, double friendRange, boolean rayTrace, boolean antiSuicide, boolean antiFriendPop, boolean multiplace) { - double highestDamage = -1.0; - BlockPos finalPos = null; - if (player == null) { - return null; - } - List placeLocations = CombatUtil.getSphere(new BlockPos((Vec3i)CombatUtil.getFlooredPosition((Entity)CombatUtil.mc.player)), (float)placeRange, (int)placeRange, false, true, 0); - placeLocations.sort(Comparator.comparing(blockPos -> CombatUtil.mc.player.getDistanceSq(blockPos))); - for (BlockPos pos : placeLocations) { - double damage; - if (!CombatUtil.canPlaceCrystal(pos, placeRange, wallsRange, rayTrace) || rayTrace && !CombatUtil.rayTraceRangeCheck(pos, wallsRange, 0.0) || (damage = (double)CombatUtil.calculateDamage(pos, (Entity)player)) < minDamage || !CombatUtil.checkFriends(pos, maxFriendDamage, friendRange, antiFriendPop) || !CombatUtil.checkSelf(pos, maxSelfDamage, antiSuicide)) continue; - if (damage > 15.0) { - return pos; - } - if (!(damage > highestDamage)) continue; - highestDamage = damage; - finalPos = pos; - } - return finalPos; - } - - public static BlockPos getClosestValidPosMultiThread(EntityPlayer player, double maxSelfDamage, double maxFriendDamage, double minDamage, double placeRange, double wallsRange, double friendRange, boolean rayTrace, boolean antiSuicide, boolean antiFriendPop) { - CopyOnWriteArrayList threads = new CopyOnWriteArrayList(); - BlockPos finalPos = null; - for (BlockPos pos : CombatUtil.getSphere(new BlockPos(player.getPositionVector()), 13.0f, 13, false, true, 0)) { - ValidPosThread thread2 = new ValidPosThread(player, pos, maxSelfDamage, maxFriendDamage, minDamage, placeRange, wallsRange, friendRange, rayTrace, antiSuicide, antiFriendPop); - threads.add(thread2); - thread2.start(); - } - boolean areAllInvalid = false; - do { - for (ValidPosThread thread2 : threads) { - if (!thread2.isInterrupted() || !thread2.isValid) continue; - finalPos = thread2.pos; - } - areAllInvalid = threads.stream().noneMatch(thread -> thread.isValid && thread.isInterrupted()); - } while (finalPos == null && !areAllInvalid); - InfinityLoop.LOGGER.info(finalPos == null ? "pos was null" : finalPos.toString()); - return finalPos; - } - - public static List getSphere(BlockPos pos, float r, int h, boolean hollow, boolean sphere, int plus_y) { - ArrayList circleblocks = new ArrayList(); - int cx = pos.getX(); - int cy = pos.getY(); - int cz = pos.getZ(); - int x = cx - (int)r; - while ((float)x <= (float)cx + r) { - int z = cz - (int)r; - while ((float)z <= (float)cz + r) { - int y = sphere ? cy - (int)r : cy; - while (true) { - float f = y; - float f2 = sphere ? (float)cy + r : (float)(cy + h); - if (!(f < f2)) break; - double dist = (cx - x) * (cx - x) + (cz - z) * (cz - z) + (sphere ? (cy - y) * (cy - y) : 0); - if (!(!(dist < (double)(r * r)) || hollow && dist < (double)((r - 1.0f) * (r - 1.0f)))) { - BlockPos l = new BlockPos(x, y + plus_y, z); - circleblocks.add(l); - } - ++y; - } - ++z; - } - ++x; - } - return circleblocks; - } - - public static boolean isArmorLow(EntityPlayer player, int durability, boolean checkDurability) { - for (ItemStack piece : player.inventory.armorInventory) { - if (piece == null) { - return true; - } - if (!checkDurability || CombatUtil.getItemDamage(piece) >= durability) continue; - return true; - } - return false; - } - - public static int getItemDamage(ItemStack stack) { - return stack.getMaxDamage() - stack.getItemDamage(); - } - - public static boolean rayTraceRangeCheck(Entity target, double range) { - boolean isVisible = CombatUtil.mc.player.canEntityBeSeen(target); - return !isVisible || CombatUtil.mc.player.getDistanceSq(target) <= range * range; - } - - public static boolean rayTraceRangeCheck(BlockPos pos, double range, double height) { - RayTraceResult result = CombatUtil.mc.world.rayTraceBlocks(new Vec3d(CombatUtil.mc.player.posX, CombatUtil.mc.player.posY + (double)CombatUtil.mc.player.getEyeHeight(), CombatUtil.mc.player.posZ), new Vec3d((double)pos.getX(), (double)pos.getY() + height, (double)pos.getZ()), false, true, false); - return result == null || CombatUtil.mc.player.getDistanceSq(pos) <= range * range; - } - - public static EntityEnderCrystal getClosestValidCrystal(EntityPlayer player, double maxSelfDamage, double maxFriendDamage, double minDamage, double breakRange, double wallsRange, double friendRange, boolean rayTrace, boolean antiSuicide, boolean antiFriendPop) { - if (player == null) { - return null; - } - List crystals = CombatUtil.mc.world.loadedEntityList.stream().filter(entity -> entity instanceof EntityEnderCrystal).filter(entity -> CombatUtil.mc.player.getDistanceSq(entity) <= breakRange * breakRange).sorted(Comparator.comparingDouble(entity -> CombatUtil.mc.player.getDistanceSq(entity))).map(entity -> (EntityEnderCrystal)entity).collect(Collectors.toList()); - for (Object crystal : crystals) { - if (rayTrace && !CombatUtil.rayTraceRangeCheck((Entity)crystal, wallsRange) || (double)CombatUtil.calculateDamage((Entity)crystal, (Entity)player) < minDamage || !CombatUtil.checkSelf((BlockPos) crystal, maxSelfDamage, antiSuicide) || !CombatUtil.checkFriends((BlockPos) crystal, maxFriendDamage, friendRange, antiFriendPop)) continue; - return (EntityEnderCrystal) crystal; - } - return null; - } - - public static List getDisc(BlockPos pos, float r) { - ArrayList circleblocks = new ArrayList(); - int cx = pos.getX(); - int cy = pos.getY(); - int cz = pos.getZ(); - int x = cx - (int)r; - while ((float)x <= (float)cx + r) { - int z = cz - (int)r; - while ((float)z <= (float)cz + r) { - double dist = (cx - x) * (cx - x) + (cz - z) * (cz - z); - if (dist < (double)(r * r)) { - BlockPos position = new BlockPos(x, cy, z); - circleblocks.add(position); - } - ++z; - } - ++x; - } - return circleblocks; - } - - public static BlockPos getFlooredPosition(Entity entity) { - return new BlockPos(Math.floor(entity.posX), Math.floor(entity.posY), Math.floor(entity.posZ)); - } - - public static float calculateDamage(double posX, double posY, double posZ, Entity entity) { - float doubleExplosionSize = 12.0f; - double distancedsize = entity.getDistance(posX, posY, posZ) / (double)doubleExplosionSize; - Vec3d vec3d = new Vec3d(posX, posY, posZ); - double blockDensity = 0.0; - try { - blockDensity = entity.world.getBlockDensity(vec3d, entity.getEntityBoundingBox()); - } - catch (Exception exception) { - // empty catch block - } - double v = (1.0 - distancedsize) * blockDensity; - float damage = (int)((v * v + v) / 2.0 * 7.0 * (double)doubleExplosionSize + 1.0); - double finald = 1.0; - if (entity instanceof EntityLivingBase) { - finald = CombatUtil.getBlastReduction((EntityLivingBase)entity, CombatUtil.getDamageMultiplied(damage), new Explosion((World)Minecraft.getMinecraft().world, null, posX, posY, posZ, 6.0f, false, true)); - } - return (float)finald; - } - - public static float getBlastReduction(EntityLivingBase entity, float damageI, Explosion explosion) { - float damage = damageI; - if (entity instanceof EntityPlayer) { - EntityPlayer ep = (EntityPlayer)entity; - DamageSource ds = DamageSource.causeExplosionDamage((Explosion)explosion); - damage = CombatRules.getDamageAfterAbsorb((float)damage, (float)ep.getTotalArmorValue(), (float)((float)ep.getEntityAttribute(SharedMonsterAttributes.ARMOR_TOUGHNESS).getAttributeValue())); - int k = 0; - try { - k = EnchantmentHelper.getEnchantmentModifierDamage((Iterable)ep.getArmorInventoryList(), (DamageSource)ds); - } - catch (Exception exception) { - // empty catch block - } - float f = MathHelper.clamp((float)k, (float)0.0f, (float)20.0f); - damage *= 1.0f - f / 25.0f; - if (entity.isPotionActive(MobEffects.RESISTANCE)) { - damage -= damage / 4.0f; - } - damage = Math.max(damage, 0.0f); - return damage; - } - damage = CombatRules.getDamageAfterAbsorb((float)damage, (float)entity.getTotalArmorValue(), (float)((float)entity.getEntityAttribute(SharedMonsterAttributes.ARMOR_TOUGHNESS).getAttributeValue())); - return damage; - } - - public static float getDamageMultiplied(float damage) { - int diff = Minecraft.getMinecraft().world.getDifficulty().getId(); - return damage * (diff == 0 ? 0.0f : (diff == 2 ? 1.0f : (diff == 1 ? 0.5f : 1.5f))); - } - - public static float calculateDamage(Entity crystal, Entity entity) { - return CombatUtil.calculateDamage(crystal.posX, crystal.posY, crystal.posZ, entity); - } - - public static float calculateDamage(BlockPos pos, Entity entity) { - return CombatUtil.calculateDamage((double)pos.getX() + 0.5, pos.getY() + 1, (double)pos.getZ() + 0.5, entity); - } - - public static Vec3d interpolateEntity(Entity entity) { - return new Vec3d(entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double)mc.getRenderPartialTicks(), entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double)mc.getRenderPartialTicks(), entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double)mc.getRenderPartialTicks()); - } - - public static float[] calcAngle(Vec3d from, Vec3d to) { - double difX = to.x - from.x; - double difY = (to.y - from.y) * -1.0; - double difZ = to.z - from.z; - double dist = MathHelper.sqrt((double)(difX * difX + difZ * difZ)); - return new float[]{(float)MathHelper.wrapDegrees((double)(Math.toDegrees(Math.atan2(difZ, difX)) - 90.0)), (float)MathHelper.wrapDegrees((double)Math.toDegrees(Math.atan2(difY, dist)))}; - } - - public static float[] getLegitRotations(Vec3d vec) { - Vec3d eyesPos = new Vec3d(CombatUtil.mc.player.posX, CombatUtil.mc.player.posY + (double)CombatUtil.mc.player.getEyeHeight(), CombatUtil.mc.player.posZ); - double diffX = vec.x - eyesPos.x; - double diffY = vec.y - eyesPos.y; - double diffZ = vec.z - eyesPos.z; - double diffXZ = Math.sqrt(diffX * diffX + diffZ * diffZ); - float yaw = (float)Math.toDegrees(Math.atan2(diffZ, diffX)) - 90.0f; - float pitch = (float)(-Math.toDegrees(Math.atan2(diffY, diffXZ))); - return new float[]{CombatUtil.mc.player.rotationYaw + MathHelper.wrapDegrees((float)(yaw - CombatUtil.mc.player.rotationYaw)), CombatUtil.mc.player.rotationPitch + MathHelper.wrapDegrees((float)(pitch - CombatUtil.mc.player.rotationPitch))}; - } - - public static class CombatPosInfo { - public EntityPlayer player; - public BlockPos pos; - public float damage; - - public CombatPosInfo(EntityPlayer player, BlockPos pos, float damage) { - this.pos = pos; - this.damage = damage; - this.player = player; - } - } - - public static class ValidPosThread - extends Thread { - BlockPos pos; - EntityPlayer player; - double maxSelfDamage; - double maxFriendDamage; - double minDamage; - double placeRange; - double wallsRange; - double friendRange; - boolean rayTrace; - boolean antiSuicide; - boolean antiFriendPop; - public float damage; - public boolean isValid; - public CombatPosInfo info; - - public ValidPosThread(EntityPlayer player, BlockPos pos, double maxSelfDamage, double maxFriendDamage, double minDamage, double placeRange, double wallsRange, double friendRange, boolean rayTrace, boolean antiSuicide, boolean antiFriendPop) { - super("Break"); - this.pos = pos; - this.maxSelfDamage = maxSelfDamage; - this.maxFriendDamage = maxFriendDamage; - this.minDamage = minDamage; - this.placeRange = placeRange; - this.wallsRange = wallsRange; - this.friendRange = friendRange; - this.rayTrace = rayTrace; - this.antiSuicide = antiSuicide; - this.antiFriendPop = antiFriendPop; - this.player = player; - } - - @Override - public void run() { - if (!(mc.player.getDistanceSq(this.pos) > this.placeRange * this.placeRange) && CombatUtil.canPlaceCrystal(this.pos, this.placeRange, this.wallsRange, this.rayTrace) && CombatUtil.checkFriends(this.pos, this.maxFriendDamage, this.friendRange, this.antiFriendPop) && CombatUtil.checkSelf(this.pos, this.maxSelfDamage, this.antiSuicide)) { - this.damage = CombatUtil.calculateDamage(this.pos, (Entity)this.player); - if ((double)this.damage >= this.minDamage && (!this.rayTrace || CombatUtil.rayTraceRangeCheck(this.pos, this.wallsRange, 0.0))) { - this.isValid = true; - this.info = new CombatPosInfo(this.player, this.pos, this.damage); - InfinityLoop.LOGGER.info("Pos was valid."); - return; - } - } - this.isValid = false; - this.info = new CombatPosInfo(this.player, this.pos, -1.0f); - InfinityLoop.LOGGER.info("Pos was invalid."); - } - } -} diff --git a/src/main/java/com/me/infinity/loop/util/utils/GeometryMasks.java b/src/main/java/com/me/infinity/loop/util/utils/GeometryMasks.java deleted file mode 100644 index 3009dcc..0000000 --- a/src/main/java/com/me/infinity/loop/util/utils/GeometryMasks.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.me.infinity.loop.util.utils; - -import net.minecraft.util.EnumFacing; - -import java.util.HashMap; - -public final class GeometryMasks { - - public static final HashMap FACEMAP = new HashMap<>(); - - static { - FACEMAP.put(EnumFacing.DOWN, Quad.DOWN); - FACEMAP.put(EnumFacing.WEST, Quad.WEST); - FACEMAP.put(EnumFacing.NORTH, Quad.NORTH); - FACEMAP.put(EnumFacing.SOUTH, Quad.SOUTH); - FACEMAP.put(EnumFacing.EAST, Quad.EAST); - FACEMAP.put(EnumFacing.UP, Quad.UP); - } - - public static final class Quad { - public static final int DOWN = 0x01; - public static final int UP = 0x02; - public static final int NORTH = 0x04; - public static final int SOUTH = 0x08; - public static final int WEST = 0x10; - public static final int EAST = 0x20; - public static final int ALL = DOWN | UP | NORTH | SOUTH | WEST | EAST; - } - - public static final class Line { - public static final int DOWN_WEST = 0x11; - public static final int UP_WEST = 0x12; - public static final int DOWN_EAST = 0x21; - public static final int UP_EAST = 0x22; - public static final int DOWN_NORTH = 0x05; - public static final int UP_NORTH = 0x06; - public static final int DOWN_SOUTH = 0x09; - public static final int UP_SOUTH = 0x0A; - public static final int NORTH_WEST = 0x14; - public static final int NORTH_EAST = 0x24; - public static final int SOUTH_WEST = 0x18; - public static final int SOUTH_EAST = 0x28; - public static final int ALL = DOWN_WEST | UP_WEST | DOWN_EAST | UP_EAST | DOWN_NORTH | UP_NORTH | DOWN_SOUTH | UP_SOUTH | NORTH_WEST | NORTH_EAST | SOUTH_WEST | SOUTH_EAST; - } -} diff --git a/src/main/java/com/me/infinity/loop/util/utils/HoleUtil.java b/src/main/java/com/me/infinity/loop/util/utils/HoleUtil.java deleted file mode 100644 index 6c5f181..0000000 --- a/src/main/java/com/me/infinity/loop/util/utils/HoleUtil.java +++ /dev/null @@ -1,262 +0,0 @@ -package com.me.infinity.loop.util.utils; - -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import net.minecraft.block.Block; -import net.minecraft.client.Minecraft; -import net.minecraft.entity.Entity; -import net.minecraft.init.Blocks; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; -import net.minecraft.util.math.Vec3i; - -public class HoleUtil { - public static final List holeBlocks = Arrays.asList(new BlockPos(0, -1, 0), new BlockPos(0, 0, -1), new BlockPos(-1, 0, 0), new BlockPos(1, 0, 0), new BlockPos(0, 0, 1)); - private static Minecraft mc = Minecraft.getMinecraft(); - public static final Vec3d[] cityOffsets = new Vec3d[]{new Vec3d(1.0, 0.0, 0.0), new Vec3d(0.0, 0.0, 1.0), new Vec3d(-1.0, 0.0, 0.0), new Vec3d(0.0, 0.0, -1.0)}; - - public static boolean isInHole() { - Vec3d playerPos = CombatUtil.interpolateEntity((Entity)HoleUtil.mc.player); - BlockPos blockpos = new BlockPos(playerPos.x, playerPos.y, playerPos.z); - int size = 0; - for (BlockPos bPos : holeBlocks) { - if (!CombatUtil.isHard(HoleUtil.mc.world.getBlockState(blockpos.add((Vec3i)bPos)).getBlock())) continue; - ++size; - } - return size == 5; - } - - public static BlockSafety isBlockSafe(Block block) { - if (block == Blocks.BEDROCK) { - return BlockSafety.UNBREAKABLE; - } - if (block == Blocks.OBSIDIAN || block == Blocks.ENDER_CHEST || block == Blocks.ANVIL) { - return BlockSafety.RESISTANT; - } - return BlockSafety.BREAKABLE; - } - - public static HoleInfo isHole(BlockPos centreBlock, boolean onlyOneWide, boolean ignoreDown) { - HoleInfo output = new HoleInfo(); - HashMap unsafeSides = HoleUtil.getUnsafeSides(centreBlock); - if (unsafeSides.containsKey((Object)BlockOffset.DOWN) && unsafeSides.remove((Object)BlockOffset.DOWN, (Object)BlockSafety.BREAKABLE) && !ignoreDown) { - output.setSafety(BlockSafety.BREAKABLE); - return output; - } - int size = unsafeSides.size(); - unsafeSides.entrySet().removeIf(entry -> entry.getValue() == BlockSafety.RESISTANT); - if (unsafeSides.size() != size) { - output.setSafety(BlockSafety.RESISTANT); - } - if ((size = unsafeSides.size()) == 0) { - output.setType(HoleType.SINGLE); - output.setCentre(new AxisAlignedBB(centreBlock)); - return output; - } - if (size == 1 && !onlyOneWide) { - return HoleUtil.isDoubleHole(output, centreBlock, (BlockOffset)((Object)unsafeSides.keySet().stream().findFirst().get())); - } - output.setSafety(BlockSafety.BREAKABLE); - return output; - } - - public static BlockPos is2Hole(BlockPos pos) { - if (isHole(pos)) - return null; - BlockPos blockpos = pos; - BlockPos blockpos2 = null; - int size = 0; - int size2 = 0; - if (mc.world.getBlockState(pos).getBlock() != Blocks.AIR) - return null; - for (BlockPos bPos : holeBlocks) { - if (mc.world.getBlockState(blockpos.add((Vec3i)bPos)).getBlock() == Blocks.AIR && blockpos.add((Vec3i)bPos) != new BlockPos(bPos.getX(), bPos.getY() - 1, bPos.getZ())) { - blockpos2 = blockpos.add((Vec3i)bPos); - size++; - } - } - if (size == 1) { - for (BlockPos bPoss : holeBlocks) { - if (mc.world.getBlockState(blockpos.add((Vec3i)bPoss)).getBlock() == Blocks.BEDROCK || mc.world.getBlockState(blockpos.add((Vec3i)bPoss)).getBlock() == Blocks.OBSIDIAN) - size2++; - } - for (BlockPos bPoss : holeBlocks) { - if (mc.world.getBlockState(blockpos2.add((Vec3i)bPoss)).getBlock() == Blocks.BEDROCK || mc.world.getBlockState(blockpos2.add((Vec3i)bPoss)).getBlock() == Blocks.OBSIDIAN) - size2++; - } - } - if (size2 == 8) - return blockpos2; - return null; - } - - public static boolean isHole(BlockPos pos) { - BlockPos blockpos = pos; - int size = 0; - for (BlockPos bPos : holeBlocks) { - if (CombatUtil.isHard(mc.world.getBlockState(blockpos.add((Vec3i)bPos)).getBlock())) - size++; - } - return (size == 5); - } - - public static boolean is2securityHole(BlockPos pos) { - if (is2Hole(pos) == null) - return false; - BlockPos blockpos = pos; - BlockPos blockpos2 = is2Hole(pos); - int size = 0; - for (BlockPos bPoss : holeBlocks) { - if (mc.world.getBlockState(blockpos.add((Vec3i)bPoss)).getBlock() == Blocks.BEDROCK) - size++; - } - for (BlockPos bPoss : holeBlocks) { - if (mc.world.getBlockState(blockpos2.add((Vec3i)bPoss)).getBlock() == Blocks.BEDROCK) - size++; - } - return (size == 8); - } - - private static HoleInfo isDoubleHole(HoleInfo info, BlockPos centreBlock, BlockOffset weakSide) { - BlockPos unsafePos = weakSide.offset(centreBlock); - HashMap unsafeSides = HoleUtil.getUnsafeSides(unsafePos); - int size = unsafeSides.size(); - unsafeSides.entrySet().removeIf(entry -> entry.getValue() == BlockSafety.RESISTANT); - if (unsafeSides.size() != size) { - info.setSafety(BlockSafety.RESISTANT); - } - if (unsafeSides.containsKey((Object)BlockOffset.DOWN)) { - info.setType(HoleType.CUSTOM); - unsafeSides.remove((Object)BlockOffset.DOWN); - } - if (unsafeSides.size() > 1) { - info.setType(HoleType.NONE); - return info; - } - double minX = Math.min(centreBlock.getX(), unsafePos.getX()); - double maxX = Math.max(centreBlock.getX(), unsafePos.getX()) + 1; - double minZ = Math.min(centreBlock.getZ(), unsafePos.getZ()); - double maxZ = Math.max(centreBlock.getZ(), unsafePos.getZ()) + 1; - info.setCentre(new AxisAlignedBB(minX, (double)centreBlock.getY(), minZ, maxX, (double)(centreBlock.getY() + 1), maxZ)); - if (info.getType() != HoleType.CUSTOM) { - info.setType(HoleType.DOUBLE); - } - return info; - } - - public static HashMap getUnsafeSides(BlockPos pos) { - HashMap output = new HashMap(); - BlockSafety temp = HoleUtil.isBlockSafe(HoleUtil.mc.world.getBlockState(BlockOffset.DOWN.offset(pos)).getBlock()); - if (temp != BlockSafety.UNBREAKABLE) { - output.put(BlockOffset.DOWN, temp); - } - if ((temp = HoleUtil.isBlockSafe(HoleUtil.mc.world.getBlockState(BlockOffset.NORTH.offset(pos)).getBlock())) != BlockSafety.UNBREAKABLE) { - output.put(BlockOffset.NORTH, temp); - } - if ((temp = HoleUtil.isBlockSafe(HoleUtil.mc.world.getBlockState(BlockOffset.SOUTH.offset(pos)).getBlock())) != BlockSafety.UNBREAKABLE) { - output.put(BlockOffset.SOUTH, temp); - } - if ((temp = HoleUtil.isBlockSafe(HoleUtil.mc.world.getBlockState(BlockOffset.EAST.offset(pos)).getBlock())) != BlockSafety.UNBREAKABLE) { - output.put(BlockOffset.EAST, temp); - } - if ((temp = HoleUtil.isBlockSafe(HoleUtil.mc.world.getBlockState(BlockOffset.WEST.offset(pos)).getBlock())) != BlockSafety.UNBREAKABLE) { - output.put(BlockOffset.WEST, temp); - } - return output; - } - - public static enum BlockOffset { - DOWN(0, -1, 0), - UP(0, 1, 0), - NORTH(0, 0, -1), - EAST(1, 0, 0), - SOUTH(0, 0, 1), - WEST(-1, 0, 0); - - private final int x; - private final int y; - private final int z; - - private BlockOffset(int x, int y, int z) { - this.x = x; - this.y = y; - this.z = z; - } - - public BlockPos offset(BlockPos pos) { - return pos.add(this.x, this.y, this.z); - } - - public BlockPos forward(BlockPos pos, int scale) { - return pos.add(this.x * scale, 0, this.z * scale); - } - - public BlockPos backward(BlockPos pos, int scale) { - return pos.add(-this.x * scale, 0, -this.z * scale); - } - - public BlockPos left(BlockPos pos, int scale) { - return pos.add(this.z * scale, 0, -this.x * scale); - } - - public BlockPos right(BlockPos pos, int scale) { - return pos.add(-this.z * scale, 0, this.x * scale); - } - } - - public static class HoleInfo { - private HoleType type; - private BlockSafety safety; - private AxisAlignedBB centre; - - public HoleInfo() { - this(BlockSafety.UNBREAKABLE, HoleType.NONE); - } - - public HoleInfo(BlockSafety safety, HoleType type) { - this.type = type; - this.safety = safety; - } - - public void setType(HoleType type) { - this.type = type; - } - - public void setSafety(BlockSafety safety) { - this.safety = safety; - } - - public void setCentre(AxisAlignedBB centre) { - this.centre = centre; - } - - public HoleType getType() { - return this.type; - } - - public BlockSafety getSafety() { - return this.safety; - } - - public AxisAlignedBB getCentre() { - return this.centre; - } - } - - public static enum HoleType { - SINGLE, - DOUBLE, - CUSTOM, - NONE; - - } - - public static enum BlockSafety { - UNBREAKABLE, - RESISTANT, - BREAKABLE; - - } -} diff --git a/src/main/java/com/me/infinity/loop/util/utils/IconUtils.java b/src/main/java/com/me/infinity/loop/util/utils/IconUtils.java deleted file mode 100644 index d101dbc..0000000 --- a/src/main/java/com/me/infinity/loop/util/utils/IconUtils.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.me.infinity.loop.util.utils; - -import java.nio.*; -import javax.imageio.*; -import java.util.*; -import java.awt.image.*; -import java.io.*; - -public class IconUtils -{ - public static final IconUtils INSTANCE; - - public ByteBuffer readImageToBuffer(final InputStream inputStream) throws IOException { - final BufferedImage bufferedimage = ImageIO.read(inputStream); - final int[] aint = bufferedimage.getRGB(0, 0, bufferedimage.getWidth(), bufferedimage.getHeight(), null, 0, bufferedimage.getWidth()); - final ByteBuffer bytebuffer = ByteBuffer.allocate(4 * aint.length); - Arrays.stream(aint).map(i -> i << 8 | (i >> 24 & 0xFF)).forEach(bytebuffer::putInt); - bytebuffer.flip(); - return bytebuffer; - } - - static { - INSTANCE = new IconUtils(); - } -} diff --git a/src/main/java/com/me/infinity/loop/util/utils/MotionUtil.java b/src/main/java/com/me/infinity/loop/util/utils/MotionUtil.java deleted file mode 100644 index fc489e7..0000000 --- a/src/main/java/com/me/infinity/loop/util/utils/MotionUtil.java +++ /dev/null @@ -1,173 +0,0 @@ -package com.me.infinity.loop.util.utils; - -import com.me.infinity.loop.event.events.network.MoveEvent; -import com.me.infinity.loop.mixin.MixinInterface; -import com.me.infinity.loop.util.utils.maths.MathUtil; -import net.minecraft.entity.Entity; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.text.TextFormatting; - -import java.text.DecimalFormat; - -/** - * @author linustouchtips - * @since 12/29/2020 - */ - -public class MotionUtil implements MixinInterface { - - public static void impressMoveSpeed(MoveEvent event, double speed, float stepHeight) { - float forward = mc.player.movementInput.moveForward; - float strafe = mc.player.movementInput.moveStrafe; - float yaw = mc.player.rotationYaw; - - if (!MotionUtil.isMoving()) { - event.setX(0.0); - event.setZ(0.0); - } - - else if (forward != 0.0f) { - if (strafe >= 1.0f) { - yaw += (float) (forward > 0.0f ? -45 : 45); - strafe = 0.0f; - } - - else if (strafe <= -1.0f) { - yaw += (float) (forward > 0.0f ? 45 : -45); - strafe = 0.0f; - } - - if (forward > 0.0f) - forward = 1.0f; - - else if (forward < 0.0f) - forward = -1.0f; - } - - final double sin = Math.sin(Math.toRadians(yaw + 90.0f)); - final double cos = Math.cos(Math.toRadians(yaw + 90.0f)); - - event.setX((double) forward * speed * cos + (double) strafe * speed * sin); - event.setZ((double) forward * speed * sin - (double) strafe * speed * cos); - mc.player.stepHeight = stepHeight; - - if (!MotionUtil.isMoving()) { - event.setX(0.0); - event.setZ(0.0); - } - } - - public static void setMoveSpeed(double speed, float stepHeight) { - Entity currentMover = mc.player.isRiding() ? mc.player.ridingEntity : mc.player; - - float forward = mc.player.movementInput.moveForward; - float strafe = mc.player.movementInput.moveStrafe; - float yaw = mc.player.rotationYaw; - - if (!MotionUtil.isMoving()) { - currentMover.motionX = 0; - currentMover.motionZ = 0; - } - - else if (forward != 0.0f) { - if (strafe >= 1.0f) { - yaw += (float) (forward > 0.0f ? -45 : 45); - strafe = 0.0f; - } - - else if (strafe <= -1.0f) { - yaw += (float) (forward > 0.0f ? 45 : -45); - strafe = 0.0f; - } - - if (forward > 0.0f) - forward = 1.0f; - - else if (forward < 0.0f) - forward = -1.0f; - } - - final double sin = Math.sin(Math.toRadians(yaw + 90.0f)); - final double cos = Math.cos(Math.toRadians(yaw + 90.0f)); - - currentMover.motionX = (double) forward * speed * cos + (double) strafe * speed * sin; - currentMover.motionZ = (double) forward * speed * sin - (double) strafe * speed * cos; - currentMover.stepHeight = stepHeight; - - if (!MotionUtil.isMoving()) { - currentMover.motionX = 0; - currentMover.motionZ = 0; - } - } - - public static double[] getMoveSpeed(double speed) { - float forward = mc.player.movementInput.moveForward; - float strafe = mc.player.movementInput.moveStrafe; - float yaw = mc.player.rotationYaw; - - double motionX; - double motionZ; - - if (forward != 0.0f) { - if (strafe >= 1.0f) { - yaw += (float) (forward > 0.0f ? -45 : 45); - strafe = 0.0f; - } - - else if (strafe <= -1.0f) { - yaw += (float) (forward > 0.0f ? 45 : -45); - strafe = 0.0f; - } - - if (forward > 0.0f) - forward = 1.0f; - - else if (forward < 0.0f) - forward = -1.0f; - } - - double sin = Math.sin(Math.toRadians(yaw + 90.0f)); - double cos = Math.cos(Math.toRadians(yaw + 90.0f)); - - motionX = (double) forward * speed * cos + (double) strafe * speed * sin; - motionZ = (double) forward * speed * sin - (double) strafe * speed * cos; - - if (!MotionUtil.isMoving()) { - motionX = 0; - motionZ = 0; - } - - return new double[] { - motionX, motionZ - }; - } - - public static boolean isMoving() { - return (mc.player.moveForward != 0.0D || mc.player.moveStrafing != 0.0D); - } - - public static String getSpeed() { - DecimalFormat formatter = new DecimalFormat("#.#"); - double deltaX = mc.player.posX - mc.player.prevPosX; - double deltaZ = mc.player.posZ - mc.player.prevPosZ; - - double KMH = MathUtil.roundAvoid((MathHelper.sqrt(deltaX * deltaX + deltaZ * deltaZ) / 1000.0f) / (0.05f / 3600.0f), 1); - - String formattedString = formatter.format(KMH); - - if (!formattedString.contains(".")) - formattedString += ".0"; - - return formattedString + TextFormatting.WHITE + " km/h"; - } - - public String format(double input) { - DecimalFormat formatter = new DecimalFormat("#.#"); - String result = formatter.format(input); - - if (!result.contains(".")) - result += ".0"; - - return result; - } -} diff --git a/src/main/java/com/me/infinity/loop/util/utils/RotationUtil.java b/src/main/java/com/me/infinity/loop/util/utils/RotationUtil.java deleted file mode 100644 index 5c23f50..0000000 --- a/src/main/java/com/me/infinity/loop/util/utils/RotationUtil.java +++ /dev/null @@ -1,142 +0,0 @@ -package com.me.infinity.loop.util.utils; - -import com.me.infinity.loop.features.modules.client.GameChanger; -import com.me.infinity.loop.util.utils.maths.MathUtil; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.network.play.client.CPacketPlayer; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.Vec3d; - -public class RotationUtil - implements Util { - public static Vec3d getEyesPos() { - return new Vec3d(RotationUtil.mc.player.posX, RotationUtil.mc.player.posY + (double) RotationUtil.mc.player.getEyeHeight(), RotationUtil.mc.player.posZ); - } - - public static double[] calculateLookAt(double px, double py, double pz, EntityPlayer me) { - double dirx = me.posX - px; - double diry = me.posY - py; - double dirz = me.posZ - pz; - double len = Math.sqrt(dirx * dirx + diry * diry + dirz * dirz); - double pitch = Math.asin(diry /= len); - double yaw = Math.atan2(dirz /= len, dirx /= len); - pitch = pitch * 180.0 / Math.PI; - yaw = yaw * 180.0 / Math.PI; - return new double[]{yaw += 90.0, pitch}; - } - - public static float[] getLegitRotations(Vec3d vec) { - Vec3d eyesPos = RotationUtil.getEyesPos(); - double diffX = vec.x - eyesPos.x; - double diffY = vec.y - eyesPos.y; - double diffZ = vec.z - eyesPos.z; - double diffXZ = Math.sqrt(diffX * diffX + diffZ * diffZ); - float yaw = (float) Math.toDegrees(Math.atan2(diffZ, diffX)) - 90.0f; - float pitch = (float) (-Math.toDegrees(Math.atan2(diffY, diffXZ))); - return new float[]{RotationUtil.mc.player.rotationYaw + MathHelper.wrapDegrees(yaw - RotationUtil.mc.player.rotationYaw), RotationUtil.mc.player.rotationPitch + MathHelper.wrapDegrees(pitch - RotationUtil.mc.player.rotationPitch)}; - } - - public static float transformYaw() { - float yaw = mc.player.rotationYaw % 360.0f; - if (mc.player.rotationYaw > 0.0f) { - if (yaw > 180.0f) { - yaw = -180.0f + (yaw - 180.0f); - } - } else if (yaw < -180.0f) { - yaw = 180.0f + (yaw + 180.0f); - } - if (yaw < 0.0f) { - return 180.0f + yaw; - } - return -180.0f + yaw; - } - - public static boolean isInFov(BlockPos pos) { - return pos != null && (mc.player.getDistanceSq(pos) < 4.0 || RotationUtil.yawDist(pos) < (double) (RotationUtil.getHalvedfov() + 2.0f)); - } - - public static boolean isInFov(Entity entity) { - return entity != null && (mc.player.getDistanceSq(entity) < 4.0 || RotationUtil.yawDist(entity) < (double) (RotationUtil.getHalvedfov() + 2.0f)); - } - - public static double yawDist(BlockPos pos) { - if (pos != null) { - Vec3d difference = new Vec3d(pos).subtract(mc.player.getPositionEyes(mc.getRenderPartialTicks())); - double d = Math.abs((double) mc.player.rotationYaw - (Math.toDegrees(Math.atan2(difference.z, difference.x)) - 90.0)) % 360.0; - return d > 180.0 ? 360.0 - d : d; - } - return 0.0; - } - - public static double yawDist(Entity e) { - if (e != null) { - Vec3d difference = e.getPositionVector().add(0.0, e.getEyeHeight() / 2.0f, 0.0).subtract(mc.player.getPositionEyes(mc.getRenderPartialTicks())); - double d = Math.abs((double) mc.player.rotationYaw - (Math.toDegrees(Math.atan2(difference.z, difference.x)) - 90.0)) % 360.0; - return d > 180.0 ? 360.0 - d : d; - } - return 0.0; - } - - public static boolean isInFov(Vec3d vec3d, Vec3d other) { - if (mc.player.rotationPitch > 30.0f ? other.y > mc.player.posY : mc.player.rotationPitch < -30.0f && other.y < mc.player.posY) { - return true; - } - float angle = MathUtil.calcAngleNoY(vec3d, other)[0] - RotationUtil.transformYaw(); - if (angle < -270.0f) { - return true; - } - float fov = (GameChanger.getInstance().customFov.getValue() ? GameChanger.getInstance().fov.getValue().floatValue() : mc.gameSettings.fovSetting) / 2.0f; - return angle < fov + 10.0f && angle > -fov - 10.0f; - } - - public static float getFov() { - return GameChanger.getInstance().customFov.getValue() ? GameChanger.getInstance().fov.getValue().floatValue() : mc.gameSettings.fovSetting; - } - - public static float getHalvedfov() { - return RotationUtil.getFov() / 2.0f; - } - - - public static void faceYawAndPitch(float yaw, float pitch) { - RotationUtil.mc.player.connection.sendPacket(new CPacketPlayer.Rotation(yaw, pitch, RotationUtil.mc.player.onGround)); - } - - public static void faceVector(Vec3d vec, boolean normalizeAngle) { - float[] rotations = RotationUtil.getLegitRotations(vec); - RotationUtil.mc.player.connection.sendPacket(new CPacketPlayer.Rotation(rotations[0], normalizeAngle ? (float) MathHelper.normalizeAngle((int) rotations[1], 360) : rotations[1], RotationUtil.mc.player.onGround)); - } - - public static void faceEntity(Entity entity) { - float[] angle = MathUtil.calcAngle(RotationUtil.mc.player.getPositionEyes(mc.getRenderPartialTicks()), entity.getPositionEyes(mc.getRenderPartialTicks())); - RotationUtil.faceYawAndPitch(angle[0], angle[1]); - } - - public static float[] getAngle(Entity entity) { - return MathUtil.calcAngle(RotationUtil.mc.player.getPositionEyes(mc.getRenderPartialTicks()), entity.getPositionEyes(mc.getRenderPartialTicks())); - } - - public static int getDirection4D() { - return MathHelper.floor((double) (RotationUtil.mc.player.rotationYaw * 4.0f / 360.0f) + 0.5) & 3; - } - - public static String getDirection4D(boolean northRed) { - int dirnumber = RotationUtil.getDirection4D(); - if (dirnumber == 0) { - return "South (+Z)"; - } - if (dirnumber == 1) { - return "West (-X)"; - } - if (dirnumber == 2) { - return (northRed ? "\u00c2\u00a7c" : "") + "North (-Z)"; - } - if (dirnumber == 3) { - return "East (+X)"; - } - return "Loading..."; - } -} - diff --git a/src/main/java/com/me/infinity/loop/util/utils/Util.java b/src/main/java/com/me/infinity/loop/util/utils/Util.java deleted file mode 100644 index 889dbd2..0000000 --- a/src/main/java/com/me/infinity/loop/util/utils/Util.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.me.infinity.loop.util.utils; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.renderer.entity.RenderManager; - -import java.util.Objects; - -public interface Util { - Minecraft mc = Objects.requireNonNull(Minecraft.getMinecraft()); - FontRenderer fr = mc.fontRenderer; - RenderManager rendermgr = mc.getRenderManager(); -} - - diff --git a/src/main/java/com/me/infinity/loop/util/utils/interfaces/IFontRenderer.java b/src/main/java/com/me/infinity/loop/util/utils/interfaces/IFontRenderer.java deleted file mode 100644 index ef6175f..0000000 --- a/src/main/java/com/me/infinity/loop/util/utils/interfaces/IFontRenderer.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.me.infinity.loop.util.utils.interfaces; - -public interface IFontRenderer { - - int drawString(String text, float x, float y, int color); - - int drawStringWithShadow(String text, float x, float y, int color); - - int drawCenteredString(String text, float x, float y, int color); - - float getStringWidth(String text); - - int getFontHeight(); - - float getStringHeight(String text); -} diff --git a/src/main/java/com/me/infinity/loop/util/utils/interfaces/Nameable.java b/src/main/java/com/me/infinity/loop/util/utils/interfaces/Nameable.java deleted file mode 100644 index ff168e1..0000000 --- a/src/main/java/com/me/infinity/loop/util/utils/interfaces/Nameable.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.me.infinity.loop.util.utils.interfaces; - -public interface Nameable -{ - String getName(); - -} diff --git a/src/main/java/com/me/infinity/loop/util/utils/maths/AstolfoAnimation.java b/src/main/java/com/me/infinity/loop/util/utils/maths/AstolfoAnimation.java deleted file mode 100644 index 5e3ba38..0000000 --- a/src/main/java/com/me/infinity/loop/util/utils/maths/AstolfoAnimation.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.me.infinity.loop.util.utils.maths; - -import net.minecraft.client.Minecraft; - -public class AstolfoAnimation { - private double value, prevValue; - - public void update() { - this.prevValue = this.value; - this.value += 0.01; - } - - public int getColor(double offset) { - double hue = ((this.prevValue + (this.value - this.prevValue) * Minecraft.getMinecraft().getRenderPartialTicks()) + offset) % 1.; - if (hue > 0.5F) { - hue = 0.5F - (hue - 0.5F); - } - hue += 0.5F; - return HSBtoRGB((float) hue, 0.5f, 1); - } - - public static int HSBtoRGB(float hue, float saturation, float brightness) { - int r = 0, g = 0, b = 0; - if (saturation == 0) { - r = g = b = (int) (brightness * 255.0f + 0.5f); - } else { - float h = (hue - (float) Math.floor(hue)) * 6.0f; - float f = h - (float) Math.floor(h); - float p = brightness * (1.0f - saturation); - float q = brightness * (1.0f - saturation * f); - float t = brightness * (1.0f - (saturation * (1.0f - f))); - switch ((int) h) { - case 0: - r = (int) (brightness * 255.0f + 0.5f); - g = (int) (t * 255.0f + 0.5f); - b = (int) (p * 255.0f + 0.5f); - break; - case 1: - r = (int) (q * 255.0f + 0.5f); - g = (int) (brightness * 255.0f + 0.5f); - b = (int) (p * 255.0f + 0.5f); - break; - case 2: - r = (int) (p * 255.0f + 0.5f); - g = (int) (brightness * 255.0f + 0.5f); - b = (int) (t * 255.0f + 0.5f); - break; - case 3: - r = (int) (p * 255.0f + 0.5f); - g = (int) (q * 255.0f + 0.5f); - b = (int) (brightness * 255.0f + 0.5f); - break; - case 4: - r = (int) (t * 255.0f + 0.5f); - g = (int) (p * 255.0f + 0.5f); - b = (int) (brightness * 255.0f + 0.5f); - break; - case 5: - r = (int) (brightness * 255.0f + 0.5f); - g = (int) (p * 255.0f + 0.5f); - b = (int) (q * 255.0f + 0.5f); - break; - } - } - return 0xff000000 | (r << 16) | (g << 8) | (b); - } -} diff --git a/src/main/java/com/me/infinity/loop/util/utils/minecraft/IMinecraft.java b/src/main/java/com/me/infinity/loop/util/utils/minecraft/IMinecraft.java deleted file mode 100644 index 9e7354e..0000000 --- a/src/main/java/com/me/infinity/loop/util/utils/minecraft/IMinecraft.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.me.infinity.loop.util.utils.minecraft; - -public interface IMinecraft { - - /** - * @return the current gameloop, will be incremented every gameloop. - */ - int getGameLoop(); -} diff --git a/src/main/java/com/me/infinity/loop/util/utils/minecraft/KeyBoardUtil.java b/src/main/java/com/me/infinity/loop/util/utils/minecraft/KeyBoardUtil.java deleted file mode 100644 index 8a63b14..0000000 --- a/src/main/java/com/me/infinity/loop/util/utils/minecraft/KeyBoardUtil.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.me.infinity.loop.util.utils.minecraft; - -import com.me.infinity.loop.features.setting.impl.Bind; -import com.me.infinity.loop.features.setting.Setting; -import net.minecraft.client.settings.KeyBinding; -import org.lwjgl.input.Keyboard; -import org.lwjgl.input.Mouse; - -public class KeyBoardUtil -{ - public static boolean isKeyDown(KeyBinding binding) - { - return isKeyDown(binding.getKeyCode()); - } - - public static boolean isKeyDown(Setting setting) - { - return isKeyDown(setting.getValue()); - } - - public static boolean isKeyDown(Bind bind) - { - return isKeyDown(bind.getKey()); - } - - public static boolean isKeyDown(int key) - { - return key != 0 && key != -1 && (key < 0 ? Mouse.isButtonDown(key + 100) : Keyboard.isKeyDown(key)); - } -} diff --git a/src/main/java/com/me/infinity/loop/util/utils/minecraft/Wrapper.java b/src/main/java/com/me/infinity/loop/util/utils/minecraft/Wrapper.java deleted file mode 100644 index 9f64c3c..0000000 --- a/src/main/java/com/me/infinity/loop/util/utils/minecraft/Wrapper.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.me.infinity.loop.util.utils.minecraft; - -import com.me.infinity.loop.manager.FileManager; -import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.EntityPlayerSP; -import net.minecraft.world.World; - -public class Wrapper { - public static FileManager fileManager; - - public static Minecraft getMinecraft() { - return Minecraft.getMinecraft(); - } - - public static EntityPlayerSP getPlayer() { - return getMinecraft().player; - } - - public static World getWorld() { - return (World)getMinecraft().world; - } - - public static FileManager getFileManager() { - if (Wrapper.fileManager == null) { - Wrapper.fileManager = new FileManager(); - } - return Wrapper.fileManager; - } -} diff --git a/src/main/java/com/me/infinity/loop/util/utils/openGL/GLUtils.java b/src/main/java/com/me/infinity/loop/util/utils/openGL/GLUtils.java deleted file mode 100644 index 4fc6c4a..0000000 --- a/src/main/java/com/me/infinity/loop/util/utils/openGL/GLUtils.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.me.infinity.loop.util.utils.openGL; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.client.renderer.GLAllocation; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.shader.Framebuffer; -import org.lwjgl.BufferUtils; -import org.lwjgl.opengl.Display; -import org.lwjgl.opengl.GL11; -import org.lwjgl.util.glu.GLU; - -import javax.vecmath.Vector3d; -import java.nio.FloatBuffer; -import java.nio.IntBuffer; -public class GLUtils { - protected static Minecraft mc = Minecraft.getMinecraft(); - static final ShaderUtility roundedShader = new ShaderUtility("roundedRect"); - private static final IntBuffer viewport = BufferUtils.createIntBuffer(16); - private final static FloatBuffer modelview = GLAllocation.createDirectFloatBuffer(16); - private final static FloatBuffer projections = GLAllocation.createDirectFloatBuffer(16); - public static Framebuffer glCreateFrameBuffer(Framebuffer framebuffer) { - if (framebuffer == null || framebuffer.framebufferWidth != mc.displayWidth || framebuffer.framebufferHeight != mc.displayHeight) { - if (framebuffer != null) { - framebuffer.deleteFramebuffer(); - } - return new Framebuffer(mc.displayWidth, mc.displayHeight, true); - } - return framebuffer; - } - public static void glBindTexture(int texture) { - GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture); - } - public static javax.vecmath.Vector3d glProject(double x, double y, double z) { - FloatBuffer vector = GLAllocation.createDirectFloatBuffer(4); - GL11.glGetFloat(2982, modelview); - GL11.glGetFloat(2983, projections); - GL11.glGetInteger(2978, viewport); - if (GLU.gluProject((float) x, (float) y, (float) z, modelview, projections, viewport, vector)) { - return new Vector3d(vector.get(0) / new ScaledResolution(mc).getScaleFactor(), (Display.getHeight() - vector.get(1)) / new ScaledResolution(mc).getScaleFactor(), vector.get(2)); - } - return null; - } - public static void glStart2D() { - GL11.glEnable(3042); - GL11.glDisable(3553); - GL11.glBlendFunc(770, 771); - GL11.glEnable(2848); - } - public static void glStop2D() { - GL11.glEnable(3553); - GL11.glDisable(3042); - GL11.glDisable(2848); - GlStateManager.enableTexture2D(); - GlStateManager.disableBlend(); - GL11.glColor4f(1, 1, 1, 1); - } -} diff --git a/src/main/java/com/me/infinity/loop/util/utils/openGL/ShaderUtility.java b/src/main/java/com/me/infinity/loop/util/utils/openGL/ShaderUtility.java deleted file mode 100644 index 5faa784..0000000 --- a/src/main/java/com/me/infinity/loop/util/utils/openGL/ShaderUtility.java +++ /dev/null @@ -1,261 +0,0 @@ -package com.me.infinity.loop.util.utils.openGL; - -import com.me.infinity.loop.mixin.MixinInterface; -import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.OpenGlHelper; -import net.minecraft.client.shader.Framebuffer; -import net.minecraft.util.ResourceLocation; - -import java.io.*; - -import static org.lwjgl.opengl.GL11.*; -import static org.lwjgl.opengl.GL20.*; -import static org.lwjgl.opengl.GL20.GL_LINK_STATUS; - - -public class ShaderUtility implements MixinInterface { - public static ShaderUtility shader = new ShaderUtility("loop/shaders/white.frag"); - private final int programID; - - public ShaderUtility(String fragmentShaderLoc, String vertexShaderLoc) { - int program = glCreateProgram(); - try { - int fragmentShaderID; - switch (fragmentShaderLoc) { - case "roundedRect": - fragmentShaderID = createShader(new ByteArrayInputStream(roundedRect.getBytes()), GL_FRAGMENT_SHADER); - break; - case "roundedOutlineRect": - fragmentShaderID = createShader(new ByteArrayInputStream(roundedOutlinedRect.getBytes()), GL_FRAGMENT_SHADER); - break; - case "roundedRectGradient": - fragmentShaderID = createShader(new ByteArrayInputStream(roundedRectGradient.getBytes()), GL_FRAGMENT_SHADER); - break; - default: - fragmentShaderID = createShader(mc.getResourceManager().getResource(new ResourceLocation(fragmentShaderLoc)).getInputStream(), GL_FRAGMENT_SHADER); - break; - } - glAttachShader(program, fragmentShaderID); - - int vertexShaderID = createShader(mc.getResourceManager().getResource(new ResourceLocation(vertexShaderLoc)).getInputStream(), GL_VERTEX_SHADER); - glAttachShader(program, vertexShaderID); - - - } catch (IOException e) { - e.printStackTrace(); - } - - glLinkProgram(program); - int status = glGetProgrami(program, GL_LINK_STATUS); - - if (status == 0) { - throw new IllegalStateException("Shader failed to link!"); - } - this.programID = program; - } - - public ShaderUtility(String fragmentShaderLoc) { - this(fragmentShaderLoc, "minecraft/textures/vertex.vsh"); - } - - - public void init() { - glUseProgram(programID); - } - - public void unload() { - glUseProgram(0); - } - - public int getUniform(String name) { - return glGetUniformLocation(programID, name); - } - - - public void setUniformf(String name, float... args) { - int loc = glGetUniformLocation(programID, name); - switch (args.length) { - case 1: - glUniform1f(loc, args[0]); - break; - case 2: - glUniform2f(loc, args[0], args[1]); - break; - case 3: - glUniform3f(loc, args[0], args[1], args[2]); - break; - case 4: - glUniform4f(loc, args[0], args[1], args[2], args[3]); - break; - } - } - - public static Framebuffer framebuffer = new Framebuffer(1, 1, false); - public static void renderColor(float force) { - GlStateManager.enableBlend(); - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - OpenGlHelper.glBlendFunc(770, 771, 1, 0); - - framebuffer = GLUtils.glCreateFrameBuffer(framebuffer); - - framebuffer.framebufferClear(); - framebuffer.bindFramebuffer(true); - shader.init(); - setupUniforms2(force); - GLUtils.glBindTexture((mc.getFramebuffer()).framebufferTexture); - - ShaderUtility.drawQuads(); - framebuffer.unbindFramebuffer(); - shader.unload(); - - mc.getFramebuffer().bindFramebuffer(true); - shader.init(); - setupUniforms2(force); - GLUtils.glBindTexture(framebuffer.framebufferTexture); - ShaderUtility.drawQuads(); - shader.unload(); - - GlStateManager.resetColor(); - GlStateManager.bindTexture(0); - } - public static void setupUniforms2(float force) { - shader.setUniformi("textureIn", 0); - shader.setUniformf("force", force); - } - - public void setUniformi(String name, int... args) { - int loc = glGetUniformLocation(programID, name); - if (args.length > 1) glUniform2i(loc, args[0], args[1]); - else glUniform1i(loc, args[0]); - } - - public static void drawQuads(float x, float y, float width, float height) { - glBegin(GL_QUADS); - glTexCoord2f(0, 0); - glVertex2f(x, y); - glTexCoord2f(0, 1); - glVertex2f(x, y + height); - glTexCoord2f(1, 1); - glVertex2f(x + width, y + height); - glTexCoord2f(1, 0); - glVertex2f(x + width, y); - glEnd(); - } - public static String readInputStream(InputStream inputStream) { - StringBuilder stringBuilder = new StringBuilder(); - - try { - BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); - String line; - while ((line = bufferedReader.readLine()) != null) - stringBuilder.append(line).append('\n'); - - } catch (Exception e) { - e.printStackTrace(); - } - return stringBuilder.toString(); - } - - public static void drawQuads() { - ScaledResolution sr = new ScaledResolution(mc); - float width = (float) sr.getScaledWidth_double(); - float height = (float) sr.getScaledHeight_double(); - glBegin(GL_QUADS); - glTexCoord2f(0, 1); - glVertex2f(0, 0); - glTexCoord2f(0, 0); - glVertex2f(0, height); - glTexCoord2f(1, 0); - glVertex2f(width, height); - glTexCoord2f(1, 1); - glVertex2f(width, 0); - glEnd(); - } - - private int createShader(InputStream inputStream, int shaderType) { - int shader = glCreateShader(shaderType); - glShaderSource(shader, readInputStream(inputStream)); - glCompileShader(shader); - - - if (glGetShaderi(shader, GL_COMPILE_STATUS) == 0) { - System.out.println(glGetShaderInfoLog(shader, 4096)); - throw new IllegalStateException(String.format("Shader (%s) failed to compile!", shaderType)); - } - - return shader; - } - - - private final String roundedRectGradient = "#version 120\n" + - "\n" + - "uniform vec2 location, rectSize;\n" + - "uniform vec4 color1, color2, color3, color4;\n" + - "uniform float radius;\n" + - "\n" + - "#define NOISE .5/255.0\n" + - "\n" + - "float roundSDF(vec2 p, vec2 b, float r) {\n" + - " return length(max(abs(p) - b , 0.0)) - r;\n" + - "}\n" + - "\n" + - "vec3 createGradient(vec2 coords, vec3 color1, vec3 color2, vec3 color3, vec3 color4){\n" + - " vec3 color = mix(mix(color1.rgb, color2.rgb, coords.y), mix(color3.rgb, color4.rgb, coords.y), coords.x);\n" + - " //Dithering the color\n" + - " // from https://shader-tutorial.dev/advanced/color-banding-dithering/\n" + - " color += mix(NOISE, -NOISE, fract(sin(dot(coords.xy, vec2(12.9898, 78.233))) * 43758.5453));\n" + - " return color;\n" + - "}\n" + - "\n" + - "void main() {\n" + - " vec2 st = gl_TexCoord[0].st;\n" + - " vec2 halfSize = rectSize * .5;\n" + - " \n" + - " float smoothedAlpha = (1.0-smoothstep(0.0, 2., roundSDF(halfSize - (gl_TexCoord[0].st * rectSize), halfSize - radius - 1., radius))) * color1.a;\n" + - " gl_FragColor = vec4(createGradient(st, color1.rgb, color2.rgb, color3.rgb, color4.rgb), smoothedAlpha);\n" + - "}"; - - - private String roundedRect = "#version 120\n" + - "\n" + - "uniform vec2 location, rectSize;\n" + - "uniform vec4 color;\n" + - "uniform float radius;\n" + - "uniform bool blur;\n" + - "\n" + - "float roundSDF(vec2 p, vec2 b, float r) {\n" + - " return length(max(abs(p) - b, 0.0)) - r;\n" + - "}\n" + - "\n" + - "\n" + - "void main() {\n" + - " vec2 rectHalf = rectSize * .5;\n" + - " // Smooth the result (free antialiasing).\n" + - " float smoothedAlpha = (1.0-smoothstep(0.0, 1.0, roundSDF(rectHalf - (gl_TexCoord[0].st * rectSize), rectHalf - radius - 1., radius))) * color.a;\n" + - " gl_FragColor = vec4(color.rgb, smoothedAlpha);// mix(quadColor, shadowColor, 0.0);\n" + - "\n" + - "}"; - - private final String roundedOutlinedRect = - "#version 120\n" + - "\n" + - "uniform vec2 location, size;\n" + - "uniform vec4 color, outlineColor;\n" + - "uniform float radius, thickness;\n" + - "\n" + - "float rounded(vec2 centerPos, vec2 size, float radius) {\n" + - " return length(max(abs(centerPos) - size + radius, 0.0)) - radius;\n" + - "}\n" + - "\n" + - "void main()\n" + - "{\n" + - " float rSDF = rounded(gl_FragCoord.xy - location - (size/2), (size/2) + (thickness/2) - 1.0, radius);\n" + - "\n" + - " float blendAmount = smoothstep(0.0, 2.0, abs(rSDF) - (thickness/2));\n" + - "\n" + - " vec4 insideColor = (rSDF < 0.0) ? color : vec4(outlineColor.rgb, 0.0);\n" + - "\n" + - " gl_FragColor = mix(outlineColor, insideColor, blendAmount);\n" + - "}"; -} diff --git a/src/main/java/com/me/infinity/loop/util/utils/phobos/GlobalExecutor.java b/src/main/java/com/me/infinity/loop/util/utils/phobos/GlobalExecutor.java deleted file mode 100644 index aee402a..0000000 --- a/src/main/java/com/me/infinity/loop/util/utils/phobos/GlobalExecutor.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.me.infinity.loop.util.utils.phobos; - -import java.util.concurrent.ExecutorService; - - -public interface GlobalExecutor -{ - - ExecutorService EXECUTOR = ThreadUtil.newDaemonCachedThreadPool(); - ExecutorService FIXED_EXECUTOR = ThreadUtil.newFixedThreadPool( - (int)(Runtime.getRuntime().availableProcessors() / 1.5)); -} diff --git a/src/main/java/com/me/infinity/loop/util/utils/phobos/Sphere.java b/src/main/java/com/me/infinity/loop/util/utils/phobos/Sphere.java deleted file mode 100644 index 36860f8..0000000 --- a/src/main/java/com/me/infinity/loop/util/utils/phobos/Sphere.java +++ /dev/null @@ -1,147 +0,0 @@ -package com.me.infinity.loop.util.utils.phobos; - -import com.me.infinity.loop.util.utils.maths.MathUtil; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3i; - -import java.util.Set; -import java.util.TreeSet; - - -public class Sphere -{ - private static final Vec3i[] SPHERE = new Vec3i[4187707]; - private static final int[] INDICES = new int[101]; - - static - { - // Setting the last byte to a dummy value. - // That way we can check if the sphere has been fully initialized. - SPHERE[SPHERE.length - 1] = new Vec3i(Integer.MAX_VALUE, 0, 0); - } - - /** This class is a Utility class and shouldn't be instantiated. */ - private Sphere() { throw new AssertionError(); } - - /** - * Gives you an Index for the Sphere. - * All Positions up to the returned index will lie within - * the given radius. Since the radius is rounded up you will - * have to check if the last indices really lie within your - * radius. radii > 100 will always return {@link Sphere#getLength()}. - * - * @param radius the radius to get the max index for. - * @return the maximum index for the given radius. - */ - public static int getRadius(double radius) - { - return INDICES[MathUtil.clamp((int) Math.ceil(radius), 0, INDICES.length)]; - } - - /** - * Gets the Vec3i from the sphere at the given index. - * - * @param index the index of the Vector. - * @return Vec3i at the given index. - * @throws IndexOutOfBoundsException if the given index - * lies outside 0 and {@link Sphere#getLength()}-1. - */ - public static Vec3i get(int index) - { - return SPHERE[index]; - } - - /** - * @return the length of the sphere array. - */ - public static int getLength() - { - return SPHERE.length; - } - - /** - * Initializes the Sphere. - * With Forge this is called on PreInit, as soon as possible. - */ - public static void cacheSphere() - { - long time = System.currentTimeMillis(); - - BlockPos pos = BlockPos.ORIGIN; - Set positions = new TreeSet<>((o, p) -> - { - if (o.equals(p)) - { - return 0; - } - - int compare = Double.compare(pos.distanceSq(o), pos.distanceSq(p)); - if (compare == 0) - { - // This prioritizes positions closer to an axis - compare = Integer.compare(Math.abs(o.getX()) - + Math.abs(o.getY()) - + Math.abs(o.getZ()), - Math.abs(p.getX()) - + Math.abs(p.getY()) - + Math.abs(p.getZ())); - } - - return compare == 0 ? 1 : compare; - }); - - double r = 100.0; - double rSquare = r * r; - for (int x = pos.getX() - (int) r; x <= pos.getX() + r; x++) - { - for (int z = pos.getZ() - (int) r; z <= pos.getZ() + r; z++) - { - for (int y = pos.getY() - (int) r; y < pos.getY() + r; y++) - { - double dist = (pos.getX() - x) * (pos.getX() - x) - + (pos.getZ() - z) * (pos.getZ() - z) - + (pos.getY() - y) * (pos.getY() - y); - if (dist < rSquare) - { - positions.add(new BlockPos(x, y, z)); - } - } - } - } - - if (positions.size() != SPHERE.length) - { - throw new IllegalStateException("Unexpected Size for Sphere: " - + positions.size() - + ", expected " - + SPHERE.length - + "!"); - } - - int i = 0; - int currentDistance = 0; - for (BlockPos off : positions) - { - if (Math.sqrt(pos.distanceSq(off)) > currentDistance) - { - INDICES[currentDistance++] = i; - } - - SPHERE[i++] = off; - } - - if (currentDistance != INDICES.length - 1) - { - throw new IllegalStateException("Sphere Indices not initialized!"); - } - - INDICES[INDICES.length - 1] = SPHERE.length; - if (SPHERE[SPHERE.length - 1].getX() == Integer.MAX_VALUE) - { - throw new IllegalStateException("Sphere wasn't filled!"); - } - - time = System.currentTimeMillis() - time; - } - -} \ No newline at end of file diff --git a/src/main/java/com/me/infinity/loop/util/utils/phobos/ThreadUtil.java b/src/main/java/com/me/infinity/loop/util/utils/phobos/ThreadUtil.java deleted file mode 100644 index 6e5d1e3..0000000 --- a/src/main/java/com/me/infinity/loop/util/utils/phobos/ThreadUtil.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.me.infinity.loop.util.utils.phobos; - -import com.google.common.util.concurrent.ThreadFactoryBuilder; - -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ThreadFactory; - - -/** - * Utility for Multithreading. - */ -public class ThreadUtil -{ - public static final ThreadFactory FACTORY = newDaemonThreadFactoryBuilder() - .setNameFormat("Infinity-Thread-%d") - .build(); - /** - * @return a single thread {@link ScheduledExecutorService}, whose - * thread set ({@link Thread#setDaemon(boolean)}) to true. - */ - public static ScheduledExecutorService newDaemonScheduledExecutor( - String name) - { - ThreadFactoryBuilder factory = newDaemonThreadFactoryBuilder(); - factory.setNameFormat("Infinity-" + name + "-%d"); - return Executors.newSingleThreadScheduledExecutor(factory.build()); - } - - public static ExecutorService newDaemonCachedThreadPool() - { - return Executors.newCachedThreadPool(FACTORY); - } - - public static ExecutorService newFixedThreadPool(int size) - { - ThreadFactoryBuilder factory = newDaemonThreadFactoryBuilder(); - factory.setNameFormat("Infinity-Fixed-%d"); - return Executors.newFixedThreadPool(Math.max(size, 1), factory.build()); - } - - public static ThreadFactoryBuilder newDaemonThreadFactoryBuilder() - { - ThreadFactoryBuilder factory = new ThreadFactoryBuilder(); - factory.setDaemon(true); - return factory; - } - -} diff --git a/src/main/java/com/me/infinity/loop/util/utils/renders/FaceMasks.java b/src/main/java/com/me/infinity/loop/util/utils/renders/FaceMasks.java deleted file mode 100644 index b371a9d..0000000 --- a/src/main/java/com/me/infinity/loop/util/utils/renders/FaceMasks.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.me.infinity.loop.util.utils.renders; - -import net.minecraft.util.EnumFacing; - -import java.util.HashMap; - -public final class FaceMasks { - - public static final HashMap FACEMAP = new HashMap<>(); - - static { - FACEMAP.put(EnumFacing.DOWN, Quad.DOWN); - FACEMAP.put(EnumFacing.WEST, Quad.WEST); - FACEMAP.put(EnumFacing.NORTH, Quad.NORTH); - FACEMAP.put(EnumFacing.SOUTH, Quad.SOUTH); - FACEMAP.put(EnumFacing.EAST, Quad.EAST); - FACEMAP.put(EnumFacing.UP, Quad.UP); - } - - public static final class Quad { - public static final int DOWN = 0x01; - public static final int UP = 0x02; - public static final int NORTH = 0x04; - public static final int SOUTH = 0x08; - public static final int WEST = 0x10; - public static final int EAST = 0x20; - public static final int ALL = DOWN | UP | NORTH | SOUTH | WEST | EAST; - } -} diff --git a/src/main/java/com/me/infinity/loop/util/utils/renders/GLUProjection.java b/src/main/java/com/me/infinity/loop/util/utils/renders/GLUProjection.java deleted file mode 100644 index fe4adba..0000000 --- a/src/main/java/com/me/infinity/loop/util/utils/renders/GLUProjection.java +++ /dev/null @@ -1,465 +0,0 @@ -package com.me.infinity.loop.util.utils.renders; - -import java.nio.FloatBuffer; -import java.nio.IntBuffer; -import org.lwjgl.BufferUtils; -import org.lwjgl.util.glu.GLU; -import org.lwjgl.util.vector.Matrix4f; - -public final class GLUProjection { - private static GLUProjection instance; - private IntBuffer viewport; - private FloatBuffer modelview; - private FloatBuffer projection; - private final FloatBuffer coords = BufferUtils.createFloatBuffer(3); - private Vector3D frustumPos; - private Vector3D[] frustum; - private Vector3D[] invFrustum; - private Vector3D viewVec; - private double displayWidth; - private double displayHeight; - private double widthScale; - private double heightScale; - private double bra; - private double bla; - private double tra; - private double tla; - private Line tb; - private Line bb; - private Line lb; - private Line rb; - private float fovY; - private float fovX; - private Vector3D lookVec; - - private GLUProjection() { - } - - public static GLUProjection getInstance() { - if (instance == null) { - instance = new GLUProjection(); - } - return instance; - } - - public void updateMatrices(IntBuffer viewport, FloatBuffer modelview, FloatBuffer projection, double widthScale, double heightScale) { - float fov; - this.viewport = viewport; - this.modelview = modelview; - this.projection = projection; - this.widthScale = widthScale; - this.heightScale = heightScale; - this.fovY = fov = (float)Math.toDegrees(Math.atan(1.0 / (double)this.projection.get(5)) * 2.0); - this.displayWidth = this.viewport.get(2); - this.displayHeight = this.viewport.get(3); - this.fovX = (float)Math.toDegrees(2.0 * Math.atan(this.displayWidth / this.displayHeight * Math.tan(Math.toRadians(this.fovY) / 2.0))); - Vector3D lv = new Vector3D(this.modelview.get(0), this.modelview.get(1), this.modelview.get(2)); - Vector3D uv = new Vector3D(this.modelview.get(4), this.modelview.get(5), this.modelview.get(6)); - Vector3D fv = new Vector3D(this.modelview.get(8), this.modelview.get(9), this.modelview.get(10)); - Vector3D nuv = new Vector3D(0.0, 1.0, 0.0); - Vector3D nlv = new Vector3D(1.0, 0.0, 0.0); - double yaw = Math.toDegrees(Math.atan2(nlv.cross(lv).length(), nlv.dot(lv))) + 180.0; - if (fv.x < 0.0) { - yaw = 360.0 - yaw; - } - double pitch = 0.0; - pitch = -fv.y > 0.0 && yaw >= 90.0 && yaw < 270.0 || fv.y > 0.0 && (!(yaw >= 90.0) || !(yaw < 270.0)) ? Math.toDegrees(Math.atan2(nuv.cross(uv).length(), nuv.dot(uv))) : -Math.toDegrees(Math.atan2(nuv.cross(uv).length(), nuv.dot(uv))); - this.lookVec = this.getRotationVector(yaw, pitch); - Matrix4f modelviewMatrix = new Matrix4f(); - modelviewMatrix.load(this.modelview.asReadOnlyBuffer()); - modelviewMatrix.invert(); - this.frustumPos = new Vector3D(modelviewMatrix.m30, modelviewMatrix.m31, modelviewMatrix.m32); - this.frustum = this.getFrustum(this.frustumPos.x, this.frustumPos.y, this.frustumPos.z, yaw, pitch, fov, 1.0, this.displayWidth / this.displayHeight); - this.invFrustum = this.getFrustum(this.frustumPos.x, this.frustumPos.y, this.frustumPos.z, yaw - 180.0, -pitch, fov, 1.0, this.displayWidth / this.displayHeight); - this.viewVec = this.getRotationVector(yaw, pitch).normalized(); - this.bra = Math.toDegrees(Math.acos(this.displayHeight * heightScale / Math.sqrt(this.displayWidth * widthScale * this.displayWidth * widthScale + this.displayHeight * heightScale * this.displayHeight * heightScale))); - this.bla = 360.0 - this.bra; - this.tra = this.bla - 180.0; - this.tla = this.bra + 180.0; - this.rb = new Line(this.displayWidth * this.widthScale, 0.0, 0.0, 0.0, 1.0, 0.0); - this.tb = new Line(0.0, 0.0, 0.0, 1.0, 0.0, 0.0); - this.lb = new Line(0.0, 0.0, 0.0, 0.0, 1.0, 0.0); - this.bb = new Line(0.0, this.displayHeight * this.heightScale, 0.0, 1.0, 0.0, 0.0); - } - - /* - * Enabled force condition propagation - * Lifted jumps to return sites - */ - public Projection project(double x, double y, double z, ClampMode clampModeOutside, boolean extrudeInverted) { - boolean outsideFrustum; - if (this.viewport == null || this.modelview == null || this.projection == null) return new Projection(0.0, 0.0, Projection.Type.FAIL); - Vector3D posVec = new Vector3D(x, y, z); - boolean[] frustum = this.doFrustumCheck(this.frustum, this.frustumPos, x, y, z); - boolean bl = outsideFrustum = frustum[0] || frustum[1] || frustum[2] || frustum[3]; - if (outsideFrustum) { - boolean outsideInvertedFrustum; - boolean opposite = posVec.sub(this.frustumPos).dot(this.viewVec) <= 0.0; - boolean[] invFrustum = this.doFrustumCheck(this.invFrustum, this.frustumPos, x, y, z); - boolean bl2 = outsideInvertedFrustum = invFrustum[0] || invFrustum[1] || invFrustum[2] || invFrustum[3]; - if (extrudeInverted && !outsideInvertedFrustum || outsideInvertedFrustum && clampModeOutside != ClampMode.NONE) { - if (extrudeInverted && !outsideInvertedFrustum || clampModeOutside == ClampMode.DIRECT && outsideInvertedFrustum) { - double vecX = 0.0; - double vecY = 0.0; - if (!GLU.gluProject((float)x, (float)y, (float)z, this.modelview, this.projection, this.viewport, this.coords)) return new Projection(0.0, 0.0, Projection.Type.FAIL); - if (opposite) { - vecX = this.displayWidth * this.widthScale - (double)this.coords.get(0) * this.widthScale - this.displayWidth * this.widthScale / 2.0; - vecY = this.displayHeight * this.heightScale - (this.displayHeight - (double)this.coords.get(1)) * this.heightScale - this.displayHeight * this.heightScale / 2.0; - } else { - vecX = (double)this.coords.get(0) * this.widthScale - this.displayWidth * this.widthScale / 2.0; - vecY = (this.displayHeight - (double)this.coords.get(1)) * this.heightScale - this.displayHeight * this.heightScale / 2.0; - } - Vector3D vec = new Vector3D(vecX, vecY, 0.0).snormalize(); - vecX = vec.x; - vecY = vec.y; - Line vectorLine = new Line(this.displayWidth * this.widthScale / 2.0, this.displayHeight * this.heightScale / 2.0, 0.0, vecX, vecY, 0.0); - double angle = Math.toDegrees(Math.acos(vec.y / Math.sqrt(vec.x * vec.x + vec.y * vec.y))); - if (vecX < 0.0) { - angle = 360.0 - angle; - } - Vector3D intersect = new Vector3D(0.0, 0.0, 0.0); - intersect = angle >= this.bra && angle < this.tra ? this.rb.intersect(vectorLine) : (angle >= this.tra && angle < this.tla ? this.tb.intersect(vectorLine) : (angle >= this.tla && angle < this.bla ? this.lb.intersect(vectorLine) : this.bb.intersect(vectorLine))); - return new Projection(intersect.x, intersect.y, outsideInvertedFrustum ? Projection.Type.OUTSIDE : Projection.Type.INVERTED); - } - if (clampModeOutside != ClampMode.ORTHOGONAL || !outsideInvertedFrustum) return new Projection(0.0, 0.0, Projection.Type.FAIL); - if (!GLU.gluProject((float)x, (float)y, (float)z, this.modelview, this.projection, this.viewport, this.coords)) return new Projection(0.0, 0.0, Projection.Type.FAIL); - double guiX = (double)this.coords.get(0) * this.widthScale; - double guiY = (this.displayHeight - (double)this.coords.get(1)) * this.heightScale; - if (opposite) { - guiX = this.displayWidth * this.widthScale - guiX; - guiY = this.displayHeight * this.heightScale - guiY; - } - if (guiX < 0.0) { - guiX = 0.0; - } else if (guiX > this.displayWidth * this.widthScale) { - guiX = this.displayWidth * this.widthScale; - } - if (guiY < 0.0) { - guiY = 0.0; - return new Projection(guiX, guiY, outsideInvertedFrustum ? Projection.Type.OUTSIDE : Projection.Type.INVERTED); - } else { - if (!(guiY > this.displayHeight * this.heightScale)) return new Projection(guiX, guiY, outsideInvertedFrustum ? Projection.Type.OUTSIDE : Projection.Type.INVERTED); - guiY = this.displayHeight * this.heightScale; - } - return new Projection(guiX, guiY, outsideInvertedFrustum ? Projection.Type.OUTSIDE : Projection.Type.INVERTED); - } - if (!GLU.gluProject((float)x, (float)y, (float)z, this.modelview, this.projection, this.viewport, this.coords)) return new Projection(0.0, 0.0, Projection.Type.FAIL); - double guiX = (double)this.coords.get(0) * this.widthScale; - double guiY = (this.displayHeight - (double)this.coords.get(1)) * this.heightScale; - if (!opposite) return new Projection(guiX, guiY, outsideInvertedFrustum ? Projection.Type.OUTSIDE : Projection.Type.INVERTED); - guiX = this.displayWidth * this.widthScale - guiX; - guiY = this.displayHeight * this.heightScale - guiY; - return new Projection(guiX, guiY, outsideInvertedFrustum ? Projection.Type.OUTSIDE : Projection.Type.INVERTED); - } - if (!GLU.gluProject((float)x, (float)y, (float)z, this.modelview, this.projection, this.viewport, this.coords)) return new Projection(0.0, 0.0, Projection.Type.FAIL); - double guiX = (double)this.coords.get(0) * this.widthScale; - double guiY = (this.displayHeight - (double)this.coords.get(1)) * this.heightScale; - return new Projection(guiX, guiY, Projection.Type.INSIDE); - } - - public boolean[] doFrustumCheck(Vector3D[] frustumCorners, Vector3D frustumPos, double x, double y, double z) { - Vector3D point = new Vector3D(x, y, z); - boolean c1 = this.crossPlane(new Vector3D[]{frustumPos, frustumCorners[3], frustumCorners[0]}, point); - boolean c2 = this.crossPlane(new Vector3D[]{frustumPos, frustumCorners[0], frustumCorners[1]}, point); - boolean c3 = this.crossPlane(new Vector3D[]{frustumPos, frustumCorners[1], frustumCorners[2]}, point); - boolean c4 = this.crossPlane(new Vector3D[]{frustumPos, frustumCorners[2], frustumCorners[3]}, point); - return new boolean[]{c1, c2, c3, c4}; - } - - public boolean crossPlane(Vector3D[] plane, Vector3D point) { - Vector3D z = new Vector3D(0.0, 0.0, 0.0); - Vector3D e0 = plane[1].sub(plane[0]); - Vector3D e1 = plane[2].sub(plane[0]); - Vector3D normal = e0.cross(e1).snormalize(); - double D = z.sub(normal).dot(plane[2]); - double dist = normal.dot(point) + D; - return dist >= 0.0; - } - - public Vector3D[] getFrustum(double x, double y, double z, double rotationYaw, double rotationPitch, double fov, double farDistance, double aspectRatio) { - double hFar = 2.0 * Math.tan(Math.toRadians(fov / 2.0)) * farDistance; - double wFar = hFar * aspectRatio; - Vector3D view = this.getRotationVector(rotationYaw, rotationPitch).snormalize(); - Vector3D up = this.getRotationVector(rotationYaw, rotationPitch - 90.0).snormalize(); - Vector3D right = this.getRotationVector(rotationYaw + 90.0, 0.0).snormalize(); - Vector3D camPos = new Vector3D(x, y, z); - Vector3D view_camPos_product = view.add(camPos); - Vector3D fc = new Vector3D(view_camPos_product.x * farDistance, view_camPos_product.y * farDistance, view_camPos_product.z * farDistance); - Vector3D topLeftfrustum = new Vector3D(fc.x + up.x * hFar / 2.0 - right.x * wFar / 2.0, fc.y + up.y * hFar / 2.0 - right.y * wFar / 2.0, fc.z + up.z * hFar / 2.0 - right.z * wFar / 2.0); - Vector3D downLeftfrustum = new Vector3D(fc.x - up.x * hFar / 2.0 - right.x * wFar / 2.0, fc.y - up.y * hFar / 2.0 - right.y * wFar / 2.0, fc.z - up.z * hFar / 2.0 - right.z * wFar / 2.0); - Vector3D topRightfrustum = new Vector3D(fc.x + up.x * hFar / 2.0 + right.x * wFar / 2.0, fc.y + up.y * hFar / 2.0 + right.y * wFar / 2.0, fc.z + up.z * hFar / 2.0 + right.z * wFar / 2.0); - Vector3D downRightfrustum = new Vector3D(fc.x - up.x * hFar / 2.0 + right.x * wFar / 2.0, fc.y - up.y * hFar / 2.0 + right.y * wFar / 2.0, fc.z - up.z * hFar / 2.0 + right.z * wFar / 2.0); - return new Vector3D[]{topLeftfrustum, downLeftfrustum, downRightfrustum, topRightfrustum}; - } - - public Vector3D[] getFrustum() { - return this.frustum; - } - - public float getFovX() { - return this.fovX; - } - - public float getFovY() { - return this.fovY; - } - - public Vector3D getLookVector() { - return this.lookVec; - } - - public Vector3D getRotationVector(double rotYaw, double rotPitch) { - double c = Math.cos(-rotYaw * 0.01745329238474369 - Math.PI); - double s = Math.sin(-rotYaw * 0.01745329238474369 - Math.PI); - double nc = -Math.cos(-rotPitch * 0.01745329238474369); - double ns = Math.sin(-rotPitch * 0.01745329238474369); - return new Vector3D(s * nc, ns, c * nc); - } - - public enum ClampMode { - ORTHOGONAL, - DIRECT, - NONE - - } - - public static class Projection { - private final double x; - private final double y; - private final Type t; - - public Projection(double x, double y, Type t) { - this.x = x; - this.y = y; - this.t = t; - } - - public double getX() { - return this.x; - } - - public double getY() { - return this.y; - } - - public Type getType() { - return this.t; - } - - public boolean isType(Type type) { - return this.t == type; - } - - public enum Type { - INSIDE, - OUTSIDE, - INVERTED, - FAIL - - } - } - - public static class Vector3D { - public double x; - public double y; - public double z; - - public Vector3D(double x, double y, double z) { - this.x = x; - this.y = y; - this.z = z; - } - - public Vector3D add(Vector3D v) { - return new Vector3D(this.x + v.x, this.y + v.y, this.z + v.z); - } - - public Vector3D add(double x, double y, double z) { - return new Vector3D(this.x + x, this.y + y, this.z + z); - } - - public Vector3D sub(Vector3D v) { - return new Vector3D(this.x - v.x, this.y - v.y, this.z - v.z); - } - - public Vector3D sub(double x, double y, double z) { - return new Vector3D(this.x - x, this.y - y, this.z - z); - } - - public Vector3D normalized() { - double len = Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z); - return new Vector3D(this.x / len, this.y / len, this.z / len); - } - - public double dot(Vector3D v) { - return this.x * v.x + this.y * v.y + this.z * v.z; - } - - public Vector3D cross(Vector3D v) { - return new Vector3D(this.y * v.z - this.z * v.y, this.z * v.x - this.x * v.z, this.x * v.y - this.y * v.x); - } - - public Vector3D mul(double m) { - return new Vector3D(this.x * m, this.y * m, this.z * m); - } - - public Vector3D div(double d) { - return new Vector3D(this.x / d, this.y / d, this.z / d); - } - - public double length() { - return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z); - } - - public Vector3D sadd(Vector3D v) { - this.x += v.x; - this.y += v.y; - this.z += v.z; - return this; - } - - public Vector3D sadd(double x, double y, double z) { - this.x += x; - this.y += y; - this.z += z; - return this; - } - - public Vector3D ssub(Vector3D v) { - this.x -= v.x; - this.y -= v.y; - this.z -= v.z; - return this; - } - - public Vector3D ssub(double x, double y, double z) { - this.x -= x; - this.y -= y; - this.z -= z; - return this; - } - - public Vector3D snormalize() { - double len = Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z); - this.x /= len; - this.y /= len; - this.z /= len; - return this; - } - - public Vector3D scross(Vector3D v) { - this.x = this.y * v.z - this.z * v.y; - this.y = this.z * v.x - this.x * v.z; - this.z = this.x * v.y - this.y * v.x; - return this; - } - - public Vector3D smul(double m) { - this.x *= m; - this.y *= m; - this.z *= m; - return this; - } - - public Vector3D sdiv(double d) { - this.x /= d; - this.y /= d; - this.z /= d; - return this; - } - - public String toString() { - return "(X: " + this.x + " Y: " + this.y + " Z: " + this.z + ")"; - } - } - - public static class Line { - public Vector3D sourcePoint = new Vector3D(0.0, 0.0, 0.0); - public Vector3D direction = new Vector3D(0.0, 0.0, 0.0); - - public Line(double sx, double sy, double sz, double dx, double dy, double dz) { - this.sourcePoint.x = sx; - this.sourcePoint.y = sy; - this.sourcePoint.z = sz; - this.direction.x = dx; - this.direction.y = dy; - this.direction.z = dz; - } - - public Vector3D intersect(Line line) { - double a = this.sourcePoint.x; - double b = this.direction.x; - double c = line.sourcePoint.x; - double d = line.direction.x; - double e = this.sourcePoint.y; - double f = this.direction.y; - double g = line.sourcePoint.y; - double h = line.direction.y; - double te = -(a * h - c * h - d * (e - g)); - double be = b * h - d * f; - if (be == 0.0) { - return this.intersectXZ(line); - } - double t = te / be; - Vector3D result = new Vector3D(0.0, 0.0, 0.0); - result.x = this.sourcePoint.x + this.direction.x * t; - result.y = this.sourcePoint.y + this.direction.y * t; - result.z = this.sourcePoint.z + this.direction.z * t; - return result; - } - - private Vector3D intersectXZ(Line line) { - double a = this.sourcePoint.x; - double b = this.direction.x; - double c = line.sourcePoint.x; - double d = line.direction.x; - double e = this.sourcePoint.z; - double f = this.direction.z; - double g = line.sourcePoint.z; - double h = line.direction.z; - double te = -(a * h - c * h - d * (e - g)); - double be = b * h - d * f; - if (be == 0.0) { - return this.intersectYZ(line); - } - double t = te / be; - Vector3D result = new Vector3D(0.0, 0.0, 0.0); - result.x = this.sourcePoint.x + this.direction.x * t; - result.y = this.sourcePoint.y + this.direction.y * t; - result.z = this.sourcePoint.z + this.direction.z * t; - return result; - } - - private Vector3D intersectYZ(Line line) { - double a = this.sourcePoint.y; - double b = this.direction.y; - double c = line.sourcePoint.y; - double d = line.direction.y; - double e = this.sourcePoint.z; - double f = this.direction.z; - double g = line.sourcePoint.z; - double h = line.direction.z; - double te = -(a * h - c * h - d * (e - g)); - double be = b * h - d * f; - if (be == 0.0) { - return null; - } - double t = te / be; - Vector3D result = new Vector3D(0.0, 0.0, 0.0); - result.x = this.sourcePoint.x + this.direction.x * t; - result.y = this.sourcePoint.y + this.direction.y * t; - result.z = this.sourcePoint.z + this.direction.z * t; - return result; - } - - public Vector3D intersectPlane(Vector3D pointOnPlane, Vector3D planeNormal) { - Vector3D result = new Vector3D(this.sourcePoint.x, this.sourcePoint.y, this.sourcePoint.z); - double d = pointOnPlane.sub(this.sourcePoint).dot(planeNormal) / this.direction.dot(planeNormal); - result.sadd(this.direction.mul(d)); - if (this.direction.dot(planeNormal) == 0.0) { - return null; - } - return result; - } - } -} diff --git a/src/main/java/com/me/infinity/loop/util/utils/renders/GuiRenderHelper.java b/src/main/java/com/me/infinity/loop/util/utils/renders/GuiRenderHelper.java deleted file mode 100644 index e59f72b..0000000 --- a/src/main/java/com/me/infinity/loop/util/utils/renders/GuiRenderHelper.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.me.infinity.loop.util.utils.renders; - -import net.minecraft.client.renderer.BufferBuilder; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import org.lwjgl.opengl.GL11; - -import static org.lwjgl.opengl.GL11.GL_LINES; -import static org.lwjgl.opengl.GL11.GL_LINE_SMOOTH; - -public final class GuiRenderHelper { - - public static void drawRect(float x, float y, float w, float h, int color) { - float right = x + w; - float bottom = y + h; - - float alpha = (color >> 24 & 0xFF) / 255.0F; - float red = (color >> 16 & 0xFF) / 255.0F; - float green = (color >> 8 & 0xFF) / 255.0F; - float blue = (color & 0xFF) / 255.0F; - - Tessellator tessellator = Tessellator.getInstance(); - BufferBuilder bufferBuilder = tessellator.getBuffer(); - - GlStateManager.enableBlend(); - GlStateManager.disableTexture2D(); - GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); - - GlStateManager.color(red, green, blue, alpha); - - bufferBuilder.begin(7, DefaultVertexFormats.POSITION); - bufferBuilder.pos(x, bottom, 0.0D).endVertex(); // top left - bufferBuilder.pos(right, bottom, 0.0D).endVertex(); // top right - bufferBuilder.pos(right, y, 0.0D).endVertex(); // bottom right - bufferBuilder.pos(x, y, 0.0D).endVertex(); // bottom left - tessellator.draw(); - - GlStateManager.enableTexture2D(); - GlStateManager.disableBlend(); - } - - public static void drawOutlineRect(float x, float y, float w, float h, float lineWidth, int color) { - float right = x + w; - float bottom = y + h; - - float alpha = (color >> 24 & 0xFF) / 255.0F; - float red = (color >> 16 & 0xFF) / 255.0F; - float green = (color >> 8 & 0xFF) / 255.0F; - float blue = (color & 0xFF) / 255.0F; - - Tessellator tessellator = Tessellator.getInstance(); - BufferBuilder bufferBuilder = tessellator.getBuffer(); - - GlStateManager.enableBlend(); - GlStateManager.disableTexture2D(); - GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); - - GlStateManager.color(red, green, blue, alpha); - - GL11.glEnable(GL_LINE_SMOOTH); - - GlStateManager.glLineWidth(lineWidth); - bufferBuilder.begin(GL_LINES, DefaultVertexFormats.POSITION); - bufferBuilder.pos(x, bottom, 0.0D).endVertex(); // top left - bufferBuilder.pos(right, bottom, 0.0D).endVertex(); // top right - bufferBuilder.pos(right, bottom, 0.0D).endVertex(); // top right - bufferBuilder.pos(right, y, 0.0D).endVertex(); // bottom right - bufferBuilder.pos(right, y, 0.0D).endVertex(); // bottom right - bufferBuilder.pos(x, y, 0.0D).endVertex(); // bottom left - bufferBuilder.pos(x, y, 0.0D).endVertex(); // bottom left - bufferBuilder.pos(x, bottom, 0.0D).endVertex(); // top left - tessellator.draw(); - - GlStateManager.enableTexture2D(); - GlStateManager.disableBlend(); - } -} diff --git a/src/main/java/com/me/infinity/loop/util/utils/renders/Render2DUtil.java b/src/main/java/com/me/infinity/loop/util/utils/renders/Render2DUtil.java deleted file mode 100644 index 861eafa..0000000 --- a/src/main/java/com/me/infinity/loop/util/utils/renders/Render2DUtil.java +++ /dev/null @@ -1,360 +0,0 @@ -package com.me.infinity.loop.util.utils.renders; - -import com.me.infinity.loop.mixin.MixinInterface; -import com.me.infinity.loop.util.utils.MotionUtil; -import com.me.infinity.loop.util.utils.renders.builder.Render2DBuilder; -import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.client.renderer.*; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.entity.EntityLivingBase; -import org.lwjgl.opengl.GL11; - -import java.awt.*; - -import static org.lwjgl.opengl.GL11.*; - -/** - * @author linustouchtips - * @since 01/12/2021 - */ - -public class Render2DUtil implements MixinInterface { - - public static void drawRect(int left, double top, int right, double bottom, int borderWidth, int insideColor, int borderColor, boolean scissor, Render2DBuilder.Render2DMode render2DMode) { - if (scissor) { - Render2DBuilder.prepareScissor(left, top, right, bottom); - GL11.glEnable(GL_SCISSOR_TEST); - } - - switch (render2DMode) { - case Normal: - drawRectBase(left, top, right, bottom, insideColor); - break; - case Border: - drawBorderedRect(left, top, right, bottom, borderWidth, new Color(0, 0, 0, 0).getRGB(), borderColor); - break; - case Both: - drawBorderedRect(left, top, right, bottom, borderWidth, insideColor, borderColor); - break; - } - - if (scissor) - GL11.glDisable(GL_SCISSOR_TEST); - } - - public static void drawRect(int left, double top, double right, double bottom, int borderWidth, int insideColor, int borderColor, boolean scissor, Render2DBuilder.Render2DMode render2DMode) { - if (scissor) { - Render2DBuilder.prepareScissor(left, top, (int) right, bottom); - GL11.glEnable(GL_SCISSOR_TEST); - } - - switch (render2DMode) { - case Normal: - drawRectBase(left, top, right, bottom, insideColor); - break; - case Border: - drawBorderedRect(left, top, (int) right, bottom, borderWidth, new Color(0, 0, 0, 0).getRGB(), borderColor); - break; - case Both: - drawBorderedRect(left, top, (int) right, bottom, borderWidth, insideColor, borderColor); - break; - } - - if (scissor) - GL11.glDisable(GL_SCISSOR_TEST); - } - - public static void drawBorderedRect(int left, double top, int right, double bottom, int borderWidth, int insideColor, int borderColor) { - drawRectBase(left + borderWidth, top + borderWidth, right - borderWidth, bottom - borderWidth, insideColor); - - drawRectBase(left, top + borderWidth, left + borderWidth, bottom - borderWidth, borderColor); - drawRectBase(right - borderWidth, top + borderWidth, right, bottom - borderWidth, borderColor); - drawRectBase(left, top, right, top + borderWidth, borderColor); - drawRectBase(left, bottom - borderWidth, right, bottom, borderColor); - } - - public static void drawBorder(int left, int top, int right, int bottom, int borderWidth, int color) { - drawRectBase(left, top + borderWidth, left + borderWidth, bottom - borderWidth, color); - drawRectBase(right - borderWidth, top + borderWidth, right, bottom - borderWidth, color); - drawRectBase(left, top, right, top + borderWidth, color); - drawRectBase(left, bottom - borderWidth, right, bottom, color); - } - - public static void drawRectBase(int left,double top, double right, double bottom, int color) { - double side; - - if (left < right) { - side = left; - left = (int) right; - right = (int) side; - } - - if (top < bottom) { - side = top; - top = bottom; - bottom = side; - } - - GlStateManager.enableBlend(); - GlStateManager.disableTexture2D(); - GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); - GlStateManager.color((float) (color >> 16 & 255) / 255.0F, (float) (color >> 8 & 255) / 255.0F, (float) (color & 255) / 255.0F, (float) (color >> 24 & 255) / 255.0F); - Tessellator tessellator = Tessellator.getInstance(); - BufferBuilder bufferbuilder = tessellator.getBuffer(); - bufferbuilder.begin(GL_QUADS, DefaultVertexFormats.POSITION); - bufferbuilder.pos(left, bottom, 0.0D).endVertex(); - bufferbuilder.pos(right, bottom, 0.0D).endVertex(); - bufferbuilder.pos(right, top, 0.0D).endVertex(); - bufferbuilder.pos(left, top, 0.0D).endVertex(); - tessellator.draw(); - GlStateManager.enableTexture2D(); - GlStateManager.disableBlend(); - } - - public static void drawRectBase(int left,double top, int right, double bottom, int color) { - double side; - - if (left < right) { - side = left; - left = right; - right = (int) side; - } - - if (top < bottom) { - side = top; - top = bottom; - bottom = side; - } - - GlStateManager.enableBlend(); - GlStateManager.disableTexture2D(); - GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); - GlStateManager.color((float) (color >> 16 & 255) / 255.0F, (float) (color >> 8 & 255) / 255.0F, (float) (color & 255) / 255.0F, (float) (color >> 24 & 255) / 255.0F); - Tessellator tessellator = Tessellator.getInstance(); - BufferBuilder bufferbuilder = tessellator.getBuffer(); - bufferbuilder.begin(GL_QUADS, DefaultVertexFormats.POSITION); - bufferbuilder.pos(left, bottom, 0.0D).endVertex(); - bufferbuilder.pos(right, bottom, 0.0D).endVertex(); - bufferbuilder.pos(right, top, 0.0D).endVertex(); - bufferbuilder.pos(left, top, 0.0D).endVertex(); - tessellator.draw(); - GlStateManager.enableTexture2D(); - GlStateManager.disableBlend(); - } - - public static void drawCircle(int x, int y, double radius, int color) { - glEnable(GL_BLEND); - glDisable(GL_TEXTURE_2D); - glEnable(GL_LINE_SMOOTH); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glColor4f(((color >> 16) & 0xff) / 255F, ((color >> 8) & 0xff) / 255F, (color & 0xff) / 255F, ((color >> 24) & 0xff) / 255F); - glBegin(GL_LINE_LOOP); - - for (int i = 0; i <= 360; i++) - glVertex2d( x + Math.sin(((i * Math.PI) / 180)) * radius, y + Math.cos(((i * Math.PI) / 180)) * radius); - - glEnd(); - glDisable(GL_LINE_SMOOTH); - glEnable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - } - - public static void drawFilledCircle(int x, int y, double radius, int color) { - glEnable(GL_BLEND); - glDisable(GL_TEXTURE_2D); - glEnable(GL_LINE_SMOOTH); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glColor4f(((color >> 16) & 0xff) / 255F, ((color >> 8) & 0xff) / 255F, (color & 0xff) / 255F, ((color >> 24) & 0xff) / 255F); - glBegin(GL_TRIANGLE_FAN); - - for (int i = 0; i <= 360; i++) - glVertex2d( x + Math.sin(((i * Math.PI) / 180)) * radius, y + Math.cos(((i * Math.PI) / 180)) * radius); - - glEnd(); - glDisable(GL_LINE_SMOOTH); - glEnable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - } - - public static void drawTriangle(double x, double y, float rotation, int color) { - glPushMatrix(); - glScaled(0.5, 0.5, 0.5); - glTranslated(x, y, 0); - glColor4f(((color >> 16) & 0xff) / 255F, ((color >> 8) & 0xff) / 255F, (color & 0xff) / 255F, ((color >> 24) & 0xff) / 255F); - glEnable(GL_BLEND); - glDisable(GL_TEXTURE_2D); - glEnable(GL_LINE_SMOOTH); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glBegin(GL_TRIANGLES); - - glVertex2d(0, 6); - glVertex2d(3, -2); - glVertex2d(-3, -2); - - glEnd(); - glDisable(GL_LINE_SMOOTH); - glEnable(GL_LINE_SMOOTH); - glDisable(GL_TEXTURE_2D); - glRotatef(rotation, 0F, 0F, 1.0F); - - glPopMatrix(); - } - - public static void drawHitMarkers(Color color) { - int screenWidth = new ScaledResolution(mc).getScaledWidth(); - int screenHeight = new ScaledResolution(mc).getScaledHeight(); - drawLine(screenWidth / 2.0f - 4.0f, screenHeight / 2.0f - 4.0f, screenWidth / 2.0f - 8.0f, screenHeight / 2.0f - 8.0f, 0.75f, ColorUtil.toRGBA(color.getRed(), color.getGreen(), color.getBlue(), 255)); - drawLine(screenWidth / 2.0f + 4.0f, screenHeight / 2.0f - 4.0f, screenWidth / 2.0f + 8.0f, screenHeight / 2.0f - 8.0f, 0.75f, ColorUtil.toRGBA(color.getRed(), color.getGreen(), color.getBlue(), 255)); - drawLine(screenWidth / 2.0f - 4.0f, screenHeight / 2.0f + 4.0f, screenWidth / 2.0f - 8.0f, screenHeight / 2.0f + 8.0f, 0.75f, ColorUtil.toRGBA(color.getRed(), color.getGreen(), color.getBlue(), 255)); - drawLine(screenWidth / 2.0f + 4.0f, screenHeight / 2.0f + 4.0f, screenWidth / 2.0f + 8.0f, screenHeight / 2.0f + 8.0f, 0.75f, ColorUtil.toRGBA(color.getRed(), color.getGreen(), color.getBlue(), 255)); - } - - public static void drawCrosshairs(double separation, double bend, double width, double thickness, boolean dynamic, int color) { - int screenWidth = new ScaledResolution(mc).getScaledWidth(); - int screenHeight = new ScaledResolution(mc).getScaledHeight(); - separation += (MotionUtil.isMoving() && dynamic) ? 1 : 0; - Render2DUtil.drawLine((float) ((screenWidth / 2) - separation), (float) ((screenHeight / 2) - (bend / 2)), (float) ((screenWidth / 2) - separation - width), (float) ((screenHeight / 2) - (bend / 2)), (int) thickness, color); - Render2DUtil.drawLine((float) ((screenWidth / 2) + separation), (float) ((screenHeight / 2) - (bend / 2)), (float) ((screenWidth / 2) + separation + width), (float) ((screenHeight / 2) + (bend / 2)), (int) thickness, color); - Render2DUtil.drawLine((float) ((screenWidth / 2) - (bend / 2)), (float) ((screenHeight / 2) - separation), (float) ((screenWidth / 2) - (bend / 2)), (float) ((screenHeight / 2) - separation - width), (int) thickness, color); - Render2DUtil.drawLine((float) ((screenWidth / 2) - (bend / 2)), (float) ((screenHeight / 2) + separation), (float) ((screenWidth / 2) + (bend / 2)), (float) ((screenHeight / 2) + separation + width), (int) thickness, color); - } - - public static void drawLine(float x, float y, float x1, float y1, float thickness, int color) { - GlStateManager.pushMatrix(); - GlStateManager.disableTexture2D(); - GlStateManager.enableBlend(); - GlStateManager.disableAlpha(); - GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ZERO, GL_ONE); - GlStateManager.shadeModel(GL_SMOOTH); - glLineWidth(thickness); - glEnable(GL_LINE_SMOOTH); - glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); - Tessellator tessellator = Tessellator.getInstance(); - BufferBuilder bufferbuilder = tessellator.getBuffer(); - bufferbuilder.begin(GL_LINE_STRIP, DefaultVertexFormats.POSITION_COLOR); - bufferbuilder.pos(x, y, 0.0D).color((color >> 16 & 0xFF) / 255.0F, (color >> 8 & 0xFF) / 255.0F, (color & 0xFF) / 255.0F, (color >> 24 & 0xFF) / 255.0F).endVertex(); - bufferbuilder.pos(x1, y1, 0.0D).color((color >> 16 & 0xFF) / 255.0F, (color >> 8 & 0xFF) / 255.0F, (color & 0xFF) / 255.0F, (color >> 24 & 0xFF) / 255.0F).endVertex(); - tessellator.draw(); - GlStateManager.shadeModel(GL_FLAT); - glDisable(GL_LINE_SMOOTH); - GlStateManager.disableBlend(); - GlStateManager.enableAlpha(); - GlStateManager.enableTexture2D(); - GlStateManager.popMatrix(); - } - - public static void drawEntityOnScreen(int posX, int posY, int scale, float mouseY, EntityLivingBase ent) { - GlStateManager.enableColorMaterial(); - GlStateManager.pushMatrix(); - GlStateManager.translate((float) posX, (float) posY, 50.0F); - GlStateManager.scale((float) (-scale), (float) scale, (float) scale); - GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F); - GlStateManager.rotate(135.0F, 0.0F, 1.0F, 0.0F); - RenderHelper.enableStandardItemLighting(); - GlStateManager.rotate(-135.0F, 0.0F, 1.0F, 0.0F); - GlStateManager.rotate(-((float) Math.atan(mouseY / 40.0F)) * 20.0F, 1.0F, 0.0F, 0.0F); - GlStateManager.translate(0.0F, 0.0F, 0.0F); - mc.getRenderManager().setPlayerViewY(180.0F); - mc.getRenderManager().setRenderShadow(false); - mc.getRenderManager().renderEntity(ent, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F, false); - mc.getRenderManager().setRenderShadow(true); - GlStateManager.popMatrix(); - RenderHelper.disableStandardItemLighting(); - GlStateManager.disableRescaleNormal(); - GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit); - GlStateManager.disableTexture2D(); - GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); - } - - public static void drawPickerBase(int pickerX, int pickerY, int pickerWidth, int pickerHeight, float red, float green, float blue, float alpha) { - glEnable(GL_BLEND); - glDisable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glShadeModel(GL_SMOOTH); - glBegin(GL_POLYGON); - glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - glVertex2f(pickerX, pickerY); - glVertex2f(pickerX, pickerY + pickerHeight); - glColor4f(red, green, blue, alpha); - glVertex2f(pickerX + pickerWidth, pickerY + pickerHeight); - glVertex2f(pickerX + pickerWidth, pickerY); - glEnd(); - glDisable(GL_ALPHA_TEST); - glBegin(GL_POLYGON); - glColor4f(0.0f, 0.0f, 0.0f, 0.0f); - glVertex2f(pickerX, pickerY); - glColor4f(0.0f, 0.0f, 0.0f, 1.0f); - glVertex2f(pickerX, pickerY + pickerHeight); - glVertex2f(pickerX + pickerWidth, pickerY + pickerHeight); - glColor4f(0.0f, 0.0f, 0.0f, 0.0f); - glVertex2f(pickerX + pickerWidth, pickerY); - glEnd(); - glEnable(GL_ALPHA_TEST); - glShadeModel(GL_FLAT); - glEnable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - } - - public static void gradient(int minX, int minY, int maxX, int maxY, int startColor, int endColor, boolean left) { - if (left) { - glEnable(GL_BLEND); - glDisable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glShadeModel(GL_SMOOTH); - glBegin(GL_POLYGON); - glColor4f((startColor >> 16 & 0xFF) / 255.0f, (startColor >> 8 & 0xFF) / 255.0f, (startColor & 0xFF) / 255.0f, (startColor >> 24 & 0xFF) / 255.0f); - glVertex2f(minX, minY); - glVertex2f(minX, maxY); - glColor4f((endColor >> 16 & 0xFF) / 255.0f, (endColor >> 8 & 0xFF) / 255.0f, (endColor & 0xFF) / 255.0f, (endColor >> 24 & 0xFF) / 255.0f); - glVertex2f(maxX, maxY); - glVertex2f(maxX, minY); - glEnd(); - glShadeModel(GL_FLAT); - glEnable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - } - - else - drawGradientRect(minX, minY, maxX, maxY, startColor, endColor); - } - - public static void drawGradientRect(int left, int top, int right, int bottom, int startColor, int endColor) { - GlStateManager.disableTexture2D(); - GlStateManager.enableBlend(); - GlStateManager.disableAlpha(); - GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); - GlStateManager.shadeModel(GL_SMOOTH); - Tessellator tessellator = Tessellator.getInstance(); - BufferBuilder bufferbuilder = tessellator.getBuffer(); - bufferbuilder.begin(GL_QUADS, DefaultVertexFormats.POSITION_COLOR); - bufferbuilder.pos(right, top, 0).color((float) (startColor >> 16 & 255) / 255.0F, (float) (startColor >> 8 & 255) / 255.0F, (float) (startColor & 255) / 255.0F, (float) (startColor >> 24 & 255) / 255.0F).endVertex(); - bufferbuilder.pos(left, top, 0).color((float) (startColor >> 16 & 255) / 255.0F, (float) (startColor >> 8 & 255) / 255.0F, (float) (startColor & 255) / 255.0F, (float) (startColor >> 24 & 255) / 255.0F).endVertex(); - bufferbuilder.pos(left, bottom, 0).color((float) (endColor >> 16 & 255) / 255.0F, (float) (endColor >> 8 & 255) / 255.0F, (float) (endColor & 255) / 255.0F, (float) (endColor >> 24 & 255) / 255.0F).endVertex(); - bufferbuilder.pos(right, bottom, 0).color((float) (endColor >> 16 & 255) / 255.0F, (float) (endColor >> 8 & 255) / 255.0F, (float) (endColor & 255) / 255.0F, (float) (endColor >> 24 & 255) / 255.0F).endVertex(); - tessellator.draw(); - GlStateManager.shadeModel(GL_FLAT); - GlStateManager.disableBlend(); - GlStateManager.enableAlpha(); - GlStateManager.enableTexture2D(); - } - - public static void drawLeftGradientRect(int left, int top, int right, int bottom, int startColor, int endColor) { - GlStateManager.disableTexture2D(); - GlStateManager.enableBlend(); - GlStateManager.disableAlpha(); - GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); - GlStateManager.shadeModel(GL_SMOOTH); - Tessellator tessellator = Tessellator.getInstance(); - BufferBuilder bufferbuilder = tessellator.getBuffer(); - bufferbuilder.begin(GL_QUADS, DefaultVertexFormats.POSITION_COLOR); - bufferbuilder.pos(right, top, 0).color((float) (endColor >> 24 & 255) / 255.0F, (float) (endColor >> 16 & 255) / 255.0F, (float) (endColor >> 8 & 255) / 255.0F, (float) (endColor >> 24 & 255) / 255.0F).endVertex(); - bufferbuilder.pos(left, top, 0).color((float) (startColor >> 16 & 255) / 255.0F, (float) (startColor >> 8 & 255) / 255.0F, (float) (startColor & 255) / 255.0F, (float) (startColor >> 24 & 255) / 255.0F).endVertex(); - bufferbuilder.pos(left, bottom, 0).color((float) (startColor >> 16 & 255) / 255.0F, (float) (startColor >> 8 & 255) / 255.0F, (float) (startColor & 255) / 255.0F, (float) (startColor >> 24 & 255) / 255.0F).endVertex(); - bufferbuilder.pos(right, bottom, 0).color((float) (endColor >> 24 & 255) / 255.0F, (float) (endColor >> 16 & 255) / 255.0F, (float) (endColor >> 8 & 255) / 255.0F, (float) (endColor >> 24 & 255) / 255.0F).endVertex(); - tessellator.draw(); - GlStateManager.shadeModel(GL_FLAT); - GlStateManager.disableBlend(); - GlStateManager.enableAlpha(); - GlStateManager.enableTexture2D(); - } -} diff --git a/src/main/java/com/me/infinity/loop/util/utils/renders/TessellatorUtil.java b/src/main/java/com/me/infinity/loop/util/utils/renders/TessellatorUtil.java deleted file mode 100644 index a98ffd8..0000000 --- a/src/main/java/com/me/infinity/loop/util/utils/renders/TessellatorUtil.java +++ /dev/null @@ -1,176 +0,0 @@ -package com.me.infinity.loop.util.utils.renders; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.BufferBuilder; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.util.math.AxisAlignedBB; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL32; - -import java.awt.*; - -import static org.lwjgl.opengl.GL11.glEnable; -import static org.lwjgl.opengl.GL11.glHint; - -public class TessellatorUtil { - private static final Minecraft mc = Minecraft.getMinecraft(); - - - public static void drawBoundingBox(AxisAlignedBB bb, double width, Color color) { - drawBoundingBox(bb, width, color, color.getAlpha()); - } - - public static void drawBoundingBox(AxisAlignedBB bb, double width, Color color, int alpha) { - Tessellator tessellator = Tessellator.getInstance(); - BufferBuilder bufferbuilder = tessellator.getBuffer(); - GlStateManager.glLineWidth((float) width); - bufferbuilder.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION_COLOR); - colorVertex(bb.minX, bb.minY, bb.minZ,color,color.getAlpha(), bufferbuilder); - colorVertex(bb.minX, bb.minY, bb.maxZ,color,color.getAlpha(), bufferbuilder); - colorVertex(bb.maxX, bb.minY, bb.maxZ,color,color.getAlpha(), bufferbuilder); - colorVertex(bb.maxX, bb.minY, bb.minZ,color,color.getAlpha(), bufferbuilder); - colorVertex(bb.minX, bb.minY, bb.minZ,color,color.getAlpha(), bufferbuilder); - colorVertex(bb.minX, bb.maxY, bb.minZ,color, alpha, bufferbuilder); - colorVertex(bb.minX, bb.maxY, bb.maxZ,color, alpha, bufferbuilder); - colorVertex(bb.minX, bb.minY, bb.maxZ,color,color.getAlpha(), bufferbuilder); - colorVertex(bb.maxX, bb.minY, bb.maxZ,color,color.getAlpha(), bufferbuilder); - colorVertex(bb.maxX, bb.maxY, bb.maxZ,color, alpha, bufferbuilder); - colorVertex(bb.minX, bb.maxY, bb.maxZ,color, alpha, bufferbuilder); - colorVertex(bb.maxX, bb.maxY, bb.maxZ,color, alpha, bufferbuilder); - colorVertex(bb.maxX, bb.maxY, bb.minZ,color, alpha, bufferbuilder); - colorVertex(bb.maxX, bb.minY, bb.minZ,color,color.getAlpha(), bufferbuilder); - colorVertex(bb.maxX, bb.maxY, bb.minZ,color, alpha, bufferbuilder); - colorVertex(bb.minX, bb.maxY, bb.minZ,color, alpha, bufferbuilder); - tessellator.draw(); - } - - - public static void drawBox(AxisAlignedBB bb, Color color) { - drawBox(bb, true, 1, color, color.getAlpha(), FaceMasks.Quad.ALL); - } - - - public static void drawBox(AxisAlignedBB bb, boolean check, double height, Color color, int alpha, int sides) { - if (check) { - drawBox(bb.minX, bb.minY, bb.minZ, bb.maxX-bb.minX, bb.maxY-bb.minY, bb.maxZ-bb.minZ, color, alpha, sides); - } - else { - drawBox(bb.minX, bb.minY, bb.minZ, bb.maxX-bb.minX, height, bb.maxZ-bb.minZ, color, alpha, sides); - } - } - - public static void drawBox(double x, double y, double z, double w, double h, double d, Color color, int alpha, int sides) { - // GlStateManager.disableAlpha(); - Tessellator tessellator = Tessellator.getInstance(); - BufferBuilder bufferbuilder = tessellator.getBuffer(); - bufferbuilder.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR); - doVerticies(new AxisAlignedBB(x,y,z,x+w,y+h,z+d),color, alpha, bufferbuilder,sides,false); - tessellator.draw(); - // GlStateManager.enableAlpha(); - } - - public static void drawLine(double posx, double posy, double posz, double posx2, double posy2, double posz2, Color color) { - drawLine(posx,posy,posz,posx2,posy2,posz2,color,1); - } - - public static void drawLine(double posx, double posy, double posz, double posx2, double posy2, double posz2, Color color, float width) { - Tessellator tessellator = Tessellator.getInstance(); - BufferBuilder bufferbuilder = tessellator.getBuffer(); - GlStateManager.glLineWidth(width); - bufferbuilder.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION); - vertex(posx,posy,posz, bufferbuilder); - vertex(posx2,posy2,posz2, bufferbuilder); - tessellator.draw(); - } - - - - private static void vertex(double x, double y, double z, BufferBuilder bufferbuilder) { - bufferbuilder.pos(x-mc.getRenderManager().viewerPosX,y-mc.getRenderManager().viewerPosY,z-mc.getRenderManager().viewerPosZ).endVertex(); - } - - private static void colorVertex(double x, double y, double z, Color color, int alpha, BufferBuilder bufferbuilder) { - bufferbuilder.pos(x-mc.getRenderManager().viewerPosX,y-mc.getRenderManager().viewerPosY,z-mc.getRenderManager().viewerPosZ).color(color.getRed(), color.getGreen(), color.getBlue(), alpha).endVertex(); - } - - - - private static void doVerticies(AxisAlignedBB axisAlignedBB, Color color, int alpha, BufferBuilder bufferbuilder, int sides, boolean five) { - if ((sides & FaceMasks.Quad.EAST) != 0) { - colorVertex(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.maxZ,color,color.getAlpha(), bufferbuilder); - colorVertex(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.minZ,color,color.getAlpha(), bufferbuilder); - colorVertex(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.minZ,color, alpha, bufferbuilder); - colorVertex(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.maxZ,color, alpha, bufferbuilder); - if (five) colorVertex(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.maxZ,color,color.getAlpha(), bufferbuilder); - } - if ((sides & FaceMasks.Quad.WEST) != 0) { - colorVertex(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.minZ,color,color.getAlpha(), bufferbuilder); - colorVertex(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.maxZ,color,color.getAlpha(), bufferbuilder); - colorVertex(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.maxZ,color, alpha, bufferbuilder); - colorVertex(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.minZ,color, alpha, bufferbuilder); - if (five) colorVertex(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.minZ,color,color.getAlpha(), bufferbuilder); - } - if ((sides & FaceMasks.Quad.NORTH) != 0) { - colorVertex(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.minZ,color,color.getAlpha(), bufferbuilder); - colorVertex(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.minZ,color,color.getAlpha(), bufferbuilder); - colorVertex(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.minZ,color, alpha, bufferbuilder); - colorVertex(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.minZ,color, alpha, bufferbuilder); - if (five) colorVertex(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.minZ,color,color.getAlpha(), bufferbuilder); - } - if ((sides & FaceMasks.Quad.SOUTH) != 0) { - colorVertex(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.maxZ,color,color.getAlpha(), bufferbuilder); - colorVertex(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.maxZ,color,color.getAlpha(), bufferbuilder); - colorVertex(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.maxZ,color, alpha, bufferbuilder); - colorVertex(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.maxZ,color, alpha, bufferbuilder); - if (five) colorVertex(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.maxZ,color,color.getAlpha(), bufferbuilder); - } - if ((sides & FaceMasks.Quad.UP) != 0) { - colorVertex(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.minZ,color, alpha, bufferbuilder); - colorVertex(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.minZ,color, alpha, bufferbuilder); - colorVertex(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.maxZ,color, alpha, bufferbuilder); - colorVertex(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.maxZ,color, alpha, bufferbuilder); - if (five) colorVertex(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.minZ,color, alpha, bufferbuilder); - } - if ((sides & FaceMasks.Quad.DOWN) != 0) { - colorVertex(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.minZ,color,color.getAlpha(), bufferbuilder); - colorVertex(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.maxZ,color,color.getAlpha(), bufferbuilder); - colorVertex(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.maxZ,color,color.getAlpha(), bufferbuilder); - colorVertex(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.minZ,color,color.getAlpha(), bufferbuilder); - if (five) colorVertex(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.minZ,color,color.getAlpha(), bufferbuilder); - } - } - - public static void prepare() { - GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); - glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ZERO, GL11.GL_ONE); - GlStateManager.shadeModel(GL11.GL_SMOOTH); - GlStateManager.depthMask(false); - GlStateManager.enableBlend(); - GlStateManager.disableDepth(); - GlStateManager.disableTexture2D(); - GlStateManager.disableLighting(); - GlStateManager.disableCull(); - GlStateManager.enableAlpha(); - glEnable(GL11.GL_LINE_SMOOTH); - glEnable(GL32.GL_DEPTH_CLAMP); - } - - public static void release() { - GL11.glDisable(GL32.GL_DEPTH_CLAMP); - GL11.glDisable(GL11.GL_LINE_SMOOTH); - GlStateManager.enableAlpha(); - GlStateManager.enableCull(); - GlStateManager.enableLighting(); - GlStateManager.enableTexture2D(); - GlStateManager.enableDepth(); - GlStateManager.disableBlend(); - GlStateManager.depthMask(true); - GlStateManager.glLineWidth(1.0f); - GlStateManager.shadeModel(GL11.GL_FLAT); - glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_DONT_CARE); - GL11.glPopAttrib(); - } -} diff --git a/src/main/java/com/me/infinity/loop/util/utils/renders/TestColor.java b/src/main/java/com/me/infinity/loop/util/utils/renders/TestColor.java deleted file mode 100644 index 0d33054..0000000 --- a/src/main/java/com/me/infinity/loop/util/utils/renders/TestColor.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.me.infinity.loop.util.utils.renders; - -import net.minecraft.client.renderer.GlStateManager; - -import java.awt.*; - -/** - * @author lukflug - */ - -public class TestColor extends Color { - - private static final long serialVersionUID = 1L; - - public TestColor(int rgb) { - super(rgb); - } - - public TestColor(int rgba, boolean hasalpha) { - super(rgba, hasalpha); - } - - public TestColor(int r, int g, int b) { - super(r, g, b); - } - - public TestColor(int r, int g, int b, int a) { - super(r, g, b, a); - } - - public TestColor(Color color) { - super(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()); - } - - public TestColor(TestColor color, int a) { - super(color.getRed(), color.getGreen(), color.getBlue(), a); - } - - public static TestColor fromHSB(float hue, float saturation, float brightness) { - return new TestColor(Color.getHSBColor(hue, saturation, brightness)); - } - - public float getHue() { - return RGBtoHSB(getRed(), getGreen(), getBlue(), null)[0]; - } - - public float getSaturation() { - return RGBtoHSB(getRed(), getGreen(), getBlue(), null)[1]; - } - - public float getBrightness() { - return RGBtoHSB(getRed(), getGreen(), getBlue(), null)[2]; - } - - public void glColor() { - GlStateManager.color(getRed() / 255.0f, getGreen() / 255.0f, getBlue() / 255.0f, getAlpha() / 255.0f); - } -} \ No newline at end of file diff --git a/src/main/java/com/me/infinity/loop/util/utils/renders/helper/MousePosition.java b/src/main/java/com/me/infinity/loop/util/utils/renders/helper/MousePosition.java deleted file mode 100644 index 7a0d306..0000000 --- a/src/main/java/com/me/infinity/loop/util/utils/renders/helper/MousePosition.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.me.infinity.loop.util.utils.renders.helper; - -import net.minecraft.util.math.Vec2f; - -public class MousePosition { - - private Vec2f mousePosition; - private boolean leftClick, rightClick, leftHeld, rightHeld; - - public MousePosition(Vec2f mousePosition, boolean leftClick, boolean rightClick, boolean leftHeld, boolean rightHeld) { - this.mousePosition = mousePosition; - this.leftClick = leftClick; - this.rightClick = rightClick; - this.leftHeld = leftHeld; - this.rightHeld = rightHeld; - } - - public boolean isLeftClick() { - return leftClick; - } - - public void setLeftClick(boolean in) { - leftClick = in; - } - - public boolean isRightClick() { - return rightClick; - } - - public void setRightClick(boolean in) { - rightClick = in; - } - - public boolean isLeftHeld() { - return leftHeld; - } - - public void setLeftHeld(boolean in) { - leftHeld = in; - } - - public boolean isRightHeld() { - return rightHeld; - } - - public void setRightHeld(boolean in) { - rightHeld = in; - } - - public void setPosition(Vec2f in) { - mousePosition = in; - } - - public Vec2f getPosition() { - return mousePosition; - } -} diff --git a/src/main/java/com/me/infinity/loop/util/utils/renders/helper/RectHelper.java b/src/main/java/com/me/infinity/loop/util/utils/renders/helper/RectHelper.java deleted file mode 100644 index d0a95f2..0000000 --- a/src/main/java/com/me/infinity/loop/util/utils/renders/helper/RectHelper.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.me.infinity.loop.util.utils.renders.helper; - -import net.minecraft.client.renderer.BufferBuilder; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import org.lwjgl.opengl.GL11; - -public class RectHelper { - - public static long delta = 0L; - - public static void drawRect(double left, double top, double right, double bottom, int color) { - if (left < right) - { - double i = left; - left = right; - right = i; - } - - if (top < bottom) - { - double j = top; - top = bottom; - bottom = j; - } - - float f3 = (float)(color >> 24 & 255) / 255.0F; - float f = (float)(color >> 16 & 255) / 255.0F; - float f1 = (float)(color >> 8 & 255) / 255.0F; - float f2 = (float)(color & 255) / 255.0F; - Tessellator tessellator = Tessellator.getInstance(); - BufferBuilder bufferbuilder = tessellator.getBuffer(); - GlStateManager.enableBlend(); - GlStateManager.disableTexture2D(); - GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); - GlStateManager.color(f, f1, f2, f3); - bufferbuilder.begin(7, DefaultVertexFormats.POSITION); - bufferbuilder.pos(left, bottom, 0.0D).endVertex(); - bufferbuilder.pos(right, bottom, 0.0D).endVertex(); - bufferbuilder.pos(right, top, 0.0D).endVertex(); - bufferbuilder.pos(left, top, 0.0D).endVertex(); - tessellator.draw(); - GlStateManager.enableTexture2D(); - GlStateManager.disableBlend(); - } - public static void drawSmoothRect(float left, float top, float right, float bottom, int color) { - GL11.glEnable(GL11.GL_BLEND); - GL11.glEnable(GL11.GL_LINE_SMOOTH); - drawRect(left, top, right, bottom, color); - GL11.glScalef(0.5f, 0.5f, 0.5f); - drawRect(left * 2 - 1, top * 2, left * 2, bottom * 2 - 1, color); - drawRect(left * 2, top * 2 - 1, right * 2, top * 2, color); - drawRect(right * 2, top * 2, right * 2 + 1, bottom * 2 - 1, color); - drawRect(left * 2, bottom * 2 - 1, right * 2, bottom * 2, color); - GL11.glDisable(GL11.GL_LINE_SMOOTH); - GL11.glDisable(GL11.GL_BLEND); - GL11.glScalef(2F, 2F, 2F); - } - public static void drawBorderedRect(float left, float top, float right, float bottom, float borderWidth, int insideColor, int borderColor, boolean borderIncludedInBounds) { - drawRect(left - (!borderIncludedInBounds ? borderWidth : 0), top - (!borderIncludedInBounds ? borderWidth : 0), right + (!borderIncludedInBounds ? borderWidth : 0), bottom + (!borderIncludedInBounds ? borderWidth : 0), borderColor); - drawRect(left + (borderIncludedInBounds ? borderWidth : 0), top + (borderIncludedInBounds ? borderWidth : 0), right - ((borderIncludedInBounds ? borderWidth : 0)), bottom - ((borderIncludedInBounds ? borderWidth : 0)), insideColor); - } -} diff --git a/src/main/java/com/me/infinity/loop/util/utils/renders/helper/dism/EntityGib.java b/src/main/java/com/me/infinity/loop/util/utils/renders/helper/dism/EntityGib.java deleted file mode 100644 index 4afa3b5..0000000 --- a/src/main/java/com/me/infinity/loop/util/utils/renders/helper/dism/EntityGib.java +++ /dev/null @@ -1,332 +0,0 @@ -package com.me.infinity.loop.util.utils.renders.helper.dism; - -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.features.modules.render.Dismemberment; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.MoverType; -import net.minecraft.entity.item.EntityMinecartTNT; -import net.minecraft.entity.item.EntityTNTPrimed; -import net.minecraft.entity.monster.EntityCreeper; -import net.minecraft.entity.monster.EntitySkeleton; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.World; - -import java.util.Iterator; -import java.util.List; - -public class EntityGib extends Entity -{ - public EntityLivingBase parent; - public int type; - public float pitchSpin; - public float yawSpin; - - public int groundTime; - public int liveTime; - - public boolean explosion; - - public EntityGib(World world) - { - super(world); - parent = null; - type = 0; //0 == head; 1 == left arm; 2 == right arm; 3 == head; 4 == left leg; 5 == right leg; 6+ creeperfeet. -1 playerhead2layer - - groundTime = 0; - liveTime = Dismemberment.ticks; - ignoreFrustumCheck = true; - } - - public EntityGib(World world, EntityLivingBase gibParent, int gibType, Entity explo) - { - this(world); - parent = gibParent; - type = gibType; - - liveTime = Dismemberment.ticks; - - setLocationAndAngles(parent.posX, parent.getEntityBoundingBox().minY, parent.posZ, parent.rotationYaw, parent.rotationPitch); - rotationYaw = parent.prevRenderYawOffset; - prevRotationYaw = parent.rotationYaw; - prevRotationPitch = parent.rotationPitch; - - motionX = parent.motionX + (rand.nextDouble() - rand.nextDouble()) * 0.25D; - motionY = parent.motionY; - motionZ = parent.motionZ + (rand.nextDouble() - rand.nextDouble()) * 0.25D; - - if(type == -1) - { - rotationYaw = parent.rotationYawHead; - setSize(1, 1); - posY += 1.5D; - } - if(type == 0) - { - rotationYaw = parent.rotationYawHead; - setSize(0.5F, 0.5F); - if(parent instanceof EntityCreeper) - { - posY += 1.25D; - } - else - { - posY += 1.5D; - } - } - else if(type == 1 || type == 2) - { - setSize(0.3F, 0.4F); - - double offset = 0.350D; - double offset1 = -0.250D; - - if(parent instanceof EntitySkeleton) - { - offset -= 0.05D; - posY += 0.15D; - } - if(type == 2) - { - offset *= -1D; - } - - posX += offset * Math.cos(Math.toRadians(parent.renderYawOffset)); - posZ += offset * Math.sin(Math.toRadians(parent.renderYawOffset)); - - posX += offset1 * Math.sin(Math.toRadians(parent.renderYawOffset)); - posZ -= offset1 * Math.cos(Math.toRadians(parent.renderYawOffset)); - - posY += 1.25D; - - prevRotationPitch = rotationPitch = -90F; - } - else if(type == 3) - { - setSize(0.5F, 0.5F); - if(parent instanceof EntityCreeper) - { - posY += 0.75D; - } - else - { - posY += 1.0D; - } - } - else if(type == 4 || type == 5) - { - setSize(0.3F, 0.4F); - - double offset = 0.125D; - - if(type == 5) - { - offset *= -1D; - } - - posX += offset * Math.cos(Math.toRadians(parent.renderYawOffset)); - posZ += offset * Math.sin(Math.toRadians(parent.renderYawOffset)); - - posY += 0.375D; - } - else if(type >= 6) - { - setSize(0.3F, 0.4F); - - double offset = 0.125D; - double offset1 = -0.250D; - - if(parent instanceof EntitySkeleton) - { - offset -= 0.05D; - posY += 0.15D; - } - if(type % 2 == 1) - { - offset *= -1D; - } - if(type >= 8) - { - offset1 *= -1D; - } - - posX += offset * Math.cos(Math.toRadians(parent.renderYawOffset)); - posZ += offset * Math.sin(Math.toRadians(parent.renderYawOffset)); - - posX += offset1 * Math.sin(Math.toRadians(parent.renderYawOffset)); - posZ -= offset1 * Math.cos(Math.toRadians(parent.renderYawOffset)); - - posY += 0.3125D; - } - - float i = rand.nextInt(45) + 5F + rand.nextFloat(); - float j = rand.nextInt(45) + 5F + rand.nextFloat(); - if(rand.nextInt(2) == 0) - { - i *= -1; - } - if(rand.nextInt(2) == 0) - { - j *= -1; - } - pitchSpin = i * (float)(motionY + 0.3D); - yawSpin = j * (float)(Math.sqrt(motionX * motionZ) + 0.3D); - - setLocationAndAngles(posX, posY, posZ, rotationYaw, rotationPitch); - - if(explo != null) - { - double mag = 1.0D; - double mag2 = 1.0D; - double dist = explo.getDistance(parent); - dist = Math.pow(dist / 2D, 2); - if(dist < 0.1D) - { - dist = 0.1D; - } - if(explo instanceof EntityTNTPrimed || explo instanceof EntityMinecartTNT) - { - mag = 1.0D * (4.0 / dist); - } - else if(explo instanceof EntityCreeper) - { - EntityCreeper creep = (EntityCreeper)explo; - if(creep.getPowered()) - { - mag = 1.0D * (6.0D / dist); - } - else - { - mag = 1.0D * (3.0D / dist); - } - } - mag = Math.pow(mag, 2) * 0.2D; - mag2 = ((posY - explo.posY)); - motionX *= mag; - motionY = mag2 * 0.4D + 0.22D; - motionZ *= mag; - - explosion = true; - } - } - - - @Override - public void onUpdate() - { - if(parent == null) - { - setDead(); - return; - } - if(explosion) - { - motionX *= 1D / 0.92D; - motionY *= 1D / 0.95D; - motionZ *= 1D / 0.92D; - } - super.onUpdate(); - move(MoverType.SELF, motionX, motionY, motionZ); - - this.motionY -= 0.08D; - - this.motionY *= 0.98D; - this.motionX *= 0.91D; - this.motionZ *= 0.91D; - - if(inWater) - { - motionY = 0.3D; - pitchSpin = 0.0F; - yawSpin = 0.0F; - } - if(onGround || handleWaterMovement()) - { - rotationPitch += (-90F - (rotationPitch % 360F)) / 2; - - this.motionY *= 0.8D; - this.motionX *= 0.8D; - this.motionZ *= 0.8D; - } - else - { - rotationPitch += pitchSpin; - rotationYaw += yawSpin; - pitchSpin *= 0.98F; - yawSpin *= 0.98F; - } - - if(true) // TODO pushing - { - List var2 = this.world.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox().grow(0.15D, 0.0D, 0.15D)); - if(var2 != null && !var2.isEmpty()) - { - Iterator var10 = var2.iterator(); - - while(var10.hasNext()) - { - Entity var4 = (Entity)var10.next(); - - if(var4 instanceof EntityGib && !var4.onGround) - { - continue; - } - - if(var4.canBePushed()) - { - var4.applyEntityCollision(this); - } - } - } - } - - if(onGround || handleWaterMovement()) - { - groundTime++; - if(groundTime > InfinityLoop.moduleManager.getModuleByClass(Dismemberment.class).gibGroundTime.getValue() + 20) - { - setDead(); - } - } - else if(groundTime > InfinityLoop.moduleManager.getModuleByClass(Dismemberment.class).gibGroundTime.getValue()) - { - groundTime--; - } - else - { - groundTime = 0; - } - if(liveTime + InfinityLoop.moduleManager.getModuleByClass(Dismemberment.class).gibTime.getValue() < Dismemberment.ticks) - { - setDead(); - } - } - - @Override - public void fall(float distance, float damageMultiplier) - { - } - - @Override - public boolean isEntityAlive() - { - return !this.isDead; - } - - @Override - protected void entityInit() - { - } - - @Override - public boolean writeToNBTOptional(NBTTagCompound par1NBTTagCompound) - { - return false; - } - - @Override - public void readEntityFromNBT(NBTTagCompound nbttagcompound) {} - - @Override - public void writeEntityToNBT(NBTTagCompound nbttagcompound) {} -} diff --git a/src/main/java/com/me/infinity/loop/util/utils/renders/helper/dism/ModelGib.java b/src/main/java/com/me/infinity/loop/util/utils/renders/helper/dism/ModelGib.java deleted file mode 100644 index e17f856..0000000 --- a/src/main/java/com/me/infinity/loop/util/utils/renders/helper/dism/ModelGib.java +++ /dev/null @@ -1,238 +0,0 @@ -package com.me.infinity.loop.util.utils.renders.helper.dism; - -import net.minecraft.client.model.ModelBase; -import net.minecraft.client.model.ModelRenderer; -import net.minecraft.entity.Entity; -import net.minecraft.entity.monster.EntityZombie; -import net.minecraft.entity.player.EntityPlayer; - -public class ModelGib extends ModelBase -{ - public ModelGib() - { - textureWidth = 64; - textureHeight = 64; - leg64 = new ModelRenderer(this, 0, 16); - leg64.setTextureSize(64, 64); - leg64.addBox(-2F, -6F, -2F, 4, 12, 4); - leg64.setRotationPoint(0F, 24F, 0F); - leg64.rotateAngleX = 0F; - leg64.rotateAngleY = 0F; - leg64.rotateAngleZ = 0F; - leg64.mirror = false; - - arm64 = new ModelRenderer(this, 40, 16); - arm64.setTextureSize(64, 64); - arm64.addBox(-2F, -6F, -2F, 4, 12, 4); - arm64.setRotationPoint(0F, 22F, 0F); - arm64.rotateAngleX = 0F; - arm64.rotateAngleY = 0F; - arm64.rotateAngleZ = 0F; - arm64.mirror = false; - - skeleArm = new ModelRenderer(this, 40, 16); - skeleArm.setTextureSize(64, 32); - skeleArm.addBox(-1F, -6F, -1F, 2, 12, 2); - skeleArm.setRotationPoint(0F, 24F, 0F); - skeleArm.rotateAngleX = 0F; - skeleArm.rotateAngleY = 0F; - skeleArm.rotateAngleZ = 0F; - skeleArm.mirror = false; - - skeleLeg = new ModelRenderer(this, 0, 16); - skeleLeg.setTextureSize(64, 32); - skeleLeg.addBox(-1F, -6F, -1F, 2, 12, 2); - skeleLeg.setRotationPoint(0F, 24F, 0F); - skeleLeg.rotateAngleX = 0F; - skeleLeg.rotateAngleY = 0F; - skeleLeg.rotateAngleZ = 0F; - skeleLeg.mirror = false; - - creeperFoot = new ModelRenderer(this, 0, 16); - creeperFoot.setTextureSize(64, 32); - creeperFoot.addBox(-2F, -3F, -2F, 4, 6, 4); - creeperFoot.setRotationPoint(0F, 24F, 0F); - creeperFoot.rotateAngleX = 0F; - creeperFoot.rotateAngleY = 0F; - creeperFoot.rotateAngleZ = 0F; - creeperFoot.mirror = false; - - head64 = new ModelRenderer(this, 0, 0); - head64.setTextureSize(64, 64); - head64.addBox(-4F, -4F, -4F, 8, 8, 8); - head64.setRotationPoint(0F, 20F, 0F); - head64.rotateAngleX = 0F; - head64.rotateAngleY = 0F; - head64.rotateAngleZ = 0F; - head64.mirror = false; - - head64.setTextureOffset(32,0); - head64.addBox(-4F, -4F, -4F, 8, 8, 8, 1.1f); - head64.setRotationPoint(0F, 20F, 0F); - head64.rotateAngleX = 0F; - head64.rotateAngleY = 0F; - head64.rotateAngleZ = 0F; - head64.mirror = false; - - - - - - /* - layerhead = new ModelRenderer(this, 32, 0); - layerhead.setTextureSize(64, 64); - layerhead.addBox(-4F, -4F, -4F, 8, 8, 8); - layerhead.setRotationPoint(0F, 20F, 0F); - layerhead.rotateAngleX = 0F; - layerhead.rotateAngleY = 0F; - layerhead.rotateAngleZ = 0F; - layerhead.mirror = false; - */ - - - - - body64 = new ModelRenderer(this, 16, 16); - body64.setTextureSize(64, 64); - body64.addBox(-4F, -6F, -2F, 8, 12, 4); - body64.setRotationPoint(0F, 22F, 0F); - body64.rotateAngleX = 0F; - body64.rotateAngleY = 0F; - body64.rotateAngleZ = 0F; - body64.mirror = false; - - head32 = new ModelRenderer(this, 0, 0); - head32.setTextureSize(64, 32); - head32.addBox(-4F, -4F, -4F, 8, 8, 8); - head32.setRotationPoint(0F, 20F, 0F); - head32.rotateAngleX = 0F; - head32.rotateAngleY = 0F; - head32.rotateAngleZ = 0F; - head32.mirror = false; - - body32 = new ModelRenderer(this, 16, 16); - body32.setTextureSize(64, 32); - body32.addBox(-4F, -6F, -2F, 8, 12, 4); - body32.setRotationPoint(0F, 22F, 0F); - body32.rotateAngleX = 0F; - body32.rotateAngleY = 0F; - body32.rotateAngleZ = 0F; - body32.mirror = false; - } - - @Override - public void render(Entity ent, float f, float f1, float f2, float f3, float f4, float f5) - { - setRotationAngles(f, f1, f2, f3, f4, f5, ent); - - if(ent instanceof EntityGib) - { - EntityGib gib = (EntityGib)ent; - - if(gib.type == -1) - { - // layerhead.render(f5); - } - - if(gib.type == 0) - { - if(gib.parent instanceof EntityZombie || gib.parent instanceof EntityPlayer) - { - head64.render(f5); - } - else - { - head32.render(f5); - } - } - else if(gib.type == 1 || gib.type == 2) - { - if(gib.parent instanceof EntityZombie || gib.parent instanceof EntityPlayer) - { - arm64.render(f5); - } - else - { - skeleArm.render(f5); - } - } - else if(gib.type == 3) //body - { - if(gib.parent instanceof EntityZombie || gib.parent instanceof EntityPlayer) - { - body64.render(f5); - } - else - { - body32.render(f5); - } - } - else if(gib.type == 4 || gib.type == 5) //legs - { - if(gib.parent instanceof EntityZombie || gib.parent instanceof EntityPlayer) - { - leg64.render(f5); - } - else - { - skeleLeg.render(f5); - } - } - else if(gib.type >= 6) //creeper feet - { - creeperFoot.render(f5); - } - } - } - - @Override - public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity ent) - { - arm64.rotateAngleY = f3 / 57.29578F; - arm64.rotateAngleX = f4 / 57.29578F; - - leg64.rotateAngleY = f3 / 57.29578F; - leg64.rotateAngleX = f4 / 57.29578F; - - skeleArm.rotateAngleY = f3 / 57.29578F; - skeleArm.rotateAngleX = f4 / 57.29578F; - - skeleLeg.rotateAngleY = f3 / 57.29578F; - skeleLeg.rotateAngleX = f4 / 57.29578F; - - creeperFoot.rotateAngleY = f3 / 57.29578F; - creeperFoot.rotateAngleX = f4 / 57.29578F; - - head64.rotateAngleY = f3 / 57.29578F; - head64.rotateAngleX = f4 / 57.29578F; - - // layerhead.rotateAngleY = f3 / 57.29578F; - // layerhead.rotateAngleX = f4 / 57.29578F; - - body64.rotateAngleY = f3 / 57.29578F; - body64.rotateAngleX = f4 / 57.29578F; - - head32.rotateAngleY = f3 / 57.29578F; - head32.rotateAngleX = f4 / 57.29578F; - - body32.rotateAngleY = f3 / 57.29578F; - body32.rotateAngleX = f4 / 57.29578F; - } - - //fields - public ModelRenderer skeleLeg; - public ModelRenderer skeleArm; - - public ModelRenderer creeperFoot; - - public ModelRenderer head64; - public ModelRenderer body64; - // public ModelRenderer layerhead; - - public ModelRenderer leg64; - public ModelRenderer arm64; - - public ModelRenderer head32; - public ModelRenderer body32; - -} diff --git a/src/main/java/com/me/infinity/loop/util/utils/renders/helper/dism/ParticleBlood.java b/src/main/java/com/me/infinity/loop/util/utils/renders/helper/dism/ParticleBlood.java deleted file mode 100644 index ce7ca93..0000000 --- a/src/main/java/com/me/infinity/loop/util/utils/renders/helper/dism/ParticleBlood.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.me.infinity.loop.util.utils.renders.helper.dism; - -import net.minecraft.client.particle.Particle; -import net.minecraft.world.World; - -public class ParticleBlood extends Particle -{ - public ParticleBlood(World world, double d, double d1, double d2, double d3, double d4, double d5, boolean isPlayer) - { - super(world, d, d1, d2, d3, d4, d5); - particleGravity = 0.06F; - particleRed = 1.0F; - particleGreen = 0.0F; - particleBlue = 0.0F; - particleScale *= 1.2F; - multiplyVelocity(1.2F); - motionY += rand.nextFloat() * 0.15F; - motionZ *= 0.4F / (rand.nextFloat() * 0.9F + 0.1F); - motionX *= 0.4F / (rand.nextFloat() * 0.9F + 0.1F); - particleMaxAge = (int)(200F + (20F / (rand.nextFloat() * 0.9F + 0.1F))); - setSize(0.01F, 0.01F); - setParticleTextureIndex(19 + rand.nextInt(4)); - } - - @Override - public void onUpdate() - { - if(particleAge++ >= particleMaxAge) - { - setExpired(); - return; - } - prevPosX = posX; - prevPosY = posY; - prevPosZ = posZ; - if(motionX != 0.0D && motionZ != 0.0D && !onGround) - { - motionY -= (double)this.particleGravity; - move(motionX, motionY, motionZ); - motionX *= 0.98000001907348633D; - motionY *= 0.98000001907348633D; - motionZ *= 0.98000001907348633D; - if(onGround) - { - motionX *= 0.69999998807907104D; - motionZ *= 0.69999998807907104D; - posY += 0.2D; - } - } - } - - @Override - public int getFXLayer() - { - return 0; - } - -} diff --git a/src/main/java/com/me/infinity/loop/util/utils/renders/helper/dism/RenderGib.java b/src/main/java/com/me/infinity/loop/util/utils/renders/helper/dism/RenderGib.java deleted file mode 100644 index 0cd45fe..0000000 --- a/src/main/java/com/me/infinity/loop/util/utils/renders/helper/dism/RenderGib.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.me.infinity.loop.util.utils.renders.helper.dism; - -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.features.modules.render.Dismemberment; -import net.minecraft.client.entity.AbstractClientPlayer; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.entity.Render; -import net.minecraft.client.renderer.entity.RenderManager; -import net.minecraft.entity.monster.EntityCreeper; -import net.minecraft.entity.monster.EntitySkeleton; -import net.minecraft.entity.monster.EntityZombie; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.MathHelper; -import org.lwjgl.opengl.GL11; - - -public class RenderGib extends Render -{ - public ModelGib modelGib; - - public RenderGib(RenderManager manager) - { - super(manager); - modelGib = new ModelGib(); - } - - - private static final ResourceLocation zombieTexture = new ResourceLocation("textures/entity/zombie/zombie.png"); - private static final ResourceLocation skeletonTexture = new ResourceLocation("textures/entity/skeleton/skeleton.png"); - private static final ResourceLocation creeperTexture = new ResourceLocation("textures/entity/creeper/creeper.png"); - - @Override - public ResourceLocation getEntityTexture(EntityGib gib) - { - if(gib.parent instanceof EntityPlayer) { - return ((AbstractClientPlayer) gib.parent).getLocationSkin(); - } else { - if(gib.parent instanceof EntityZombie){ - return zombieTexture; - } - if(gib.parent instanceof EntitySkeleton){ - return skeletonTexture; - } - if(gib.parent instanceof EntityCreeper){ - return creeperTexture; - } - return zombieTexture; - } - } - - - - - @Override - public void doRender(EntityGib gib, double par2, double par4, double par6, float par8, float par9) - { - GlStateManager.disableCull(); - GlStateManager.pushMatrix(); - bindEntityTexture(gib); - // bindTexture(); - GlStateManager.enableBlend(); - GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.color(1.0F, 1.0F, 1.0F, MathHelper.clamp(gib.groundTime >= InfinityLoop.moduleManager.getModuleByClass(Dismemberment.class).gibGroundTime.getValue() ? 1.0F - (gib.groundTime - InfinityLoop.moduleManager.getModuleByClass(Dismemberment.class).gibGroundTime.getValue() + par9) / 20F : 1.0F, 0F, 1F)); - GlStateManager.alphaFunc(GL11.GL_GREATER, 0.003921569F); - - GlStateManager.translate(par2, par4, par6); - - GlStateManager.translate(0.0F, gib.type == 0 ? 4F / 16F : gib.type <= 2 && gib.parent instanceof EntitySkeleton ? 1F / 16F : 2F / 16F, 0.0F); - - GlStateManager.rotate(interpolateRotation(gib.prevRotationYaw, gib.rotationYaw, par9), 0.0F, 1.0F, 0.0F); - GlStateManager.rotate(interpolateRotation(gib.prevRotationPitch, gib.rotationPitch, par9), -1.0F, 0.0F, 0.0F); - - GlStateManager.translate(0.0F, 24F / 16F - gib.height * 0.5F, 0.0F); - - GlStateManager.scale(-1.0F, -1.0F, 1.0F); - - modelGib.render(gib, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); - - GlStateManager.alphaFunc(GL11.GL_GREATER, 0.1F); - GlStateManager.disableBlend(); - GlStateManager.popMatrix(); - GlStateManager.enableCull(); - } - public static float interpolateRotation(float par1, float par2, float par3) - { - float f3; - - for (f3 = par2 - par1; f3 < -180.0F; f3 += 360.0F) - { - ; - } - - while (f3 >= 180.0F) - { - f3 -= 360.0F; - } - - return par1 + par3 * f3; - } - -} diff --git a/src/main/java/com/me/infinity/loop/util/utils/renders/helper/ffp/InboundInterceptor.java b/src/main/java/com/me/infinity/loop/util/utils/renders/helper/ffp/InboundInterceptor.java deleted file mode 100644 index d75d2c5..0000000 --- a/src/main/java/com/me/infinity/loop/util/utils/renders/helper/ffp/InboundInterceptor.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.me.infinity.loop.util.utils.renders.helper.ffp; - - -import net.minecraft.network.Packet; -import net.minecraft.network.NetworkManager; -import net.minecraft.network.NettyPacketDecoder; -import net.minecraft.network.EnumPacketDirection; -import net.minecraft.network.EnumConnectionState; -import net.minecraftforge.fml.relauncher.SideOnly; -import net.minecraftforge.fml.relauncher.Side; - -import io.netty.channel.ChannelHandlerContext; -import io.netty.buffer.ByteBuf; - -import java.lang.Exception; -import java.lang.IllegalAccessException; -import java.lang.InstantiationException; -import java.io.IOException; -import java.util.List; - -/* Intercept packet sent by server to client */ - -@SideOnly(Side.CLIENT) -public class InboundInterceptor extends NettyPacketDecoder { - - private final EnumPacketDirection direction; - private NetworkHandler handler; - private boolean isPlay; - - public InboundInterceptor(NetworkHandler handler, EnumPacketDirection direction) { - super(direction); - this.handler = handler; - this.direction = direction; // let's save it twice - this.isPlay = false; - } - - protected void decode(ChannelHandlerContext context, ByteBuf in, List out) throws IOException, InstantiationException, IllegalAccessException, Exception { - if (in.readableBytes() != 0) { - - int start_index = in.readerIndex(); // Mark start index - super.decode(context, in, out); // Computer packet - - if(! this.isPlay) { // don't go fetch the attr every time - EnumConnectionState state = (EnumConnectionState)(context.channel().attr(NetworkManager.PROTOCOL_ATTRIBUTE_KEY).get()); - this.isPlay = (state == EnumConnectionState.PLAY); - } - - if(this.isPlay && out.size() > 0) { - Packet packet = (Packet)out.get(0); - int id = ((EnumConnectionState)context.channel().attr(NetworkManager.PROTOCOL_ATTRIBUTE_KEY).get()).getPacketId(this.direction, packet); - int end_index = in.readerIndex(); - - in.readerIndex(start_index); - packet = this.handler.packetReceived(this.direction, id, packet, in); - in.readerIndex(end_index); - - if(packet == null) out.clear(); - else out.set(0, packet); - } - } - } - -} - diff --git a/src/main/java/com/me/infinity/loop/util/utils/renders/helper/ffp/NetworkHandler.java b/src/main/java/com/me/infinity/loop/util/utils/renders/helper/ffp/NetworkHandler.java deleted file mode 100644 index c1620a0..0000000 --- a/src/main/java/com/me/infinity/loop/util/utils/renders/helper/ffp/NetworkHandler.java +++ /dev/null @@ -1,180 +0,0 @@ -package com.me.infinity.loop.util.utils.renders.helper.ffp; - -import net.minecraft.network.EnumPacketDirection; -import net.minecraft.network.NettyPacketDecoder; -import net.minecraft.network.NettyPacketEncoder; -import net.minecraft.network.NetworkManager; -import net.minecraft.network.Packet; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.common.network.FMLNetworkEvent; -import net.minecraftforge.fml.relauncher.SideOnly; -import net.minecraftforge.fml.relauncher.Side; - -import io.netty.buffer.ByteBuf; -import io.netty.channel.ChannelHandler; -import io.netty.channel.ChannelPipeline; - -import java.util.concurrent.locks.ReadWriteLock; -import java.util.concurrent.locks.ReentrantReadWriteLock; -import java.util.ArrayList; -import java.util.List; - - - -/* Handles network listeners */ - -@SideOnly(Side.CLIENT) -public class NetworkHandler { - - private boolean isConnected; - private NetworkManager networkManager; - - private ReadWriteLock[] outbound_lock; - private ReadWriteLock[] inbound_lock; - private List[] outbound_listeners; - private List[] inbound_listeners; - - public NetworkHandler() { - this.isConnected = false; - this.networkManager = null; - this.outbound_listeners = new List[33]; - this.outbound_lock = new ReadWriteLock[33]; - - for(int i = 0; i < 33; i ++) { - this.outbound_lock[i] = new ReentrantReadWriteLock(); - } - - this.inbound_listeners = new List[80]; - this.inbound_lock = new ReadWriteLock[80]; - - for(int i = 0; i < 80; i ++) { - this.inbound_lock[i] = new ReentrantReadWriteLock(); - } - } - - public Packet packetReceived(EnumPacketDirection direction, int id, Packet packet, ByteBuf buf) { - List listeners; - ReadWriteLock lock; - - if(direction == EnumPacketDirection.CLIENTBOUND) { - listeners = this.inbound_listeners[id]; - lock = this.inbound_lock[id]; - } else { - listeners = this.outbound_listeners[id]; - lock = this.outbound_lock[id]; - } - - if(listeners != null) { - int buff_start = 0; - if(buf != null) buff_start = buf.readerIndex(); - - lock.readLock().lock(); - int size = listeners.size(); // Get starting size, we assume that a listener can unregister itself & only itself - lock.readLock().unlock(); - - for(int i = 0; i < size; i ++) { - lock.readLock().lock(); - PacketListener l = listeners.get(i - (size - listeners.size())); - lock.readLock().unlock(); - - if(buf != null) buf.readerIndex(buff_start); - if((packet = l.packetReceived(direction, id, packet, buf)) == null) return null; - } - } - - return packet; - } - - public void registerListener(EnumPacketDirection direction, PacketListener listener, int ... ids) { - List[] listeners; - ReadWriteLock[] locks; - - if(direction == EnumPacketDirection.CLIENTBOUND) { - listeners = this.inbound_listeners; - locks = this.inbound_lock; - } else { - listeners = this.outbound_listeners; - locks = this.outbound_lock; - } - - for(int id : ids) { - try { - locks[id].writeLock().lock(); - - if(listeners[id] == null) listeners[id] = new ArrayList(); - if(! listeners[id].contains(listener)) { // Not twice - listeners[id].add(listener); - } - } finally { - locks[id].writeLock().unlock(); - } - } - } - - - public void unregisterListener(EnumPacketDirection direction, PacketListener listener, int ... ids) { - List[] listeners; - ReadWriteLock[] locks; - - if(direction == EnumPacketDirection.CLIENTBOUND) { - listeners = this.inbound_listeners; - locks = this.inbound_lock; - } else { - listeners = this.outbound_listeners; - locks = this.outbound_lock; - } - - for(int id : ids) { - try { - locks[id].writeLock().lock(); - if(listeners[id] != null) { - listeners[id].remove(listener); - if(listeners[id].size() == 0) listeners[id] = null; - } - } finally { - locks[id].writeLock().unlock(); - } - } - } - - public void sendPacket(Packet packet) { - if(this.networkManager != null) { - this.networkManager.sendPacket(packet); - } - } - - - @SubscribeEvent - public void onConnect(FMLNetworkEvent.ClientConnectedToServerEvent event) { - if(!this.isConnected) { - - ChannelPipeline pipeline = event.getManager().channel().pipeline(); - - try { - // Install receive interception - ChannelHandler old = pipeline.get("decoder"); - if(old != null && old instanceof NettyPacketDecoder) { - InboundInterceptor spoof = new InboundInterceptor(this, EnumPacketDirection.CLIENTBOUND); - pipeline.replace("decoder", "decoder", spoof); - } - - // Install send interception - old = pipeline.get("encoder"); - if(old != null && old instanceof NettyPacketEncoder) { - OutboundInterceptor spoof = new OutboundInterceptor(this, EnumPacketDirection.SERVERBOUND); - pipeline.replace("encoder", "encoder", spoof); - } - - // Record NetworkManager - this.networkManager = event.getManager(); - this.isConnected = true; - } catch (java.util.NoSuchElementException e) {} - } - } - - @SubscribeEvent - public void onDisconnect(FMLNetworkEvent.ClientDisconnectionFromServerEvent event) { - this.isConnected = false; - this.networkManager = null; - } -} diff --git a/src/main/java/com/me/infinity/loop/util/utils/renders/helper/ffp/OutboundInterceptor.java b/src/main/java/com/me/infinity/loop/util/utils/renders/helper/ffp/OutboundInterceptor.java deleted file mode 100644 index 28fab93..0000000 --- a/src/main/java/com/me/infinity/loop/util/utils/renders/helper/ffp/OutboundInterceptor.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.me.infinity.loop.util.utils.renders.helper.ffp; - -import net.minecraft.network.Packet; -import net.minecraft.network.NetworkManager; -import net.minecraft.network.NettyPacketEncoder; -import net.minecraft.network.EnumPacketDirection; -import net.minecraft.network.EnumConnectionState; -import net.minecraftforge.fml.relauncher.SideOnly; -import net.minecraftforge.fml.relauncher.Side; - -import io.netty.buffer.ByteBuf; -import io.netty.channel.ChannelHandlerContext; - -import java.lang.Exception; -import java.io.IOException; - -/* Intercept packet sent by client to server */ - -@SideOnly(Side.CLIENT) -public class OutboundInterceptor extends NettyPacketEncoder { - - private final EnumPacketDirection direction; - private NetworkHandler handler; - private boolean isPlay; - - public OutboundInterceptor(NetworkHandler handler, EnumPacketDirection direction) { - super(direction); - this.handler = handler; - this.direction = direction; // let's save it twice - this.isPlay = false; - } - - protected void encode(ChannelHandlerContext context, Packet packet, ByteBuf out) throws IOException, Exception { - - if(! this.isPlay) { - EnumConnectionState state = (EnumConnectionState)(context.channel().attr(NetworkManager.PROTOCOL_ATTRIBUTE_KEY).get()); - this.isPlay = (state == EnumConnectionState.PLAY); - } - - if(this.isPlay) { - int id = ((EnumConnectionState)(context.channel().attr(NetworkManager.PROTOCOL_ATTRIBUTE_KEY).get())).getPacketId(this.direction, packet); - - packet = this.handler.packetReceived(this.direction, id, packet, null); - - if(packet == null) return; - } - - super.encode(context, packet, out); - } - -} diff --git a/src/main/java/com/me/infinity/loop/util/utils/renders/helper/ffp/PacketListener.java b/src/main/java/com/me/infinity/loop/util/utils/renders/helper/ffp/PacketListener.java deleted file mode 100644 index 7ed2e35..0000000 --- a/src/main/java/com/me/infinity/loop/util/utils/renders/helper/ffp/PacketListener.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.me.infinity.loop.util.utils.renders.helper.ffp; - -import net.minecraft.network.EnumPacketDirection; -import net.minecraft.network.Packet; -import net.minecraftforge.fml.relauncher.SideOnly; -import net.minecraftforge.fml.relauncher.Side; - -import io.netty.buffer.ByteBuf; - -/* A class listening for network packets, register a listener on NetworkHandler */ - -@SideOnly(Side.CLIENT) -public interface PacketListener { - - public Packet packetReceived(EnumPacketDirection direction, int id, Packet packet, ByteBuf in); - -} diff --git a/src/main/java/com/me/infinity/loop/util/utils/renders/shaders/GlShader.java b/src/main/java/com/me/infinity/loop/util/utils/renders/shaders/GlShader.java deleted file mode 100644 index 773cdb5..0000000 --- a/src/main/java/com/me/infinity/loop/util/utils/renders/shaders/GlShader.java +++ /dev/null @@ -1,279 +0,0 @@ -package com.me.infinity.loop.util.utils.renders.shaders; - -import com.me.infinity.loop.util.utils.interfaces.Nameable; -import net.minecraft.util.math.Vec2f; -import net.minecraft.util.math.Vec3d; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL20; -import org.lwjgl.util.vector.Vector4f; - -import java.awt.*; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.nio.FloatBuffer; -import java.nio.charset.StandardCharsets; -import java.util.HashMap; -import java.util.Map; - -import static org.lwjgl.opengl.GL20.*; - -/** - * @author cookiedragon234 - * TOOD: antipaste - */ -public class GlShader implements Nameable { - - private int programId; - private int vertexShaderId; - private int fragmentShaderId; - private String name; - - private final Map uniforms; - - public GlShader(InputStream sourceStream, String name) - { - this.name = name; - this.uniforms = new HashMap<>(); - if (sourceStream == null) return; - String source; - try { - source = readStreamToString(sourceStream); - } catch (IOException e) { - e.printStackTrace(); - return; - } - - StringBuilder vertexSource = new StringBuilder(source.length() / 2); - StringBuilder fragmentSource = new StringBuilder(source.length() / 2); - - int mode = -1; - - for (String line : source.split("\n")) { - if (line.contains("#shader vert")) { - mode = 0; - } else if (line.contains("#shader frag")) { - mode = 1; - } else { - if (mode == 0) { - vertexSource.append(line).append("\n"); - } else if (mode == 1) { - fragmentSource.append(line).append("\n"); - } - } - } - - int vertId = glCreateShader(GL_VERTEX_SHADER); - int fragId = glCreateShader(GL_FRAGMENT_SHADER); - - glShaderSource(vertId, vertexSource); - glShaderSource(fragId, fragmentSource); - - glCompileShader(vertId); - glCompileShader(fragId); - - if (glGetShaderi(vertId, GL_COMPILE_STATUS) == GL11.GL_FALSE) { - String error = GL20.glGetShaderInfoLog(vertId, 1024); - System.err.println("Vertex shader " + name + " could not compile: " + error); - } - if (glGetShaderi(fragId, GL_COMPILE_STATUS) == GL11.GL_FALSE) { - String error = GL20.glGetShaderInfoLog(fragId, 1024); - System.err.println("Fragment shader " + name + " could not compile: " + error); - } - - int programId = glCreateProgram(); - - this.programId = programId; - this.vertexShaderId = vertId; - this.fragmentShaderId = fragId; - - glAttachShader(programId, vertId); - glAttachShader(programId, fragId); - glLinkProgram(programId); - - if (glGetProgrami(programId, GL_LINK_STATUS) == GL11.GL_FALSE) { - String error = GL20.glGetShaderInfoLog(programId, 1024); - System.err.println("Shader " + name + " could not be linked: " + error); - } - - glDetachShader(programId, vertId); - glDetachShader(programId, fragId); - - glValidateProgram(programId); - } - - public GlShader(String name) - { - this(GlShader.class.getResourceAsStream("/shaders/" + name + ".shader"), name); - } - - public GlShader(int programId, int vertexShaderId, int fragmentShaderId) { - this.programId = programId; - this.vertexShaderId = vertexShaderId; - this.fragmentShaderId = fragmentShaderId; - this.uniforms = new HashMap<>(); - } - - public void bind() { - glUseProgram(programId); - } - - public void unbind() { - glUseProgram(0); - } - - protected void finalize() { - unbind(); - glDeleteProgram(programId); - } - - public int createUniform(String uniformName) { - if (uniforms.containsKey(uniformName)) { - return uniforms.get(uniformName); - } else { - int location = glGetUniformLocation(programId, uniformName); - uniforms.put(uniformName, location); - return location; - } - } - - public void set(String uniformName, int value) { - glUniform1i(createUniform(uniformName), value); - } - - public void set(String uniformName, float value) { - glUniform1f(createUniform(uniformName), value); - } - - public void set(String uniformName, boolean value) { - glUniform1i(createUniform(uniformName), value ? 1 : 0); - } - - public void set(String uniformName, Vec2f value) { - glUniform2f(createUniform(uniformName), value.x, value.y); - } - - public void set(String uniformName, Vec3d value) { - glUniform3f(createUniform(uniformName), (float) value.x, (float) value.y, (float) value.z); - } - - public void set(String uniformName, Vector4f value) { - glUniform4f(createUniform(uniformName), value.x, value.y, value.z, value.w); - } - - public void set(String uniformName, Color value) { - glUniform4f(createUniform(uniformName), value.getRed() / 255.0f, value.getBlue() / 255.0f, value.getGreen() / 255.0f, value.getAlpha() / 255.0f); - } - - public void set(String uniformName, FloatBuffer matrix) - { - glUniformMatrix4(createUniform(uniformName), false, matrix); - } - - public void set(String uniformName, int[] integers) { - glUniform4i(createUniform(uniformName), integers[0], integers[1], integers[2], integers[3]); - } - - public int getVertexShaderId() { - return vertexShaderId; - } - - public int getFragmentShaderId() { - return fragmentShaderId; - } - - public int getProgramId() { - return programId; - } - - private static String readStreamToString(final InputStream inputStream) throws IOException { - final ByteArrayOutputStream out = new ByteArrayOutputStream(); - final byte[] buffer = new byte[512]; - int read; - while ((read = inputStream.read(buffer, 0, buffer.length)) != -1) { - out.write(buffer, 0, read); - } - return new String(out.toByteArray(), StandardCharsets.UTF_8); - } - - // TODO: replace kotlin design with more conventional java design - public static GlShader createShader(String name) { - InputStream sourceStream = GlShader.class.getResourceAsStream("/shaders/" + name + ".shader"); - return createShader(name, sourceStream); - } - - public static GlShader createShader(String name, InputStream sourceStream) { - if (sourceStream == null) return null; - String source; - try { - source = readStreamToString(sourceStream); - } catch (IOException e) { - e.printStackTrace(); - return null; - } - - StringBuilder vertexSource = new StringBuilder(source.length() / 2); - StringBuilder fragmentSource = new StringBuilder(source.length() / 2); - - int mode = -1; - - for (String line : source.split("\n")) { - if (line.contains("#shader vert")) { - mode = 0; - } else if (line.contains("#shader frag")) { - mode = 1; - } else { - if (mode == 0) { - vertexSource.append(line).append("\n"); - } else if (mode == 1) { - fragmentSource.append(line).append("\n"); - } - } - } - - int vertId = glCreateShader(GL_VERTEX_SHADER); - int fragId = glCreateShader(GL_FRAGMENT_SHADER); - - glShaderSource(vertId, vertexSource); - glShaderSource(fragId, fragmentSource); - - glCompileShader(vertId); - glCompileShader(fragId); - - if (glGetShaderi(vertId, GL_COMPILE_STATUS) == GL11.GL_FALSE) { - String error = GL20.glGetShaderInfoLog(vertId, 1024); - System.err.println("Vertex shader " + name + " could not compile: " + error); - } - if (glGetShaderi(fragId, GL_COMPILE_STATUS) == GL11.GL_FALSE) { - String error = GL20.glGetShaderInfoLog(fragId, 1024); - System.err.println("Fragment shader " + name + " could not compile: " + error); - } - - int programId = glCreateProgram(); - - GlShader shader = new GlShader(programId, vertId, fragId); - - glAttachShader(programId, vertId); - glAttachShader(programId, fragId); - glLinkProgram(programId); - - if (glGetProgrami(programId, GL_LINK_STATUS) == GL11.GL_FALSE) { - String error = GL20.glGetShaderInfoLog(programId, 1024); - System.err.println("Shader " + name + " could not be linked: " + error); - } - - glDetachShader(programId, vertId); - glDetachShader(programId, fragId); - - glValidateProgram(programId); - - return shader; - } - - @Override - public String getName() - { - return name; - } - -} diff --git a/src/main/java/com/me/infinity/loop/util/utils/renders/shaders/Shader.java b/src/main/java/com/me/infinity/loop/util/utils/renders/shaders/Shader.java deleted file mode 100644 index 507027e..0000000 --- a/src/main/java/com/me/infinity/loop/util/utils/renders/shaders/Shader.java +++ /dev/null @@ -1,148 +0,0 @@ -package com.me.infinity.loop.util.utils.renders.shaders; - -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.util.utils.interfaces.Nameable; -import org.lwjgl.opengl.GL11; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.nio.charset.StandardCharsets; -import java.util.HashMap; -import java.util.Map; - -import static org.lwjgl.opengl.GL20.*; - -/** - * To be implemented on a case-by-case basis - * TODO: parse shaders and types from the fragment and vertex shaders considering we already have the sources - * No uniform blocks yet - */ -public abstract class Shader implements Nameable -{ - - private int program; - private int vertex; - private int fragment; - private boolean initialized; - private final String name; - - private final Map uniformMap = new HashMap<>(); - - public Shader(String name, String path, String[] uniforms) - { - this(name, path); - for (String uniformName : uniforms) - { - int uniform = glGetUniformLocation(program, uniformName); - if (uniform > -1) uniformMap.put(uniformName, uniform); - } - } - - public Shader(String name, String path) - { - this.name = name; - String source; - try (InputStream stream = net.minecraft.client.shader.Shader.class.getResourceAsStream("/shaders/" + path)) - { - final ByteArrayOutputStream out = new ByteArrayOutputStream(); - final byte[] buffer = new byte[512]; - int read; - while ((read = stream.read(buffer, 0, buffer.length)) != -1) - { - out.write(buffer, 0, read); - } - source = new String(out.toByteArray(), StandardCharsets.UTF_8); - } - catch (IOException | NullPointerException e) - { - InfinityLoop.getLogger().error("Shader " + name + " failed to read."); - e.printStackTrace(); - return; - } - - boolean vertexShader = false; - final StringBuilder vertexBuilder = new StringBuilder(); - final StringBuilder fragmentBuilder = new StringBuilder(); - - for (String line : source.split("\n")) - { - if (line.contains("#shader vertex")) - { - vertexShader = true; - continue; - } - else if (line.contains("#shader fragment")) - { - vertexShader = false; - continue; - } - - if (vertexShader) - { - vertexBuilder.append(line); - } - else - { - fragmentBuilder.append(line); - } - } - - vertex = glCreateShader(GL_VERTEX_SHADER); - fragment = glCreateShader(GL_FRAGMENT_SHADER); - - glShaderSource(vertex, vertexBuilder); - glShaderSource(fragment, fragmentBuilder); - - glCompileShader(vertex); - glCompileShader(fragment); - - if (glGetShaderi(vertex, GL_COMPILE_STATUS) == GL11.GL_FALSE) - { - InfinityLoop.getLogger().error("Shader " + name + "'s vertex shader failed to compile! Reason: " + glGetShaderInfoLog(vertex, 1024)); - return; - } - - if (glGetShaderi(vertex, GL_COMPILE_STATUS) == GL11.GL_FALSE) - { - InfinityLoop.getLogger().error("Shader " + name + "'s fragment shader failed to compile! Reason: " + glGetShaderInfoLog(fragment, 1024)); - return; - } - - program = glCreateProgram(); - glAttachShader(program, vertex); - glAttachShader(program, fragment); - glLinkProgram(program); - - if (glGetProgrami(program, GL_LINK_STATUS) == GL11.GL_FALSE) - { - InfinityLoop.getLogger().error("Shader " + name + "failed to link! Reason: " + glGetProgramInfoLog(fragment, 1024)); - return; - } - - glDetachShader(program, vertex); - glDetachShader(program, fragment); - - glValidateProgram(program); - - if (glGetProgrami(program, GL_VALIDATE_STATUS) == GL11.GL_FALSE) - { - InfinityLoop.getLogger().error("Shader " + name + "failed to validate! Reason: " + glGetProgramInfoLog(fragment, 1024)); - return; - } - - initialized = true; - } - - @Override - public String getName() - { - return name; - } - - public boolean isInitialized() - { - return initialized; - } - -} diff --git a/src/main/java/com/me/infinity/loop/DiscordPresence.java b/src/main/java/me/loop/DiscordPresence.java similarity index 95% rename from src/main/java/com/me/infinity/loop/DiscordPresence.java rename to src/main/java/me/loop/DiscordPresence.java index 32af444..cd46477 100644 --- a/src/main/java/com/me/infinity/loop/DiscordPresence.java +++ b/src/main/java/me/loop/DiscordPresence.java @@ -1,11 +1,11 @@ -package com.me.infinity.loop; +package me.loop; import club.minnced.discord.rpc.DiscordEventHandlers; import club.minnced.discord.rpc.DiscordRPC; import club.minnced.discord.rpc.DiscordRichPresence; -import com.me.infinity.loop.features.modules.client.RPC; -import net.minecraft.client.gui.*; -import net.minecraft.client.*; +import me.loop.features.modules.client.RPC; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiMainMenu; public class DiscordPresence { diff --git a/src/main/java/com/me/infinity/loop/InfinityLoop.java b/src/main/java/me/loop/InfinityLoop.java similarity index 52% rename from src/main/java/com/me/infinity/loop/InfinityLoop.java rename to src/main/java/me/loop/InfinityLoop.java index 3e41b4c..16f2105 100644 --- a/src/main/java/com/me/infinity/loop/InfinityLoop.java +++ b/src/main/java/me/loop/InfinityLoop.java @@ -1,17 +1,10 @@ -package com.me.infinity.loop; - -import com.me.infinity.loop.features.gui.font.CFontRenderer; -import com.me.infinity.loop.util.utils.IconUtils; -import com.me.infinity.loop.util.utils.renders.helper.dism.EntityGib; -import com.me.infinity.loop.util.utils.renders.helper.dism.RenderGib; -import com.me.infinity.loop.util.utils.renders.helper.ffp.NetworkHandler; -import com.me.infinity.loop.manager.*; -import com.me.infinity.loop.util.utils.phobos.GlobalExecutor; -import com.me.infinity.loop.util.utils.phobos.Sphere; +package me.loop; + +import me.loop.features.gui.font.CFontRenderer; +import me.loop.manager.*; +import me.loop.util.impl.IconUtil; import net.minecraft.client.Minecraft; import net.minecraft.util.Util; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.fml.client.registry.RenderingRegistry; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; @@ -25,41 +18,34 @@ import java.util.ArrayList; import java.util.Objects; -import static com.me.infinity.loop.util.utils.Util.mc; - -@Mod(modid = "loop", name = "InfinityLoop", version = "0.0.3") +import static me.loop.util.impl.Util.mc; +@Mod(modid = "infinityloop", name = "InfinityLoop", version = "0.0.3") public class InfinityLoop { - public static final String MODID = "loop", MODNAME = "InfinityLoop", MODVER = "0.0.3"; + public static final String + MODID = "infinityloop", + MODNAME = "InfinityLoop", + MODVER = "0.0.3"; + public static final Logger LOGGER = LogManager.getLogger("InfinityLoop"); @Mod.Instance public static InfinityLoop INSTANCE; + private static boolean unloaded; public static long initTime; public static java.util.List alts = new ArrayList<>(); - /*-------------------- LOGGER ------------------------*/ - - public static final Logger LOGGER; static { - LOGGER = LogManager.getLogger("InfinityLoop"); unloaded = false; } - public static Logger getLogger() - { - return LOGGER; - } - - /*----------------- MANAGERS ---------------------*/ + public static FpsManager fpsManager; public static CommandManager commandManager; public static FriendManager friendManager; - public static FpsManagement fpsManagement; public static ModuleManager moduleManager; public static PacketManager packetManager; public static ColorManager colorManager; - public static NetworkHandler networkHandler; public static HoleManager holeManager; public static InventoryManager inventoryManager; public static PotionManager potionManager; @@ -67,16 +53,10 @@ public static Logger getLogger() public static PositionManager positionManager; public static SpeedManager speedManager; public static ReloadManager reloadManager; - public static FileManager fileManager; public static ConfigManager configManager; public static ServerManager serverManager; public static EventManager eventManager; public static TextManager textManager; - public static TimerManager timerManager; - public static FpsManagement getFpsManagement() { - return fpsManagement; - } - /*----------------- Fonts ---------------------*/ @@ -91,36 +71,38 @@ public static FpsManagement getFpsManagement() { /*--------------------- LOAD -------------------------*/ + public static void load() { - ConfigManager.loadAlts(); - ConfigManager.loadSearch(); - LOGGER.info("\n\nLoading InfinityLoop by KuroHere"); + + LOGGER.info("Loading InfinityLoop..."); unloaded = false; + + ConfigManager.loadAlts(); + ConfigManager.init(); + if (reloadManager != null) { reloadManager.unload(); reloadManager = null; } - ConfigManager.init(); - /*------------ FONTS ------------ */ + try { - fontRenderer = new CFontRenderer( Font.createFont( Font.TRUETYPE_FONT, Objects.requireNonNull(InfinityLoop.class.getResourceAsStream("/fonts/ThunderFont2.ttf"))).deriveFont( 24.f ), true, true ); - fontRenderer2 = new CFontRenderer( Font.createFont( Font.TRUETYPE_FONT, Objects.requireNonNull(InfinityLoop.class.getResourceAsStream("/fonts/ThunderFont3.ttf"))).deriveFont( 36.f ), true, true ); - fontRenderer3 = new CFontRenderer( Font.createFont( Font.TRUETYPE_FONT, Objects.requireNonNull(InfinityLoop.class.getResourceAsStream("/fonts/ThunderFont2.ttf"))).deriveFont( 18.f ), true, true ); - fontRenderer4 = new CFontRenderer( Font.createFont( Font.TRUETYPE_FONT, Objects.requireNonNull(InfinityLoop.class.getResourceAsStream("/fonts/ThunderFont2.ttf"))).deriveFont( 50.f ), true, true ); - fontRenderer5 = new CFontRenderer( Font.createFont( Font.TRUETYPE_FONT, Objects.requireNonNull(InfinityLoop.class.getResourceAsStream("/fonts/Monsterrat.ttf"))).deriveFont( 12.f ), true, true ); - fontRenderer6 = new CFontRenderer( Font.createFont( Font.TRUETYPE_FONT, Objects.requireNonNull(InfinityLoop.class.getResourceAsStream("/fonts/Monsterrat.ttf"))).deriveFont( 14.f ), true, true ); - fontRenderer7 = new CFontRenderer( Font.createFont( Font.TRUETYPE_FONT, Objects.requireNonNull(InfinityLoop.class.getResourceAsStream("/fonts/Monsterrat.ttf"))).deriveFont( 10.f ), true, true ); - fontRenderer8 = new CFontRenderer( Font.createFont( Font.TRUETYPE_FONT, Objects.requireNonNull(InfinityLoop.class.getResourceAsStream("/fonts/ThunderFont3.ttf"))).deriveFont( 62.f ), true, true ); - } catch ( Exception e ) { - e.printStackTrace( ); + fontRenderer = new CFontRenderer(Font.createFont(Font.TRUETYPE_FONT, Objects.requireNonNull(InfinityLoop.class.getResourceAsStream("/fonts/ThunderFont2.ttf"))).deriveFont(24.f), true, true); + fontRenderer2 = new CFontRenderer(Font.createFont(Font.TRUETYPE_FONT, Objects.requireNonNull(InfinityLoop.class.getResourceAsStream("/fonts/ThunderFont3.ttf"))).deriveFont(36.f), true, true); + fontRenderer3 = new CFontRenderer(Font.createFont(Font.TRUETYPE_FONT, Objects.requireNonNull(InfinityLoop.class.getResourceAsStream("/fonts/ThunderFont2.ttf"))).deriveFont(18.f), true, true); + fontRenderer4 = new CFontRenderer(Font.createFont(Font.TRUETYPE_FONT, Objects.requireNonNull(InfinityLoop.class.getResourceAsStream("/fonts/ThunderFont2.ttf"))).deriveFont(50.f), true, true); + fontRenderer5 = new CFontRenderer(Font.createFont(Font.TRUETYPE_FONT, Objects.requireNonNull(InfinityLoop.class.getResourceAsStream("/fonts/Monsterrat.ttf"))).deriveFont(12.f), true, true); + fontRenderer6 = new CFontRenderer(Font.createFont(Font.TRUETYPE_FONT, Objects.requireNonNull(InfinityLoop.class.getResourceAsStream("/fonts/Monsterrat.ttf"))).deriveFont(14.f), true, true); + fontRenderer7 = new CFontRenderer(Font.createFont(Font.TRUETYPE_FONT, Objects.requireNonNull(InfinityLoop.class.getResourceAsStream("/fonts/Monsterrat.ttf"))).deriveFont(10.f), true, true); + fontRenderer8 = new CFontRenderer(Font.createFont(Font.TRUETYPE_FONT, Objects.requireNonNull(InfinityLoop.class.getResourceAsStream("/fonts/ThunderFont3.ttf"))).deriveFont(62.f), true, true); + } catch (Exception e) { + e.printStackTrace(); } /*------------------------------------- */ - networkHandler = new NetworkHandler(); + fpsManager = new FpsManager(); textManager = new TextManager(); - fpsManagement = new FpsManagement(); commandManager = new CommandManager(); friendManager = new FriendManager(); moduleManager = new ModuleManager(); @@ -131,52 +113,39 @@ public static void load() { potionManager = new PotionManager(); inventoryManager = new InventoryManager(); serverManager = new ServerManager(); - fileManager = new FileManager(); colorManager = new ColorManager(); positionManager = new PositionManager(); configManager = new ConfigManager(); holeManager = new HoleManager(); - timerManager = new TimerManager(); LOGGER.info("Managers loaded."); moduleManager.init(); LOGGER.info("Modules loaded."); - ConfigManager.load(ConfigManager.getCurrentConfig()); + configManager.init(); eventManager.init(); LOGGER.info("EventManager loaded."); textManager.init(true); moduleManager.onLoad(); - LOGGER.info("InfinityLoop successfully loaded!\n"); + LOGGER.info(MODNAME + "successfully loaded!\n"); - if(mc.session != null && !alts.contains(mc.session.getUsername())) { + if (mc.session != null && !alts.contains(mc.session.getUsername())) { alts.add(mc.session.getUsername()); } } - /*-------------------- UNLOAD ------------------------*/ - - private static boolean unloaded; public static void unload(boolean unload) { Display.setTitle("Minecraft 1.12.2"); - LOGGER.info("\n\nUnloading InfinityLoop by KuroHere"); if (unload) { reloadManager = new ReloadManager(); reloadManager.init(commandManager != null ? commandManager.getPrefix() : "."); } - ConfigManager.saveAlts(); - ConfigManager.saveSearch(); - if (!unloaded) { - eventManager.onUnload(); - moduleManager.onUnload(); - ConfigManager.save(ConfigManager.getCurrentConfig()); - moduleManager.onUnloadPost(); - unloaded = true; - } + ConfigManager.saveAlts(); + InfinityLoop.onUnload(); - networkHandler = null; - fontRenderer = null; + fpsManager = null; eventManager = null; + fontRenderer = null; friendManager = null; speedManager = null; holeManager = null; @@ -186,57 +155,51 @@ public static void unload(boolean unload) { commandManager = null; colorManager = null; serverManager = null; - fileManager = null; potionManager = null; inventoryManager = null; moduleManager = null; textManager = null; - timerManager = null; LOGGER.info("InfinityLoop unloaded!\n"); } - /*-------------------- RELOAD ------------------------*/ - public static void reload() { InfinityLoop.unload(false); InfinityLoop.load(); } - - /*--------------------------------------------------------*/ + public static void onUnload() { + if (!unloaded) { + eventManager.onUnload(); + moduleManager.onUnload(); + ConfigManager.save(ConfigManager.getCurrentConfig()); + moduleManager.onUnloadPost(); + unloaded = true; + } + } public static void setWindowIcon() { if (Util.getOSType() != Util.EnumOS.OSX) { - try (final InputStream inputStream16x = Minecraft.class.getResourceAsStream("logo.png"); - final InputStream inputStream32x = Minecraft.class.getResourceAsStream("logo.png")) { - final ByteBuffer[] icons = { IconUtils.INSTANCE.readImageToBuffer(inputStream16x), IconUtils.INSTANCE.readImageToBuffer(inputStream32x) }; - Display.setIcon((ByteBuffer[])icons); + try (final InputStream inputStream16x = Minecraft.class.getResourceAsStream("/assets/minecraft/textures/icon16x.png"); + final InputStream inputStream32x = Minecraft.class.getResourceAsStream("/assets/minecraft/textures/icon32x.png")) { + final ByteBuffer[] icons = { IconUtil.INSTANCE.readImageToBuffer(inputStream16x), IconUtil.INSTANCE.readImageToBuffer(inputStream32x) }; + Display.setIcon(icons); } catch (Exception e) { - InfinityLoop.LOGGER.error("Couldn't set Windows Icon", (Throwable)e); + InfinityLoop.LOGGER.error("Couldn't set Windows Icon", e); } } } - @Mod.EventHandler public void preInit(FMLPreInitializationEvent event) { - RenderingRegistry.registerEntityRenderingHandler(EntityGib.class, RenderGib::new); - GlobalExecutor.EXECUTOR.submit(() -> Sphere.cacheSphere()); - LOGGER.info("KuroHere!"); + Display.setTitle(MODNAME + ": Loading..."); } @Mod.EventHandler public void init(FMLInitializationEvent event) { - this.setWindowIcon(); - Display.setTitle("InfinityLoop"); - initTime = System.currentTimeMillis(); + setWindowIcon(); + Display.setTitle(MODNAME + " | " + MODVER); InfinityLoop.load(); - MinecraftForge.EVENT_BUS.register(networkHandler); - } - - static { - unloaded = false; } } diff --git a/src/main/java/me/loop/event/EventStage.java b/src/main/java/me/loop/event/EventStage.java new file mode 100644 index 0000000..be2fb52 --- /dev/null +++ b/src/main/java/me/loop/event/EventStage.java @@ -0,0 +1,24 @@ +package me.loop.event; + +import net.minecraftforge.fml.common.eventhandler.Event; + +public class EventStage + extends Event { + private int stage; + + public EventStage() { + } + + public EventStage(int stage) { + this.stage = stage; + } + + public int getStage() { + return this.stage; + } + + public void setStage(int stage) { + this.stage = stage; + } +} + diff --git a/src/main/java/me/loop/event/events/BlockEvent.java b/src/main/java/me/loop/event/events/BlockEvent.java new file mode 100644 index 0000000..cd8fbb2 --- /dev/null +++ b/src/main/java/me/loop/event/events/BlockEvent.java @@ -0,0 +1,20 @@ +package me.loop.event.events; + +import me.loop.event.EventStage; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraftforge.fml.common.eventhandler.Cancelable; + +@Cancelable +public class BlockEvent + extends EventStage { + public BlockPos pos; + public EnumFacing facing; + + public BlockEvent(int stage, BlockPos pos, EnumFacing facing) { + super(stage); + this.pos = pos; + this.facing = facing; + } +} + diff --git a/src/main/java/com/me/infinity/loop/event/events/ChatEvent.java b/src/main/java/me/loop/event/events/ChatEvent.java similarity index 70% rename from src/main/java/com/me/infinity/loop/event/events/ChatEvent.java rename to src/main/java/me/loop/event/events/ChatEvent.java index d766276..4cb21fa 100644 --- a/src/main/java/com/me/infinity/loop/event/events/ChatEvent.java +++ b/src/main/java/me/loop/event/events/ChatEvent.java @@ -1,11 +1,11 @@ -package com.me.infinity.loop.event.events; +package me.loop.event.events; -import com.me.infinity.loop.event.Event; +import me.loop.event.EventStage; import net.minecraftforge.fml.common.eventhandler.Cancelable; @Cancelable public class ChatEvent - extends Event { + extends EventStage { private final String msg; public ChatEvent(String msg) { diff --git a/src/main/java/com/me/infinity/loop/event/events/client/ClientEvent.java b/src/main/java/me/loop/event/events/ClientEvent.java similarity index 62% rename from src/main/java/com/me/infinity/loop/event/events/client/ClientEvent.java rename to src/main/java/me/loop/event/events/ClientEvent.java index b2a47a9..63d740e 100644 --- a/src/main/java/com/me/infinity/loop/event/events/client/ClientEvent.java +++ b/src/main/java/me/loop/event/events/ClientEvent.java @@ -1,22 +1,23 @@ -package com.me.infinity.loop.event.events.client; +package me.loop.event.events; -import com.me.infinity.loop.event.Event; -import com.me.infinity.loop.features.Feature; -import com.me.infinity.loop.features.setting.Setting; +import me.loop.event.EventStage; +import me.loop.features.Feature; +import me.loop.features.setting.Setting; import net.minecraftforge.fml.common.eventhandler.Cancelable; @Cancelable public class ClientEvent - extends Event { + extends EventStage { private Feature feature; private Setting setting; - public ClientEvent(Stage stage, Feature feature) { + public ClientEvent(int stage, Feature feature) { super(stage); this.feature = feature; } public ClientEvent(Setting setting) { + super(2); this.setting = setting; } diff --git a/src/main/java/com/me/infinity/loop/event/events/network/ConnectionEvent.java b/src/main/java/me/loop/event/events/ConnectionEvent.java similarity index 67% rename from src/main/java/com/me/infinity/loop/event/events/network/ConnectionEvent.java rename to src/main/java/me/loop/event/events/ConnectionEvent.java index 087befa..68703cd 100644 --- a/src/main/java/com/me/infinity/loop/event/events/network/ConnectionEvent.java +++ b/src/main/java/me/loop/event/events/ConnectionEvent.java @@ -1,23 +1,25 @@ -package com.me.infinity.loop.event.events.network; +package me.loop.event.events; -import com.me.infinity.loop.event.Event; +import me.loop.event.EventStage; import net.minecraft.entity.player.EntityPlayer; import java.util.UUID; public class ConnectionEvent - extends Event { + extends EventStage { private final UUID uuid; private final EntityPlayer entity; private final String name; - public ConnectionEvent( UUID uuid, String name) { + public ConnectionEvent(int stage, UUID uuid, String name) { + super(stage); this.uuid = uuid; this.name = name; this.entity = null; } - public ConnectionEvent( EntityPlayer entity, UUID uuid, String name) { + public ConnectionEvent(int stage, EntityPlayer entity, UUID uuid, String name) { + super(stage); this.entity = entity; this.uuid = uuid; this.name = name; diff --git a/src/main/java/me/loop/event/events/DeathEvent.java b/src/main/java/me/loop/event/events/DeathEvent.java new file mode 100644 index 0000000..52c6361 --- /dev/null +++ b/src/main/java/me/loop/event/events/DeathEvent.java @@ -0,0 +1,14 @@ +package me.loop.event.events; + +import me.loop.event.EventStage; +import net.minecraft.entity.player.EntityPlayer; + +public class DeathEvent + extends EventStage { + public EntityPlayer player; + + public DeathEvent(EntityPlayer player) { + this.player = player; + } +} + diff --git a/src/main/java/me/loop/event/events/KeyEvent.java b/src/main/java/me/loop/event/events/KeyEvent.java new file mode 100644 index 0000000..319a82c --- /dev/null +++ b/src/main/java/me/loop/event/events/KeyEvent.java @@ -0,0 +1,17 @@ +package me.loop.event.events; + +import me.loop.event.EventStage; + +public class KeyEvent + extends EventStage { + private final int key; + + public KeyEvent(int key) { + this.key = key; + } + + public int getKey() { + return this.key; + } +} + diff --git a/src/main/java/com/me/infinity/loop/event/events/network/MoveEvent.java b/src/main/java/me/loop/event/events/MoveEvent.java similarity index 80% rename from src/main/java/com/me/infinity/loop/event/events/network/MoveEvent.java rename to src/main/java/me/loop/event/events/MoveEvent.java index 3c7363c..c11efce 100644 --- a/src/main/java/com/me/infinity/loop/event/events/network/MoveEvent.java +++ b/src/main/java/me/loop/event/events/MoveEvent.java @@ -1,18 +1,18 @@ -package com.me.infinity.loop.event.events.network; +package me.loop.event.events; -import com.me.infinity.loop.event.Event; +import me.loop.event.EventStage; import net.minecraft.entity.MoverType; import net.minecraftforge.fml.common.eventhandler.Cancelable; @Cancelable public class MoveEvent - extends Event { + extends EventStage { private MoverType type; private double x; private double y; private double z; - public MoveEvent(Stage stage, MoverType type, double x, double y, double z) { + public MoveEvent(int stage, MoverType type, double x, double y, double z) { super(stage); this.type = type; this.x = x; diff --git a/src/main/java/me/loop/event/events/PacketEvent.java b/src/main/java/me/loop/event/events/PacketEvent.java new file mode 100644 index 0000000..fc57f0c --- /dev/null +++ b/src/main/java/me/loop/event/events/PacketEvent.java @@ -0,0 +1,36 @@ +package me.loop.event.events; + +import me.loop.event.EventStage; +import net.minecraft.network.Packet; +import net.minecraftforge.fml.common.eventhandler.Cancelable; + +public class PacketEvent + extends EventStage { + private final Packet packet; + + public PacketEvent(int stage, Packet packet) { + super(stage); + this.packet = packet; + } + + public > T getPacket() { + return (T) this.packet; + } + + @Cancelable + public static class Send + extends PacketEvent { + public Send(int stage, Packet packet) { + super(stage, packet); + } + } + + @Cancelable + public static class Receive + extends PacketEvent { + public Receive(int stage, Packet packet) { + super(stage, packet); + } + } +} + diff --git a/src/main/java/com/me/infinity/loop/event/events/player/ProcessRightClickBlockEvent.java b/src/main/java/me/loop/event/events/ProcessRightClickBlockEvent.java similarity index 80% rename from src/main/java/com/me/infinity/loop/event/events/player/ProcessRightClickBlockEvent.java rename to src/main/java/me/loop/event/events/ProcessRightClickBlockEvent.java index 9f05ab4..4c94fb1 100644 --- a/src/main/java/com/me/infinity/loop/event/events/player/ProcessRightClickBlockEvent.java +++ b/src/main/java/me/loop/event/events/ProcessRightClickBlockEvent.java @@ -1,6 +1,6 @@ -package com.me.infinity.loop.event.events.player; +package me.loop.event.events; -import com.me.infinity.loop.event.Event; +import me.loop.event.EventStage; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; @@ -8,7 +8,7 @@ @Cancelable public class ProcessRightClickBlockEvent - extends Event { + extends EventStage { public BlockPos pos; public EnumHand hand; public ItemStack stack; diff --git a/src/main/java/com/me/infinity/loop/event/events/render/Render2DEvent.java b/src/main/java/me/loop/event/events/Render2DEvent.java similarity index 87% rename from src/main/java/com/me/infinity/loop/event/events/render/Render2DEvent.java rename to src/main/java/me/loop/event/events/Render2DEvent.java index 3365129..fe79519 100644 --- a/src/main/java/com/me/infinity/loop/event/events/render/Render2DEvent.java +++ b/src/main/java/me/loop/event/events/Render2DEvent.java @@ -1,10 +1,10 @@ -package com.me.infinity.loop.event.events.render; +package me.loop.event.events; -import com.me.infinity.loop.event.Event; +import me.loop.event.EventStage; import net.minecraft.client.gui.ScaledResolution; public class Render2DEvent - extends Event { + extends EventStage { public float partialTicks; public ScaledResolution scaledResolution; diff --git a/src/main/java/com/me/infinity/loop/event/events/render/Render3DEvent.java b/src/main/java/me/loop/event/events/Render3DEvent.java similarity index 67% rename from src/main/java/com/me/infinity/loop/event/events/render/Render3DEvent.java rename to src/main/java/me/loop/event/events/Render3DEvent.java index a8bd6b5..7ea1f0c 100644 --- a/src/main/java/com/me/infinity/loop/event/events/render/Render3DEvent.java +++ b/src/main/java/me/loop/event/events/Render3DEvent.java @@ -1,9 +1,9 @@ -package com.me.infinity.loop.event.events.render; +package me.loop.event.events; -import com.me.infinity.loop.event.Event; +import me.loop.event.EventStage; public class Render3DEvent - extends Event { + extends EventStage { private final float partialTicks; public Render3DEvent(float partialTicks) { diff --git a/src/main/java/com/me/infinity/loop/event/events/TotemPopEvent.java b/src/main/java/me/loop/event/events/TotemPopEvent.java similarity index 72% rename from src/main/java/com/me/infinity/loop/event/events/TotemPopEvent.java rename to src/main/java/me/loop/event/events/TotemPopEvent.java index e00b5f3..38295f7 100644 --- a/src/main/java/com/me/infinity/loop/event/events/TotemPopEvent.java +++ b/src/main/java/me/loop/event/events/TotemPopEvent.java @@ -1,10 +1,10 @@ -package com.me.infinity.loop.event.events; +package me.loop.event.events; -import com.me.infinity.loop.event.Event; +import me.loop.event.EventStage; import net.minecraft.entity.player.EntityPlayer; public class TotemPopEvent - extends Event { + extends EventStage { private final EntityPlayer entity; public TotemPopEvent(EntityPlayer entity) { diff --git a/src/main/java/me/loop/event/events/UpdateWalkingPlayerEvent.java b/src/main/java/me/loop/event/events/UpdateWalkingPlayerEvent.java new file mode 100644 index 0000000..d7d1824 --- /dev/null +++ b/src/main/java/me/loop/event/events/UpdateWalkingPlayerEvent.java @@ -0,0 +1,11 @@ +package me.loop.event.events; + +import me.loop.event.EventStage; + +public class UpdateWalkingPlayerEvent + extends EventStage { + public UpdateWalkingPlayerEvent(int stage) { + super(stage); + } +} + diff --git a/src/main/java/com/me/infinity/loop/features/Feature.java b/src/main/java/me/loop/features/Feature.java similarity index 76% rename from src/main/java/com/me/infinity/loop/features/Feature.java rename to src/main/java/me/loop/features/Feature.java index 529c802..8211b0b 100644 --- a/src/main/java/com/me/infinity/loop/features/Feature.java +++ b/src/main/java/me/loop/features/Feature.java @@ -1,11 +1,11 @@ -package com.me.infinity.loop.features; +package me.loop.features; -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.features.gui.InfinityLoopGui; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.setting.Setting; -import com.me.infinity.loop.manager.TextManager; -import com.me.infinity.loop.util.utils.Util; +import me.loop.InfinityLoop; +import me.loop.features.gui.InfinityLoopGui; +import me.loop.features.modules.Module; +import me.loop.features.setting.Setting; +import me.loop.manager.TextManager; +import me.loop.util.impl.Util; import java.util.ArrayList; import java.util.List; @@ -24,11 +24,11 @@ public Feature(String name) { } public static boolean nullCheck() { - return Feature.mc.player == null; + return mc.player == null; } public static boolean fullNullCheck() { - return Feature.mc.player == null || Feature.mc.world == null; + return mc.player == null || mc.world == null; } public String getName() { @@ -57,7 +57,7 @@ public boolean isDisabled() { public Setting register(Setting setting) { setting.setFeature(this); this.settings.add(setting); - if (this instanceof Module && Feature.mc.currentScreen instanceof InfinityLoopGui) { + if (this instanceof Module && mc.currentScreen instanceof InfinityLoopGui) { InfinityLoopGui.getInstance().updateModule((Module) this); } return setting; @@ -72,7 +72,7 @@ public void unregister(Setting settingIn) { if (!removeList.isEmpty()) { this.settings.removeAll(removeList); } - if (this instanceof Module && Feature.mc.currentScreen instanceof InfinityLoopGui) { + if (this instanceof Module && mc.currentScreen instanceof InfinityLoopGui) { InfinityLoopGui.getInstance().updateModule((Module) this); } } diff --git a/src/main/java/com/me/infinity/loop/features/command/Command.java b/src/main/java/me/loop/features/command/Command.java similarity index 80% rename from src/main/java/com/me/infinity/loop/features/command/Command.java rename to src/main/java/me/loop/features/command/Command.java index 2bd4b53..c9b82a9 100644 --- a/src/main/java/com/me/infinity/loop/features/command/Command.java +++ b/src/main/java/me/loop/features/command/Command.java @@ -1,8 +1,8 @@ -package com.me.infinity.loop.features.command; +package me.loop.features.command; -import com.me.infinity.loop.InfinityLoop; import com.mojang.realmsclient.gui.ChatFormatting; -import com.me.infinity.loop.features.Feature; +import me.loop.InfinityLoop; +import me.loop.features.Feature; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TextComponentBase; @@ -11,8 +11,6 @@ public abstract class Command extends Feature { - String specialUsage; - String description; protected String name; protected String[] commands; @@ -28,21 +26,6 @@ public Command(String name, String[] commands) { this.commands = commands; } - public Command(String name, String specialUsage, String description) { - this.name = name; - this.specialUsage = specialUsage; - this.description = description; - } - - public String getDescription() { - return this.description; - } - - public String getUsageException() { - return this.specialUsage; - } - - public static void sendMessage(String message) { Command.sendSilentMessage(InfinityLoop.commandManager.getClientMessage() + " " + ChatFormatting.GRAY + message); } diff --git a/src/main/java/com/me/infinity/loop/features/command/commands/BindCommand.java b/src/main/java/me/loop/features/command/commands/BindCommand.java similarity index 84% rename from src/main/java/com/me/infinity/loop/features/command/commands/BindCommand.java rename to src/main/java/me/loop/features/command/commands/BindCommand.java index 077fe93..f71e305 100644 --- a/src/main/java/com/me/infinity/loop/features/command/commands/BindCommand.java +++ b/src/main/java/me/loop/features/command/commands/BindCommand.java @@ -1,10 +1,10 @@ -package com.me.infinity.loop.features.command.commands; +package me.loop.features.command.commands; -import com.me.infinity.loop.InfinityLoop; import com.mojang.realmsclient.gui.ChatFormatting; -import com.me.infinity.loop.features.command.Command; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.setting.impl.Bind; +import me.loop.InfinityLoop; +import me.loop.features.command.Command; +import me.loop.features.modules.Module; +import me.loop.features.setting.Bind; import org.lwjgl.input.Keyboard; public class BindCommand diff --git a/src/main/java/com/me/infinity/loop/features/command/commands/ConfigCommand.java b/src/main/java/me/loop/features/command/commands/ConfigCommand.java similarity index 77% rename from src/main/java/com/me/infinity/loop/features/command/commands/ConfigCommand.java rename to src/main/java/me/loop/features/command/commands/ConfigCommand.java index 06343e0..68f8f87 100644 --- a/src/main/java/com/me/infinity/loop/features/command/commands/ConfigCommand.java +++ b/src/main/java/me/loop/features/command/commands/ConfigCommand.java @@ -1,25 +1,20 @@ -package com.me.infinity.loop.features.command.commands; +package me.loop.features.command.commands; -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.manager.ConfigManager; -import com.mojang.realmsclient.gui.ChatFormatting; -import com.me.infinity.loop.features.command.Command; +import me.loop.features.command.Command; +import me.loop.manager.ConfigManager; import java.awt.*; import java.io.File; -import java.util.Arrays; -import java.util.List; import java.util.Objects; -import java.util.stream.Collectors; public class ConfigCommand extends Command { public ConfigCommand() { - super("config"); + super("configs"); } public void execute(String[] commands) { if (commands.length == 1) { - sendMessage("configs are saved in loop/configs/"); + sendMessage("configs are saved in loop/configs/"); return; } if (commands.length == 2) @@ -53,4 +48,4 @@ public void execute(String[] commands) { } } -} \ No newline at end of file +} diff --git a/src/main/java/com/me/infinity/loop/features/command/commands/FriendCommand.java b/src/main/java/me/loop/features/command/commands/FriendCommand.java similarity index 91% rename from src/main/java/com/me/infinity/loop/features/command/commands/FriendCommand.java rename to src/main/java/me/loop/features/command/commands/FriendCommand.java index 1ee56e8..a0ab650 100644 --- a/src/main/java/com/me/infinity/loop/features/command/commands/FriendCommand.java +++ b/src/main/java/me/loop/features/command/commands/FriendCommand.java @@ -1,9 +1,8 @@ -package com.me.infinity.loop.features.command.commands; +package me.loop.features.command.commands; -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.manager.FriendManager; import com.mojang.realmsclient.gui.ChatFormatting; -import com.me.infinity.loop.features.command.Command; +import me.loop.InfinityLoop; +import me.loop.features.command.Command; public class FriendCommand extends Command { @@ -58,3 +57,5 @@ public void execute(String[] commands) { } } + + diff --git a/src/main/java/com/me/infinity/loop/features/command/commands/HelpCommand.java b/src/main/java/me/loop/features/command/commands/HelpCommand.java similarity index 76% rename from src/main/java/com/me/infinity/loop/features/command/commands/HelpCommand.java rename to src/main/java/me/loop/features/command/commands/HelpCommand.java index 4710355..9708218 100644 --- a/src/main/java/com/me/infinity/loop/features/command/commands/HelpCommand.java +++ b/src/main/java/me/loop/features/command/commands/HelpCommand.java @@ -1,8 +1,8 @@ -package com.me.infinity.loop.features.command.commands; +package me.loop.features.command.commands; -import com.me.infinity.loop.InfinityLoop; import com.mojang.realmsclient.gui.ChatFormatting; -import com.me.infinity.loop.features.command.Command; +import me.loop.InfinityLoop; +import me.loop.features.command.Command; public class HelpCommand extends Command { diff --git a/src/main/java/com/me/infinity/loop/features/command/commands/HistoryCommand.java b/src/main/java/me/loop/features/command/commands/HistoryCommand.java similarity index 88% rename from src/main/java/com/me/infinity/loop/features/command/commands/HistoryCommand.java rename to src/main/java/me/loop/features/command/commands/HistoryCommand.java index 47ffb79..3996b5e 100644 --- a/src/main/java/com/me/infinity/loop/features/command/commands/HistoryCommand.java +++ b/src/main/java/me/loop/features/command/commands/HistoryCommand.java @@ -1,8 +1,8 @@ -package com.me.infinity.loop.features.command.commands; +package me.loop.features.command.commands; -import com.me.infinity.loop.util.utils.PlayerUtil; import com.mojang.realmsclient.gui.ChatFormatting; -import com.me.infinity.loop.features.command.Command; +import me.loop.features.command.Command; +import me.loop.util.impl.PlayerUtil; import java.util.List; import java.util.UUID; diff --git a/src/main/java/com/me/infinity/loop/features/command/commands/ModuleCommand.java b/src/main/java/me/loop/features/command/commands/ModuleCommand.java similarity index 83% rename from src/main/java/com/me/infinity/loop/features/command/commands/ModuleCommand.java rename to src/main/java/me/loop/features/command/commands/ModuleCommand.java index c54f2bd..07cfb45 100644 --- a/src/main/java/com/me/infinity/loop/features/command/commands/ModuleCommand.java +++ b/src/main/java/me/loop/features/command/commands/ModuleCommand.java @@ -1,17 +1,16 @@ -package com.me.infinity.loop.features.command.commands; +package me.loop.features.command.commands; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonParser; -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.features.Feature; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.setting.*; -import com.me.infinity.loop.features.setting.impl.*; import com.mojang.realmsclient.gui.ChatFormatting; -import com.me.infinity.loop.features.command.Command; -import com.me.infinity.loop.features.modules.Module; - +import me.loop.InfinityLoop; +import me.loop.features.Feature; +import me.loop.features.command.Command; +import me.loop.features.modules.Module; +import me.loop.features.setting.Bind; +import me.loop.features.setting.EnumConverter; +import me.loop.features.setting.Setting; import java.awt.*; import java.util.Objects; @@ -27,7 +26,7 @@ public void execute(String[] commands) { Setting setting; if (commands.length == 1) { ModuleCommand.sendMessage("Modules: "); - for (ModuleCategory category : InfinityLoop.moduleManager.getCategories()) { + for (Module.Category category : InfinityLoop.moduleManager.getCategories()) { String modules = category.getName() + ": "; for (Module module1 : InfinityLoop.moduleManager.getModulesByCategory(category)) { modules = modules + (module1.isEnabled() ? ChatFormatting.GREEN : ChatFormatting.RED) + module1.getName() + ChatFormatting.WHITE + ", "; @@ -95,9 +94,9 @@ public void execute(String[] commands) { } - public static void setCommandValue(Feature feature, Setting setting, JsonElement element) { + public static void setCommandValue(Feature mod, Setting setting, JsonElement element) { String str; - for(Setting setting2 : feature.getSettings()) { + for(Setting setting2 : mod.getSettings()) { if(Objects.equals(setting.getName(), setting2.getName())) { switch (setting2.getType()) { case "Parent": @@ -127,14 +126,6 @@ public static void setCommandValue(Feature feature, Setting setting, JsonElement JsonArray array = element.getAsJsonArray(); setting2.setValue(new Color(array.getAsInt(), true)); return; - case "PositionSetting": - JsonArray array3 = element.getAsJsonArray(); - ((PositionSetting) setting2.getValue()).setX(array3.get(0).getAsFloat()); - ((PositionSetting) setting2.getValue()).setY(array3.get(1).getAsFloat()); - return; - case "SubBind": - setting2.setValue((new SubBind.SubBindConverter()).doBackward(element)); - return; case "Enum": try { EnumConverter converter = new EnumConverter(((Enum) setting2.getValue()).getClass()); diff --git a/src/main/java/com/me/infinity/loop/features/command/commands/PrefixCommand.java b/src/main/java/me/loop/features/command/commands/PrefixCommand.java similarity index 79% rename from src/main/java/com/me/infinity/loop/features/command/commands/PrefixCommand.java rename to src/main/java/me/loop/features/command/commands/PrefixCommand.java index aa4a62b..add060f 100644 --- a/src/main/java/com/me/infinity/loop/features/command/commands/PrefixCommand.java +++ b/src/main/java/me/loop/features/command/commands/PrefixCommand.java @@ -1,8 +1,8 @@ -package com.me.infinity.loop.features.command.commands; +package me.loop.features.command.commands; -import com.me.infinity.loop.InfinityLoop; import com.mojang.realmsclient.gui.ChatFormatting; -import com.me.infinity.loop.features.command.Command; +import me.loop.InfinityLoop; +import me.loop.features.command.Command; public class PrefixCommand extends Command { diff --git a/src/main/java/com/me/infinity/loop/features/command/commands/ReloadCommand.java b/src/main/java/me/loop/features/command/commands/ReloadCommand.java similarity index 60% rename from src/main/java/com/me/infinity/loop/features/command/commands/ReloadCommand.java rename to src/main/java/me/loop/features/command/commands/ReloadCommand.java index 7309373..0954bb3 100644 --- a/src/main/java/com/me/infinity/loop/features/command/commands/ReloadCommand.java +++ b/src/main/java/me/loop/features/command/commands/ReloadCommand.java @@ -1,7 +1,7 @@ -package com.me.infinity.loop.features.command.commands; +package me.loop.features.command.commands; -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.features.command.Command; +import me.loop.features.command.Command; +import me.loop.InfinityLoop; public class ReloadCommand extends Command { diff --git a/src/main/java/com/me/infinity/loop/features/command/commands/ReloadSoundCommand.java b/src/main/java/me/loop/features/command/commands/ReloadSoundCommand.java similarity index 71% rename from src/main/java/com/me/infinity/loop/features/command/commands/ReloadSoundCommand.java rename to src/main/java/me/loop/features/command/commands/ReloadSoundCommand.java index 8649190..8d4e0f0 100644 --- a/src/main/java/com/me/infinity/loop/features/command/commands/ReloadSoundCommand.java +++ b/src/main/java/me/loop/features/command/commands/ReloadSoundCommand.java @@ -2,10 +2,10 @@ // Decompiled by Procyon v0.5.36 // -package com.me.infinity.loop.features.command.commands; +package me.loop.features.command.commands; import com.mojang.realmsclient.gui.ChatFormatting; -import com.me.infinity.loop.features.command.Command; +import me.loop.features.command.Command; import net.minecraft.client.audio.SoundHandler; import net.minecraft.client.audio.SoundManager; import net.minecraftforge.fml.common.ObfuscationReflectionHelper; @@ -18,11 +18,11 @@ public ReloadSoundCommand() { @Override public void execute(final String[] commands) { try { - final SoundManager sndManager = ObfuscationReflectionHelper.getPrivateValue(SoundHandler.class, ReloadSoundCommand.mc.getSoundHandler(), new String[]{"sndManager", "sndManager"}); + final SoundManager sndManager = (SoundManager) ObfuscationReflectionHelper.getPrivateValue(SoundHandler.class, ReloadSoundCommand.mc.getSoundHandler(), new String[]{"sndManager", "sndManager"}); sndManager.reloadSoundSystem(); Command.sendMessage(ChatFormatting.GREEN + "Reloaded Sound System."); } catch (Exception e) { - System.out.println(ChatFormatting.RED + "Could not restart sound manager: " + e); + System.out.println(ChatFormatting.RED + "Could not restart sound manager: " + e.toString()); e.printStackTrace(); Command.sendMessage(ChatFormatting.RED + "Couldnt Reload Sound System!"); } diff --git a/src/main/java/com/me/infinity/loop/features/command/commands/UnloadCommand.java b/src/main/java/me/loop/features/command/commands/UnloadCommand.java similarity index 60% rename from src/main/java/com/me/infinity/loop/features/command/commands/UnloadCommand.java rename to src/main/java/me/loop/features/command/commands/UnloadCommand.java index 555224e..421012a 100644 --- a/src/main/java/com/me/infinity/loop/features/command/commands/UnloadCommand.java +++ b/src/main/java/me/loop/features/command/commands/UnloadCommand.java @@ -1,7 +1,7 @@ -package com.me.infinity.loop.features.command.commands; +package me.loop.features.command.commands; -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.features.command.Command; +import me.loop.InfinityLoop; +import me.loop.features.command.Command; public class UnloadCommand extends Command { diff --git a/src/main/java/com/me/infinity/loop/features/gui/InfinityLoopGui.java b/src/main/java/me/loop/features/gui/InfinityLoopGui.java similarity index 66% rename from src/main/java/com/me/infinity/loop/features/gui/InfinityLoopGui.java rename to src/main/java/me/loop/features/gui/InfinityLoopGui.java index 695a291..a67f4fb 100644 --- a/src/main/java/com/me/infinity/loop/features/gui/InfinityLoopGui.java +++ b/src/main/java/me/loop/features/gui/InfinityLoopGui.java @@ -1,20 +1,20 @@ -package com.me.infinity.loop.features.gui; - -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.features.Feature; -import com.me.infinity.loop.features.gui.screen.anchor.AnchorPoint; -import com.me.infinity.loop.features.gui.components.Component; -import com.me.infinity.loop.features.gui.components.items.Item; -import com.me.infinity.loop.features.gui.components.items.buttons.ModuleButton; -import com.me.infinity.loop.features.gui.screen.particles.ParticleSystem; -import com.me.infinity.loop.features.gui.screen.particles.ParticlesComponent; -import com.me.infinity.loop.features.gui.screen.taskbar.TaskbarStage; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.modules.client.ClickGui.ClickGui; -import com.me.infinity.loop.features.modules.client.Colors; -import com.me.infinity.loop.util.utils.renders.ColorUtil; -import com.me.infinity.loop.util.utils.renders.RenderUtil; +package me.loop.features.gui; + +import me.loop.InfinityLoop; +import me.loop.features.Feature; +import me.loop.features.gui.click.Component; +import me.loop.features.gui.click.items.Item; +import me.loop.features.gui.click.items.buttons.Description; +import me.loop.features.gui.click.items.buttons.ModuleButton; +import me.loop.features.gui.screen.anchor.AnchorPoint; +import me.loop.features.gui.screen.effects.particles.ParticleSystem; +import me.loop.features.gui.screen.effects.particles.ParticlesComponent; +import me.loop.features.gui.screen.taskbar.TaskbarStage; +import me.loop.features.modules.Module; +import me.loop.features.modules.client.Colors; +import me.loop.features.modules.client.clickgui.ClickGui; +import me.loop.util.impl.ColorUtil; +import me.loop.util.impl.RenderUtil; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.ScaledResolution; @@ -28,18 +28,17 @@ public class InfinityLoopGui extends GuiScreen { private static InfinityLoopGui INSTANCE; + private final ArrayList components = new ArrayList(); private final TaskbarStage taskbarStage = new TaskbarStage(); - - public ParticleSystem particleSystem; private ParticlesComponent particlesComponent; + public ParticleSystem particleSystem; + private static Description description; private int color; static { INSTANCE = new InfinityLoopGui(); } - private final ArrayList components = new ArrayList(); - public InfinityLoopGui() { this.setInstance(); this.load(); @@ -52,7 +51,6 @@ public static InfinityLoopGui getInstance() { return INSTANCE; } - public static InfinityLoopGui getClickGui() { return InfinityLoopGui.getInstance(); } @@ -63,8 +61,8 @@ private void setInstance() { private void load() { int x = -80; - for (final ModuleCategory category : InfinityLoop.moduleManager.getCategories()) { - this.components.add(new Component(category.getName(), x += 96, 50, true) { + for (final Module.Category category : InfinityLoop.moduleManager.getCategories()) { + this.components.add(new Component(category.getName(), x += 100, 50, true) { @Override public void setupItems() { @@ -80,17 +78,14 @@ public void setupItems() { this.components.forEach(components -> components.getItems().sort(Comparator.comparing(Feature::getName))); } - public void updateModule(final Module module) { - for (final com.me.infinity.loop.features.gui.components.Component component : this.components) { - for (final Item item : component.getItems()) { - if (item instanceof ModuleButton) { - final ModuleButton button = (ModuleButton) item; - final Module mod = button.getModule(); - if (module != null && module.equals(mod)) { - button.initSettings(); - break; - } - } + public void updateModule(Module module) { + for (Component component : this.components) { + for (Item item : component.getItems()) { + if (!(item instanceof ModuleButton)) continue; + ModuleButton button = (ModuleButton) item; + Module mod = button.getModule(); + if (module == null || !module.equals(mod)) continue; + button.initSettings(); } } } @@ -108,29 +103,37 @@ public void onResize(Minecraft mcIn, int w, int h) { } } + public Description getDescription() { + return description; + } + public void drawScreen(int mouseX, int mouseY, float partialTicks) { this.checkMouseWheel(); - ScaledResolution rs = new ScaledResolution(mc); - if (ClickGui.getInstance().background.getValue()) { + ScaledResolution sr = new ScaledResolution(mc); + description.setDraw(false); + if (ClickGui.getInstance().isEnabled()) { + if (ClickGui.getInstance().dirt.getValue()) { + this.drawBackground(1); + } if (ClickGui.getInstance().dark.getValue()) { this.drawDefaultBackground(); } if (ClickGui.getInstance().blur.getValue()) { - RenderUtil.drawBlurryRect(0, 0, rs.getScaledWidth(), rs.getScaledHeight(), ClickGui.getInstance().blurAmount.getValue(), ClickGui.getInstance().blurSize.getValue()); + RenderUtil.drawBlurryRect(0, 0, sr.getScaledWidth(), sr.getScaledHeight(), ClickGui.getInstance().blurAmount.getValue(), ClickGui.getInstance().blurSize.getValue()); } if (ClickGui.getInstance().gradiant.getValue()) { - RenderUtil.drawGradientRect(0, 0, rs.getScaledWidth(), rs.getScaledHeight() + ClickGui.getInstance().gradiantHeight.getValue(), 0, new Color(ClickGui.getInstance().red.getValue(), ClickGui.getInstance().green.getValue(), ClickGui.getInstance().blue.getValue(), ClickGui.getInstance().gradiantAlpha.getValue()).getRGB()); + RenderUtil.drawGradientRect(0, 0, sr.getScaledWidth(), sr.getScaledHeight() + ClickGui.getInstance().gradiantHeight.getValue(), 0, new Color(ClickGui.getInstance().moduleEnableC.getValue().getRed(), ClickGui.getInstance().moduleEnableC.getValue().getGreen(), ClickGui.getInstance().moduleEnableC.getValue().getBlue(), ClickGui.getInstance().gradiantAlpha.getValue()).getRGB()); if (ClickGui.getInstance().gradiant.getValue() && ClickGui.getInstance().colorSync.getValue() && Colors.getInstance().rainbow.getValue()) { - RenderUtil.drawGradientRect(0, 0, rs.getScaledWidth(), rs.getScaledHeight() + ClickGui.getInstance().gradiantHeight.getValue().intValue(), 0, (Colors.getInstance()).rainbow.getValue().booleanValue() ? (((Colors.getInstance()).rainbowModeA.getValue() == Colors.rainbowModeArray.Up) ? ColorUtil.rainbow((Colors.getInstance()).rainbowHue.getValue().intValue()).getRGB() : ColorUtil.rainbow((Colors.getInstance()).rainbowHue.getValue().intValue(), ClickGui.getInstance().hoverAlpha.getValue()).getRGB()) : this.color); + RenderUtil.drawGradientRect(0, 0, sr.getScaledWidth(), sr.getScaledHeight() + ClickGui.getInstance().gradiantHeight.getValue().intValue(), 0, (Colors.getInstance()).rainbow.getValue().booleanValue() ? (((Colors.getInstance()).rainbowModeA.getValue() == Colors.rainbowModeArray.Up) ? ColorUtil.rainbow((Colors.getInstance()).rainbowHue.getValue().intValue()).getRGB() : ColorUtil.rainbow((Colors.getInstance()).rainbowHue.getValue().intValue(), ClickGui.getInstance().hoverAlpha.getValue()).getRGB()) : this.color); } } if (this.particleSystem != null && ClickGui.getInstance().particles.getValue()) { this.particleSystem.render(mouseX, mouseY); - } - else { + } else { this.particleSystem = new ParticleSystem(new ScaledResolution(this.mc)); } } + this.components.forEach(components -> components.drawScreen(mouseX, mouseY, partialTicks)); taskbarStage.drawComponent(); } @@ -174,9 +177,11 @@ public final ArrayList getComponents() { public void checkMouseWheel() { int dWheel = Mouse.getDWheel(); if (dWheel < 0) { - this.components.forEach(component -> component.setY(component.getY() - 10)); - } else if (dWheel > 0) { - this.components.forEach(component -> component.setY(component.getY() + 10)); + if (ClickGui.getInstance().scroll.getValue().booleanValue()) { + this.components.forEach(component -> component.setY(component.getY() - ClickGui.getInstance().scrollval.getValue())); + } + } else if (dWheel > 0 && ClickGui.getInstance().scroll.getValue().booleanValue()) { + this.components.forEach(component -> component.setY(component.getY() + ClickGui.getInstance().scrollval.getValue())); } } @@ -198,7 +203,8 @@ public void keyTyped(char typedChar, int keyCode) throws IOException { } static { - InfinityLoopGui.INSTANCE = new InfinityLoopGui(); + INSTANCE = new InfinityLoopGui(); + description = new Description("", 0.0f, 0.0f); } } diff --git a/src/main/java/com/me/infinity/loop/features/gui/components/Component.java b/src/main/java/me/loop/features/gui/click/Component.java similarity index 71% rename from src/main/java/com/me/infinity/loop/features/gui/components/Component.java rename to src/main/java/me/loop/features/gui/click/Component.java index e1423bf..3ec08c4 100644 --- a/src/main/java/com/me/infinity/loop/features/gui/components/Component.java +++ b/src/main/java/me/loop/features/gui/click/Component.java @@ -1,16 +1,15 @@ -package com.me.infinity.loop.features.gui.components; - -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.features.Feature; -import com.me.infinity.loop.features.gui.InfinityLoopGui; -import com.me.infinity.loop.features.gui.components.items.Item; -import com.me.infinity.loop.features.gui.components.items.buttons.Button; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.client.ClickGui.ClickGui; -import com.me.infinity.loop.features.modules.client.Colors; -import com.me.infinity.loop.util.utils.maths.ImageUtil; -import com.me.infinity.loop.util.utils.renders.ColorUtil; -import com.me.infinity.loop.util.utils.renders.RenderUtil; +package me.loop.features.gui.click; + +import me.loop.InfinityLoop; +import me.loop.features.Feature; +import me.loop.features.gui.InfinityLoopGui; +import me.loop.features.gui.click.items.Item; +import me.loop.features.gui.click.items.buttons.Button; +import me.loop.features.modules.client.Colors; +import me.loop.features.modules.client.clickgui.ClickGui; +import me.loop.util.impl.ColorUtil; +import me.loop.util.impl.ImageUtil; +import me.loop.util.impl.RenderUtil; import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.client.gui.Gui; import net.minecraft.client.renderer.GlStateManager; @@ -21,23 +20,17 @@ import java.awt.*; import java.util.ArrayList; -import static com.me.infinity.loop.features.modules.client.ClickGui.ClickGui.getInstance; - public abstract class Component extends Feature { public static int[] counter1 = new int[]{1}; private final ArrayList items = new ArrayList(); private final ResourceLocation arrow = new ResourceLocation("textures/arrow.png"); - private ResourceLocation client = new ResourceLocation("textures/client.png"); private ResourceLocation combat = new ResourceLocation("textures/combat.png"); private ResourceLocation misc = new ResourceLocation("textures/misc.png"); private ResourceLocation movement = new ResourceLocation("textures/movement.png"); private ResourceLocation player = new ResourceLocation("textures/player.png"); private ResourceLocation render = new ResourceLocation("textures/render.png"); - - private Module module; - private int color; public boolean drag; private int x; private int y; @@ -47,7 +40,6 @@ public abstract class Component private int height; private int angle; private boolean open; - private boolean hidden = false; private boolean visible; public Component(String name, int x, int y, boolean open) { @@ -55,7 +47,7 @@ public Component(String name, int x, int y, boolean open) { this.x = x; this.y = y; this.width = 96; - this.height = 18; + this.height = 19; this.angle = 180; this.open = open; this.setupItems(); @@ -80,35 +72,38 @@ public void drawScreen(int mouseX, int mouseY, float partialTicks) { counter1 = new int[]{1}; float totalItemHeight = this.open ? this.getTotalItemHeight() - 2.0f : 0.0f; - int color = new Color(255, 0, 0, 162).getRGB(); - int colorButton1 = new Color(67, 67, 67, 110).getRGB(); - int colorButton2 = new Color(22, 22, 22, 143).getRGB(); + boolean future = ClickGui.getInstance().moduleiconmode.getValue(); + + if (ClickGui.getInstance().isOn()); { + RenderUtil.drawGradientSideways(this.x, (float)this.y - 1.5f, this.x + this.width, this.y + this.height - 6, new Color(0,0,0,255).getRGB(), new Color(ClickGui.getInstance().moduleMainC.getValue().getRed(), ClickGui.getInstance().moduleMainC.getValue().getGreen(), ClickGui.getInstance().moduleMainC.getValue().getBlue(), 255).getRGB()); + RenderUtil.drawBorderedRect(this.x + 0.4, (float) this.y + 12.5f + 0.1 - 13, this.x + this.width + 0.1, (float) (this.y + this.height) + totalItemHeight + 0.5, ClickGui.getInstance().getOutlineWidth() - ClickGui.getInstance().getOutlineWidth() * 2, new Color(0, 0, 0, 0).getRGB(), new Color(ClickGui.getInstance().moduleMainC.getValue().getRed(), ClickGui.getInstance().moduleMainC.getValue().getGreen(), ClickGui.getInstance().moduleMainC.getValue().getBlue(), ClickGui.getInstance().moduleMainC.getValue().getAlpha()).getRGB()); + } + if (!this.open) { + RenderUtil.drawBorderedRect(this.x, (float)this.y - 1.5f, this.x + this.width, this.y + this.height - 6, ClickGui.getInstance().getOutlineWidth() - ClickGui.getInstance().getOutlineWidth()*2, new Color(0,0,0,0).getRGB(), new Color(ClickGui.getInstance().moduleMainC.getValue().getRed(), ClickGui.getInstance().moduleMainC.getValue().getGreen(), ClickGui.getInstance().moduleMainC.getValue().getBlue(), ClickGui.getInstance().moduleMainC.getValue().getAlpha()).getRGB()); + } Gui.drawRect(this.x, this.y - 2, this.x + this.width, this.y + this.height - 6, new Color(0xCD232323, true).getRGB()); - RenderUtil.drawOutlineRect(this.x, this.y - 2, this.x + this.width, this.y + this.height - 6, (Colors.getInstance()).rainbow.getValue().booleanValue() ? (ColorUtil.rainbow((Colors.getInstance()).rainbowHue.getValue().intValue())) : new Color(getInstance().red.getValue(), getInstance().green.getValue(), getInstance().blue.getValue(), 240), 0.2f); + RenderUtil.drawOutlineRect(this.x, this.y - 2, this.x + this.width, this.y + this.height - 6, (Colors.getInstance()).rainbow.getValue().booleanValue() ? (ColorUtil.rainbow((Colors.getInstance()).rainbowHue.getValue().intValue())) : new Color(ClickGui.getInstance().moduleMainC.getValue().getRed(), ClickGui.getInstance().moduleMainC.getValue().getGreen(), ClickGui.getInstance().moduleMainC.getValue().getBlue(), 240), 0.2f); Gui.drawRect(this.x, this.y + height - 5, this.x + this.width, this.y + this.height - 6, new Color(255, 255, 255, 176).getRGB()); RenderUtil.drawRect(this.x, (float) this.y + 12.5f, this.x + this.width, (float) (this.y + this.height) + totalItemHeight + 5, 0x77000000); - if (Colors.getInstance().isEnabled()); { - int n = color = (Colors.getInstance()).rainbow.getValue().booleanValue() ? (((Colors.getInstance()).rainbowModeA.getValue() == Colors.rainbowModeArray.Up) ? ColorUtil.rainbow((Colors.getInstance()).rainbowHue.getValue().intValue()).getRGB() : ColorUtil.rainbow((Colors.getInstance()).rainbowHue.getValue().intValue(), ClickGui.getInstance().hoverAlpha.getValue()).getRGB()) : ColorUtil.toARGB(getInstance().red.getValue(), getInstance().green.getValue(), getInstance().blue.getValue(), getInstance().alpha.getValue()); + if (ClickGui.getInstance().shader.getValue().booleanValue()) { + RenderUtil.drawColorShader(this.x, (int)((double)this.y - 1.5), this.x + this.width, this.y + this.height + (int)totalItemHeight, ColorUtil.toRGBA(new Color(ClickGui.getInstance().shaderC.getValue().getRed(), ClickGui.getInstance().shaderC.getValue().getGreen(), ClickGui.getInstance().shaderC.getValue().getBlue(), ClickGui.getInstance().shaderC.getValue().getAlpha())), ClickGui.getInstance().shaderRadius.getValue()); } - if (getInstance().isEnabled()); { - RenderUtil.drawGradientSideways(this.x, (float)this.y - 1.5f, this.x + this.width, this.y + this.height - 6, new Color(0,0,0,255).getRGB(), color); + if (ClickGui.getInstance().categoryTextCenter.getValue().booleanValue()) { + InfinityLoop.textManager.drawStringWithShadow(this.getName(), (float)this.x + (float)(this.width / 2) - (float)(this.renderer.getStringWidth(this.getName()) / 2), (float)this.y - 4.0f - (float)InfinityLoopGui.getClickGui().getTextOffset(), -1); + } else { + InfinityLoop.textManager.drawStringWithShadow(this.getName(), (float)this.x + 3.0f, (float)this.y - 4.0f - (float)InfinityLoopGui.getClickGui().getTextOffset(), -1); } - if (this.open) { - RenderUtil.drawGradientSideways(this.x, (float) this.y + 12.5f, this.x + this.width, (float) (this.y + this.height) + totalItemHeight, colorButton2 ,colorButton1); - } - - InfinityLoop.textManager.drawString(this.getName(), (float)this.x + 3.0f, (float)this.y - 4.0f - (float) InfinityLoopGui.getClickGui().getTextOffset(), -1); - if (!this.open) { - if (this.angle > 0) { - this.angle -= 6; + if (future) { + if (!open) { + if (angle > 0) { + angle -= 6; + } + } else if (angle < 180) { + angle += 6; } - } else if (this.angle < 180) { - this.angle += 6; - } - if (getInstance().moduleiconmode.getValue()) { GlStateManager.pushMatrix(); GlStateManager.enableBlend(); ImageUtil.glColor(new Color(255, 255, 255, 255)); @@ -247,13 +242,6 @@ public void setHeight(int height) { this.height = height; } - public boolean isHidden() { - return this.hidden; - } - - public void setHidden(boolean hidden) { - this.hidden = hidden; - } public boolean isVisible() { return visible; } @@ -262,24 +250,16 @@ public void setVisible(boolean visible) { this.visible = visible; } - public boolean isOpen() { - return this.open; - } - public final ArrayList getItems() { return this.items; } - public boolean onMouseClicked(int mouseX, int mouseY, int mouseButton) { - return false; - } - - public static boolean mouseWithinBounds(int mouseX, int mouseY, double x, double y, double width, double height) { - return (mouseX >= x && mouseX <= x + width && mouseY >= y && mouseY <= y + height); - } - private boolean isHovering(int mouseX, int mouseY) { - return mouseX >= this.getX() && mouseX <= this.getX() + this.getWidth() && mouseY >= this.getY() && mouseY <= this.getY() + this.getHeight() - (this.open ? 2 : 0); + if (mouseX < this.getX()) return false; + if (mouseX > this.getX() + this.getWidth()) return false; + if (mouseY < this.getY()) return false; + if (mouseY > this.getY() + this.getHeight() - (this.open ? 2 : 0)) return false; + return true; } private float getTotalItemHeight() { @@ -292,3 +272,5 @@ private float getTotalItemHeight() { } + + diff --git a/src/main/java/com/me/infinity/loop/features/gui/components/items/Item.java b/src/main/java/me/loop/features/gui/click/items/Item.java similarity index 82% rename from src/main/java/com/me/infinity/loop/features/gui/components/items/Item.java rename to src/main/java/me/loop/features/gui/click/items/Item.java index 2b7d767..b0a1c3f 100644 --- a/src/main/java/com/me/infinity/loop/features/gui/components/items/Item.java +++ b/src/main/java/me/loop/features/gui/click/items/Item.java @@ -1,11 +1,9 @@ -package com.me.infinity.loop.features.gui.components.items; +package me.loop.features.gui.click.items; -import com.me.infinity.loop.features.Feature; -import com.me.infinity.loop.features.setting.Setting; +import me.loop.features.Feature; public class Item extends Feature { - protected Setting setting; protected float x; protected float y; protected int width; @@ -68,10 +66,5 @@ public boolean setHidden(boolean hidden) { this.hidden = hidden; return this.hidden; } - - public boolean isVisible() { - return setting.isVisible(); - } - } diff --git a/src/main/java/com/me/infinity/loop/features/gui/components/items/buttons/BindButton.java b/src/main/java/me/loop/features/gui/click/items/buttons/BindButton.java similarity index 86% rename from src/main/java/com/me/infinity/loop/features/gui/components/items/buttons/BindButton.java rename to src/main/java/me/loop/features/gui/click/items/buttons/BindButton.java index 2934783..254c011 100644 --- a/src/main/java/com/me/infinity/loop/features/gui/components/items/buttons/BindButton.java +++ b/src/main/java/me/loop/features/gui/click/items/buttons/BindButton.java @@ -1,12 +1,12 @@ -package com.me.infinity.loop.features.gui.components.items.buttons; +package me.loop.features.gui.click.items.buttons; -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.features.modules.client.ClickGui.ClickGui; -import com.me.infinity.loop.features.setting.Setting; -import com.me.infinity.loop.util.utils.renders.RenderUtil; import com.mojang.realmsclient.gui.ChatFormatting; -import com.me.infinity.loop.features.gui.InfinityLoopGui; -import com.me.infinity.loop.features.setting.impl.Bind; +import me.loop.InfinityLoop; +import me.loop.features.gui.InfinityLoopGui; +import me.loop.features.modules.client.clickgui.ClickGui; +import me.loop.features.setting.Bind; +import me.loop.features.setting.Setting; +import me.loop.util.impl.RenderUtil; import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.init.SoundEvents; diff --git a/src/main/java/com/me/infinity/loop/features/gui/components/items/buttons/BooleanButton.java b/src/main/java/me/loop/features/gui/click/items/buttons/BooleanButton.java similarity index 80% rename from src/main/java/com/me/infinity/loop/features/gui/components/items/buttons/BooleanButton.java rename to src/main/java/me/loop/features/gui/click/items/buttons/BooleanButton.java index d485f30..9c3529c 100644 --- a/src/main/java/com/me/infinity/loop/features/gui/components/items/buttons/BooleanButton.java +++ b/src/main/java/me/loop/features/gui/click/items/buttons/BooleanButton.java @@ -1,10 +1,10 @@ -package com.me.infinity.loop.features.gui.components.items.buttons; +package me.loop.features.gui.click.items.buttons; -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.features.gui.InfinityLoopGui; -import com.me.infinity.loop.features.modules.client.ClickGui.ClickGui; -import com.me.infinity.loop.features.setting.Setting; -import com.me.infinity.loop.util.utils.renders.RenderUtil; +import me.loop.InfinityLoop; +import me.loop.features.gui.InfinityLoopGui; +import me.loop.features.modules.client.clickgui.ClickGui; +import me.loop.features.setting.Setting; +import me.loop.util.impl.RenderUtil; import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.init.SoundEvents; @@ -22,7 +22,6 @@ public BooleanButton(Setting setting) { public void drawScreen(int mouseX, int mouseY, float partialTicks) { RenderUtil.drawRect(this.x, this.y, this.x + (float) this.width + 7.4f, this.y + (float) this.height - 0.5f, this.getState() ? (!this.isHovering(mouseX, mouseY) ? InfinityLoop.colorManager.getColorWithAlpha(InfinityLoop.moduleManager.getModuleByClass(ClickGui.class).hoverAlpha.getValue()) : InfinityLoop.colorManager.getColorWithAlpha(InfinityLoop.moduleManager.getModuleByClass(ClickGui.class).alpha.getValue())) : (!this.isHovering(mouseX, mouseY) ? 0x11555555 : -2007673515)); InfinityLoop.textManager.drawStringWithShadow(this.getName(), this.x + 2.3f, this.y - 1.7f - (float) InfinityLoopGui.getClickGui().getTextOffset(), this.getState() ? -1 : -5592406); - } @Override @@ -45,7 +44,7 @@ public int getHeight() { @Override public void toggle() { - this.setting.setValue(!((Boolean) this.setting.getValue())); + this.setting.setValue((Boolean) this.setting.getValue() == false); } @Override diff --git a/src/main/java/com/me/infinity/loop/features/gui/components/items/buttons/Button.java b/src/main/java/me/loop/features/gui/click/items/buttons/Button.java similarity index 76% rename from src/main/java/com/me/infinity/loop/features/gui/components/items/buttons/Button.java rename to src/main/java/me/loop/features/gui/click/items/buttons/Button.java index 8043460..38b044c 100644 --- a/src/main/java/com/me/infinity/loop/features/gui/components/items/buttons/Button.java +++ b/src/main/java/me/loop/features/gui/click/items/buttons/Button.java @@ -1,12 +1,12 @@ -package com.me.infinity.loop.features.gui.components.items.buttons; +package me.loop.features.gui.click.items.buttons; -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.features.modules.client.ClickGui.ClickGui; -import com.me.infinity.loop.features.gui.InfinityLoopGui; -import com.me.infinity.loop.features.gui.components.Component; -import com.me.infinity.loop.features.gui.components.items.Item; -import com.me.infinity.loop.util.utils.renders.Drawable; -import com.me.infinity.loop.util.utils.renders.RenderUtil; +import me.loop.InfinityLoop; +import me.loop.features.gui.InfinityLoopGui; +import me.loop.features.gui.click.Component; +import me.loop.features.gui.click.items.Item; +import me.loop.features.modules.client.clickgui.ClickGui; +import me.loop.util.impl.RenderUtil; +import me.loop.util.init.Drawable; import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.init.SoundEvents; @@ -23,7 +23,7 @@ public Button(String name) { @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { - RenderUtil.drawRect(this.x, this.y, this.x + (float) this.width, this.y + (float) this.height - 1.5f, this.getState() ? (!this.isHovering(mouseX, mouseY) ? InfinityLoop.colorManager.getColorWithAlpha(InfinityLoop.moduleManager.getModuleByClass(ClickGui.class).hoverAlpha.getValue()) : InfinityLoop.colorManager.getColorWithAlpha(InfinityLoop.moduleManager.getModuleByClass(ClickGui.class).alpha.getValue())) : (!this.isHovering(mouseX, mouseY) ? new Color(0x273B3B3B, true).getRGB() : new Color(0x4D3B3B3B, true).getRGB())); + RenderUtil.drawRect(this.x, this.y, this.x + (float) this.width, this.y + (float) this.height - 0.5f, this.getState() ? (!this.isHovering(mouseX, mouseY) ? InfinityLoop.colorManager.getColorWithAlpha(InfinityLoop.moduleManager.getModuleByClass(ClickGui.class).hoverAlpha.getValue()) : InfinityLoop.colorManager.getColorWithAlpha(InfinityLoop.moduleManager.getModuleByClass(ClickGui.class).alpha.getValue())) : (!this.isHovering(mouseX, mouseY) ? 0x11555555 : -2007673515)); InfinityLoop.textManager.drawStringWithShadow(this.getName(), this.x + 2.3f, this.y - 2.0f - (float) InfinityLoopGui.getClickGui().getTextOffset(), this.getState() ? -1 : -5592406); Drawable.drawBlurredShadow((int) x, (int) (y + height), (int) width, 1, 9, new Color(0, 0, 0, 192)); } diff --git a/src/main/java/com/me/infinity/loop/features/gui/components/items/buttons/ColorButton.java b/src/main/java/me/loop/features/gui/click/items/buttons/ColorButton.java similarity index 52% rename from src/main/java/com/me/infinity/loop/features/gui/components/items/buttons/ColorButton.java rename to src/main/java/me/loop/features/gui/click/items/buttons/ColorButton.java index c435310..fe70f66 100644 --- a/src/main/java/com/me/infinity/loop/features/gui/components/items/buttons/ColorButton.java +++ b/src/main/java/me/loop/features/gui/click/items/buttons/ColorButton.java @@ -1,15 +1,14 @@ -package com.me.infinity.loop.features.gui.components.items.buttons; - -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.features.command.Command; -import com.me.infinity.loop.features.gui.InfinityLoopGui; -import com.me.infinity.loop.features.modules.client.ClickGui.ClickGui; -import com.me.infinity.loop.features.setting.Setting; -import com.me.infinity.loop.util.utils.renders.ColorUtil; -import com.me.infinity.loop.util.utils.renders.RenderUtil; -import com.mojang.realmsclient.gui.ChatFormatting; +package me.loop.features.gui.click.items.buttons; + + +import me.loop.InfinityLoop; +import me.loop.features.command.Command; +import me.loop.features.gui.InfinityLoopGui; +import me.loop.features.modules.client.clickgui.ClickGui; +import me.loop.features.setting.Setting; +import me.loop.util.impl.ColorUtil; +import me.loop.util.impl.RenderUtil; import net.minecraft.client.audio.PositionedSoundRecord; -import net.minecraft.client.gui.Gui; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; @@ -32,19 +31,12 @@ public class ColorButton extends Button { Setting setting; private Color finalColor; - boolean pickingColor = false; - boolean pickingHue = false; - boolean pickingAlpha = false; - public static Tessellator tessellator; - public static BufferBuilder builder; - - private int oldMouseX = -1; - private int oldMouseY = -1; - - static { - tessellator = Tessellator.getInstance(); - builder = tessellator.getBuffer(); - } + boolean pickingColor; + boolean pickingHue; + boolean pickingAlpha; + + public static Tessellator tessellator = Tessellator.getInstance(); + public static BufferBuilder builder = tessellator.getBuffer(); public ColorButton(Setting setting) { super(setting.getName()); @@ -56,22 +48,21 @@ public ColorButton(Setting setting) { public void drawScreen(int mouseX, int mouseY, float partialTicks) { if (ClickGui.getInstance().sideSettings.getValue().booleanValue()) { int sideColor = ColorUtil.toRGBA(ClickGui.getInstance().sideLineC.getValue().getRed(), ClickGui.getInstance().sideLineC.getValue().getGreen(), ClickGui.getInstance().sideLineC.getValue().getBlue(), ClickGui.getInstance().sideLineC.getValue().getAlpha()); - RenderUtil.drawRect(this.x, this.y, this.x + 0.7f, this.y + (float) this.height + 1.0f, sideColor); + RenderUtil.drawRect(x, y, x + (float) width + 7.4f, y + (float) height - 0.5f, sideColor); } try { - RenderUtil.drawRect(x + width - 5, y + 2, x + width + 7, y + height - 2, finalColor.getRGB()); - } catch (Exception ex) { - ex.printStackTrace(); + RenderUtil.drawRect(x - 1.5f + (float) width + 0.6f - 0.5f, y + 5.0f, x + (float) width + 7.0f - 2.5f, y + (float) height - 4.0f, finalColor.getRGB()); + } + catch (Exception e) { + e.printStackTrace(); } - RenderUtil.drawRect(x, y, x + (float) width + 7.4f, y + (float) height - 0.5f, !isHovering(mouseX, mouseY) ? 0x11555555 : -2007673515); - RenderUtil.drawOutlineRect(x + width - 5, y + 2, x + width + 7, y + height - 2, new Color(0xFFFFFF), 0.4f); + InfinityLoop.textManager.drawStringWithShadow(getName(), x + 2.3f, y - 1.7f - (float) InfinityLoopGui.getClickGui().getTextOffset(), -1); if (setting.isOpen) { - drawPicker(setting, (int) x + 4, (int) y + 15, (int) x + 4, (int) y + 103, (int) x + 4, (int) y + 95, mouseX, mouseY); - InfinityLoop.textManager.drawStringWithShadow(isInsideCopy(mouseX, mouseY) ? ChatFormatting.UNDERLINE + "Copy" : "Copy", x + 25f, y + 113, -1); - InfinityLoop.textManager.drawStringWithShadow(isInsidePaste(mouseX, mouseY) ? ChatFormatting.UNDERLINE + "Paste" : "Paste", x + 60f, y + 113, -1); + drawPicker(setting, (int) x, (int) y + 15, (int) x, setting.hideAlpha ? (int) y + 100 : (int) y + 103, (int) x, (int) y + 95, mouseX, mouseY); + InfinityLoop.textManager.drawStringWithShadow("copy", x + 2.3f, y + 113.0f, isInsideCopy(mouseX, mouseY) ? -1 : -5592406); + InfinityLoop.textManager.drawStringWithShadow("paste", x + (float) width - 2.3f - InfinityLoop.textManager.getStringWidth("paste") + 11.7f - 4.6f, y + 113.0f, isInsidePaste(mouseX, mouseY) ? -1 : -5592406); setting.setValue(finalColor); - } } @@ -83,33 +74,46 @@ public void update() { @Override public void mouseClicked(int mouseX, int mouseY, int mouseButton) { - super.mouseClicked(mouseX, mouseY, mouseButton); if (mouseButton == 1 && isHovering(mouseX, mouseY)) { mc.getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0f)); - setting.isOpen = !setting.isOpen; + boolean bl = setting.isOpen = !setting.isOpen; + } + if (mouseButton == 0 && isHovering(mouseX, mouseY)) { + mc.getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0f)); + setting.booleanValue = !setting.booleanValue; } if (mouseButton == 0 && isInsideCopy(mouseX, mouseY) && setting.isOpen) { mc.getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0f)); - String hex = String.format("#%06x", ((Color) setting.getValue()).getRGB() & 0xFFFFFF); + String hex = String.format("#%02x%02x%02x%02x", finalColor.getAlpha(), finalColor.getRed(), finalColor.getGreen(), finalColor.getBlue()); StringSelection selection = new StringSelection(hex); Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents(selection, selection); - Command.sendMessage("Color" + setting.getValue() + "has been successfully copied to clipboard!"); + Command.sendMessage("Copied the color to your clipboard."); } if (mouseButton == 0 && isInsidePaste(mouseX, mouseY) && setting.isOpen) { try { if (readClipboard() != null) { - if (Objects.requireNonNull(readClipboard()).startsWith("#")) { // hex color - setting.setValue(Color.decode(Objects.requireNonNull(readClipboard()))); + if (Objects.requireNonNull(readClipboard()).startsWith("#")) { + String hex = Objects.requireNonNull(readClipboard()); + + int a = Integer.valueOf(hex.substring(1, 3), 16); + int r = Integer.valueOf(hex.substring(3, 5), 16); + int g = Integer.valueOf(hex.substring(5, 7), 16); + int b = Integer.valueOf(hex.substring(7, 9), 16); + + if (setting.hideAlpha) { + setting.setValue(new Color(r, g, b)); + } else { + setting.setValue(new Color(r, g, b, a)); + } } else { - String[] color = readClipboard().split(","); // r, g, b + String[] color = readClipboard().split(","); setting.setValue(new Color(Integer.parseInt(color[0]), Integer.parseInt(color[1]), Integer.parseInt(color[2]))); } } - } catch (NumberFormatException ex) { - Command.sendMessage("Not a color format! Available color formats:"); - Command.sendMessage("RGB: (Red), (Green), (Blue)"); - Command.sendMessage("HEX: #FFFFFF - must start with a hashtag '#'"); + } + catch (NumberFormatException e) { + Command.sendMessage("Bad color format! Use Hex (#FFFFFFFF)"); } } } @@ -120,105 +124,86 @@ public void mouseReleased(int mouseX, int mouseY, int releaseButton) { } public boolean isInsideCopy(int mouseX, int mouseY) { - return mouseOver((int) x + 25, (int) y + 113, (int) (x + 25) + InfinityLoop.textManager.getStringWidth("Copy"), (int) (y + 112) + InfinityLoop.textManager.getFontHeight(), mouseX, mouseY); + return mouseOver((int) ((int) x + 2.3f), (int) y + 113, (int) ((int) x + 2.3f) + InfinityLoop.textManager.getStringWidth("copy"), (int)(y + 112.0f) + InfinityLoop.textManager.getFontHeight(), mouseX, mouseY); } public boolean isInsidePaste(int mouseX, int mouseY) { - return mouseOver((int) x + 60, (int) y + 113, (int) (x + 60) + InfinityLoop.textManager.getStringWidth("Paste"), (int) (y + 112) + InfinityLoop.textManager.getFontHeight(), mouseX, mouseY); + return mouseOver((int) (x + (float) width - 2.3f - InfinityLoop.textManager.getStringWidth("paste") + 11.7f - 4.6f), (int) y + 113, (int) (x + (float) width - 2.3f - InfinityLoop.textManager.getStringWidth("paste") + 11.7f - 4.6f) + InfinityLoop.textManager.getStringWidth("paste"), (int)(y + 112.0f) + InfinityLoop.textManager.getFontHeight(), mouseX, mouseY); } public void drawPicker(Setting setting, int pickerX, int pickerY, int hueSliderX, int hueSliderY, int alphaSliderX, int alphaSliderY, int mouseX, int mouseY) { - float[] color = new float[]{ - 0, 0, 0, 0 - }; - + float restrictedX; + float[] color = new float[]{0.0f, 0.0f, 0.0f, 0.0f}; try { - color = new float[]{ - Color.RGBtoHSB(((Color) setting.getValue()).getRed(), ((Color) setting.getValue()).getGreen(), ((Color) setting.getValue()).getBlue(), null)[0], Color.RGBtoHSB(((Color) setting.getValue()).getRed(), ((Color) setting.getValue()).getGreen(), ((Color) setting.getValue()).getBlue(), null)[1], Color.RGBtoHSB(((Color) setting.getValue()).getRed(), ((Color) setting.getValue()).getGreen(), ((Color) setting.getValue()).getBlue(), null)[2], ((Color) setting.getValue()).getAlpha() / 255f - }; - } catch (Exception ex) { - ex.printStackTrace(); + color = new float[]{Color.RGBtoHSB(((Color)setting.getValue()).getRed(), ((Color)setting.getValue()).getGreen(), ((Color)setting.getValue()).getBlue(), null)[0], Color.RGBtoHSB(((Color)setting.getValue()).getRed(), ((Color)setting.getValue()).getGreen(), ((Color)setting.getValue()).getBlue(), null)[1], Color.RGBtoHSB(((Color)setting.getValue()).getRed(), ((Color)setting.getValue()).getGreen(), ((Color)setting.getValue()).getBlue(), null)[2], (float)((Color)setting.getValue()).getAlpha() / 255.0f}; } - - int pickerWidth = 88; + catch (Exception exception) { + InfinityLoop.LOGGER.info("Loop color picker says it's a bad color!"); + } + int pickerWidth = (int) (width + 7.4f); int pickerHeight = 78; - int hueSliderWidth = pickerWidth; + int hueSliderWidth = pickerWidth + 3; int hueSliderHeight = 7; int alphaSliderHeight = 7; - - if (pickingColor) { - if (!(Mouse.isButtonDown(0) && mouseOver(pickerX, pickerY, pickerX + pickerWidth, pickerY + pickerHeight, mouseX, mouseY))) { - pickingColor = false; - } + if (!(!pickingColor || Mouse.isButtonDown(0) && mouseOver(pickerX, pickerY, pickerX + pickerWidth, pickerY + pickerHeight, mouseX, mouseY))) { + pickingColor = false; } - - if (pickingHue) { - if (!(Mouse.isButtonDown(0) && mouseOver(hueSliderX, hueSliderY, hueSliderX + hueSliderWidth, hueSliderY + hueSliderHeight, mouseX, mouseY))) { - pickingHue = false; - } + if (!(!pickingHue || Mouse.isButtonDown(0) && mouseOver(hueSliderX, hueSliderY, hueSliderX + hueSliderWidth, hueSliderY + hueSliderHeight, mouseX, mouseY))) { + pickingHue = false; } - - if (pickingAlpha) { - if (!(Mouse.isButtonDown(0) && mouseOver(alphaSliderX, alphaSliderY, alphaSliderX + pickerWidth, alphaSliderY + alphaSliderHeight, mouseX, mouseY))) - pickingAlpha = false; + if (!(!pickingAlpha || Mouse.isButtonDown(0) && mouseOver(alphaSliderX, alphaSliderY, alphaSliderX + pickerWidth, alphaSliderY + alphaSliderHeight, mouseX, mouseY))) { + pickingAlpha = false; } - - if (Mouse.isButtonDown(0) && mouseOver(pickerX, pickerY, pickerX + pickerWidth, pickerY + pickerHeight, mouseX, mouseY)) + if (Mouse.isButtonDown(0) && mouseOver(pickerX, pickerY, pickerX + pickerWidth, pickerY + pickerHeight, mouseX, mouseY)) { pickingColor = true; - if (Mouse.isButtonDown(0) && mouseOver(hueSliderX, hueSliderY, hueSliderX + hueSliderWidth, hueSliderY + hueSliderHeight, mouseX, mouseY)) + } + if (Mouse.isButtonDown(0) && mouseOver(hueSliderX, hueSliderY, hueSliderX + hueSliderWidth, hueSliderY + hueSliderHeight, mouseX, mouseY)) { pickingHue = true; - if (Mouse.isButtonDown(0) && mouseOver(alphaSliderX, alphaSliderY, alphaSliderX + pickerWidth, alphaSliderY + alphaSliderHeight, mouseX, mouseY)) + } + if (Mouse.isButtonDown(0) && mouseOver(alphaSliderX, alphaSliderY, alphaSliderX + pickerWidth, alphaSliderY + alphaSliderHeight, mouseX, mouseY)) { pickingAlpha = true; - + } if (pickingHue) { - float restrictedX = (float) Math.min(Math.max(hueSliderX, mouseX), hueSliderX + hueSliderWidth); - color[0] = (restrictedX - (float) hueSliderX) / hueSliderWidth; + restrictedX = Math.min(Math.max(hueSliderX, mouseX), hueSliderX + hueSliderWidth); + color[0] = (restrictedX - (float)hueSliderX) / (float)hueSliderWidth; } - - if (pickingAlpha) { - float restrictedX = (float) Math.min(Math.max(alphaSliderX, mouseX), alphaSliderX + pickerWidth); - color[3] = 1 - (restrictedX - (float) alphaSliderX) / pickerWidth; + if (pickingAlpha && !setting.hideAlpha) { + restrictedX = Math.min(Math.max(alphaSliderX, mouseX), alphaSliderX + pickerWidth); + color[3] = 1.0f - (restrictedX - (float)alphaSliderX) / (float)pickerWidth; } - if (pickingColor) { - float restrictedX = (float) Math.min(Math.max(pickerX, mouseX), pickerX + pickerWidth); - float restrictedY = (float) Math.min(Math.max(pickerY, mouseY), pickerY + pickerHeight); - color[1] = (restrictedX - (float) pickerX) / pickerWidth; - color[2] = 1 - (restrictedY - (float) pickerY) / pickerHeight; + restrictedX = Math.min(Math.max(pickerX, mouseX), pickerX + pickerWidth); + float restrictedY = Math.min(Math.max(pickerY, mouseY), pickerY + pickerHeight); + color[1] = (restrictedX - (float)pickerX) / (float)pickerWidth; + color[2] = 1.0f - (restrictedY - (float)pickerY) / (float)pickerHeight; } - int selectedColor = Color.HSBtoRGB(color[0], 1.0f, 1.0f); - - float selectedRed = (selectedColor >> 16 & 0xFF) / 255.0f; - float selectedGreen = (selectedColor >> 8 & 0xFF) / 255.0f; - float selectedBlue = (selectedColor & 0xFF) / 255.0f; + float selectedRed = (float)(selectedColor >> 16 & 0xFF) / 255.0f; + float selectedGreen = (float)(selectedColor >> 8 & 0xFF) / 255.0f; + float selectedBlue = (float)(selectedColor & 0xFF) / 255.0f; drawPickerBase(pickerX, pickerY, pickerWidth, pickerHeight, selectedRed, selectedGreen, selectedBlue, color[3]); + drawHueSlider(hueSliderX, hueSliderY, pickerWidth + 1, hueSliderHeight, color[0]); - drawHueSlider(hueSliderX, hueSliderY, hueSliderWidth - 5, hueSliderHeight, color[0]); + int cursorX = (int)((float)pickerX + color[1] * (float)pickerWidth); + int cursorY = (int)((float)(pickerY + pickerHeight) - color[2] * (float)pickerHeight); - int cursorX = (int) (pickerX + color[1] * pickerWidth); - int cursorY = (int) ((pickerY + pickerHeight) - color[2] * pickerHeight); - - RenderUtil.drawOutlineRect(cursorX - 2, cursorY - 2, cursorX - 2, cursorY - 2, new Color(0xFFFFFF), 0.4f); //cursorX - 2, cursorY - 2, cursorX + 2, cursorY + 2 - Gui.drawRect(cursorX - 2, cursorY - 2, cursorX - 2, cursorY - 2, -1); //cursorX - 2, cursorY - 2, cursorX + 2, cursorY + 2 - - drawAlphaSlider(alphaSliderX, alphaSliderY, pickerWidth - 5, alphaSliderHeight, selectedRed, selectedGreen, selectedBlue, color[3]); - - if ((Mouse.isButtonDown(0) && mouseOver(pickerX, pickerY, pickerX + pickerWidth, pickerY + pickerHeight, mouseX, mouseY)) || oldMouseX < 0 || oldMouseY < 0) { - oldMouseX = mouseX; - oldMouseY = mouseY; + //drawOutlineRect(cursorX - 2.2, cursorY - 2.2, cursorX + 2.2, cursorY + 2.2, Color.black, 0.1f); + //Gui.drawRect((int) (cursorX - 2), (int) (cursorY - 2), (int) (cursorX + 2), (int) (cursorY + 2), (int) -1); + if (pickingColor) { + RenderUtil.drawCircle((cursorX), (cursorY), 6.4f, Color.BLACK.getRGB()); + RenderUtil.drawCircle((cursorX), (cursorY), 6, ColorUtil.toARGB(finalColor.getRed(), finalColor.getGreen(), finalColor.getBlue(), 255)); + } else { + RenderUtil.drawCircle((cursorX), (cursorY), 3.4f, Color.BLACK.getRGB()); + RenderUtil.drawCircle((cursorX), (cursorY), 3, -1); } - drawIndicator(); - + if (!setting.hideAlpha) { + drawAlphaSlider(alphaSliderX, alphaSliderY, pickerWidth - 1, alphaSliderHeight, selectedRed, selectedGreen, selectedBlue, color[3]); + } finalColor = getColor(new Color(Color.HSBtoRGB(color[0], color[1], color[2])), color[3]); } - void drawIndicator() { - Gui.drawRect(oldMouseX - 2, oldMouseY + 2, oldMouseX + 2, oldMouseY - 2, Color.WHITE.getRGB()); - } - boolean mouseOver(int minX, int minY, int maxX, int maxY, int mX, int mY) { return mX >= minX && mY >= minY && mX <= maxX && mY <= maxY; } @@ -259,58 +244,108 @@ void drawPickerBase(int pickerX, int pickerY, int pickerWidth, int pickerHeight, glDisable(GL_BLEND); } - void drawHueSlider(int x, int y, int width, int height, float hue) { + private float hueX; + private float prevHueX; + + public void drawHueSlider(int x, int y, int width, int height, float hue) { int step = 0; if (height > width) { - RenderUtil.drawRect(x, y, x + width, y + 4, 0xFFFF0000); + RenderUtil.drawRect(x, y, x + width, y + 4, -65536); y += 4; - for (int colorIndex = 0; colorIndex < 6; colorIndex++) { - int previousStep = Color.HSBtoRGB((float) step / 6, 1.0f, 1.0f); - int nextStep = Color.HSBtoRGB((float) (step + 1) / 6, 1.0f, 1.0f); - drawGradientRect(x, y + step * (height / 6f), x + width, y + (step + 1) * (height / 6f), previousStep, nextStep, false); - step++; + for (int colorIndex = 0; colorIndex < 6; ++colorIndex) { + int previousStep = Color.HSBtoRGB((float)step / 6.0f, 1.0f, 1.0f); + int nextStep = Color.HSBtoRGB((float)(step + 1) / 6.0f, 1.0f, 1.0f); + drawGradientRect(x, (float)y + (float)step * ((float)height / 6.0f), x + width, (float)y + (float)(step + 1) * ((float)height / 6.0f), previousStep, nextStep, false); + ++step; } - int sliderMinY = (int) (y + height * hue) - 4; + int sliderMinY = (int)((float)y + (float)height * hue) - 4; RenderUtil.drawRect(x, sliderMinY - 1, x + width, sliderMinY + 1, -1); - RenderUtil.drawOutlineRect(x, sliderMinY - 1, x + width, sliderMinY + 1, new Color(0xFFFFFF), 0.4f); + drawOutlineRect(x, sliderMinY - 1, x + width, sliderMinY + 1, Color.BLACK, 1.0f); } else { - for (int colorIndex = 0; colorIndex < 6; colorIndex++) { - int previousStep = Color.HSBtoRGB((float) step / 6, 1.0f, 1.0f); - int nextStep = Color.HSBtoRGB((float) (step + 1) / 6, 1.0f, 1.0f); - gradient(x + step * (width / 6), y, x + (step + 1) * (width / 6), y + height, previousStep, nextStep, true); - step++; + for (int colorIndex = 0; colorIndex < 6; ++colorIndex) { + int previousStep = Color.HSBtoRGB((float)step / 6.0f, 1.0f, 1.0f); + int nextStep = Color.HSBtoRGB((float)(step + 1) / 6.0f, 1.0f, 1.0f); + gradient(x + step * (width / 6), y, x + (step + 1) * (width / 6) + 3, y + height, previousStep, nextStep, true); + ++step; } - int sliderMinX = (int) (x + (width * hue)); - RenderUtil.drawRect(sliderMinX - 1, y, sliderMinX + 1, y + height, -1); - RenderUtil.drawOutlineRect(sliderMinX - 1, y, sliderMinX + 1, y + height, new Color(0xFFFFFF), 0.4f); + + /*int sliderMinX = (int) ((float)width * hue); + setHueX(sliderMinX); + int sliderPosX = (int) getHueX() + x; + RenderUtil.drawRect(sliderPosX - 1, y - 1.2f, sliderPosX + 1, y + height + 1.2f, -1); + drawOutlineRect(sliderPosX - 1.2, y - 1.2, sliderPosX + 1.2, y + height + 1.2, Color.BLACK, 0.1f); + */ + int sliderMinX = (int)((float)x + (float)width * hue); + + RenderUtil.drawRect(sliderMinX - 1, y - 1.2f, sliderMinX + 1, y + height + 1.2f, -1); + drawOutlineRect(sliderMinX - 1.2, y - 1.2, sliderMinX + 1.2, y + height + 1.2, Color.BLACK, 0.1f); + } } - void drawAlphaSlider(int x, int y, int width, int height, float red, float green, float blue, float alpha) { + public void setHueX(float x) { + if (hueX == x) return; + prevHueX = hueX; + hueX = x; + } + + public float getHueX() { + if (InfinityLoop.fpsManager.getFPS() < 20) { + return hueX; + } + hueX = prevHueX + (hueX - prevHueX) * mc.getRenderPartialTicks() / (8 * (Math.min(240, InfinityLoop.fpsManager.getFPS()) / 240f)); + return hueX; + } + + private float alphaX; + private float prevAlphaX; + + public void drawAlphaSlider(int x, int y, int width, int height, float red, float green, float blue, float alpha) { boolean left = true; int checkerBoardSquareSize = height / 2; for (int squareIndex = -checkerBoardSquareSize; squareIndex < width; squareIndex += checkerBoardSquareSize) { if (!left) { - RenderUtil.drawRect(x + squareIndex, y, x + squareIndex + checkerBoardSquareSize, y + height, 0xFFFFFFFF); - RenderUtil.drawRect(x + squareIndex, y + checkerBoardSquareSize, x + squareIndex + checkerBoardSquareSize, y + height, 0xFF909090); - + RenderUtil.drawRect(x + squareIndex, y, x + squareIndex + checkerBoardSquareSize, y + height, -1); + RenderUtil.drawRect(x + squareIndex, y + checkerBoardSquareSize, x + squareIndex + checkerBoardSquareSize, y + height, -7303024); if (squareIndex < width - checkerBoardSquareSize) { int minX = x + squareIndex + checkerBoardSquareSize; int maxX = Math.min(x + width, x + squareIndex + checkerBoardSquareSize * 2); - RenderUtil.drawRect(minX, y, maxX, y + height, 0xFF909090); - RenderUtil.drawRect(minX, y + checkerBoardSquareSize, maxX, y + height, 0xFFFFFFFF); + RenderUtil.drawRect(minX, y, maxX, y + height, -7303024); + RenderUtil.drawRect(minX, y + checkerBoardSquareSize, maxX, y + height, -1); } } left = !left; } - drawLeftGradientRect(x, y, x + width, y + height, new Color(red, green, blue, 1).getRGB(), 0); - int sliderMinX = (int) (x + width - (width * alpha)); - RenderUtil.drawRect(sliderMinX - 1, y, sliderMinX + 1, y + height, -1); - RenderUtil.drawOutlineRect(sliderMinX - 1, y, sliderMinX + 1, y + height, new Color(0xFFFFFF), 0.4f); + drawLeftGradientRect(x, y, x + width, y + height, new Color(red, green, blue, 1.0f).getRGB(), 0); + /*int sliderMinX = (int) ((float)width * alpha); + //RenderUtil.drawRect(sliderMinX - 1, y, sliderMinX + 1, y + height, -1); + //drawOutlineRect(sliderMinX - 1, y, sliderMinX + 1, y + height, Color.BLACK, 1.0f); + setAlphaX(sliderMinX); + int sliderPosX = (int) getAlphaX() + x; + RenderUtil.drawRect(sliderPosX - 1, y - 1.2f, sliderPosX + 1, y + height + 1.2f, -1); + drawOutlineRect(sliderPosX - 1.2, y - 1.2, sliderPosX + 1.2, y + height + 1.2, Color.BLACK, 0.1f); + */ + int sliderMinX = (int)((float)(x + width) - (float)width * alpha); + RenderUtil.drawRect(sliderMinX - 1, y - 1.2f, sliderMinX + 1, y + height + 1.2f, -1); + drawOutlineRect(sliderMinX - 1.2, y - 1.2, sliderMinX + 1.2, y + height + 1.2, Color.BLACK, 0.1f); + } + public void setAlphaX(float x) { + if (alphaX == x) return; + prevAlphaX = alphaX; + alphaX = x; + } + + public float getAlphaX() { + if (InfinityLoop.fpsManager.getFPS() < 20) { + return alphaX; + } + alphaX = prevAlphaX + (alphaX - prevAlphaX) * mc.getRenderPartialTicks() / (8 * (Math.min(240, InfinityLoop.fpsManager.getFPS()) / 240f)); + return alphaX; + } - void drawGradientRect(double leftpos, double top, double right, double bottom, int col1, int col2) { + void drawGradientRect(double leftpos, double top,double right, double bottom, int col1, int col2) { float f = (col1 >> 24 & 0xFF) / 255.0f; float f2 = (col1 >> 16 & 0xFF) / 255.0f; float f3 = (col1 >> 8 & 0xFF) / 255.0f; @@ -372,8 +407,7 @@ void gradient(int minX, int minY, int maxX, int maxY, int startColor, int endCol GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glShadeModel(GL_SMOOTH); - GL11.glBegin(GL11.GL_POLYGON); - { + GL11.glBegin(GL11.GL_POLYGON);{ GL11.glColor4f(startR, startG, startB, startA); GL11.glVertex2f(minX, minY); GL11.glVertex2f(minX, maxY); @@ -438,6 +472,40 @@ public static String readClipboard() { } + public static void drawOutlineRect(double left, double top, double right, double bottom, Color color, float lineWidth) { + if (left < right) { + double i = left; + left = right; + right = i; + } + if (top < bottom) { + double j = top; + top = bottom; + bottom = j; + } + float f3 = (float)(color.getRGB() >> 24 & 0xFF) / 255.0f; + float f = (float)(color.getRGB() >> 16 & 0xFF) / 255.0f; + float f1 = (float)(color.getRGB() >> 8 & 0xFF) / 255.0f; + float f2 = (float)(color.getRGB() & 0xFF) / 255.0f; + Tessellator tessellator = Tessellator.getInstance(); + BufferBuilder bufferbuilder = tessellator.getBuffer(); + GlStateManager.enableBlend(); + GL11.glPolygonMode(1032, 6913); + GL11.glLineWidth(lineWidth); + GlStateManager.disableTexture2D(); + GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + GlStateManager.color(f, f1, f2, f3); + bufferbuilder.begin(7, DefaultVertexFormats.POSITION); + bufferbuilder.pos(left, bottom, 0.0).endVertex(); + bufferbuilder.pos(right, bottom, 0.0).endVertex(); + bufferbuilder.pos(right, top, 0.0).endVertex(); + bufferbuilder.pos(left, top, 0.0).endVertex(); + tessellator.draw(); + GlStateManager.enableTexture2D(); + GlStateManager.disableBlend(); + GL11.glPolygonMode(1032, 6914); + } + @Override public int getHeight() { return setting.isOpen ? 124 : 14; diff --git a/src/main/java/me/loop/features/gui/click/items/buttons/Description.java b/src/main/java/me/loop/features/gui/click/items/buttons/Description.java new file mode 100644 index 0000000..bc6ca61 --- /dev/null +++ b/src/main/java/me/loop/features/gui/click/items/buttons/Description.java @@ -0,0 +1,43 @@ +package me.loop.features.gui.click.items.buttons; + +import me.loop.InfinityLoop; +import me.loop.features.gui.click.items.Item; +import me.loop.util.impl.RenderUtil; + +public class Description extends Item { + private String description; + private boolean draw; + + public Description(String description, float x, float y) { + super("Description"); + this.description = description; + this.setLocation(x, y); + this.width = InfinityLoop.textManager.getStringWidth(this.description) + 4; + this.height = InfinityLoop.textManager.getFontHeight() + 4; + this.draw = false; + } + + @Override + public void drawScreen(int mouseX, int mouseY, float partialTicks) { + this.width = InfinityLoop.textManager.getStringWidth(this.description) + 4; + this.height = InfinityLoop.textManager.getFontHeight() + 4; + RenderUtil.drawRect(this.x, this.y, this.x + (float)this.width, this.y + (float)this.height, -704643072); + InfinityLoop.textManager.drawString(this.description, this.x + 2.0f, this.y + 2.0f, 0xFFFFFF, true); + } + + public boolean shouldDraw() { + return this.draw; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public void setDraw(boolean draw) { + this.draw = draw; + } +} diff --git a/src/main/java/me/loop/features/gui/click/items/buttons/EnumButton.java b/src/main/java/me/loop/features/gui/click/items/buttons/EnumButton.java new file mode 100644 index 0000000..778659a --- /dev/null +++ b/src/main/java/me/loop/features/gui/click/items/buttons/EnumButton.java @@ -0,0 +1,69 @@ +package me.loop.features.gui.click.items.buttons; + +import me.loop.InfinityLoop; +import me.loop.features.gui.InfinityLoopGui; +import me.loop.features.modules.client.clickgui.ClickGui; +import me.loop.features.modules.client.Colors; +import me.loop.features.modules.client.HUD; +import me.loop.features.setting.Setting; +import me.loop.util.impl.ColorUtil; +import me.loop.util.impl.MathUtil; +import me.loop.util.impl.RenderUtil; +import net.minecraft.client.audio.PositionedSoundRecord; +import net.minecraft.init.SoundEvents; + +public class EnumButton + extends Button { + public Setting setting; + + public EnumButton(Setting setting) { + super(setting.getName()); + this.setting = setting; + this.width = 40; + } + + @Override + public void drawScreen(int mouseX, int mouseY, float partialTicks) { + if (ClickGui.getInstance().sideSettings.getValue().booleanValue()) { + int sideColor = ColorUtil.toRGBA(ClickGui.getInstance().sideLineC.getValue().getRed(), ClickGui.getInstance().sideLineC.getValue().getGreen(), ClickGui.getInstance().sideLineC.getValue().getBlue(), ClickGui.getInstance().sideLineC.getValue().getAlpha()); + RenderUtil.drawRect(this.x, this.y, this.x + 1.0f, this.y + (float)this.height + 1.0f, sideColor); + } + if (Colors.getInstance().rainbow.getValue() && ClickGui.getInstance().colorSync.getValue().booleanValue()) { + int color = ColorUtil.changeAlpha(HUD.getInstance().colorMap.get(MathUtil.clamp((int)this.y, 0, this.renderer.scaledHeight)), InfinityLoop.moduleManager.getModuleByClass(ClickGui.class).moduleMainC.getValue().getAlpha()); + int color1 = ColorUtil.changeAlpha(HUD.getInstance().colorMap.get(MathUtil.clamp((int)this.y + this.height, 0, this.renderer.scaledHeight)), InfinityLoop.moduleManager.getModuleByClass(ClickGui.class).moduleMainC.getValue().getAlpha()); + RenderUtil.drawGradientRect(this.x, this.y, (float)this.width + 7.4f, (float)this.height - 0.5f, this.getState() ? (!this.isHovering(mouseX, mouseY) ? HUD.getInstance().colorMap.get(MathUtil.clamp((int)this.y, 0, this.renderer.scaledHeight)) : color) : (!this.isHovering(mouseX, mouseY) ? 0x11555555 : -2007673515), this.getState() ? (!this.isHovering(mouseX, mouseY) ? HUD.getInstance().colorMap.get(MathUtil.clamp((int)this.y + this.height, 0, this.renderer.scaledHeight)) : color1) : (!this.isHovering(mouseX, mouseY) ? 0x11555555 : -2007673515)); + } else { + RenderUtil.drawRect(this.x, this.y, this.x + (float)this.width + 7.4f, this.y + (float)this.height - 0.5f, this.getState() ? (!this.isHovering(mouseX, mouseY) ? InfinityLoop.colorManager.getColorWithAlpha(InfinityLoop.moduleManager.getModuleByClass(ClickGui.class).moduleMainC.getValue().getAlpha()) : InfinityLoop.colorManager.getColorWithAlpha(InfinityLoop.moduleManager.getModuleByClass(ClickGui.class).hoverAlpha.getValue())) : (!this.isHovering(mouseX, mouseY) ? 0x11555555 : -2007673515)); + } + InfinityLoop.textManager.drawStringWithShadow(this.setting.getName() + " \u00a77" + this.setting.currentEnumName(), this.x + 2.3f, this.y - 1.7f - (float) InfinityLoopGui.getInstance().getTextOffset(), this.getState() ? -1 : -5592406); + } + + @Override + public void update() { + this.setHidden(!this.setting.isVisible()); + } + + @Override + public void mouseClicked(int mouseX, int mouseY, int mouseButton) { + super.mouseClicked(mouseX, mouseY, mouseButton); + if (this.isHovering(mouseX, mouseY)) { + mc.getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0f)); + } + } + + @Override + public int getHeight() { + return 14; + } + + @Override + public void toggle() { + this.setting.increaseEnum(); + } + + @Override + public boolean getState() { + return true; + } +} + diff --git a/src/main/java/com/me/infinity/loop/features/gui/components/items/buttons/ModuleButton.java b/src/main/java/me/loop/features/gui/click/items/buttons/ModuleButton.java similarity index 57% rename from src/main/java/com/me/infinity/loop/features/gui/components/items/buttons/ModuleButton.java rename to src/main/java/me/loop/features/gui/click/items/buttons/ModuleButton.java index 6e8938f..f8c5c80 100644 --- a/src/main/java/com/me/infinity/loop/features/gui/components/items/buttons/ModuleButton.java +++ b/src/main/java/me/loop/features/gui/click/items/buttons/ModuleButton.java @@ -1,35 +1,41 @@ -package com.me.infinity.loop.features.gui.components.items.buttons; - -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.features.command.Command; -import com.me.infinity.loop.features.gui.components.items.Item; -import com.me.infinity.loop.features.gui.font.FontRender; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.client.ClickGui.ClickGui; -import com.me.infinity.loop.features.modules.client.ClickGui.ClickguiEnum; -import com.me.infinity.loop.features.modules.client.Colors; -import com.me.infinity.loop.features.setting.Setting; -import com.me.infinity.loop.features.setting.impl.Bind; -import com.me.infinity.loop.util.utils.renders.ColorUtil; -import com.me.infinity.loop.util.utils.renders.RenderUtil; -import com.me.infinity.loop.util.utils.renders.helper.RoundedShader; +package me.loop.features.gui.click.items.buttons; + +import com.mojang.realmsclient.gui.ChatFormatting; +import me.loop.InfinityLoop; +import me.loop.features.gui.InfinityLoopGui; +import me.loop.features.gui.click.items.Item; +import me.loop.features.gui.font.FontRender; +import me.loop.features.modules.Module; +import me.loop.features.modules.client.Colors; +import me.loop.features.modules.client.clickgui.ClickEnum; +import me.loop.features.modules.client.clickgui.ClickGui; +import me.loop.features.setting.Bind; +import me.loop.features.setting.Setting; +import me.loop.util.impl.ColorUtil; +import me.loop.util.impl.ImageUtil; +import me.loop.util.impl.RenderUtil; +import me.loop.util.init.shaders.RoundedShader; import net.minecraft.client.audio.PositionedSoundRecord; +import net.minecraft.client.renderer.GlStateManager; import net.minecraft.init.SoundEvents; +import net.minecraft.util.ResourceLocation; import java.awt.*; import java.util.ArrayList; import java.util.List; - public class ModuleButton extends Button { private final Module module; + public int[] counter1 = new int[]{1}; private List items = new ArrayList(); private boolean subOpen; + private int progress; private int color; public ModuleButton(Module module) { super(module.getName()); + progress = 0; this.module = module; this.initSettings(); } @@ -38,67 +44,56 @@ public void initSettings() { ArrayList newItems = new ArrayList(); if (!this.module.getSettings().isEmpty()) { newItems.add(new BindButton(this.module.getSettingByName("Keybind"))); - this.items = newItems; for (Setting setting : this.module.getSettings()) { if (setting.getValue() instanceof Boolean && !setting.getName().equals("Enabled")) { newItems.add(new BooleanButton(setting)); } - if (setting.getValue() instanceof ColorButton) { - newItems.add(new ColorButton(setting)); - } if (setting.getValue() instanceof Bind && !setting.getName().equalsIgnoreCase("Keybind") && !this.module.getName().equalsIgnoreCase("Hud")) { newItems.add(new BindButton(setting)); } if ((setting.getValue() instanceof String || setting.getValue() instanceof Character) && !setting.getName().equalsIgnoreCase("displayName")) { newItems.add(new StringButton(setting)); } - if (setting.isNumberSetting() && setting.hasRestriction()) { - newItems.add(new Slider(setting)); - continue; + if (setting.getValue() instanceof Color) + newItems.add(new ColorButton(setting)); + + if (setting.isNumberSetting()) { + if (setting.hasRestriction()) { + newItems.add(new SliderButton(setting)); + continue; + } + newItems.add(new UnlimitedSlider(setting)); } if (!setting.isEnumSetting()) continue; newItems.add(new EnumButton(setting)); } } + this.items = newItems; } @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { super.drawScreen(mouseX, mouseY, partialTicks); if (!this.items.isEmpty()) { + + boolean frame = ClickGui.getInstance().description.getValue() == ClickEnum.Mode.Frame; + boolean follow = ClickGui.getInstance().description.getValue() == ClickEnum.Mode.Folow; + Color outline = new Color(0xCD000000, true); - Color fillcolor = new Color(ClickGui.getInstance().red.getValue(), ClickGui.getInstance().green.getValue(), ClickGui.getInstance().blue.getValue(), ClickGui.getInstance().hoverAlpha.getValue()); + Color fillcolor = new Color(ClickGui.getInstance().moduleMainC.getValue().getRed(), ClickGui.getInstance().moduleMainC.getValue().getGreen(), ClickGui.getInstance().moduleMainC.getValue().getBlue(), ClickGui.getInstance().hoverAlpha.getValue()); Color rainbow = new Color(Colors.getInstance().rainbow.getValue().booleanValue() ? (((Colors.getInstance()).rainbowModeA.getValue() == Colors.rainbowModeArray.Up) ? ColorUtil.rainbow((Colors.getInstance()).rainbowHue.getValue().intValue()).getRGB() : ColorUtil.rainbow((Colors.getInstance()).rainbowHue.getValue().intValue(), ClickGui.getInstance().hoverAlpha.getValue()).getRGB()) : this.color); - ClickGui gui = InfinityLoop.moduleManager.getModuleByClass(ClickGui.class); - if (ClickGui.getInstance().butonIcon.getValue() == ClickguiEnum.Icon.OpenColse) { - if (module.getSettings().size() > 4) - if (ClickGui.getInstance().butonIcon.getValue() == ClickguiEnum.Icon.OpenColse) - FontRender.drawCentString6(isEnabled() ? gui.close.getValue() : gui.open.getValue(), (float) x + (float) width - 8f, (float) y + 6, -1); - } else if (ClickGui.getInstance().butonIcon.getValue() == ClickguiEnum.Icon.ShowBind) { - if (!module.getBind().toString().equalsIgnoreCase("none")) - FontRender.drawString5(module.getBind().toString(), (float) x + (float) width - FontRender.getStringWidth5(module.getBind().toString()) - 3f, (float) y + 6, -1); - } + RenderUtil.drawOutlineRect(this.x, this.y, this.x + (float) this.width, this.y + (float) this.height - 1.5f, new Color(0x73212121, true), 0.4f); - if (this.isHovering(mouseX, mouseY)) { - if (ClickGui.getInstance().description.getValue() == ClickguiEnum.Mode.Frame) { - RoundedShader.drawGradientRound(15.0f, 35.0f, 10 + this.renderer.getStringWidth(this.module.getDescription()), (float) (10), 3f, outline, outline, outline, outline); - if (ClickGui.getInstance().colorSync.getValue() && Colors.getInstance().rainbow.getValue()) { - RoundedShader.drawRoundOutline(15.0f, 35.0f, 10 + this.renderer.getStringWidth(this.module.getDescription()), (float) (10), 2.8f, 0.1f, rainbow, rainbow); - } else { - RoundedShader.drawRoundOutline(15.0f, 35.0f, 10 + this.renderer.getStringWidth(this.module.getDescription()), (float) (10), 2.8f, 0.1f, fillcolor, fillcolor); - } - InfinityLoop.textManager.drawStringWithShadow(this.module.getDescription(), 17.0f, 36.0f, -1); - } else if (ClickGui.getInstance().description.getValue() == ClickguiEnum.Mode.Folow) { - RenderUtil.drawRect((float) (mouseX + 10), (float) mouseY, (float) (mouseX + 10 + this.renderer.getStringWidth(this.module.getDescription())), (float) (mouseY + 10), new Color(ClickGui.getInstance().red.getValue(), ClickGui.getInstance().green.getValue(), ClickGui.getInstance().blue.getValue(), (ClickGui.getInstance().hoverAlpha.getValue() / 2)).getRGB()); - RenderUtil.drawBorder((float) (mouseX + 10), (float) mouseY, (float) this.renderer.getStringWidth(this.module.getDescription()), 10.0f, new Color(0xCD000000)); - this.renderer.drawStringWithShadow(this.module.getDescription(), (float) (mouseX + 10), (float) mouseY, -1); - } - } + drawGear(); if (subOpen) { + + ++progress; + float height = 1.0f; for (Item item : items) { + counter1[0] = counter1[0] + 1; if (!item.isHidden()) { if (item instanceof ColorButton) { item.setLocation(x + 1.0f, y + (height + 15.0f)); @@ -108,14 +103,70 @@ public void drawScreen(int mouseX, int mouseY, float partialTicks) { item.setHeight((int) 15.0f); item.setWidth(width - 9); item.drawScreen(mouseX, mouseY, partialTicks); + if (item instanceof ColorButton) + height += item.getHeight(); + if (item instanceof EnumButton && ((EnumButton) item).setting.isOpen) + height += ((EnumButton) item).setting.getValue().getClass().getEnumConstants().length * 15; } item.update(); } } - RenderUtil.drawOutlineRect(this.x, this.y, this.x + (float) this.width, this.y + (float) this.height - 1.5f, new Color(0x73212121, true), 0.4f); + + if (this.isHovering(mouseX, mouseY)) { + + if (frame) { + RoundedShader.drawGradientRound(15.0f, 35.0f, 10 + this.renderer.getStringWidth(this.module.getDescription()), (float) (10), 3f, outline, outline, outline, outline); + if (ClickGui.getInstance().colorSync.getValue() && Colors.getInstance().rainbow.getValue()) { + RoundedShader.drawRoundOutline(15.0f, 35.0f, 10 + this.renderer.getStringWidth(this.module.getDescription()), (float) (10), 2.8f, 0.1f, rainbow, rainbow); + } else { + RoundedShader.drawRoundOutline(15.0f, 35.0f, 10 + this.renderer.getStringWidth(this.module.getDescription()), (float) (10), 2.8f, 0.1f, fillcolor, fillcolor); + } + InfinityLoop.textManager.drawStringWithShadow(this.module.getDescription(), 17.0f, 36.0f, -1); + } + if (follow) { + + Description descriptionDisplay = InfinityLoopGui.getClickGui().getDescription(); + descriptionDisplay.setDescription(this.module.getDescription()); + descriptionDisplay.setLocation(mouseX + 2, mouseY + 1); + descriptionDisplay.setDraw(true); + + } + } + } } + public void drawGear() { + boolean future = ClickGui.getInstance().setting.getValue() == ClickEnum.Style.Future; + boolean chart = ClickGui.getInstance().butonIcon.getValue() == ClickEnum.Style.OpenColse; + boolean bind = ClickGui.getInstance().butonIcon.getValue() == ClickEnum.Style.ShowBind; + + if (future) { + GlStateManager.pushMatrix(); + GlStateManager.enableBlend(); + mc.getTextureManager().bindTexture(new ResourceLocation("textures/gear.png")); + GlStateManager.translate(getX() + getWidth() - 6.7F, getY() + 7.7F - 0.3F, 0.0F); + GlStateManager.rotate(ImageUtil.calculateRotation((float) progress), 0.0F, 0.0F, 1.0F); + ImageUtil.drawModalRect(-5, -5, 0.0F, 0.0F, 10, 10, 10, 10, 10.0F, 10.0F); + GlStateManager.disableBlend(); + GlStateManager.popMatrix(); + } + if (chart) { + if (module.getSettings().size() > 4) { + ClickGui gui = InfinityLoop.moduleManager.getModuleByClass(ClickGui.class); + String color = (module.isOn() || chart) ? "" : "" + ChatFormatting.GRAY; + String gear = subOpen ? gui.close.getValue() : gui.open.getValue(); + + FontRender.drawCentString6(color + gear, (float) x + (float) width - 8f, (float) y + 6, -1); + } + } + if (bind) { + if (!module.getBind().toString().equalsIgnoreCase("none")) + FontRender.drawString5(module.getBind().toString(), (float) x + (float) width - FontRender.getStringWidth5(module.getBind().toString()) - 3f, (float) y + 6, -1); + + } + + } @Override public void mouseClicked(int mouseX, int mouseY, int mouseButton) { @@ -124,14 +175,6 @@ public void mouseClicked(int mouseX, int mouseY, int mouseButton) { if (mouseButton == 1 && this.isHovering(mouseX, mouseY)) { this.subOpen = !this.subOpen; mc.getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0f)); - }else if(mouseButton == 2) { - if(module.isDrawn()) { - module.setUndrawn(); - Command.sendMessage(module.getName() + " is no longer Drawn."); - }else { - module.setDrawn(true); - Command.sendMessage(module.getName() + " is now Drawn."); - } } if (this.subOpen) { for (Item item : this.items) { diff --git a/src/main/java/me/loop/features/gui/click/items/buttons/SliderButton.java b/src/main/java/me/loop/features/gui/click/items/buttons/SliderButton.java new file mode 100644 index 0000000..7b354fc --- /dev/null +++ b/src/main/java/me/loop/features/gui/click/items/buttons/SliderButton.java @@ -0,0 +1,118 @@ +package me.loop.features.gui.click.items.buttons; + +import me.loop.InfinityLoop; +import me.loop.features.gui.InfinityLoopGui; +import me.loop.features.gui.click.Component; +import me.loop.features.modules.client.Colors; +import me.loop.features.modules.client.HUD; +import me.loop.features.modules.client.clickgui.ClickEnum; +import me.loop.features.modules.client.clickgui.ClickGui; +import me.loop.features.setting.Setting; +import me.loop.util.impl.ColorUtil; +import me.loop.util.impl.MathUtil; +import me.loop.util.impl.RenderUtil; +import org.lwjgl.input.Mouse; + +public class SliderButton + extends Button { + private final Number min; + private final Number max; + private final int difference; + public Setting setting; + + public SliderButton(Setting setting) { + super(setting.getName()); + this.setting = setting; + this.min = (Number)setting.getMin(); + this.max = (Number)setting.getMax(); + this.difference = this.max.intValue() - this.min.intValue(); + this.width = 40; + } + + @Override + public void drawScreen(int mouseX, int mouseY, float partialTicks) { + this.dragSetting(mouseX, mouseY); + RenderUtil.drawRect(this.x, this.y, this.x + (float) this.width + 7.4f, this.y + (float) this.height - 0.5f, !this.isHovering(mouseX, mouseY) ? 0x11555555 : -2007673515); + if (ClickGui.getInstance().sideSettings.getValue().booleanValue()) { + int sideColor = ColorUtil.toRGBA(ClickGui.getInstance().sideLineC.getValue().getRed(), ClickGui.getInstance().sideLineC.getValue().getGreen(), ClickGui.getInstance().sideLineC.getValue().getBlue(), ClickGui.getInstance().sideLineC.getValue().getAlpha()); + RenderUtil.drawRect(this.x, this.y, this.x + 1.0f, this.y + (float) this.height + 1.0f, sideColor); + } + if (ClickGui.getInstance().colorSync.getValue() && Colors.getInstance().rainbow.getValue().booleanValue()) { + int color = ColorUtil.changeAlpha(HUD.getInstance().colorMap.get(MathUtil.clamp((int) this.y, 0, this.renderer.scaledHeight)), InfinityLoop.moduleManager.getModuleByClass(ClickGui.class).moduleMainC.getValue().getAlpha()); + int color1 = ColorUtil.changeAlpha(HUD.getInstance().colorMap.get(MathUtil.clamp((int) this.y + this.height, 0, this.renderer.scaledHeight)), InfinityLoop.moduleManager.getModuleByClass(ClickGui.class).moduleMainC.getValue().getAlpha()); + RenderUtil.drawGradientRect(this.x, this.y, ((Number) this.setting.getValue()).floatValue() <= this.min.floatValue() ? 0.0f : ((float) this.width + 7.4f) * this.partialMultiplier(), (float) this.height - 0.5f, !this.isHovering(mouseX, mouseY) ? HUD.getInstance().colorMap.get(MathUtil.clamp((int) this.y, 0, this.renderer.scaledHeight)) : color, !this.isHovering(mouseX, mouseY) ? HUD.getInstance().colorMap.get(MathUtil.clamp((int) this.y, 0, this.renderer.scaledHeight)) : color1); + } else { + if (ClickGui.getInstance().sliderType.getValue() == ClickEnum.SliderType.Line) { + int sliderColor = ColorUtil.toRGBA(ClickGui.getInstance().sliderC.getValue().getRed(), ClickGui.getInstance().sliderC.getValue().getGreen(), ClickGui.getInstance().sliderC.getValue().getBlue(), ClickGui.getInstance().sliderC.getValue().getAlpha()); + //todo + // int sliderColorHovering = ColorUtil.toRGBA(ClickGui.getInstance().sliderRed.getValue(), ClickGui.getInstance().sliderGreen.getValue(), ClickGui.getInstance().sliderBlue.getValue(), ClickGui.getInstance().moduleMainC.getValue().getAlpha()); + RenderUtil.drawRect(this.x, this.y + (float) this.height - 2.0f, ((Number) this.setting.getValue()).floatValue() <= this.min.floatValue() ? this.x : this.x + ((float) this.width + 7.4f) * this.partialMultiplier(), this.y + (float) this.height - 0.5f, sliderColor); + } else if (ClickGui.getInstance().sliderType.getValue() == ClickEnum.SliderType.Fill) { + int sliderColor = ColorUtil.toRGBA(ClickGui.getInstance().sliderC.getValue().getRed(), ClickGui.getInstance().sliderC.getValue().getGreen(), ClickGui.getInstance().sliderC.getValue().getBlue(), ClickGui.getInstance().sliderC.getValue().getAlpha()); + //todo + // int sliderColorHovering = ColorUtil.toRGBA(ClickGui.getInstance().sliderRed.getValue(), ClickGui.getInstance().sliderGreen.getValue(), ClickGui.getInstance().sliderBlue.getValue(), ClickGui.getInstance().moduleMainC.getValue().getAlpha()); + RenderUtil.drawRect(this.x, this.y, ((Number) this.setting.getValue()).floatValue() <= this.min.floatValue() ? this.x : this.x + ((float) this.width + 7.4f) * this.partialMultiplier(), this.y + (float) this.height - 0.5f, sliderColor); + } + } + InfinityLoop.textManager.drawStringWithShadow(this.getName() + " \u00a77" + (this.setting.getValue() instanceof Float ? (Number)((Number)this.setting.getValue()) : (Number)((Number)this.setting.getValue()).doubleValue()), this.x + 2.3f, this.y - 1.7f - (float)InfinityLoopGui.getClickGui().getTextOffset(), -1); + } + + @Override + public void mouseClicked(int mouseX, int mouseY, int mouseButton) { + super.mouseClicked(mouseX, mouseY, mouseButton); + if (this.isHovering(mouseX, mouseY)) { + this.setSettingFromX(mouseX); + } + } + + @Override + public boolean isHovering(int mouseX, int mouseY) { + for (Component component : InfinityLoopGui.getInstance().getComponents()) { + if (!component.drag) continue; + return false; + } + return (float)mouseX >= this.getX() && (float)mouseX <= this.getX() + (float)this.getWidth() + 8.0f && (float)mouseY >= this.getY() && (float)mouseY <= this.getY() + (float)this.height; + } + + @Override + public void update() { + this.setHidden(!this.setting.isVisible()); + } + + private void dragSetting(int mouseX, int mouseY) { + if (this.isHovering(mouseX, mouseY) && Mouse.isButtonDown((int)0)) { + this.setSettingFromX(mouseX); + } + } + + @Override + public int getHeight() { + return 14; + } + + private void setSettingFromX(int mouseX) { + float percent = ((float)mouseX - this.x) / ((float)this.width + 7.4f); + if (this.setting.getValue() instanceof Double) { + double result = (Double)this.setting.getMin() + (double)((float)this.difference * percent); + this.setting.setValue((double)Math.round(10.0 * result) / 10.0); + } else if (this.setting.getValue() instanceof Float) { + float result = ((Float)this.setting.getMin()).floatValue() + (float)this.difference * percent; + this.setting.setValue(Float.valueOf((float)Math.round(10.0f * result) / 10.0f)); + } else if (this.setting.getValue() instanceof Integer) { + this.setting.setValue((Integer)this.setting.getMin() + (int)((float)this.difference * percent)); + } + } + + private float middle() { + return this.max.floatValue() - this.min.floatValue(); + } + + private float part() { + return ((Number)this.setting.getValue()).floatValue() - this.min.floatValue(); + } + + private float partialMultiplier() { + return this.part() / this.middle(); + } +} + diff --git a/src/main/java/com/me/infinity/loop/features/gui/components/items/buttons/StringButton.java b/src/main/java/me/loop/features/gui/click/items/buttons/StringButton.java similarity index 83% rename from src/main/java/com/me/infinity/loop/features/gui/components/items/buttons/StringButton.java rename to src/main/java/me/loop/features/gui/click/items/buttons/StringButton.java index 804056a..9872ba1 100644 --- a/src/main/java/com/me/infinity/loop/features/gui/components/items/buttons/StringButton.java +++ b/src/main/java/me/loop/features/gui/click/items/buttons/StringButton.java @@ -1,12 +1,11 @@ -package com.me.infinity.loop.features.gui.components.items.buttons; - -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.features.gui.InfinityLoopGui; -import com.me.infinity.loop.features.modules.client.ClickGui.ClickGui; -import com.me.infinity.loop.features.setting.Setting; -import com.me.infinity.loop.util.utils.Util; -import com.me.infinity.loop.util.utils.renders.RenderUtil; +package me.loop.features.gui.click.items.buttons; + import com.mojang.realmsclient.gui.ChatFormatting; +import me.loop.InfinityLoop; +import me.loop.features.gui.InfinityLoopGui; +import me.loop.features.modules.client.clickgui.ClickGui; +import me.loop.features.setting.Setting; +import me.loop.util.impl.RenderUtil; import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.init.SoundEvents; import net.minecraft.util.ChatAllowedCharacters; @@ -37,7 +36,7 @@ public void drawScreen(int mouseX, int mouseY, float partialTicks) { if (this.isListening) { InfinityLoop.textManager.drawStringWithShadow(this.currentString.getString() + InfinityLoop.textManager.getIdleSign(), this.x + 2.3f, this.y - 1.7f - (float) InfinityLoopGui.getClickGui().getTextOffset(), this.getState() ? -1 : -5592406); } else { - InfinityLoop.textManager.drawStringWithShadow((this.setting.getName().equals("Buttons") ? "Buttons " : (this.setting.getName().equals("Prefix") ? "Prefix " + ChatFormatting.GRAY : "")) + this.setting.getValue(), this.x + 2.3f, this.y - 1.7f - (float) InfinityLoopGui.getClickGui().getTextOffset(), this.getState() ? -1 : -5592406); + InfinityLoop.textManager.drawStringWithShadow((this.setting.getName().equals("Buttons") ? "Buttons " : (this.setting.getName().equals("Prefix") ? "Prefix " + ChatFormatting.GRAY : "")) + this.setting.getValue(), this.x + 2.3f, this.y - 1.7f - (float) InfinityLoopGui.getClickGui().getTextOffset(), this.getState() ? -1 : -5592406); } } @@ -45,7 +44,7 @@ public void drawScreen(int mouseX, int mouseY, float partialTicks) { public void mouseClicked(int mouseX, int mouseY, int mouseButton) { super.mouseClicked(mouseX, mouseY, mouseButton); if (this.isHovering(mouseX, mouseY)) { - Util.mc.getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0f)); + mc.getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0f)); } } diff --git a/src/main/java/com/me/infinity/loop/features/gui/components/items/buttons/UnlimitedSlider.java b/src/main/java/me/loop/features/gui/click/items/buttons/UnlimitedSlider.java similarity index 84% rename from src/main/java/com/me/infinity/loop/features/gui/components/items/buttons/UnlimitedSlider.java rename to src/main/java/me/loop/features/gui/click/items/buttons/UnlimitedSlider.java index 065f87e..a41903e 100644 --- a/src/main/java/com/me/infinity/loop/features/gui/components/items/buttons/UnlimitedSlider.java +++ b/src/main/java/me/loop/features/gui/click/items/buttons/UnlimitedSlider.java @@ -1,12 +1,11 @@ -package com.me.infinity.loop.features.gui.components.items.buttons; +package me.loop.features.gui.click.items.buttons; -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.features.gui.InfinityLoopGui; -import com.me.infinity.loop.features.modules.client.ClickGui.ClickGui; -import com.me.infinity.loop.features.setting.Setting; -import com.me.infinity.loop.util.utils.Util; -import com.me.infinity.loop.util.utils.renders.RenderUtil; import com.mojang.realmsclient.gui.ChatFormatting; +import me.loop.InfinityLoop; +import me.loop.features.gui.InfinityLoopGui; +import me.loop.features.modules.client.clickgui.ClickGui; +import me.loop.features.setting.Setting; +import me.loop.util.impl.RenderUtil; import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.init.SoundEvents; @@ -30,7 +29,7 @@ public void drawScreen(int mouseX, int mouseY, float partialTicks) { public void mouseClicked(int mouseX, int mouseY, int mouseButton) { super.mouseClicked(mouseX, mouseY, mouseButton); if (this.isHovering(mouseX, mouseY)) { - Util.mc.getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0f)); + mc.getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0f)); if (this.isRight(mouseX)) { if (this.setting.getValue() instanceof Double) { this.setting.setValue((Double) this.setting.getValue() + 1.0); diff --git a/src/main/java/com/me/infinity/loop/features/gui/font/CFont.java b/src/main/java/me/loop/features/gui/font/CFont.java similarity index 99% rename from src/main/java/com/me/infinity/loop/features/gui/font/CFont.java rename to src/main/java/me/loop/features/gui/font/CFont.java index 7dd359f..3f1c818 100644 --- a/src/main/java/com/me/infinity/loop/features/gui/font/CFont.java +++ b/src/main/java/me/loop/features/gui/font/CFont.java @@ -1,4 +1,4 @@ -package com.me.infinity.loop.features.gui.font; +package me.loop.features.gui.font; import net.minecraft.client.renderer.texture.DynamicTexture; import org.lwjgl.opengl.GL11; diff --git a/src/main/java/com/me/infinity/loop/features/gui/font/CFontRenderer.java b/src/main/java/me/loop/features/gui/font/CFontRenderer.java similarity index 99% rename from src/main/java/com/me/infinity/loop/features/gui/font/CFontRenderer.java rename to src/main/java/me/loop/features/gui/font/CFontRenderer.java index 5f94401..6ae71e7 100644 --- a/src/main/java/com/me/infinity/loop/features/gui/font/CFontRenderer.java +++ b/src/main/java/me/loop/features/gui/font/CFontRenderer.java @@ -1,4 +1,4 @@ -package com.me.infinity.loop.features.gui.font; +package me.loop.features.gui.font; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.texture.DynamicTexture; diff --git a/src/main/java/com/me/infinity/loop/features/gui/font/CustomFont.java b/src/main/java/me/loop/features/gui/font/CustomFont.java similarity index 93% rename from src/main/java/com/me/infinity/loop/features/gui/font/CustomFont.java rename to src/main/java/me/loop/features/gui/font/CustomFont.java index ddcf147..3e180d1 100644 --- a/src/main/java/com/me/infinity/loop/features/gui/font/CustomFont.java +++ b/src/main/java/me/loop/features/gui/font/CustomFont.java @@ -1,4 +1,4 @@ -package com.me.infinity.loop.features.gui.font; +package me.loop.features.gui.font; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.texture.DynamicTexture; @@ -94,8 +94,8 @@ public float drawString(String text, double x, double y, int color, boolean shad underline = false; strikethrough = false; GlStateManager.bindTexture(tex.getGlTextureId()); - GL11.glBindTexture(GL11.GL_TEXTURE_2D, - tex.getGlTextureId()); + // GL11.glBindTexture(GL11.GL_TEXTURE_2D, + // tex.getGlTextureId()); currentData = this.charData; if ((colorIndex < 0) || (colorIndex > 15)) colorIndex = 15; if (shadow) colorIndex += 16; @@ -106,13 +106,13 @@ else if (colorIndex == 17) { bold = true; if (italic) { GlStateManager.bindTexture(texItalicBold.getGlTextureId()); - GL11.glBindTexture(GL11.GL_TEXTURE_2D, - texItalicBold.getGlTextureId()); + // GL11.glBindTexture(GL11.GL_TEXTURE_2D, + // texItalicBold.getGlTextureId()); currentData = this.boldItalicChars; } else { GlStateManager.bindTexture(texBold.getGlTextureId()); - GL11.glBindTexture(GL11.GL_TEXTURE_2D, - texBold.getGlTextureId()); + // GL11.glBindTexture(GL11.GL_TEXTURE_2D, + // texBold.getGlTextureId()); currentData = this.boldChars; } } else if (colorIndex == 18) strikethrough = true; @@ -121,13 +121,13 @@ else if (colorIndex == 20) { italic = true; if (bold) { GlStateManager.bindTexture(texItalicBold.getGlTextureId()); - GL11.glBindTexture(GL11.GL_TEXTURE_2D, - texItalicBold.getGlTextureId()); + // GL11.glBindTexture(GL11.GL_TEXTURE_2D, + // texItalicBold.getGlTextureId()); currentData = this.boldItalicChars; } else { GlStateManager.bindTexture(texItalic.getGlTextureId()); - GL11.glBindTexture(GL11.GL_TEXTURE_2D, - texItalic.getGlTextureId()); + // GL11.glBindTexture(GL11.GL_TEXTURE_2D, + // texItalic.getGlTextureId()); currentData = this.italicChars; } } else if (colorIndex == 21) { @@ -138,8 +138,8 @@ else if (colorIndex == 20) { strikethrough = false; GlStateManager.color((color >> 16 & 0xFF) / 255.0F, (color >> 8 & 0xFF) / 255.0F, (color & 0xFF) / 255.0F, alpha); GlStateManager.bindTexture(tex.getGlTextureId()); - GL11.glBindTexture(GL11.GL_TEXTURE_2D, - tex.getGlTextureId()); + // GL11.glBindTexture(GL11.GL_TEXTURE_2D, + // tex.getGlTextureId()); currentData = this.charData; } i++; diff --git a/src/main/java/com/me/infinity/loop/features/gui/font/FontRender.java b/src/main/java/me/loop/features/gui/font/FontRender.java similarity index 97% rename from src/main/java/com/me/infinity/loop/features/gui/font/FontRender.java rename to src/main/java/me/loop/features/gui/font/FontRender.java index 5333207..eb163ac 100644 --- a/src/main/java/com/me/infinity/loop/features/gui/font/FontRender.java +++ b/src/main/java/me/loop/features/gui/font/FontRender.java @@ -1,7 +1,7 @@ -package com.me.infinity.loop.features.gui.font; +package me.loop.features.gui.font; -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.util.utils.Util; +import me.loop.InfinityLoop; +import me.loop.util.impl.Util; import net.minecraft.client.renderer.GlStateManager; import org.lwjgl.opengl.GL11; diff --git a/src/main/java/me/loop/features/gui/other/chat/BetterChat.java b/src/main/java/me/loop/features/gui/other/chat/BetterChat.java new file mode 100644 index 0000000..f2cbc6f --- /dev/null +++ b/src/main/java/me/loop/features/gui/other/chat/BetterChat.java @@ -0,0 +1,39 @@ + +package me.loop.features.gui.other.chat; + +import me.loop.features.gui.other.chat.command.CommandConfig; +import me.loop.features.gui.other.chat.handlers.InjectUtile; +import net.minecraft.command.ICommand; +import net.minecraftforge.client.ClientCommandHandler; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.config.Configuration; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.common.event.FMLInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +@Mod(modid = "betterchat", name = "Better Chat", version = "1.5") +@SideOnly(Side.CLIENT) +public class BetterChat +{ + public static final String MODID = "betterchat"; + public static final String NAME = "Better Chat"; + public static final String VERSION = "1.5"; + private static ChatSettings settings; + + public static ChatSettings getSettings() { + return BetterChat.settings; + } + + @Mod.EventHandler + public void preInit(final FMLPreInitializationEvent event) { + (BetterChat.settings = new ChatSettings(new Configuration(event.getSuggestedConfigurationFile()))).loadConfig(); + } + + @Mod.EventHandler + public void init(final FMLInitializationEvent event) { + MinecraftForge.EVENT_BUS.register((Object)new InjectUtile()); + ClientCommandHandler.instance.registerCommand((ICommand)new CommandConfig()); + } +} diff --git a/src/main/java/me/loop/features/gui/other/chat/ChatSettings.java b/src/main/java/me/loop/features/gui/other/chat/ChatSettings.java new file mode 100644 index 0000000..5c77da2 --- /dev/null +++ b/src/main/java/me/loop/features/gui/other/chat/ChatSettings.java @@ -0,0 +1,76 @@ + + + + +package me.loop.features.gui.other.chat; + +import net.minecraft.client.*; +import net.minecraftforge.common.config.*; + +public class ChatSettings +{ + private final Configuration config; + public boolean smooth; + public boolean clear; + public int xOffset; + public int yOffset; + + public ChatSettings(final Configuration config) { + this.config = config; + } + + public void saveConfig() { + this.updateConfig(false); + this.config.save(); + } + + public void loadConfig() { + this.config.load(); + this.updateConfig(true); + } + + public void resetConfig() { + Property prop = this.config.get("All", "Clear", false); + prop.set(this.clear = false); + prop = this.config.get("All", "Smooth", true); + prop.set(this.smooth = true); + prop = this.config.get("All", "xOffset", 0); + prop.set(this.xOffset = 0); + prop = this.config.get("All", "yOffset", 0); + prop.set(this.yOffset = 0); + Minecraft.getMinecraft().gameSettings.chatScale = 1.0f; + Minecraft.getMinecraft().gameSettings.chatWidth = 1.0f; + this.config.save(); + } + + private void updateConfig(final boolean load) { + Property prop = this.config.get("All", "Clear", false); + if (load) { + this.clear = prop.getBoolean(); + } + else { + prop.set(this.clear); + } + prop = this.config.get("All", "Smooth", true); + if (load) { + this.smooth = prop.getBoolean(); + } + else { + prop.set(this.smooth); + } + prop = this.config.get("All", "xOffset", 0); + if (load) { + this.xOffset = prop.getInt(); + } + else { + prop.set(this.xOffset); + } + prop = this.config.get("All", "yOffset", 0); + if (load) { + this.yOffset = prop.getInt(); + } + else { + prop.set(this.yOffset); + } + } +} diff --git a/src/main/java/me/loop/features/gui/other/chat/command/CommandConfig.java b/src/main/java/me/loop/features/gui/other/chat/command/CommandConfig.java new file mode 100644 index 0000000..0107893 --- /dev/null +++ b/src/main/java/me/loop/features/gui/other/chat/command/CommandConfig.java @@ -0,0 +1,38 @@ + +package me.loop.features.gui.other.chat.command; + +import me.loop.features.gui.other.chat.gui.GuiConfig; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommandSender; +import net.minecraft.server.MinecraftServer; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; + +public class CommandConfig extends CommandBase +{ + public String getName() { + return "betterchat"; + } + + public String getUsage(final ICommandSender sender) { + return "/betterchat"; + } + + public boolean checkPermission(final MinecraftServer server, final ICommandSender sender) { + return true; + } + + public void execute(final MinecraftServer server, final ICommandSender sender, final String[] args) throws CommandException { + MinecraftForge.EVENT_BUS.register((Object)this); + } + + @SubscribeEvent + public void onClientTick(final TickEvent.ClientTickEvent event) { + MinecraftForge.EVENT_BUS.unregister((Object)this); + Minecraft.getMinecraft().displayGuiScreen((GuiScreen)new GuiConfig()); + } +} diff --git a/src/main/java/me/loop/features/gui/other/chat/gui/GuiBetterChat.java b/src/main/java/me/loop/features/gui/other/chat/gui/GuiBetterChat.java new file mode 100644 index 0000000..2792e8e --- /dev/null +++ b/src/main/java/me/loop/features/gui/other/chat/gui/GuiBetterChat.java @@ -0,0 +1,312 @@ + +package me.loop.features.gui.other.chat.gui; + +import com.google.common.collect.Lists; +import me.loop.features.gui.other.chat.BetterChat; +import me.loop.features.gui.other.chat.utils.AnimationTools; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.*; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextComponentString; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import javax.annotation.Nullable; +import java.util.Iterator; +import java.util.List; + +@SideOnly(Side.CLIENT) +public class GuiBetterChat extends GuiNewChat +{ + private static final Logger LOGGER; + public static float percentComplete; + public static int newLines; + public static long prevMillis; + private final Minecraft mc; + /** + * A list of messages previously sent through the chat GUI + */ + private final List sentMessages = Lists.newArrayList(); + /** + * Chat lines to be displayed in the chat box + */ + private final List chatLines = Lists.newArrayList(); + /** + * List of the ChatLines currently drawn + */ + private final List drawnChatLines = Lists.newArrayList(); + public boolean configuring; + private int scrollPos; + private boolean isScrolled; + + public GuiBetterChat(final Minecraft mcIn) { + super(mcIn); + this.mc = mcIn; + } + + public static void updatePercentage(final long diff) { + if (GuiBetterChat.percentComplete < 1.0f) { + GuiBetterChat.percentComplete += 0.004f * diff; + } + GuiBetterChat.percentComplete = AnimationTools.clamp(GuiBetterChat.percentComplete, 0.0f, 1.0f); + } + + public static int calculateChatboxWidth(final float scale) { + return MathHelper.floor(scale * 280.0f + 40.0f); + } + + public static int calculateChatboxHeight(final float scale) { + return MathHelper.floor(scale * 160.0f + 20.0f); + } + + public void drawChat(final int updateCounter) { + if (this.configuring) { + return; + } + if (GuiBetterChat.prevMillis == -1L) { + GuiBetterChat.prevMillis = System.currentTimeMillis(); + return; + } + final long current = System.currentTimeMillis(); + final long diff = current - GuiBetterChat.prevMillis; + GuiBetterChat.prevMillis = current; + updatePercentage(diff); + float t = GuiBetterChat.percentComplete; + float percent = 1.0f - --t * t * t * t; + percent = AnimationTools.clamp(percent, 0.0f, 1.0f); + if (this.mc.gameSettings.chatVisibility != EntityPlayer.EnumChatVisibility.HIDDEN) { + final int i = this.getLineCount(); + final int j = this.drawnChatLines.size(); + final float f = this.mc.gameSettings.chatOpacity * 0.9f + 0.1f; + if (j > 0) { + final boolean flag = this.getChatOpen(); + final float f2 = this.getChatScale(); + final int k = MathHelper.ceil(this.getChatWidth() / f2); + GlStateManager.pushMatrix(); + if (BetterChat.getSettings().smooth && !this.isScrolled) { + GlStateManager.translate(2.0f + BetterChat.getSettings().xOffset, 8.0f + BetterChat.getSettings().yOffset + (9.0f - 9.0f * percent) * f2, 0.0f); + } + else { + GlStateManager.translate(2.0f + BetterChat.getSettings().xOffset, 8.0f + BetterChat.getSettings().yOffset, 0.0f); + } + GlStateManager.scale(f2, f2, 1.0f); + int l = 0; + for (int i2 = 0; i2 + this.scrollPos < this.drawnChatLines.size() && i2 < i; ++i2) { + final ChatLine chatline = this.drawnChatLines.get(i2 + this.scrollPos); + if (chatline != null) { + final int j2 = updateCounter - chatline.getUpdatedCounter(); + if (j2 < 200 || flag) { + double d0 = j2 / 200.0; + d0 = 1.0 - d0; + d0 *= 10.0; + d0 = MathHelper.clamp(d0, 0.0, 1.0); + d0 *= d0; + int l2 = (int)(255.0 * d0); + if (flag) { + l2 = 255; + } + l2 *= (int)f; + ++l; + if (l2 > 3) { + final int i3 = 0; + final int j3 = -i2 * 9; + if (!BetterChat.getSettings().clear) { + drawRect(-2, j3 - 9, i3 + k + 4, j3, l2 / 2 << 24); + } + final String s = chatline.getChatComponent().getFormattedText(); + GlStateManager.enableBlend(); + if (BetterChat.getSettings().smooth && i2 <= GuiBetterChat.newLines) { + this.mc.fontRenderer.drawStringWithShadow(s, 0.0f, (float)(j3 - 8), 16777215 + ((int)(l2 * percent) << 24)); + } + else { + this.mc.fontRenderer.drawStringWithShadow(s, (float)i3, (float)(j3 - 8), 16777215 + (l2 << 24)); + } + GlStateManager.disableAlpha(); + GlStateManager.disableBlend(); + } + } + } + } + if (flag) { + final int k2 = this.mc.fontRenderer.FONT_HEIGHT; + GlStateManager.translate(-3.0f, 0.0f, 0.0f); + final int l3 = j * k2 + j; + final int i4 = l * k2 + l; + final int j4 = this.scrollPos * i4 / j; + final int k3 = i4 * i4 / l3; + if (l3 != i4) { + final int k4 = (j4 > 0) ? 170 : 96; + final int l4 = this.isScrolled ? 13382451 : 3355562; + drawRect(0, -j4, 2, -j4 - k3, l4 + (k4 << 24)); + drawRect(2, -j4, 1, -j4 - k3, 13421772 + (k4 << 24)); + } + } + GlStateManager.popMatrix(); + } + } + } + + public void clearChatMessages(final boolean p_146231_1_) { + this.drawnChatLines.clear(); + this.chatLines.clear(); + if (p_146231_1_) { + this.sentMessages.clear(); + } + } + + public void printChatMessage(final ITextComponent chatComponent) { + this.printChatMessageWithOptionalDeletion(chatComponent, 0); + } + + public void printChatMessageWithOptionalDeletion(final ITextComponent chatComponent, final int chatLineId) { + GuiBetterChat.percentComplete = 0.0f; + this.setChatLine(chatComponent, chatLineId, this.mc.ingameGUI.getUpdateCounter(), false); + GuiBetterChat.LOGGER.info("[CHAT] {}", (Object)chatComponent.getUnformattedText().replaceAll("\r", "\\\\r").replaceAll("\n", "\\\\n")); + } + + private void setChatLine(final ITextComponent chatComponent, final int chatLineId, final int updateCounter, final boolean displayOnly) { + if (chatLineId != 0) { + this.deleteChatLine(chatLineId); + } + final int i = MathHelper.floor(this.getChatWidth() / this.getChatScale()); + final List list = GuiUtilRenderComponents.splitText(chatComponent, i, this.mc.fontRenderer, false, false); + final boolean flag = this.getChatOpen(); + GuiBetterChat.newLines = list.size() - 1; + for (final ITextComponent itextcomponent : list) { + if (flag && this.scrollPos > 0) { + this.isScrolled = true; + this.scroll(1); + } + this.drawnChatLines.add(0, new ChatLine(updateCounter, itextcomponent, chatLineId)); + } + while (this.drawnChatLines.size() > 100) { + this.drawnChatLines.remove(this.drawnChatLines.size() - 1); + } + if (!displayOnly) { + this.chatLines.add(0, new ChatLine(updateCounter, chatComponent, chatLineId)); + while (this.chatLines.size() > 100) { + this.chatLines.remove(this.chatLines.size() - 1); + } + } + } + + public void refreshChat() { + this.drawnChatLines.clear(); + this.resetScroll(); + for (int i = this.chatLines.size() - 1; i >= 0; --i) { + final ChatLine chatline = this.chatLines.get(i); + this.setChatLine(chatline.getChatComponent(), chatline.getChatLineID(), chatline.getUpdatedCounter(), true); + } + } + + public List getSentMessages() { + return this.sentMessages; + } + + public void addToSentMessages(final String message) { + if (this.sentMessages.isEmpty() || !this.sentMessages.get(this.sentMessages.size() - 1).equals(message)) { + this.sentMessages.add(message); + } + } + + public void resetScroll() { + this.scrollPos = 0; + this.isScrolled = false; + } + + public void scroll(final int amount) { + this.scrollPos += amount; + final int i = this.drawnChatLines.size(); + if (this.scrollPos > i - this.getLineCount()) { + this.scrollPos = i - this.getLineCount(); + } + if (this.scrollPos <= 0) { + this.scrollPos = 0; + this.isScrolled = false; + } + } + + @Nullable + public ITextComponent getChatComponent(final int mouseX, final int mouseY) { + if (!this.getChatOpen()) { + return null; + } + final ScaledResolution scaledresolution = new ScaledResolution(this.mc); + final int i = scaledresolution.getScaleFactor(); + final float f = this.getChatScale(); + int j = mouseX / i - 2 - BetterChat.getSettings().xOffset; + int k = mouseY / i - 40 + BetterChat.getSettings().yOffset; + j = MathHelper.floor(j / f); + k = MathHelper.floor(k / f); + if (j < 0 || k < 0) { + return null; + } + final int l = Math.min(this.getLineCount(), this.drawnChatLines.size()); + if (j <= MathHelper.floor(this.getChatWidth() / this.getChatScale()) && k < this.mc.fontRenderer.FONT_HEIGHT * l + l) { + final int i2 = k / this.mc.fontRenderer.FONT_HEIGHT + this.scrollPos; + if (i2 >= 0 && i2 < this.drawnChatLines.size()) { + final ChatLine chatline = this.drawnChatLines.get(i2); + int j2 = 0; + for (final ITextComponent itextcomponent : chatline.getChatComponent()) { + if (itextcomponent instanceof TextComponentString) { + j2 += this.mc.fontRenderer.getStringWidth(GuiUtilRenderComponents.removeTextColorsIfConfigured(((TextComponentString)itextcomponent).getText(), false)); + if (j2 > j) { + return itextcomponent; + } + continue; + } + } + } + return null; + } + return null; + } + + public boolean getChatOpen() { + return this.mc.currentScreen instanceof GuiChat; + } + + public void deleteChatLine(final int id) { + Iterator iterator = this.drawnChatLines.iterator(); + while (iterator.hasNext()) { + final ChatLine chatline = iterator.next(); + if (chatline.getChatLineID() == id) { + iterator.remove(); + } + } + iterator = this.chatLines.iterator(); + while (iterator.hasNext()) { + final ChatLine chatline2 = iterator.next(); + if (chatline2.getChatLineID() == id) { + iterator.remove(); + break; + } + } + } + + public int getChatWidth() { + return calculateChatboxWidth(this.mc.gameSettings.chatWidth); + } + + public int getChatHeight() { + return calculateChatboxHeight(this.getChatOpen() ? this.mc.gameSettings.chatHeightFocused : this.mc.gameSettings.chatHeightUnfocused); + } + + public float getChatScale() { + return this.mc.gameSettings.chatScale; + } + + public int getLineCount() { + return this.getChatHeight() / 9; + } + + static { + LOGGER = LogManager.getLogger(); + GuiBetterChat.prevMillis = -1L; + } +} diff --git a/src/main/java/me/loop/features/gui/other/chat/gui/GuiConfig.java b/src/main/java/me/loop/features/gui/other/chat/gui/GuiConfig.java new file mode 100644 index 0000000..7cb618c --- /dev/null +++ b/src/main/java/me/loop/features/gui/other/chat/gui/GuiConfig.java @@ -0,0 +1,166 @@ +package me.loop.features.gui.other.chat.gui; + +import me.loop.features.gui.other.chat.BetterChat; +import me.loop.features.gui.other.chat.ChatSettings; +import me.loop.features.gui.other.chat.handlers.InjectUtile; +import net.minecraft.client.gui.*; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.resources.I18n; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextComponentString; +import net.minecraft.util.text.TextFormatting; +import net.minecraftforge.fml.client.config.GuiSlider; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +public class GuiConfig extends GuiScreen +{ + private final ChatSettings settings; + private final List exampleChat; + private boolean dragging; + private int chatLeft; + private int chatRight; + private int chatTop; + private int chatBottom; + private int dragStartX; + private int dragStartY; + private GuiButton clearButton; + private GuiButton smoothButton; + private GuiSlider scaleSlider; + private GuiSlider widthSlider; + + public GuiConfig() { + this.exampleChat = new ArrayList(); + this.settings = BetterChat.getSettings(); + this.exampleChat.add((ITextComponent)new TextComponentString(I18n.format("gui.betterchat.text.example3", new Object[0]))); + this.exampleChat.add((ITextComponent)new TextComponentString(I18n.format("gui.betterchat.text.example2", new Object[0]))); + this.exampleChat.add((ITextComponent)new TextComponentString(I18n.format("gui.betterchat.text.example1", new Object[0]))); + } + + public void initGui() { + InjectUtile.chatGUI.configuring = true; + this.buttonList.add(this.clearButton = new GuiButton(0, this.width / 2 - 120, this.height / 2 - 50, 240, 20, this.getPropName("clear") + " " + this.getColoredBool("clear", this.settings.clear))); + this.buttonList.add(this.smoothButton = new GuiButton(1, this.width / 2 - 120, this.height / 2 - 25, 240, 20, this.getPropName("smooth") + " " + this.getColoredBool("smooth", this.settings.smooth))); + this.buttonList.add(this.scaleSlider = new GuiSlider(3, this.width / 2 - 120, this.height / 2, 240, 20, this.getPropName("scale") + " ", "%", 0.0, 100.0, (double)(this.mc.gameSettings.chatScale * 100.0f), false, true)); + this.buttonList.add(this.widthSlider = new GuiSlider(4, this.width / 2 - 120, this.height / 2 + 25, 240, 20, this.getPropName("width") + " ", "px", 40.0, 320.0, (double)GuiNewChat.calculateChatboxWidth(this.mc.gameSettings.chatWidth), false, true)); + this.buttonList.add(new GuiButton(2, this.width / 2 - 120, this.height / 2 + 50, 240, 20, this.getPropName("reset"))); + } + + public void drawScreen(final int mouseX, final int mouseY, final float partialTicks) { + super.drawScreen(mouseX, mouseY, partialTicks); + this.drawCenteredString(this.mc.fontRenderer, I18n.format("gui.betterchat.text.title", new Object[] { TextFormatting.GREEN + TextFormatting.BOLD.toString() + "Better Chat" + TextFormatting.RESET, TextFormatting.AQUA + TextFormatting.BOLD.toString() + "LlamaLad7" }), this.width / 2, this.height / 2 - 75, 16777215); + this.drawCenteredString(this.mc.fontRenderer, I18n.format("gui.betterchat.text.drag", new Object[0]), this.width / 2, this.height / 2 - 63, 16777215); + if (this.dragging) { + final ChatSettings settings = this.settings; + settings.xOffset += mouseX - this.dragStartX; + final ChatSettings settings2 = this.settings; + settings2.yOffset += mouseY - this.dragStartY; + this.dragStartX = mouseX; + this.dragStartY = mouseY; + } + this.mc.gameSettings.chatScale = this.scaleSlider.getValueInt() / 100.0f; + this.mc.gameSettings.chatWidth = (this.widthSlider.getValueInt() - 40.0f) / 280.0f; + this.drawExampleChat(); + } + + public void drawExampleChat() { + final List lines = new ArrayList(); + final int i = MathHelper.floor(InjectUtile.chatGUI.getChatWidth() / InjectUtile.chatGUI.getChatScale()); + for (final ITextComponent line : this.exampleChat) { + lines.addAll(GuiUtilRenderComponents.splitText(line, i, this.mc.fontRenderer, false, false)); + } + Collections.reverse(lines); + GlStateManager.pushMatrix(); + final ScaledResolution scaledresolution = new ScaledResolution(this.mc); + GlStateManager.translate(2.0f + this.settings.xOffset, 8.0f + this.settings.yOffset + scaledresolution.getScaledHeight() - 48.0f, 0.0f); + final float f = this.mc.gameSettings.chatOpacity * 0.9f + 0.1f; + final float f2 = this.mc.gameSettings.chatScale; + final int k = MathHelper.ceil(InjectUtile.chatGUI.getChatWidth() / f2); + GlStateManager.scale(f2, f2, 1.0f); + int i2 = 0; + final double d0 = 1.0; + int l1 = (int)(255.0 * d0); + l1 *= (int)f; + GlStateManager.enableAlpha(); + GlStateManager.enableBlend(); + this.chatLeft = this.settings.xOffset; + this.chatRight = (int)(this.settings.xOffset + (k + 4) * f2); + this.chatBottom = 8 + this.settings.yOffset + scaledresolution.getScaledHeight() - 48; + for (final ITextComponent message : lines) { + final int j2 = -i2 * 9; + if (!this.settings.clear) { + drawRect(-2, j2 - 9, k + 4, j2, l1 / 2 << 24); + } + this.mc.fontRenderer.drawStringWithShadow(message.getFormattedText(), 0.0f, (float)(j2 - 8), 16777215 + (l1 << 24)); + ++i2; + } + this.chatTop = (int)(8 + this.settings.yOffset + scaledresolution.getScaledHeight() - 48 + -i2 * 9 * f2); + GlStateManager.disableAlpha(); + GlStateManager.disableBlend(); + GlStateManager.popMatrix(); + } + + public void mouseClicked(final int mouseX, final int mouseY, final int mouseButton) throws IOException { + super.mouseClicked(mouseX, mouseY, mouseButton); + if (mouseButton == 0 && mouseX >= this.chatLeft && mouseX <= this.chatRight && mouseY >= this.chatTop && mouseY <= this.chatBottom) { + this.dragging = true; + this.dragStartX = mouseX; + this.dragStartY = mouseY; + } + } + + public void mouseReleased(final int mouseX, final int mouseY, final int mouseButton) { + super.mouseReleased(mouseX, mouseY, mouseButton); + this.dragging = false; + } + + public void onGuiClosed() { + this.settings.saveConfig(); + InjectUtile.chatGUI.configuring = false; + this.mc.gameSettings.saveOptions(); + } + + protected void actionPerformed(final GuiButton button) { + switch (button.id) { + case 0: { + this.settings.clear = !this.settings.clear; + button.displayString = this.getPropName("clear") + " " + this.getColoredBool("clear", this.settings.clear); + break; + } + case 1: { + this.settings.smooth = !this.settings.smooth; + button.displayString = this.getPropName("smooth") + " " + this.getColoredBool("smooth", this.settings.smooth); + break; + } + case 2: { + this.settings.resetConfig(); + this.clearButton.displayString = this.getPropName("clear") + " " + this.getColoredBool("clear", this.settings.clear); + this.smoothButton.displayString = this.getPropName("smooth") + " " + this.getColoredBool("smooth", this.settings.smooth); + this.scaleSlider.setValue((double)(this.mc.gameSettings.chatScale * 100.0f)); + this.scaleSlider.updateSlider(); + this.widthSlider.setValue((double)GuiNewChat.calculateChatboxWidth(this.mc.gameSettings.chatWidth)); + this.widthSlider.updateSlider(); + break; + } + } + } + + public boolean doesGuiPauseGame() { + return false; + } + + private String getColoredBool(final String prop, final boolean bool) { + if (bool) { + return TextFormatting.GREEN + I18n.format("gui.betterchat.text." + prop + ".enabled", new Object[0]); + } + return TextFormatting.RED + I18n.format("gui.betterchat.text." + prop + ".disabled", new Object[0]); + } + + private String getPropName(final String prop) { + return I18n.format("gui.betterchat.text." + prop + ".name", new Object[0]); + } +} diff --git a/src/main/java/me/loop/features/gui/other/chat/handlers/InjectUtile.java b/src/main/java/me/loop/features/gui/other/chat/handlers/InjectUtile.java new file mode 100644 index 0000000..168d2ee --- /dev/null +++ b/src/main/java/me/loop/features/gui/other/chat/handlers/InjectUtile.java @@ -0,0 +1,22 @@ +package me.loop.features.gui.other.chat.handlers; + +import me.loop.features.gui.other.chat.gui.GuiBetterChat; +import me.loop.util.impl.Util; +import net.minecraft.client.gui.GuiIngame; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.fml.common.ObfuscationReflectionHelper; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; + + +// full credit goes to llamalad7 +// too lazy to make it a mixin lol +public class InjectUtile implements Util { + public static GuiBetterChat chatGUI; + @SubscribeEvent + public void onClientTick(TickEvent.ClientTickEvent event) { + MinecraftForge.EVENT_BUS.unregister(this); + chatGUI = new GuiBetterChat(mc); + ObfuscationReflectionHelper.setPrivateValue(GuiIngame.class, mc.ingameGUI, chatGUI, "field_73840_e"); + } +} diff --git a/src/main/java/me/loop/features/gui/other/chat/utils/AnimationTools.java b/src/main/java/me/loop/features/gui/other/chat/utils/AnimationTools.java new file mode 100644 index 0000000..b295c44 --- /dev/null +++ b/src/main/java/me/loop/features/gui/other/chat/utils/AnimationTools.java @@ -0,0 +1,12 @@ + + + + +package me.loop.features.gui.other.chat.utils; + +public class AnimationTools +{ + public static float clamp(final float number, final float min, final float max) { + return (number < min) ? min : Math.min(number, max); + } +} diff --git a/src/main/java/com/me/infinity/loop/features/gui/mainmenu/GuiMainMenuButton.java b/src/main/java/me/loop/features/gui/other/mainmenu/GuiMainMenuButton.java similarity index 94% rename from src/main/java/com/me/infinity/loop/features/gui/mainmenu/GuiMainMenuButton.java rename to src/main/java/me/loop/features/gui/other/mainmenu/GuiMainMenuButton.java index 20a1a09..46ffac8 100644 --- a/src/main/java/com/me/infinity/loop/features/gui/mainmenu/GuiMainMenuButton.java +++ b/src/main/java/me/loop/features/gui/other/mainmenu/GuiMainMenuButton.java @@ -1,8 +1,8 @@ -package com.me.infinity.loop.features.gui.mainmenu; +package me.loop.features.gui.other.mainmenu; -import com.me.infinity.loop.features.gui.font.FontRender; -import com.me.infinity.loop.util.utils.renders.helper.RoundedShader; -import com.me.infinity.loop.util.utils.Util; +import me.loop.features.gui.font.FontRender; +import me.loop.util.impl.Util; +import me.loop.util.init.shaders.RoundedShader; import net.minecraft.client.Minecraft; import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.client.audio.SoundHandler; diff --git a/src/main/java/com/me/infinity/loop/features/gui/mainmenu/InfinityLoopMenu.java b/src/main/java/me/loop/features/gui/other/mainmenu/InfinityLoopMenu.java similarity index 91% rename from src/main/java/com/me/infinity/loop/features/gui/mainmenu/InfinityLoopMenu.java rename to src/main/java/me/loop/features/gui/other/mainmenu/InfinityLoopMenu.java index fb3df49..c77a100 100644 --- a/src/main/java/com/me/infinity/loop/features/gui/mainmenu/InfinityLoopMenu.java +++ b/src/main/java/me/loop/features/gui/other/mainmenu/InfinityLoopMenu.java @@ -1,11 +1,11 @@ -package com.me.infinity.loop.features.gui.mainmenu; +package me.loop.features.gui.other.mainmenu; -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.features.gui.font.FontRender; -import com.me.infinity.loop.features.gui.mainmenu.alts.GuiAltManager; -import com.me.infinity.loop.features.modules.client.MainSettings; -import com.me.infinity.loop.util.utils.renders.RenderUtil; -import com.me.infinity.loop.util.utils.renders.helper.RoundedShader; +import me.loop.InfinityLoop; +import me.loop.features.gui.font.FontRender; +import me.loop.features.gui.other.mainmenu.alts.GuiAltManager; +import me.loop.features.modules.client.MainSettings; +import me.loop.util.impl.RenderUtil; +import me.loop.util.init.shaders.RoundedShader; import net.minecraft.client.gui.*; import net.minecraft.client.renderer.GlStateManager; import org.lwjgl.opengl.GL11; diff --git a/src/main/java/com/me/infinity/loop/features/gui/mainmenu/MainMenuShader.java b/src/main/java/me/loop/features/gui/other/mainmenu/MainMenuShader.java similarity index 98% rename from src/main/java/com/me/infinity/loop/features/gui/mainmenu/MainMenuShader.java rename to src/main/java/me/loop/features/gui/other/mainmenu/MainMenuShader.java index 4a6409c..b50755e 100644 --- a/src/main/java/com/me/infinity/loop/features/gui/mainmenu/MainMenuShader.java +++ b/src/main/java/me/loop/features/gui/other/mainmenu/MainMenuShader.java @@ -1,4 +1,4 @@ -package com.me.infinity.loop.features.gui.mainmenu; +package me.loop.features.gui.other.mainmenu; import org.lwjgl.opengl.GL20; diff --git a/src/main/java/com/me/infinity/loop/features/gui/mainmenu/alts/AltCompoment.java b/src/main/java/me/loop/features/gui/other/mainmenu/alts/AltCompoment.java similarity index 91% rename from src/main/java/com/me/infinity/loop/features/gui/mainmenu/alts/AltCompoment.java rename to src/main/java/me/loop/features/gui/other/mainmenu/alts/AltCompoment.java index 508d5bd..4678907 100644 --- a/src/main/java/com/me/infinity/loop/features/gui/mainmenu/alts/AltCompoment.java +++ b/src/main/java/me/loop/features/gui/other/mainmenu/alts/AltCompoment.java @@ -1,10 +1,10 @@ -package com.me.infinity.loop.features.gui.mainmenu.alts; +package me.loop.features.gui.other.mainmenu.alts; -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.features.gui.font.FontRender; -import com.me.infinity.loop.util.utils.Util; -import com.me.infinity.loop.util.utils.renders.helper.RoundedShader; -import com.me.infinity.loop.util.utils.renders.shaders.PNGtoResourceLocation; +import me.loop.InfinityLoop; +import me.loop.features.gui.font.FontRender; +import me.loop.util.impl.Util; +import me.loop.util.init.shaders.PNGtoResourceLocation; +import me.loop.util.init.shaders.RoundedShader; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; import net.minecraft.util.ResourceLocation; diff --git a/src/main/java/com/me/infinity/loop/features/gui/mainmenu/alts/GuiAltManager.java b/src/main/java/me/loop/features/gui/other/mainmenu/alts/GuiAltManager.java similarity index 87% rename from src/main/java/com/me/infinity/loop/features/gui/mainmenu/alts/GuiAltManager.java rename to src/main/java/me/loop/features/gui/other/mainmenu/alts/GuiAltManager.java index 1e6308b..461a216 100644 --- a/src/main/java/com/me/infinity/loop/features/gui/mainmenu/alts/GuiAltManager.java +++ b/src/main/java/me/loop/features/gui/other/mainmenu/alts/GuiAltManager.java @@ -1,15 +1,16 @@ -package com.me.infinity.loop.features.gui.mainmenu.alts; - -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.features.gui.font.FontRender; -import com.me.infinity.loop.features.gui.mainmenu.GuiMainMenuButton; -import com.me.infinity.loop.features.gui.mainmenu.InfinityLoopMenu; -import com.me.infinity.loop.features.gui.mainmenu.MainMenuShader; -import com.me.infinity.loop.features.modules.client.MainSettings; -import com.me.infinity.loop.util.LoopUtil; -import com.me.infinity.loop.util.utils.renders.RenderUtil; -import com.me.infinity.loop.util.utils.renders.helper.RoundedShader; -import com.me.infinity.loop.util.utils.worlds.Timer; +package me.loop.features.gui.other.mainmenu.alts; + +import me.loop.InfinityLoop; +import me.loop.features.gui.click.items.buttons.StringButton; +import me.loop.features.gui.font.FontRender; +import me.loop.features.gui.other.mainmenu.GuiMainMenuButton; +import me.loop.features.gui.other.mainmenu.InfinityLoopMenu; +import me.loop.features.gui.other.mainmenu.MainMenuShader; +import me.loop.features.modules.client.MainSettings; +import me.loop.util.LoopUtil; +import me.loop.util.impl.RenderUtil; +import me.loop.util.init.Timer; +import me.loop.util.init.shaders.RoundedShader; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.renderer.GlStateManager; @@ -23,9 +24,6 @@ import java.util.ArrayList; import java.util.List; -import static com.me.infinity.loop.InfinityLoop.alts; -import static com.me.infinity.loop.features.gui.components.items.buttons.StringButton.removeLastChar; - public class GuiAltManager extends GuiScreen { private MainMenuShader backgroundShader; @@ -103,7 +101,7 @@ public void drawScreen(int mouseX, int mouseY, float partialTicks) { int alts_y = 0; - for(String alt : alts){ + for(String alt : InfinityLoop.alts){ altscomponents.add(new AltCompoment((int) (half_w - 105), 30 + alts_y + dwheel, alt)); alts_y += 49; } @@ -128,7 +126,7 @@ public void drawScreen(int mouseX, int mouseY, float partialTicks) { //half_w - 15, halh_h + 10, 30, 10 if((mouseX > half_w - 15) && (mouseX < half_w + 15) && (mouseY > halh_h + 10) && (mouseY < halh_h + 20) && Mouse.isButtonDown(0) && listening){ - alts.add(add_name); + InfinityLoop.alts.add(add_name); add_name = ""; listening = false; } @@ -154,7 +152,7 @@ public void mouseClicked(int x,int y, int button){ } if (x >= sr.getScaledWidth() / 2 + 4 && x <= sr.getScaledWidth() / 2 + 111 && y >= sr.getScaledHeight() - 135 && y <= sr.getScaledHeight() - 100) { String name = "Th" + (int)(Math.random() * 10000); - alts.add(name); + InfinityLoop.alts.add(name); try { new Thread(() -> LoopUtil.saveUserAvatar("https://minotar.net/helm/" + name +"/16.png", name)); } catch (Exception e){} @@ -172,13 +170,13 @@ public void keyTyped(char chr, int keyCode) { return; } case 28: { - alts.add(add_name); + InfinityLoop.alts.add(add_name); LoopUtil.saveUserAvatar("https://minotar.net/helm/" + add_name + "/16.png", add_name); add_name = ""; listening = false; } case 14: { - add_name = removeLastChar(add_name); + add_name = StringButton.removeLastChar(add_name); } } if (ChatAllowedCharacters.isAllowedCharacter(chr)) { diff --git a/src/main/java/com/me/infinity/loop/features/gui/screen/windows/WindowsGui.java b/src/main/java/me/loop/features/gui/other/windows/WindowsGui.java similarity index 59% rename from src/main/java/com/me/infinity/loop/features/gui/screen/windows/WindowsGui.java rename to src/main/java/me/loop/features/gui/other/windows/WindowsGui.java index 3aa44d8..062e23a 100644 --- a/src/main/java/com/me/infinity/loop/features/gui/screen/windows/WindowsGui.java +++ b/src/main/java/me/loop/features/gui/other/windows/WindowsGui.java @@ -1,24 +1,23 @@ -package com.me.infinity.loop.features.gui.screen.windows; - -import com.me.infinity.loop.features.gui.screen.particles.ParticleSystem; -import com.me.infinity.loop.features.gui.screen.particles.ParticlesComponent; -import com.me.infinity.loop.features.gui.screen.windows.window.WindowConfig; -import com.me.infinity.loop.features.gui.screen.windows.window.WindowFriends; -import com.me.infinity.loop.features.gui.screen.windows.window.WindowPackets; -import com.me.infinity.loop.features.gui.screen.windows.window.WindowAltManager; -import com.me.infinity.loop.features.modules.client.ClickGui.ClickGui; -import com.me.infinity.loop.features.modules.client.Colors; -import com.me.infinity.loop.features.modules.client.Windows; -import com.me.infinity.loop.features.setting.impl.Bind; -import com.me.infinity.loop.util.utils.renders.ColorUtil; -import com.me.infinity.loop.util.utils.renders.RenderUtil; +package me.loop.features.gui.other.windows; + +import me.loop.features.gui.other.windows.window.WindowAltManager; +import me.loop.features.gui.other.windows.window.WindowConfig; +import me.loop.features.gui.other.windows.window.WindowFriends; +import me.loop.features.gui.other.windows.window.WindowPackets; +import me.loop.features.gui.screen.effects.particles.ParticleSystem; +import me.loop.features.gui.screen.effects.particles.ParticlesComponent; +import me.loop.features.modules.client.Colors; +import me.loop.features.modules.client.Windows; +import me.loop.features.modules.client.clickgui.ClickGui; +import me.loop.features.setting.Bind; +import me.loop.util.impl.ColorUtil; +import me.loop.util.impl.RenderUtil; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.ScaledResolution; import org.lwjgl.input.Mouse; import java.awt.*; - public class WindowsGui extends GuiScreen { public ParticleSystem particleSystem; private ParticlesComponent particlesComponent; @@ -58,27 +57,25 @@ private void setInstance() { public void drawScreen(int mouseX, int mouseY, float partialTicks) { ScaledResolution sr = new ScaledResolution(mc); - int color = new Color(ClickGui.getInstance().red.getValue(), ClickGui.getInstance().green.getValue(), ClickGui.getInstance().blue.getValue()).getRGB(); - if (ClickGui.getInstance().background.getValue()) { - if (ClickGui.getInstance().dark.getValue()) { - this.drawDefaultBackground(); - } - if (ClickGui.getInstance().blur.getValue()) { - RenderUtil.drawBlurryRect(0, 0, sr.getScaledWidth(), sr.getScaledHeight(), ClickGui.getInstance().blurAmount.getValue(), ClickGui.getInstance().blurSize.getValue()); - } - if (ClickGui.getInstance().gradiant.getValue()) { - RenderUtil.drawGradientRect(0, 0, sr.getScaledWidth(), sr.getScaledHeight() + ClickGui.getInstance().gradiantHeight.getValue(), 0, new Color(ClickGui.getInstance().red.getValue(), ClickGui.getInstance().green.getValue(), ClickGui.getInstance().blue.getValue(), ClickGui.getInstance().gradiantAlpha.getValue()).getRGB()); - if (ClickGui.getInstance().gradiant.getValue() && ClickGui.getInstance().colorSync.getValue() && Colors.getInstance().rainbow.getValue()) { - RenderUtil.drawGradientRect(0, 0, sr.getScaledWidth(), sr.getScaledHeight() + ClickGui.getInstance().gradiantHeight.getValue().intValue(), 0, (Colors.getInstance()).rainbow.getValue().booleanValue() ? (((Colors.getInstance()).rainbowModeA.getValue() == Colors.rainbowModeArray.Up) ? ColorUtil.rainbow((Colors.getInstance()).rainbowHue.getValue().intValue()).getRGB() : ColorUtil.rainbow((Colors.getInstance()).rainbowHue.getValue().intValue(), ClickGui.getInstance().hoverAlpha.getValue()).getRGB()) : color); - } - } - if (this.particleSystem != null && ClickGui.getInstance().particles.getValue()) { - this.particleSystem.render(mouseX, mouseY); - } - else { - this.particleSystem = new ParticleSystem(new ScaledResolution(this.mc)); + int color = new Color(ClickGui.getInstance().moduleEnableC.getValue().getRed(), ClickGui.getInstance().moduleEnableC.getValue().getGreen(), ClickGui.getInstance().moduleEnableC.getValue().getBlue()).getRGB(); + + if (ClickGui.getInstance().dark.getValue()) { + this.drawDefaultBackground(); + } + if (ClickGui.getInstance().blur.getValue()) { + RenderUtil.drawBlurryRect(0, 0, sr.getScaledWidth(), sr.getScaledHeight(), ClickGui.getInstance().blurAmount.getValue(), ClickGui.getInstance().blurSize.getValue()); + } + if (ClickGui.getInstance().gradiant.getValue()) { + RenderUtil.drawGradientRect(0, 0, sr.getScaledWidth(), sr.getScaledHeight() + ClickGui.getInstance().gradiantHeight.getValue(), 0, new Color(ClickGui.getInstance().moduleEnableC.getValue().getRed(), ClickGui.getInstance().moduleEnableC.getValue().getGreen(), ClickGui.getInstance().moduleEnableC.getValue().getBlue(), ClickGui.getInstance().gradiantAlpha.getValue()).getRGB()); + if (ClickGui.getInstance().gradiant.getValue() && ClickGui.getInstance().colorSync.getValue() && Colors.getInstance().rainbow.getValue()) { + RenderUtil.drawGradientRect(0, 0, sr.getScaledWidth(), sr.getScaledHeight() + ClickGui.getInstance().gradiantHeight.getValue().intValue(), 0, (Colors.getInstance()).rainbow.getValue().booleanValue() ? (((Colors.getInstance()).rainbowModeA.getValue() == Colors.rainbowModeArray.Up) ? ColorUtil.rainbow((Colors.getInstance()).rainbowHue.getValue().intValue()).getRGB() : ColorUtil.rainbow((Colors.getInstance()).rainbowHue.getValue().intValue(), ClickGui.getInstance().hoverAlpha.getValue()).getRGB()) : color); } } + if (this.particleSystem != null && ClickGui.getInstance().particles.getValue()) { + this.particleSystem.render(mouseX, mouseY); + } else { + this.particleSystem = new ParticleSystem(new ScaledResolution(this.mc)); + } if(Windows.getInstance().altmanager.getValue()) WindowAltManager.drawScreen(mouseX,mouseY, partialTicks); if(Windows.getInstance().configs.getValue()) diff --git a/src/main/java/com/me/infinity/loop/features/gui/screen/windows/window/WindowAltManager.java b/src/main/java/me/loop/features/gui/other/windows/window/WindowAltManager.java similarity index 84% rename from src/main/java/com/me/infinity/loop/features/gui/screen/windows/window/WindowAltManager.java rename to src/main/java/me/loop/features/gui/other/windows/window/WindowAltManager.java index a26fc17..123383d 100644 --- a/src/main/java/com/me/infinity/loop/features/gui/screen/windows/window/WindowAltManager.java +++ b/src/main/java/me/loop/features/gui/other/windows/window/WindowAltManager.java @@ -1,4 +1,4 @@ -package com.me.infinity.loop.features.gui.screen.windows.window; +package me.loop.features.gui.other.windows.window; public class WindowAltManager { public static void drawScreen(int mouseX, int mouseY, float partialTicks) { diff --git a/src/main/java/com/me/infinity/loop/features/gui/screen/windows/window/WindowConfig.java b/src/main/java/me/loop/features/gui/other/windows/window/WindowConfig.java similarity index 89% rename from src/main/java/com/me/infinity/loop/features/gui/screen/windows/window/WindowConfig.java rename to src/main/java/me/loop/features/gui/other/windows/window/WindowConfig.java index 2d29f4e..1df1013 100644 --- a/src/main/java/com/me/infinity/loop/features/gui/screen/windows/window/WindowConfig.java +++ b/src/main/java/me/loop/features/gui/other/windows/window/WindowConfig.java @@ -1,10 +1,11 @@ -package com.me.infinity.loop.features.gui.screen.windows.window; - -import com.me.infinity.loop.features.gui.font.FontRender; -import com.me.infinity.loop.features.gui.screen.windows.window.parts.ConfigPart; -import com.me.infinity.loop.features.modules.client.ClickGui.ClickGui; -import com.me.infinity.loop.manager.ConfigManager; -import com.me.infinity.loop.util.utils.renders.RenderUtil; +package me.loop.features.gui.other.windows.window; + +import me.loop.features.gui.click.items.buttons.StringButton; +import me.loop.features.gui.font.FontRender; +import me.loop.features.gui.other.windows.window.parts.ConfigPart; +import me.loop.features.modules.client.clickgui.ClickGui; +import me.loop.manager.ConfigManager; +import me.loop.util.impl.RenderUtil; import net.minecraft.client.gui.ScaledResolution; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; @@ -14,8 +15,7 @@ import java.util.ArrayList; import java.util.Objects; -import static com.me.infinity.loop.features.gui.components.items.buttons.StringButton.removeLastChar; -import static com.me.infinity.loop.util.utils.Util.mc; +import static me.loop.util.impl.Util.mc; public class WindowConfig { private static int posX = 350; @@ -50,12 +50,12 @@ public class WindowConfig { static boolean once = false; public static void once(){ - file = new File("loop/"); + file = new File("loop"); } public static void drawScreen(int mouseX, int mouseY, float partialTicks) { ScaledResolution sr = new ScaledResolution(mc); - int color = new Color(ClickGui.getInstance().red.getValue(), ClickGui.getInstance().green.getValue(), ClickGui.getInstance().blue.getValue()).getRGB(); + int color = new Color(ClickGui.getInstance().moduleEnableC.getValue().getRed(), ClickGui.getInstance().moduleEnableC.getValue().getGreen(), ClickGui.getInstance().moduleEnableC.getValue().getBlue()).getRGB(); if(!once){ once(); once = false; @@ -138,7 +138,7 @@ public static void keyTyped(char typedChar, int keyCode) { return; } if(keyCode == 14){ - addString = removeLastChar(addString); + addString = StringButton.removeLastChar(addString); return; } if(keyCode == 28){ diff --git a/src/main/java/com/me/infinity/loop/features/gui/screen/windows/window/WindowFriends.java b/src/main/java/me/loop/features/gui/other/windows/window/WindowFriends.java similarity index 90% rename from src/main/java/com/me/infinity/loop/features/gui/screen/windows/window/WindowFriends.java rename to src/main/java/me/loop/features/gui/other/windows/window/WindowFriends.java index ef52df3..868b3ee 100644 --- a/src/main/java/com/me/infinity/loop/features/gui/screen/windows/window/WindowFriends.java +++ b/src/main/java/me/loop/features/gui/other/windows/window/WindowFriends.java @@ -1,10 +1,11 @@ -package com.me.infinity.loop.features.gui.screen.windows.window; - -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.features.gui.font.FontRender; -import com.me.infinity.loop.features.gui.screen.windows.window.parts.FriendPart; -import com.me.infinity.loop.features.modules.client.ClickGui.ClickGui; -import com.me.infinity.loop.util.utils.renders.RenderUtil; +package me.loop.features.gui.other.windows.window; + +import me.loop.InfinityLoop; +import me.loop.features.gui.click.items.buttons.StringButton; +import me.loop.features.gui.font.FontRender; +import me.loop.features.gui.other.windows.window.parts.FriendPart; +import me.loop.features.modules.client.clickgui.ClickGui; +import me.loop.util.impl.RenderUtil; import net.minecraft.client.gui.ScaledResolution; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; @@ -13,8 +14,7 @@ import java.util.ArrayList; import java.util.Objects; -import static com.me.infinity.loop.features.gui.components.items.buttons.StringButton.removeLastChar; -import static com.me.infinity.loop.util.utils.Util.mc; +import static me.loop.util.impl.Util.mc; public class WindowFriends { private static int posX; @@ -46,7 +46,7 @@ public class WindowFriends { public static void drawScreen(int mouseX, int mouseY, float partialTicks) { ScaledResolution sr = new ScaledResolution(mc); - int color = new Color(ClickGui.getInstance().red.getValue(), ClickGui.getInstance().green.getValue(), ClickGui.getInstance().blue.getValue()).getRGB(); + int color = new Color(ClickGui.getInstance().moduleEnableC.getValue().getRed(), ClickGui.getInstance().moduleEnableC.getValue().getGreen(), ClickGui.getInstance().moduleEnableC.getValue().getBlue()).getRGB(); if(drag){ posX = mouseX - dragX; posY = mouseY - dragY; @@ -123,7 +123,7 @@ public static void keyTyped(char typedChar, int keyCode) { return; } if(keyCode == 14){ - addString = removeLastChar(addString); + addString = StringButton.removeLastChar(addString); return; } if(keyCode == 28){ diff --git a/src/main/java/com/me/infinity/loop/features/gui/screen/windows/window/WindowPackets.java b/src/main/java/me/loop/features/gui/other/windows/window/WindowPackets.java similarity index 84% rename from src/main/java/com/me/infinity/loop/features/gui/screen/windows/window/WindowPackets.java rename to src/main/java/me/loop/features/gui/other/windows/window/WindowPackets.java index 337d863..92ec28e 100644 --- a/src/main/java/com/me/infinity/loop/features/gui/screen/windows/window/WindowPackets.java +++ b/src/main/java/me/loop/features/gui/other/windows/window/WindowPackets.java @@ -1,4 +1,4 @@ -package com.me.infinity.loop.features.gui.screen.windows.window; +package me.loop.features.gui.other.windows.window; public class WindowPackets { public static void drawScreen(int mouseX, int mouseY, float partialTicks) { diff --git a/src/main/java/com/me/infinity/loop/features/gui/screen/windows/window/parts/ConfigPart.java b/src/main/java/me/loop/features/gui/other/windows/window/parts/ConfigPart.java similarity index 86% rename from src/main/java/com/me/infinity/loop/features/gui/screen/windows/window/parts/ConfigPart.java rename to src/main/java/me/loop/features/gui/other/windows/window/parts/ConfigPart.java index c522142..d70a45c 100644 --- a/src/main/java/com/me/infinity/loop/features/gui/screen/windows/window/parts/ConfigPart.java +++ b/src/main/java/me/loop/features/gui/other/windows/window/parts/ConfigPart.java @@ -1,17 +1,17 @@ -package com.me.infinity.loop.features.gui.screen.windows.window.parts; +package me.loop.features.gui.other.windows.window.parts; -import com.me.infinity.loop.features.gui.font.FontRender; -import com.me.infinity.loop.features.command.Command; -import com.me.infinity.loop.manager.ConfigManager; -import com.me.infinity.loop.util.utils.Util; -import com.me.infinity.loop.util.utils.renders.RenderUtil; +import me.loop.features.command.Command; +import me.loop.features.gui.font.FontRender; +import me.loop.manager.ConfigManager; +import me.loop.util.impl.RenderUtil; +import me.loop.util.impl.Util; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.util.ResourceLocation; import java.awt.*; -import static com.me.infinity.loop.util.utils.renders.RenderUtil.drawCompleteImage; -import static com.me.infinity.loop.util.utils.renders.RenderUtil.drawImage; +import static me.loop.util.impl.RenderUtil.drawCompleteImage; +import static me.loop.util.impl.RenderUtil.drawImage; public class ConfigPart { public String name; diff --git a/src/main/java/com/me/infinity/loop/features/gui/screen/windows/window/parts/FriendPart.java b/src/main/java/me/loop/features/gui/other/windows/window/parts/FriendPart.java similarity index 85% rename from src/main/java/com/me/infinity/loop/features/gui/screen/windows/window/parts/FriendPart.java rename to src/main/java/me/loop/features/gui/other/windows/window/parts/FriendPart.java index a909165..2c96da7 100644 --- a/src/main/java/com/me/infinity/loop/features/gui/screen/windows/window/parts/FriendPart.java +++ b/src/main/java/me/loop/features/gui/other/windows/window/parts/FriendPart.java @@ -1,17 +1,18 @@ -package com.me.infinity.loop.features.gui.screen.windows.window.parts; +package me.loop.features.gui.other.windows.window.parts; -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.features.gui.font.FontRender; -import com.me.infinity.loop.util.utils.renders.RenderUtil; -import com.me.infinity.loop.util.utils.renders.shaders.PNGtoResourceLocation; import com.mojang.realmsclient.gui.ChatFormatting; +import me.loop.InfinityLoop; +import me.loop.features.gui.font.FontRender; +import me.loop.util.impl.RenderUtil; +import me.loop.util.init.shaders.PNGtoResourceLocation; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.util.ResourceLocation; + import java.awt.*; -import static com.me.infinity.loop.util.utils.Util.mc; -import static com.me.infinity.loop.util.utils.renders.RenderUtil.drawCompleteImage; -import static com.me.infinity.loop.util.utils.renders.RenderUtil.drawImage; +import static me.loop.util.impl.RenderUtil.drawCompleteImage; +import static me.loop.util.impl.RenderUtil.drawImage; +import static me.loop.util.impl.Util.mc; public class FriendPart{ diff --git a/src/main/java/com/me/infinity/loop/features/gui/screen/DrawableComponent.java b/src/main/java/me/loop/features/gui/screen/DrawableComponent.java similarity index 52% rename from src/main/java/com/me/infinity/loop/features/gui/screen/DrawableComponent.java rename to src/main/java/me/loop/features/gui/screen/DrawableComponent.java index 7153186..194111f 100644 --- a/src/main/java/com/me/infinity/loop/features/gui/screen/DrawableComponent.java +++ b/src/main/java/me/loop/features/gui/screen/DrawableComponent.java @@ -1,6 +1,6 @@ -package com.me.infinity.loop.features.gui.screen; +package me.loop.features.gui.screen; -import com.me.infinity.loop.util.utils.Util; +import me.loop.util.impl.Util; public abstract class DrawableComponent implements Util { diff --git a/src/main/java/com/me/infinity/loop/features/gui/screen/anchor/AnchorPoint.java b/src/main/java/me/loop/features/gui/screen/anchor/AnchorPoint.java similarity index 96% rename from src/main/java/com/me/infinity/loop/features/gui/screen/anchor/AnchorPoint.java rename to src/main/java/me/loop/features/gui/screen/anchor/AnchorPoint.java index c154055..d349d10 100644 --- a/src/main/java/com/me/infinity/loop/features/gui/screen/anchor/AnchorPoint.java +++ b/src/main/java/me/loop/features/gui/screen/anchor/AnchorPoint.java @@ -1,4 +1,4 @@ -package com.me.infinity.loop.features.gui.screen.anchor; +package me.loop.features.gui.screen.anchor; import net.minecraft.client.gui.ScaledResolution; diff --git a/src/main/java/com/me/infinity/loop/features/gui/screen/particles/Particle.java b/src/main/java/me/loop/features/gui/screen/effects/particles/Particle.java similarity index 89% rename from src/main/java/com/me/infinity/loop/features/gui/screen/particles/Particle.java rename to src/main/java/me/loop/features/gui/screen/effects/particles/Particle.java index 46658cb..ef079e8 100644 --- a/src/main/java/com/me/infinity/loop/features/gui/screen/particles/Particle.java +++ b/src/main/java/me/loop/features/gui/screen/effects/particles/Particle.java @@ -1,9 +1,9 @@ -package com.me.infinity.loop.features.gui.screen.particles; +package me.loop.features.gui.screen.effects.particles; -import com.me.infinity.loop.features.modules.client.ClickGui.ClickGui; -import com.me.infinity.loop.features.modules.client.Colors; -import com.me.infinity.loop.util.utils.renders.ColorUtil; -import com.me.infinity.loop.util.utils.renders.RenderUtil; +import me.loop.features.modules.client.clickgui.ClickGui; +import me.loop.features.modules.client.Colors; +import me.loop.util.impl.ColorUtil; +import me.loop.util.impl.RenderUtil; import net.minecraft.client.gui.ScaledResolution; import org.lwjgl.input.Mouse; @@ -72,7 +72,7 @@ public void render(int mouseX, int mouseY) { if (Colors.getInstance().rainbow.getValue() && ClickGui.getInstance().colorSync.getValue()) { RenderUtil.drawRect(this.pos.x, this.pos.y, this.pos.x + this.size, this.pos.y + this.size, ColorUtil.changeAlpha(0xFF9900EE, this.alpha)); } else { - RenderUtil.drawRect(this.pos.x, this.pos.y, this.pos.x + this.size, this.pos.y + this.size, new Color(ClickGui.getInstance().red.getValue(), ClickGui.getInstance().green.getValue(), ClickGui.getInstance().blue.getValue()).getRGB()); + RenderUtil.drawRect(this.pos.x, this.pos.y, this.pos.x + this.size, this.pos.y + this.size, new Color(ClickGui.getInstance().moduleMainC.getValue().getRed(), ClickGui.getInstance().moduleMainC.getValue().getGreen(), ClickGui.getInstance().moduleMainC.getValue().getBlue()).getRGB()); } } diff --git a/src/main/java/com/me/infinity/loop/features/gui/screen/particles/ParticleSystem.java b/src/main/java/me/loop/features/gui/screen/effects/particles/ParticleSystem.java similarity index 85% rename from src/main/java/com/me/infinity/loop/features/gui/screen/particles/ParticleSystem.java rename to src/main/java/me/loop/features/gui/screen/effects/particles/ParticleSystem.java index 4844c49..1e14e5c 100644 --- a/src/main/java/com/me/infinity/loop/features/gui/screen/particles/ParticleSystem.java +++ b/src/main/java/me/loop/features/gui/screen/effects/particles/ParticleSystem.java @@ -1,11 +1,11 @@ -package com.me.infinity.loop.features.gui.screen.particles; +package me.loop.features.gui.screen.effects.particles; -import com.me.infinity.loop.features.gui.InfinityLoopGui; -import com.me.infinity.loop.features.modules.client.ClickGui.ClickGui; -import com.me.infinity.loop.features.modules.client.Colors; -import com.me.infinity.loop.util.utils.renders.ColorUtil; -import com.me.infinity.loop.util.utils.renders.RenderUtil; -import com.me.infinity.loop.util.utils.maths.MathUtil; +import me.loop.features.gui.InfinityLoopGui; +import me.loop.features.modules.client.Colors; +import me.loop.features.modules.client.clickgui.ClickGui; +import me.loop.util.impl.ColorUtil; +import me.loop.util.impl.MathUtil; +import me.loop.util.impl.RenderUtil; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.ScaledResolution; @@ -61,7 +61,7 @@ public void render(int mouseX, int mouseY) { if (Colors.getInstance().rainbow.getValue() && ClickGui.getInstance().colorSync.getValue()) { RenderUtil.drawLine(particle.getPos().x + particle.getSize() / 2.0f, particle.getPos().y + particle.getSize() / 2.0f, otherParticle.getPos().x + otherParticle.getSize() / 2.0f, otherParticle.getPos().y + otherParticle.getSize() / 2.0f, 1.0f, ColorUtil.changeAlpha(0xFF9900EE, this.alpha)); } else { - RenderUtil.drawLine(particle.getPos().x + particle.getSize() / 2.0f, particle.getPos().y + particle.getSize() / 2.0f, otherParticle.getPos().x + otherParticle.getSize() / 2.0f, otherParticle.getPos().y + otherParticle.getSize() / 2.0f, 1.0f, new Color(ClickGui.getInstance().red.getValue(), ClickGui.getInstance().green.getValue(), ClickGui.getInstance().blue.getValue()).getRGB()); + RenderUtil.drawLine(particle.getPos().x + particle.getSize() / 2.0f, particle.getPos().y + particle.getSize() / 2.0f, otherParticle.getPos().x + otherParticle.getSize() / 2.0f, otherParticle.getPos().y + otherParticle.getSize() / 2.0f, 1.0f, new Color(ClickGui.getInstance().moduleMainC.getValue().getRed(), ClickGui.getInstance().moduleMainC.getValue().getGreen(), ClickGui.getInstance().moduleMainC.getValue().getBlue()).getRGB()); } } } diff --git a/src/main/java/com/me/infinity/loop/features/gui/screen/particles/ParticlesComponent.java b/src/main/java/me/loop/features/gui/screen/effects/particles/ParticlesComponent.java similarity index 55% rename from src/main/java/com/me/infinity/loop/features/gui/screen/particles/ParticlesComponent.java rename to src/main/java/me/loop/features/gui/screen/effects/particles/ParticlesComponent.java index 083d72b..b22d9d4 100644 --- a/src/main/java/com/me/infinity/loop/features/gui/screen/particles/ParticlesComponent.java +++ b/src/main/java/me/loop/features/gui/screen/effects/particles/ParticlesComponent.java @@ -1,6 +1,7 @@ -package com.me.infinity.loop.features.gui.screen.particles; +package me.loop.features.gui.screen.effects.particles; -import com.me.infinity.loop.features.gui.components.Component; + +import me.loop.features.gui.click.Component; public final class ParticlesComponent extends Component { diff --git a/src/main/java/com/me/infinity/loop/features/gui/screen/taskbar/TaskbarStage.java b/src/main/java/me/loop/features/gui/screen/taskbar/TaskbarStage.java similarity index 51% rename from src/main/java/com/me/infinity/loop/features/gui/screen/taskbar/TaskbarStage.java rename to src/main/java/me/loop/features/gui/screen/taskbar/TaskbarStage.java index 8aec286..f09c197 100644 --- a/src/main/java/com/me/infinity/loop/features/gui/screen/taskbar/TaskbarStage.java +++ b/src/main/java/me/loop/features/gui/screen/taskbar/TaskbarStage.java @@ -1,8 +1,8 @@ -package com.me.infinity.loop.features.gui.screen.taskbar; +package me.loop.features.gui.screen.taskbar; -import com.me.infinity.loop.features.gui.screen.DrawableComponent; -import com.me.infinity.loop.features.gui.screen.taskbar.element.Taskbar; -import com.me.infinity.loop.features.gui.screen.taskbar.element.TimeDate; +import me.loop.features.gui.screen.DrawableComponent; +import me.loop.features.gui.screen.taskbar.element.Taskbar; +import me.loop.features.gui.screen.taskbar.element.TimeDate; public class TaskbarStage extends DrawableComponent { private final Taskbar taskbar = new Taskbar(); diff --git a/src/main/java/com/me/infinity/loop/features/gui/screen/taskbar/element/Taskbar.java b/src/main/java/me/loop/features/gui/screen/taskbar/element/Taskbar.java similarity index 63% rename from src/main/java/com/me/infinity/loop/features/gui/screen/taskbar/element/Taskbar.java rename to src/main/java/me/loop/features/gui/screen/taskbar/element/Taskbar.java index 1dae4fa..1e68c16 100644 --- a/src/main/java/com/me/infinity/loop/features/gui/screen/taskbar/element/Taskbar.java +++ b/src/main/java/me/loop/features/gui/screen/taskbar/element/Taskbar.java @@ -1,10 +1,10 @@ -package com.me.infinity.loop.features.gui.screen.taskbar.element; +package me.loop.features.gui.screen.taskbar.element; -import com.me.infinity.loop.features.gui.screen.DrawableComponent; -import com.me.infinity.loop.features.modules.client.ClickGui.ClickGui; -import com.me.infinity.loop.features.modules.client.Colors; -import com.me.infinity.loop.util.utils.renders.ColorUtil; -import com.me.infinity.loop.util.utils.renders.RenderUtil; +import me.loop.features.gui.screen.DrawableComponent; +import me.loop.features.modules.client.clickgui.ClickGui; +import me.loop.features.modules.client.Colors; +import me.loop.util.impl.ColorUtil; +import me.loop.util.impl.RenderUtil; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.util.ResourceLocation; @@ -20,13 +20,13 @@ public class Taskbar extends DrawableComponent { public void drawComponent() { ScaledResolution resolution = new ScaledResolution(mc); if (ClickGui.getInstance().colorSync.getValue()) { - RenderUtil.drawOutlineRect(0, 0, resolution.getScaledWidth(), 30, new Color(Colors.getInstance().red.getValue(), Colors.getInstance().green.getValue(), Colors.getInstance().blue.getValue(), 250), 3f); + RenderUtil.drawOutlineRect(0, 0, resolution.getScaledWidth(), 30, new Color(Colors.getInstance().c.getValue().getRed(), Colors.getInstance().c.getValue().getGreen(), Colors.getInstance().c.getValue().getBlue(), 255), 3f); } else { - RenderUtil.drawOutlineRect(0, 0, resolution.getScaledWidth(), 30, new Color(ClickGui.getInstance().red.getValue(), ClickGui.getInstance().green.getValue(), ClickGui.getInstance().blue.getValue(), 250), 3f); + RenderUtil.drawOutlineRect(0, 0, resolution.getScaledWidth(), 30, new Color(ClickGui.getInstance().moduleMainC.getValue().getRed(), ClickGui.getInstance().moduleMainC.getValue().getGreen(), ClickGui.getInstance().moduleMainC.getValue().getBlue(), 250), 3f); //RenderUtil.drawRect(0, 0, resolution.getScaledWidth(), 31, new Color(ClickGui.getInstance().red.getValue(), ClickGui.getInstance().green.getValue(), ClickGui.getInstance().blue.getValue(), 250).getRGB()); } if (ClickGui.getInstance().colorSync.getValue() && Colors.getInstance().rainbow.getValue()) { - RenderUtil.drawOutlineRect(0, 0, resolution.getScaledWidth(), 30, (Colors.getInstance()).rainbow.getValue().booleanValue() ? (ColorUtil.rainbow((Colors.getInstance()).rainbowHue.getValue().intValue())) : new Color(Colors.getInstance().red.getValue(), Colors.getInstance().green.getValue(), Colors.getInstance().blue.getValue()), 3f); + RenderUtil.drawOutlineRect(0, 0, resolution.getScaledWidth(), 30, (Colors.getInstance()).rainbow.getValue().booleanValue() ? (ColorUtil.rainbow((Colors.getInstance()).rainbowHue.getValue().intValue())) : new Color(Colors.getInstance().c.getValue().getRed(), Colors.getInstance().c.getValue().getGreen(), Colors.getInstance().c.getValue().getBlue()), 3f); } RenderUtil.drawRect(0, 0, resolution.getScaledWidth(), 30, new Color(23, 23, 29).getRGB()); glPushMatrix(); @@ -42,7 +42,7 @@ public void drawComponent() { glPushMatrix(); /* // player name scaled width - float scaledWidth = (InfinityLoop.textManager.getStringWidth(mc.player.getName()) + 8) * 2.75F; + float scaledWidth = (Managers.textManager.getStringWidth(mc.player.getName()) + 8) * 2.75F; RenderUtil.drawRect(0, resolution.getScaledHeight() - 44, scaledWidth, 44, new Color(23, 23, 29).getRGB()); @@ -50,7 +50,7 @@ public void drawComponent() { glScaled(2.75, 2.75, 2.75); { float scaledX = 7 * 0.36363636F; float scaledY = (resolution.getScaledHeight() - 35) * 0.36363636F; - InfinityLoop.textManager.drawStringWithShadow(mc.player.getName(), scaledX, scaledY, new Color(ClickGui.getInstance().red.getValue(), ClickGui.getInstance().green.getValue(), ClickGui.getInstance().blue.getValue()).getRGB()); + Managers.textManager.drawStringWithShadow(mc.player.getName(), scaledX, scaledY, new Color(ClickGui.getInstance().red.getValue(), ClickGui.getInstance().green.getValue(), ClickGui.getInstance().blue.getValue()).getRGB()); } glScaled(0.36363636F, 0.36363636F, 0.36363636F); diff --git a/src/main/java/com/me/infinity/loop/features/gui/screen/taskbar/element/TimeDate.java b/src/main/java/me/loop/features/gui/screen/taskbar/element/TimeDate.java similarity index 65% rename from src/main/java/com/me/infinity/loop/features/gui/screen/taskbar/element/TimeDate.java rename to src/main/java/me/loop/features/gui/screen/taskbar/element/TimeDate.java index 291650f..1452f26 100644 --- a/src/main/java/com/me/infinity/loop/features/gui/screen/taskbar/element/TimeDate.java +++ b/src/main/java/me/loop/features/gui/screen/taskbar/element/TimeDate.java @@ -1,9 +1,9 @@ -package com.me.infinity.loop.features.gui.screen.taskbar.element; +package me.loop.features.gui.screen.taskbar.element; -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.features.gui.screen.DrawableComponent; -import com.me.infinity.loop.util.utils.renders.builder.Render2DBuilder; import com.mojang.realmsclient.gui.ChatFormatting; +import me.loop.InfinityLoop; +import me.loop.features.gui.screen.DrawableComponent; +import me.loop.util.impl.Render2DBuilder; import java.text.SimpleDateFormat; import java.util.Date; diff --git a/src/main/java/com/me/infinity/loop/features/modules/Module.java b/src/main/java/me/loop/features/modules/Module.java similarity index 64% rename from src/main/java/com/me/infinity/loop/features/modules/Module.java rename to src/main/java/me/loop/features/modules/Module.java index 781443f..cc062bd 100644 --- a/src/main/java/com/me/infinity/loop/features/modules/Module.java +++ b/src/main/java/me/loop/features/modules/Module.java @@ -1,29 +1,26 @@ -package com.me.infinity.loop.features.modules; - -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.event.events.render.Render2DEvent; -import com.me.infinity.loop.event.events.render.Render3DEvent; -import com.me.infinity.loop.event.events.render.RenderEvent; -import com.me.infinity.loop.features.Feature; -import com.me.infinity.loop.features.command.Command; -import com.me.infinity.loop.features.modules.client.HUD; -import com.me.infinity.loop.features.setting.impl.Bind; -import com.me.infinity.loop.features.setting.Setting; +package me.loop.features.modules; + import com.mojang.realmsclient.gui.ChatFormatting; +import me.loop.InfinityLoop; +import me.loop.event.events.ClientEvent; +import me.loop.event.events.Render2DEvent; +import me.loop.event.events.Render3DEvent; +import me.loop.features.Feature; +import me.loop.features.command.Command; +import me.loop.features.modules.client.HUD; +import me.loop.features.setting.Bind; +import me.loop.features.setting.Setting; import net.minecraft.util.text.TextComponentString; import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.fml.common.gameevent.TickEvent; -public abstract class Module +public class Module extends Feature { private final String description; - private final ModuleCategory category; - public Setting enabled = this.register(new Setting<>("Enabled", false)); - public Setting drawn = this.register(new Setting<>("Drawn", true)); - public Setting bind = this.register(new Setting<>("Keybind", new Bind(-1))); + private final Category category; + public Setting enabled = this.register(new Setting("Enabled", false)); + public Setting drawn = this.register(new Setting("Drawn", true)); + public Setting bind = this.register(new Setting("Keybind", new Bind(-1))); public Setting displayName; - public boolean toggled; - public boolean persistent; public boolean hasListener; public boolean alwaysListening; public boolean hidden; @@ -33,40 +30,29 @@ public abstract class Module public float vOffset; public boolean sliding; - public Module(String name, String description, ModuleCategory category) { + public Module(String name, String description, Category category, boolean hasListener, boolean hidden, boolean alwaysListening) { super(name); - this.displayName = this.register(new Setting<>("DisplayName", name)); + this.displayName = this.register(new Setting("DisplayName", name)); this.description = description; this.category = category; - this.persistent = false; - } - - public Module(String name, String description, ModuleCategory category, boolean persistent) { - super(name); - this.displayName = this.register(new Setting<>("DisplayName", name)); - this.description = description; - this.category = category; - this.persistent = persistent; - this.persist(); - } - - public ModuleCategory getCategory() { - return this.category; + this.hasListener = hasListener; + this.hidden = hidden; + this.alwaysListening = alwaysListening; } public boolean isSliding() { return this.sliding; } - public void onMotionUpdate() { - } - public void onEnable() { } public void onDisable() { } + public void onToggle() { + } + public void onLoad() { } @@ -82,9 +68,6 @@ public void onLogout() { public void onUpdate() { } - public void onWorldRender(RenderEvent event) { - - } public void onRender2D(Render2DEvent event) { } @@ -94,21 +77,6 @@ public void onRender3D(Render3DEvent event) { public void onUnload() { } - public String getHudInfo() { - return ""; - } - - public void onClientTick(final TickEvent.ClientTickEvent event) { - } - - public boolean isToggled() { - return this.toggled; - } - - public void setToggled(final boolean toggled) { - this.toggled = toggled; - } - public String getDisplayInfo() { return null; } @@ -118,7 +86,7 @@ public boolean isOn() { } public boolean isOff() { - return !this.enabled.getValue(); + return this.enabled.getValue() == false; } public void setEnabled(boolean enabled) { @@ -129,17 +97,9 @@ public void setEnabled(boolean enabled) { } } - public void persist() { - block0: { - if (!this.persistent) break block0; - this.setToggled(true); - MinecraftForge.EVENT_BUS.register((Object)this); - } - } - public void enable() { this.enabled.setValue(Boolean.TRUE); - this.setToggled(true); + this.onToggle(); this.onEnable(); if (HUD.getInstance().notifyToggles.getValue().booleanValue()) { TextComponentString text = new TextComponentString(InfinityLoop.commandManager.getClientMessage() + " " + ChatFormatting.GREEN + this.getDisplayName() + " toggled on."); @@ -159,15 +119,15 @@ public void disable() { TextComponentString text = new TextComponentString(InfinityLoop.commandManager.getClientMessage() + " " + ChatFormatting.RED + this.getDisplayName() + " toggled off."); Module.mc.ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(text, 1); } - this.setToggled(false); + this.onToggle(); this.onDisable(); } public void toggle() { - if (this.toggled) { - this.disable(); - } else { - this.enable(); + ClientEvent event = new ClientEvent(!this.isEnabled() ? 1 : 0, this); + MinecraftForge.EVENT_BUS.post(event); + if (!event.isCanceled()) { + this.setEnabled(!this.isEnabled()); } } @@ -198,8 +158,8 @@ public void setDrawn(boolean drawn) { this.drawn.setValue(drawn); } - public void setUndrawn() { - this.drawn.setValue(null); + public Category getCategory() { + return this.category; } public String getInfo() { @@ -222,5 +182,23 @@ public String getFullArrayString() { return this.getDisplayName() + ChatFormatting.GRAY + (this.getDisplayInfo() != null ? " [" + ChatFormatting.WHITE + this.getDisplayInfo() + ChatFormatting.GRAY + "]" : ""); } + public enum Category { + COMBAT("Combat"), + MISC("Misc"), + RENDER("Render"), + MOVEMENT("Movement"), + PLAYER("Player"), + CLIENT("Client"); + + private final String name; + + Category(String name) { + this.name = name; + } + + public String getName() { + return this.name; + } + } } diff --git a/src/main/java/me/loop/features/modules/client/BlurExtends.java b/src/main/java/me/loop/features/modules/client/BlurExtends.java new file mode 100644 index 0000000..cb94276 --- /dev/null +++ b/src/main/java/me/loop/features/modules/client/BlurExtends.java @@ -0,0 +1,48 @@ +package me.loop.features.modules.client; + +import me.loop.features.modules.Module; +import me.loop.util.impl.Util; +import net.minecraft.client.gui.*; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.gui.inventory.GuiEditSign; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fml.client.GuiModList; + +public class BlurExtends extends Module implements Util { + + public BlurExtends() { + super("BlurExtends", "Sussy", Category.CLIENT, true, false, false); + } + + public void onDisable() { + if (BlurExtends.mc.world != null) { + BlurExtends.mc.entityRenderer.getShaderGroup().deleteShaderGroup(); + } + + } + + public void onUpdate() { + if (BlurExtends.mc.world != null) { + if (!(BlurExtends.mc.currentScreen instanceof GuiContainer) && !(BlurExtends.mc.currentScreen instanceof GuiChat) && !(BlurExtends.mc.currentScreen instanceof GuiConfirmOpenLink) && !(BlurExtends.mc.currentScreen instanceof GuiEditSign) && !(BlurExtends.mc.currentScreen instanceof GuiGameOver) && !(BlurExtends.mc.currentScreen instanceof GuiOptions) && !(BlurExtends.mc.currentScreen instanceof GuiIngameMenu) && !(BlurExtends.mc.currentScreen instanceof GuiVideoSettings) && !(BlurExtends.mc.currentScreen instanceof GuiScreenOptionsSounds) && !(BlurExtends.mc.currentScreen instanceof GuiControls) && !(BlurExtends.mc.currentScreen instanceof GuiCustomizeSkin) && !(BlurExtends.mc.currentScreen instanceof GuiModList)) { + if (BlurExtends.mc.entityRenderer.getShaderGroup() != null) { + BlurExtends.mc.entityRenderer.getShaderGroup().deleteShaderGroup(); + } + } else if (OpenGlHelper.shadersSupported && BlurExtends.mc.getRenderViewEntity() instanceof EntityPlayer) { + if (BlurExtends.mc.entityRenderer.getShaderGroup() != null) { + BlurExtends.mc.entityRenderer.getShaderGroup().deleteShaderGroup(); + } + + try { + BlurExtends.mc.entityRenderer.loadShader(new ResourceLocation("shaders/post/blur.json")); + } catch (Exception exception) { + exception.printStackTrace(); + } + } else if (BlurExtends.mc.entityRenderer.getShaderGroup() != null && BlurExtends.mc.currentScreen == null) { + BlurExtends.mc.entityRenderer.getShaderGroup().deleteShaderGroup(); + } + } + + } +} diff --git a/src/main/java/com/me/infinity/loop/features/modules/client/Colors.java b/src/main/java/me/loop/features/modules/client/Colors.java similarity index 67% rename from src/main/java/com/me/infinity/loop/features/modules/client/Colors.java rename to src/main/java/me/loop/features/modules/client/Colors.java index 31af341..b5bb0f6 100644 --- a/src/main/java/com/me/infinity/loop/features/modules/client/Colors.java +++ b/src/main/java/me/loop/features/modules/client/Colors.java @@ -1,34 +1,30 @@ -package com.me.infinity.loop.features.modules.client; +package me.loop.features.modules.client; -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.modules.client.ClickGui.ClickGui; -import com.me.infinity.loop.features.setting.Setting; -import com.me.infinity.loop.util.utils.renders.ColorUtil; +import me.loop.InfinityLoop; +import me.loop.features.modules.Module; +import me.loop.features.modules.client.clickgui.ClickGui; +import me.loop.features.setting.Setting; +import me.loop.util.impl.ColorUtil; -import java.awt.Color; +import java.awt.*; import java.util.HashMap; import java.util.Map; public class Colors extends Module { private static Colors INSTANCE = new Colors(); + public Setting c = this.register(new Setting("Color", new Color(-1))); public Setting rainbow = this.register(new Setting<>("Rainbow", Boolean.valueOf(false), "Rainbow colors.")); - public Setting rainbowModeHud = this.register(new Setting("HRainbowMode", rainbowMode.Static, v -> this.rainbow.getValue())); public Setting rainbowModeA = this.register(new Setting("ARainbowMode", rainbowModeArray.Static, v -> this.rainbow.getValue())); public Setting rainbowHue = this.register(new Setting("Delay", Integer.valueOf(160), Integer.valueOf(0), Integer.valueOf(600), v -> this.rainbow.getValue())); public Setting rainbowSaturation = this.register(new Setting("Saturation", Integer.valueOf(120), Integer.valueOf(0), Integer.valueOf(255), v -> this.rainbow.getValue())); public Setting rainbowBrightness = this.register(new Setting("Brightness", Integer.valueOf(170), Integer.valueOf(0), Integer.valueOf(255), v -> this.rainbow.getValue())); - public Setting red = this.register(new Setting("Red", Integer.valueOf(230), Integer.valueOf(0), Integer.valueOf(255), v -> !this.rainbow.getValue())); - public Setting green = this.register(new Setting("Green", Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(255), v -> !this.rainbow.getValue())); - public Setting blue = this.register(new Setting("Blue", Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(255), v -> !this.rainbow.getValue())); - public Setting alpha = this.register(new Setting("Alpha", Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(255), v -> !this.rainbow.getValue())); + public float hue; public Map colorHeightMap = new HashMap(); public Colors() { - super("Colors", "Universal colors.", ModuleCategory.CLIENT); + super("Colors", "Universal colors.", Category.CLIENT, true, false, false); this.setInstance(); } @@ -61,7 +57,7 @@ public Color getCurrentColor() { if (this.rainbow.getValue().booleanValue()) { return ColorUtil.rainbow(this.rainbowHue.getValue()); } - return new Color(this.red.getValue(), this.green.getValue(), this.blue.getValue(), this.alpha.getValue()); + return new Color(this.c.getValue().getRed(), this.c.getValue().getGreen(), this.c.getValue().getBlue(), this.c.getValue().getAlpha()); } public enum rainbowModeArray { diff --git a/src/main/java/com/me/infinity/loop/features/modules/client/FontMod.java b/src/main/java/me/loop/features/modules/client/FontMod.java similarity index 81% rename from src/main/java/com/me/infinity/loop/features/modules/client/FontMod.java rename to src/main/java/me/loop/features/modules/client/FontMod.java index 5c1ef12..2e6eaff 100644 --- a/src/main/java/com/me/infinity/loop/features/modules/client/FontMod.java +++ b/src/main/java/me/loop/features/modules/client/FontMod.java @@ -1,12 +1,11 @@ -package com.me.infinity.loop.features.modules.client; +package me.loop.features.modules.client; -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.event.events.client.ClientEvent; -import com.me.infinity.loop.features.modules.ModuleCategory; import com.mojang.realmsclient.gui.ChatFormatting; -import com.me.infinity.loop.features.command.Command; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.setting.Setting; +import me.loop.InfinityLoop; +import me.loop.event.events.ClientEvent; +import me.loop.features.command.Command; +import me.loop.features.modules.Module; +import me.loop.features.setting.Setting; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import java.awt.*; @@ -22,7 +21,7 @@ public class FontMod private boolean reloadFont = false; public FontMod() { - super("CustomFont", "CustomFont for all of the clients text. Use the font command.", ModuleCategory.CLIENT); + super("CustomFont", "CustomFont for all of the clients text. Use the font command.", Module.Category.CLIENT, true, false, false); this.setInstance(); } @@ -52,7 +51,7 @@ private void setInstance() { @SubscribeEvent public void onSettingChange(ClientEvent event) { Setting setting; - if (event.isPre() && (setting = event.getSetting()) != null && setting.getFeature().equals(this)) { + if (event.getStage() == 2 && (setting = event.getSetting()) != null && setting.getFeature().equals(this)) { if (setting.getName().equals("FontName") && !FontMod.checkFont(setting.getPlannedValue().toString(), false)) { Command.sendMessage(ChatFormatting.RED + "That font doesnt exist."); event.setCanceled(true); diff --git a/src/main/java/com/me/infinity/loop/features/modules/client/HUD.java b/src/main/java/me/loop/features/modules/client/HUD.java similarity index 95% rename from src/main/java/com/me/infinity/loop/features/modules/client/HUD.java rename to src/main/java/me/loop/features/modules/client/HUD.java index daf5b49..b9ecae5 100644 --- a/src/main/java/com/me/infinity/loop/features/modules/client/HUD.java +++ b/src/main/java/me/loop/features/modules/client/HUD.java @@ -1,35 +1,34 @@ -package com.me.infinity.loop.features.modules.client; +package me.loop.features.modules.client; -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.event.events.client.ClientEvent; -import com.me.infinity.loop.event.events.render.Render2DEvent; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.modules.client.ClickGui.ClickGui; -import com.me.infinity.loop.util.utils.EntityUtil; import com.mojang.realmsclient.gui.ChatFormatting; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.setting.Setting; -import com.me.infinity.loop.util.utils.maths.MathUtil; -import com.me.infinity.loop.util.utils.worlds.Timer; -import com.me.infinity.loop.util.utils.renders.ColorUtil; -import com.me.infinity.loop.util.utils.renders.RenderUtil; -import com.me.infinity.loop.util.utils.renders.TextUtil; +import me.loop.InfinityLoop; +import me.loop.event.events.ClientEvent; +import me.loop.event.events.Render2DEvent; +import me.loop.features.Feature; +import me.loop.features.modules.Module; +import me.loop.features.setting.Setting; +import me.loop.util.impl.*; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; +import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.util.ResourceLocation; import net.minecraftforge.event.entity.player.AttackEntityEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import java.awt.*; import java.text.SimpleDateFormat; +import java.util.List; import java.util.*; public class HUD extends Module { private static final ResourceLocation box = new ResourceLocation("textures/gui/container/shulker_box.png"); private static final ItemStack totem = new ItemStack(Items.TOTEM_OF_UNDYING); private static HUD INSTANCE = new HUD(); + private final Map potionColorMap = new HashMap(); + public Map colorMap = new HashMap(); private final Setting grayNess = register(new Setting("Gray", Boolean.valueOf(true))); private final Setting renderingUp = register(new Setting("RenderingUp", Boolean.valueOf(false), "Orientation of the HUD-Elements.")); private final Setting waterMark = register(new Setting("Watermark", Boolean.valueOf(false), "displays watermark")); @@ -45,14 +44,15 @@ public class HUD extends Module { private final Setting tps = register(new Setting("TPS", Boolean.valueOf(false), "Ticks per second of the server.")); private final Setting fps = register(new Setting("FPS", Boolean.valueOf(false), "Your frames per second.")); private final Setting lag = register(new Setting("LagNotifier", Boolean.valueOf(false), "The time")); - private final Timer timer = new Timer(); + private final java.util.Timer timer = new Timer(); private final Map players = new HashMap<>(); - public Setting command = register(new Setting("Command", "[InfinityLoop]")); + public Setting command = register(new Setting("Command", "OyVey")); public Setting bracketColor = register(new Setting("BracketColor", TextUtil.Color.BLUE)); public Setting commandColor = register(new Setting("NameColor", TextUtil.Color.BLUE)); public Setting commandBracket = register(new Setting("Bracket", "<")); public Setting commandBracket2 = register(new Setting("Bracket2", ">")); public Setting notifyToggles = register(new Setting("ChatNotify", Boolean.valueOf(false), "notifys in chat")); + public Setting magenDavid = register(new Setting("MagenDavid", Boolean.valueOf(false), "draws magen david")); public Setting animationHorizontalTime = register(new Setting("AnimationHTime", Integer.valueOf(500), Integer.valueOf(1), Integer.valueOf(1000), v -> this.arrayList.getValue().booleanValue())); public Setting animationVerticalTime = register(new Setting("AnimationVTime", Integer.valueOf(50), Integer.valueOf(1), Integer.valueOf(500), v -> this.arrayList.getValue().booleanValue())); public Setting renderingMode = register(new Setting("Ordering", RenderingMode.ABC)); @@ -62,11 +62,9 @@ public class HUD extends Module { private int color; private boolean shouldIncrement; private int hitMarkerTimer; - public Map colorMap; public HUD() { - super("HUD", "HUD Elements rendered on your screen", ModuleCategory.CLIENT); - this.colorMap = new HashMap(); + super("HUD", "HUD Elements rendered on your screen", Module.Category.CLIENT, true, false, false); setInstance(); } @@ -90,14 +88,14 @@ public void onUpdate() { } public void onRender2D(Render2DEvent event) { - if (fullNullCheck()) + if (Feature.fullNullCheck()) return; int width = this.renderer.scaledWidth; int height = this.renderer.scaledHeight; - this.color = ColorUtil.toRGBA((ClickGui.getInstance()).red.getValue().intValue(), (ClickGui.getInstance()).green.getValue().intValue(), (ClickGui.getInstance()).blue.getValue().intValue()); + this.color = ColorUtil.toRGBA((Colors.getInstance()).c.getValue().getRed(), (Colors.getInstance()).c.getValue().getGreen(), (Colors.getInstance()).c.getValue().getBlue()); if (this.waterMark.getValue().booleanValue()) { String string = this.command.getPlannedValue() + " v0.0.3"; - if ((ClickGui.getInstance()).colorSync.getValue().booleanValue()) { + if ((Colors.getInstance()).rainbow.getValue().booleanValue()) { if ((Colors.getInstance()).rainbowModeHud.getValue() == Colors.rainbowMode.Static) { this.renderer.drawString(string, 2.0F, this.waterMarkY.getValue().intValue(), ColorUtil.rainbow((Colors.getInstance()).rainbowHue.getValue().intValue()).getRGB(), true); } else { @@ -262,7 +260,7 @@ public void onRender2D(Render2DEvent event) { String coords = this.coords.getValue().booleanValue() ? coordinates : ""; i += 10; if ((Colors.getInstance()).rainbow.getValue().booleanValue()) { - String rainbowCoords = this.coords.getValue().booleanValue() ? ("XYZ " + ((posX + ", " + posY + ", " + posZ + " [" + hposX + ", " + hposZ + "]"))) : ""; + String rainbowCoords = this.coords.getValue().booleanValue() ? ("XYZ " + (inHell ? (posX + ", " + posY + ", " + posZ + " [" + hposX + ", " + hposZ + "]") : (posX + ", " + posY + ", " + posZ + " [" + hposX + ", " + hposZ + "]"))) : ""; if ((Colors.getInstance()).rainbowModeHud.getValue() == Colors.rainbowMode.Static) { this.renderer.drawString(direction, 2.0F, (height - i - 11), ColorUtil.rainbow((Colors.getInstance()).rainbowHue.getValue().intValue()).getRGB(), true); this.renderer.drawString(rainbowCoords, 2.0F, (height - i), ColorUtil.rainbow((Colors.getInstance()).rainbowHue.getValue().intValue()).getRGB(), true); @@ -398,14 +396,14 @@ public void onUpdateWalkingPlayer(AttackEntityEvent event) { } public void onLoad() { - InfinityLoop.commandManager.getClientMessage(); + InfinityLoop.commandManager.setClientMessage(getCommandMessage()); } @SubscribeEvent public void onSettingChange(ClientEvent event) { - if (event.isPre() && + if (event.getStage() == 2 && equals(event.getSetting().getFeature())) - InfinityLoop.commandManager.getClientMessage(); + InfinityLoop.commandManager.setClientMessage(getCommandMessage()); } public String getCommandMessage() { diff --git a/src/main/java/com/me/infinity/loop/features/modules/client/MainSettings.java b/src/main/java/me/loop/features/modules/client/MainSettings.java similarity index 61% rename from src/main/java/com/me/infinity/loop/features/modules/client/MainSettings.java rename to src/main/java/me/loop/features/modules/client/MainSettings.java index 136c3a6..e154c36 100644 --- a/src/main/java/com/me/infinity/loop/features/modules/client/MainSettings.java +++ b/src/main/java/me/loop/features/modules/client/MainSettings.java @@ -1,12 +1,11 @@ -package com.me.infinity.loop.features.modules.client; +package me.loop.features.modules.client; -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.event.events.client.ClientEvent; -import com.me.infinity.loop.features.command.Command; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.setting.Setting; import com.mojang.realmsclient.gui.ChatFormatting; +import me.loop.InfinityLoop; +import me.loop.event.events.ClientEvent; +import me.loop.features.command.Command; +import me.loop.features.modules.Module; +import me.loop.features.setting.Setting; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class MainSettings extends Module { @@ -14,18 +13,18 @@ public class MainSettings extends Module { public Setting showcapes = this.register(new Setting<>("Capes", true)); public Setting DownloadCapes = this.register(new Setting<>("DownloadCapes", true)); public Setting notifyToggles = this.register(new Setting<>("NotifyToggles", false)); - public Setting renderRotations = this.register(new Setting<>("RenderRotations", true)); public Setting prefix = this.register(new Setting("Prefix", ".")); public Setting mainMenu = this.register(new Setting<>("MainMenu", true)); - public Setting shaderMode = register(new Setting("ShaderMode", ShaderModeEn.Smoke2, v -> this.mainMenu.getValue())); + public Setting shaderMode = this.register(new Setting("ShaderMode", ShaderModeEn.Smoke2, v -> this.mainMenu.getValue())); + public Setting ofFastRender = this.register(new Setting<>("TurnOffFastRender", true)); public MainSettings() { - super("MainSettings", "MAIN MENU", ModuleCategory.CLIENT); + super("MainSettings", "MAIN MENU", Category.CLIENT, true, false, true); } @SubscribeEvent public void onSettingChange(ClientEvent event) { - if (event.isPre() && event.getSetting().getFeature().equals(this)) { + if (event.getStage() == 0 && event.getSetting().getFeature().equals(this)) { if (event.getSetting().equals(this.prefix)) { InfinityLoop.commandManager.setPrefix(this.prefix.getPlannedValue()); Command.sendMessage("Prefix set to " + ChatFormatting.DARK_GRAY + InfinityLoop.commandManager.getPrefix()); diff --git a/src/main/java/com/me/infinity/loop/features/modules/client/RPC.java b/src/main/java/me/loop/features/modules/client/RPC.java similarity index 54% rename from src/main/java/com/me/infinity/loop/features/modules/client/RPC.java rename to src/main/java/me/loop/features/modules/client/RPC.java index 589883f..17eb243 100644 --- a/src/main/java/com/me/infinity/loop/features/modules/client/RPC.java +++ b/src/main/java/me/loop/features/modules/client/RPC.java @@ -1,19 +1,17 @@ -package com.me.infinity.loop.features.modules.client; +package me.loop.features.modules.client; -import com.me.infinity.loop.DiscordPresence; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.setting.Setting; +import me.loop.DiscordPresence; +import me.loop.features.modules.Module; +import me.loop.features.setting.Setting; public class RPC - extends Module -{ + extends Module { public static RPC INSTANCE; public Setting showIP = this.register(new Setting<>("IP", false)); public Setting users = this.register(new Setting<>("users", false)); public RPC() { - super("RPC", "Discord rich presence", ModuleCategory.CLIENT); + super("RPC", "Discord rich presence", Category.CLIENT, true, false, true); RPC.INSTANCE = this; } diff --git a/src/main/java/com/me/infinity/loop/features/modules/client/Windows.java b/src/main/java/me/loop/features/modules/client/Windows.java similarity index 67% rename from src/main/java/com/me/infinity/loop/features/modules/client/Windows.java rename to src/main/java/me/loop/features/modules/client/Windows.java index a11c88c..43d00c9 100644 --- a/src/main/java/com/me/infinity/loop/features/modules/client/Windows.java +++ b/src/main/java/me/loop/features/modules/client/Windows.java @@ -1,17 +1,17 @@ -package com.me.infinity.loop.features.modules.client; +package me.loop.features.modules.client; -import com.me.infinity.loop.features.gui.screen.windows.WindowsGui; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.setting.Setting; -import com.me.infinity.loop.util.utils.Util; + +import me.loop.features.gui.other.windows.WindowsGui; +import me.loop.features.modules.Module; +import me.loop.features.setting.Setting; +import me.loop.util.impl.Util; public class Windows extends Module { private static Windows INSTANCE = new Windows(); public Windows() { - super("Windows", "Windows", ModuleCategory.CLIENT); + super("Windows", "Windows", Category.CLIENT, true, false, false); this.setInstance(); } diff --git a/src/main/java/me/loop/features/modules/client/clickgui/ClickEnum.java b/src/main/java/me/loop/features/modules/client/clickgui/ClickEnum.java new file mode 100644 index 0000000..13f0b9c --- /dev/null +++ b/src/main/java/me/loop/features/modules/client/clickgui/ClickEnum.java @@ -0,0 +1,29 @@ +package me.loop.features.modules.client.clickgui; + +public class ClickEnum { + + public enum Settings { + Main, + Color, + Misc, + BackGround + } + + public enum Style { + None, + ShowBind, + OpenColse, + Future + } + + public enum SliderType { + Fill, + Line + } + + public enum Mode { + Frame, + Folow, + None + } +} diff --git a/src/main/java/me/loop/features/modules/client/clickgui/ClickGui.java b/src/main/java/me/loop/features/modules/client/clickgui/ClickGui.java new file mode 100644 index 0000000..3f90441 --- /dev/null +++ b/src/main/java/me/loop/features/modules/client/clickgui/ClickGui.java @@ -0,0 +1,127 @@ +package me.loop.features.modules.client.clickgui; + +import me.loop.InfinityLoop; +import me.loop.event.events.ClientEvent; +import me.loop.features.gui.InfinityLoopGui; +import me.loop.features.gui.screen.anchor.AnchorPoint; +import me.loop.features.modules.Module; +import me.loop.features.modules.client.Colors; +import me.loop.features.setting.Setting; +import net.minecraft.client.gui.GuiMainMenu; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +import java.awt.*; +import java.util.ArrayList; +import java.util.List; + +public class ClickGui + extends Module { + + private static ClickGui INSTANCE = new ClickGui(); + + public Setting setting = this.register(new Setting("Page", ClickEnum.Settings.Main)); + + public Setting moduleiconmode = register(new Setting("ModuleIcon",true, v -> this.setting.getValue() == ClickEnum.Settings.Main)); + public Setting butonIcon = register(new Setting("ButtonIcon", ClickEnum.Style.OpenColse, v -> this.setting.getValue() == ClickEnum.Settings.Main)); + public Setting open = register(new Setting("Open: ", "+", v -> this.setting.getValue() == ClickEnum.Settings.Main && this.butonIcon.getValue() == ClickEnum.Style.OpenColse).setRenderName(true)); + public Setting close = register(new Setting("Close: ", "-", v -> this.setting.getValue() == ClickEnum.Settings.Main && this.butonIcon.getValue() == ClickEnum.Style.OpenColse).setRenderName(true)); + + // MISC + public Setting scroll = this.register(new Setting<>("Scroll", true, v -> this.setting.getValue() == ClickEnum.Settings.Misc)); + public Setting scrollval = this.register(new Setting<>("Scroll Speed", 10, 1, 30, v -> this.setting.getValue() == ClickEnum.Settings.Misc && this.scroll.getValue())); + public Setting description = this.register(new Setting("Description", ClickEnum.Mode.Frame, v -> this.setting.getValue() == ClickEnum.Settings.Misc)); + public Setting categoryTextCenter = this.register(new Setting<>("CategoryTextCenter", true, v -> this.setting.getValue() == ClickEnum.Settings.Misc)); + public Setting buttonTextCenter = this.register(new Setting<>("ButtonTextCenter", false, v -> this.setting.getValue() == ClickEnum.Settings.Misc)); + + // COLORS + public Setting sideSettings = this.register(new Setting<>("SideSettings", false, v -> this.setting.getValue() == ClickEnum.Settings.Color)); + public Setting sideLineC = this.register(new Setting<>("SideLine", new Color(0xFFFFFF), v -> this.setting.getValue() == ClickEnum.Settings.Color)); + public Setting moduleMainC = this.register(new Setting<>("ModuleMainColor", new Color(0, 255, 102, 255), v -> this.setting.getValue() == ClickEnum.Settings.Color)); + public Setting moduleEnableC = this.register(new Setting<>("ModuleEnableColor", new Color(0, 255, 60, 77), v -> this.setting.getValue() == ClickEnum.Settings.Color)); + public Setting sliderType = this.register(new Setting<>("SliderType", ClickEnum.SliderType.Line, v -> this.setting.getValue() == ClickEnum.Settings.Color)); + public Setting sliderC = register(new Setting<>("SliderColor", new Color(0, 110, 42, 255), v -> this.setting.getValue() == ClickEnum.Settings.Color)); + + public Setting hoverAlpha = this.register(new Setting<>("Alpha", 170, 0, 255, v -> this.setting.getValue() == ClickEnum.Settings.Color)); + public Setting colorSync = this.register(new Setting<>("ColorSync", false, v -> this.setting.getValue() == ClickEnum.Settings.Color)); + public Setting outline = this.register(new Setting<>("Outline", false, v -> this.setting.getValue() == ClickEnum.Settings.Color)); + public Setting shader = this.register(new Setting<>("Shader", false, v -> this.setting.getValue() == ClickEnum.Settings.Color)); + public Setting shaderRadius = this.register(new Setting("ShaderRadius", Integer.valueOf(2), Integer.valueOf(1), Integer.valueOf(10), v -> this.setting.getValue() == ClickEnum.Settings.Color && this.shader.getValue())); + public Setting shaderC = register(new Setting<>("ShaderColor", new Color(0, 229, 100, 255), v -> this.setting.getValue() == ClickEnum.Settings.Color && this.shader.getValue())); + public Setting olWidth = this.register(new Setting("Outline Width", 0.0f, 1f, 5f, v -> this.setting.getValue() == ClickEnum.Settings.Main && outline.getValue())); + public Setting alpha = this.register(new Setting<>("HoverAlpha", 240, 0, 255, v -> this.setting.getValue() == ClickEnum.Settings.Main)); + + // BACKGROUND + public Setting particles = this.register(new Setting("Particles", false, v -> this.setting.getValue() == ClickEnum.Settings.BackGround)); + public Setting particleLength = this.register(new Setting<>("ParticlesLength", 80, 0, 300, v -> this.setting.getValue() == ClickEnum.Settings.BackGround && this.particles.getValue())); + public Setting blur = this.register(new Setting("Blur", false, v -> this.setting.getValue() == ClickEnum.Settings.BackGround)); + public Setting blurAmount = this.register(new Setting<>("BlurAmount", 2, 0, 20, v -> this.setting.getValue() == ClickEnum.Settings.BackGround && this.blur.getValue())); + public Setting blurSize = this.register(new Setting<>("BlurSize", 0, 0, 20, v -> this.setting.getValue() == ClickEnum.Settings.BackGround && this.blur.getValue())); + public Setting dirt = this.register(new Setting<>("Dirt", false, v -> this.setting.getValue() == ClickEnum.Settings.BackGround)); + public Setting dark = this.register(new Setting("Dark", true, v -> this.setting.getValue() == ClickEnum.Settings.BackGround)); + public Setting gradiant = this.register(new Setting("Gradiant", false, v -> this.setting.getValue() == ClickEnum.Settings.BackGround)); + public Setting gradiantHeight = this.register(new Setting("GradiantHeight", 0, 0, 255, v -> this.setting.getValue() == ClickEnum.Settings.BackGround && this.gradiant.getValue())); + public Setting gradiantAlpha = this.register(new Setting<>("GradiantAlpha", 230, 0, 255, v -> this.setting.getValue() == ClickEnum.Settings.BackGround && this.gradiant.getValue())); + private List anchorPoints = new ArrayList<>(); + + public ClickGui() { + super("ClickGui", "Opens the ClickGui", Module.Category.CLIENT, true, false, false); + this.setInstance(); + } + + public static ClickGui getInstance() { + if (INSTANCE == null) { + INSTANCE = new ClickGui(); + } + return INSTANCE; + } + + private void setInstance() { + INSTANCE = this; + } + + @SubscribeEvent + public void onSettingChange(ClientEvent event) { + InfinityLoop.colorManager.setColor(this.moduleMainC.getPlannedValue().getRed(), this.moduleMainC.getPlannedValue().getGreen(), this.moduleMainC.getPlannedValue().getBlue(), this.moduleMainC.getPlannedValue().getAlpha()); + } + + @Override + public void onEnable() { + mc.displayGuiScreen(InfinityLoopGui.getClickGui()); + } + + @Override + public void onDisable() { + if (mc.currentScreen instanceof InfinityLoopGui) { + mc.displayGuiScreen(null); + } + } + + @Override + public void onLoad() { + if (this.colorSync.getValue()) { + InfinityLoop.colorManager.setColor(Colors.getInstance().getCurrentColor().getRed(), Colors.getInstance().getCurrentColor().getGreen(), Colors.getInstance().getCurrentColor().getBlue(), this.alpha.getValue()); + } else { + InfinityLoop.colorManager.setColor(this.moduleMainC.getPlannedValue().getRed(), this.moduleMainC.getPlannedValue().getGreen(), this.moduleMainC.getPlannedValue().getBlue(), this.moduleMainC.getPlannedValue().getAlpha()); + } + } + + @Override + public void onTick() { + if (!(ClickGui.mc.currentScreen instanceof InfinityLoopGui) && !(mc.currentScreen instanceof GuiMainMenu)) { + this.disable(); + } + } + + public float getOutlineWidth() { + if (outline.getValue()) { + return olWidth.getValue(); + } + return 0; + } + + public List getAnchorPoints() { + return anchorPoints; + } + +} + diff --git a/src/main/java/com/me/infinity/loop/features/modules/combat/AutoArmor.java b/src/main/java/me/loop/features/modules/combat/AutoArmor.java similarity index 94% rename from src/main/java/com/me/infinity/loop/features/modules/combat/AutoArmor.java rename to src/main/java/me/loop/features/modules/combat/AutoArmor.java index d267cc0..452a069 100644 --- a/src/main/java/com/me/infinity/loop/features/modules/combat/AutoArmor.java +++ b/src/main/java/me/loop/features/modules/combat/AutoArmor.java @@ -1,11 +1,10 @@ -package com.me.infinity.loop.features.modules.combat; +package me.loop.features.modules.combat; -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.setting.Setting; -import com.me.infinity.loop.util.utils.minecraft.InventoryUtil; -import com.me.infinity.loop.util.utils.worlds.Timer; +import me.loop.InfinityLoop; +import me.loop.features.modules.Module; +import me.loop.features.setting.Setting; +import me.loop.util.impl.InventoryUtil; +import me.loop.util.init.Timer; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.gui.inventory.GuiInventory; import net.minecraft.init.Items; @@ -30,7 +29,7 @@ public class AutoArmor boolean flag; public AutoArmor() { - super("AutoArmor", "Puts Armor on for you.", ModuleCategory.COMBAT); + super("AutoArmor", "Puts Armor on for you.", Module.Category.COMBAT, true, false, false); } @Override diff --git a/src/main/java/com/me/infinity/loop/features/modules/combat/AutoCrystal.java b/src/main/java/me/loop/features/modules/combat/AutoCrystal.java similarity index 90% rename from src/main/java/com/me/infinity/loop/features/modules/combat/AutoCrystal.java rename to src/main/java/me/loop/features/modules/combat/AutoCrystal.java index 2bc3598..9e2c431 100644 --- a/src/main/java/com/me/infinity/loop/features/modules/combat/AutoCrystal.java +++ b/src/main/java/me/loop/features/modules/combat/AutoCrystal.java @@ -1,18 +1,15 @@ -package com.me.infinity.loop.features.modules.combat; +package me.loop.features.modules.combat; -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.event.events.network.EventPacket; -import com.me.infinity.loop.event.events.render.Render3DEvent; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.modules.client.Colors; -import com.me.infinity.loop.features.modules.misc.AutoGG; -import com.me.infinity.loop.features.setting.Setting; -import com.me.infinity.loop.util.utils.EntityUtil; -import com.me.infinity.loop.util.utils.maths.MathUtil; -import com.me.infinity.loop.util.utils.worlds.Timer; -import com.me.infinity.loop.util.utils.renders.ColorUtil; -import com.me.infinity.loop.util.utils.renders.RenderUtil; +import me.loop.InfinityLoop; +import me.loop.event.events.PacketEvent; +import me.loop.event.events.Render3DEvent; +import me.loop.features.modules.Module; +import me.loop.features.modules.client.Colors; +import me.loop.features.modules.client.clickgui.ClickGui; +import me.loop.features.modules.misc.AutoGG; +import me.loop.features.setting.Setting; +import me.loop.util.impl.*; +import me.loop.util.init.Timer; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -101,9 +98,9 @@ public class AutoCrystal private boolean rotating = false; public AutoCrystal() { - super("AutoCrystal", "NiggaHack ac best ac", ModuleCategory.COMBAT); - + super("AutoCrystal", "NiggaHack ac best ac", Module.Category.COMBAT, true, false, false); } + public static List getSphere(BlockPos loc, float r, int h, boolean hollow, boolean sphere, int plus_y) { ArrayList circleblocks = new ArrayList(); int cx = loc.getX(); @@ -133,9 +130,9 @@ public static List getSphere(BlockPos loc, float r, int h, boolean hol } @SubscribeEvent - public void onPacketSend(EventPacket.Send event) { - if (event.isPre() && this.rotate.getValue().booleanValue() && this.rotating && event.getPacket() instanceof CPacketPlayer) { - CPacketPlayer packet = (CPacketPlayer) event.getPacket(); + public void onPacketSend(PacketEvent.Send event) { + if (event.getStage() == 0 && this.rotate.getValue().booleanValue() && this.rotating && event.getPacket() instanceof CPacketPlayer) { + CPacketPlayer packet = event.getPacket(); packet.yaw = this.yaw; packet.pitch = this.pitch; this.rotating = false; @@ -248,7 +245,7 @@ public void onCrystal() { this.crystal = null; this.target = null; } - this.crystal = AutoCrystal.mc.world.loadedEntityList.stream().filter(this::IsValidCrystal).map(p_Entity -> (EntityEnderCrystal) p_Entity).min(Comparator.comparing(p_Entity -> Float.valueOf(this.target.getDistance(p_Entity)))).orElse(null); + this.crystal = AutoCrystal.mc.world.loadedEntityList.stream().filter(this::IsValidCrystal).map(p_Entity -> (EntityEnderCrystal) p_Entity).min(Comparator.comparing(p_Entity -> Float.valueOf(this.target.getDistance((Entity) p_Entity)))).orElse(null); if (this.crystal != null && this.explode.getValue().booleanValue() && this.breakTimer.passedMs(this.breakDelay.getValue().longValue())) { this.breakTimer.reset(); if (this.packetBreak.getValue().booleanValue()) { @@ -281,7 +278,7 @@ public void onCrystal() { if (!((float) dmg <= this.minArmor.getValue().floatValue())) continue; this.armor = true; } - if (targetDmg < (double) this.minDamage.getValue().floatValue() && (this.facePlaceSword.getValue() ? this.target.getAbsorptionAmount() + this.target.getHealth() > this.facePlace.getValue().floatValue() : AutoCrystal.mc.player.getHeldItemMainhand().getItem() instanceof ItemSword || this.target.getAbsorptionAmount() + this.target.getHealth() > this.facePlace.getValue().floatValue()) && (this.facePlaceSword.getValue() ? !this.armor : AutoCrystal.mc.player.getHeldItemMainhand().getItem() instanceof ItemSword || !this.armor) || (selfDmg = this.calculateDamage((double) blockPos.getX() + 0.5, (double) blockPos.getY() + 1.0, (double) blockPos.getZ() + 0.5, AutoCrystal.mc.player)) + (this.suicide.getValue() ? 2.0 : 0.5) >= (double) (AutoCrystal.mc.player.getHealth() + AutoCrystal.mc.player.getAbsorptionAmount()) && selfDmg >= targetDmg && targetDmg < (double) (this.target.getHealth() + this.target.getAbsorptionAmount()) || !(damage < targetDmg)) + if (targetDmg < (double) this.minDamage.getValue().floatValue() && (this.facePlaceSword.getValue() != false ? this.target.getAbsorptionAmount() + this.target.getHealth() > this.facePlace.getValue().floatValue() : AutoCrystal.mc.player.getHeldItemMainhand().getItem() instanceof ItemSword || this.target.getAbsorptionAmount() + this.target.getHealth() > this.facePlace.getValue().floatValue()) && (this.facePlaceSword.getValue() != false ? !this.armor : AutoCrystal.mc.player.getHeldItemMainhand().getItem() instanceof ItemSword || !this.armor) || (selfDmg = this.calculateDamage((double) blockPos.getX() + 0.5, (double) blockPos.getY() + 1.0, (double) blockPos.getZ() + 0.5, AutoCrystal.mc.player)) + (this.suicide.getValue() != false ? 2.0 : 0.5) >= (double) (AutoCrystal.mc.player.getHealth() + AutoCrystal.mc.player.getAbsorptionAmount()) && selfDmg >= targetDmg && targetDmg < (double) (this.target.getHealth() + this.target.getAbsorptionAmount()) || !(damage < targetDmg)) continue; this.pos = blockPos; damage = targetDmg; @@ -320,9 +317,9 @@ public void onCrystal() { } @SubscribeEvent(priority = EventPriority.HIGHEST, receiveCanceled = true) - public void onPacketReceive(EventPacket.Receive event) { + public void onPacketReceive(PacketEvent.Receive event) { SPacketSpawnObject packet; - if (event.getPacket() instanceof SPacketSpawnObject && (packet = (SPacketSpawnObject) event.getPacket()).getType() == 51 && this.predicts.getValue().booleanValue() && this.preditTimer.passedMs(this.attackFactor.getValue().longValue()) && this.predicts.getValue().booleanValue() && this.explode.getValue().booleanValue() && this.packetBreak.getValue().booleanValue() && this.target != null) { + if (event.getPacket() instanceof SPacketSpawnObject && (packet = event.getPacket()).getType() == 51 && this.predicts.getValue().booleanValue() && this.preditTimer.passedMs(this.attackFactor.getValue().longValue()) && this.predicts.getValue().booleanValue() && this.explode.getValue().booleanValue() && this.packetBreak.getValue().booleanValue() && this.target != null) { if (!this.isPredicting(packet)) { return; } @@ -336,7 +333,7 @@ public void onPacketReceive(EventPacket.Receive event) { @Override public void onRender3D(Render3DEvent event) { if (this.pos != null && this.render.getValue().booleanValue() && this.target != null) { - RenderUtil.drawBoxESP(this.pos, Colors.getInstance().rainbow.getValue() ? ColorUtil.rainbow(Colors.getInstance().rainbowHue.getValue()) : new Color(this.red.getValue(), this.green.getValue(), this.blue.getValue(), this.alpha.getValue()), this.outline.getValue(), Colors.getInstance().rainbow.getValue() ? ColorUtil.rainbow(Colors.getInstance().rainbowHue.getValue()) : new Color(this.cRed.getValue(), this.cGreen.getValue(), this.cBlue.getValue(), this.cAlpha.getValue()), this.lineWidth.getValue().floatValue(), this.outline.getValue(), this.box.getValue(), this.boxAlpha.getValue(), true); + RenderUtil.drawBoxESP(this.pos, ClickGui.getInstance().colorSync.getValue() && Colors.getInstance().rainbow.getValue() != false ? ColorUtil.rainbow(Colors.getInstance().rainbowHue.getValue()) : new Color(this.red.getValue(), this.green.getValue(), this.blue.getValue(), this.alpha.getValue()), this.outline.getValue(), Colors.getInstance().rainbow.getValue() != false ? ColorUtil.rainbow(Colors.getInstance().rainbowHue.getValue()) : new Color(this.cRed.getValue(), this.cGreen.getValue(), this.cBlue.getValue(), this.cAlpha.getValue()), this.lineWidth.getValue().floatValue(), this.outline.getValue(), this.box.getValue(), this.boxAlpha.getValue(), true); if (this.renderDmg.getValue().booleanValue()) { double renderDamage = this.calculateDamage((double) this.pos.getX() + 0.5, (double) this.pos.getY() + 1.0, (double) this.pos.getZ() + 0.5, this.target); RenderUtil.drawText(this.pos, (Math.floor(renderDamage) == renderDamage ? Integer.valueOf((int) renderDamage) : String.format("%.1f", renderDamage)) + ""); @@ -357,7 +354,7 @@ private boolean isPredicting(SPacketSpawnObject packet) { return true; } double selfDmg = this.calculateDamage(packet.getX() + 0.5, packet.getY() + 1.0, packet.getZ() + 0.5, AutoCrystal.mc.player); - double d = this.suicide.getValue() ? 2.0 : 0.5; + double d = this.suicide.getValue() != false ? 2.0 : 0.5; if (selfDmg + d < (double) (AutoCrystal.mc.player.getHealth() + AutoCrystal.mc.player.getAbsorptionAmount()) && targetDmg >= (double) (this.target.getAbsorptionAmount() + this.target.getHealth())) { return true; } @@ -399,7 +396,7 @@ private boolean IsValidCrystal(Entity p_Entity) { return true; } double selfDmg = this.calculateDamage((double) p_Entity.getPosition().getX() + 0.5, (double) p_Entity.getPosition().getY() + 1.0, (double) p_Entity.getPosition().getZ() + 0.5, AutoCrystal.mc.player); - double d = this.suicide.getValue() ? 2.0 : 0.5; + double d = this.suicide.getValue() != false ? 2.0 : 0.5; if (selfDmg + d < (double) (AutoCrystal.mc.player.getHealth() + AutoCrystal.mc.player.getAbsorptionAmount()) && targetDmg >= (double) (this.target.getAbsorptionAmount() + this.target.getHealth())) { return true; } diff --git a/src/main/java/me/loop/features/modules/combat/AutoTrap.java b/src/main/java/me/loop/features/modules/combat/AutoTrap.java new file mode 100644 index 0000000..4d21b2b --- /dev/null +++ b/src/main/java/me/loop/features/modules/combat/AutoTrap.java @@ -0,0 +1,190 @@ +package me.loop.features.modules.combat; + +import com.mojang.realmsclient.gui.ChatFormatting; +import me.loop.InfinityLoop; +import me.loop.features.command.Command; +import me.loop.features.modules.Module; +import me.loop.features.setting.Setting; +import me.loop.util.impl.*; +import me.loop.util.init.Timer; +import net.minecraft.block.BlockEnderChest; +import net.minecraft.block.BlockObsidian; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; + +import java.util.Comparator; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class AutoTrap + extends Module { + public static boolean isPlacing = false; + private final Setting delay = this.register(new Setting("Delay", 50, 0, 250)); + private final Setting blocksPerPlace = this.register(new Setting("BlocksPerTick", 8, 1, 30)); + private final Setting rotate = this.register(new Setting("Rotate", true)); + private final Setting raytrace = this.register(new Setting("Raytrace", false)); + private final Setting antiScaffold = this.register(new Setting("AntiScaffold", false)); + private final Setting antiStep = this.register(new Setting("AntiStep", false)); + private final Timer timer = new Timer(); + private final Map retries = new HashMap(); + private final Timer retryTimer = new Timer(); + public EntityPlayer target; + private boolean didPlace = false; + private boolean switchedItem; + private boolean isSneaking; + private int lastHotbarSlot; + private int placements = 0; + private boolean smartRotate = false; + private BlockPos startPos = null; + + public AutoTrap() { + super("AutoTrap", "Traps other players", Module.Category.COMBAT, true, false, false); + } + + @Override + public void onEnable() { + if (AutoTrap.fullNullCheck()) { + return; + } + this.startPos = EntityUtil.getRoundedBlockPos(AutoTrap.mc.player); + this.lastHotbarSlot = AutoTrap.mc.player.inventory.currentItem; + this.retries.clear(); + } + + @Override + public void onTick() { + if (AutoTrap.fullNullCheck()) { + return; + } + this.smartRotate = false; + this.doTrap(); + } + + @Override + public String getDisplayInfo() { + if (this.target != null) { + return this.target.getName(); + } + return null; + } + + @Override + public void onDisable() { + isPlacing = false; + this.isSneaking = EntityUtil.stopSneaking(this.isSneaking); + } + + private void doTrap() { + if (this.check()) { + return; + } + this.doStaticTrap(); + if (this.didPlace) { + this.timer.reset(); + } + } + + private void doStaticTrap() { + List placeTargets = EntityUtil.targets(this.target.getPositionVector(), this.antiScaffold.getValue(), this.antiStep.getValue(), false, false, false, this.raytrace.getValue()); + this.placeList(placeTargets); + } + + private void placeList(List list) { + list.sort((vec3d, vec3d2) -> Double.compare(AutoTrap.mc.player.getDistanceSq(vec3d2.x, vec3d2.y, vec3d2.z), AutoTrap.mc.player.getDistanceSq(vec3d.x, vec3d.y, vec3d.z))); + list.sort(Comparator.comparingDouble(vec3d -> vec3d.y)); + for (Vec3d vec3d3 : list) { + BlockPos position = new BlockPos(vec3d3); + int placeability = BlockUtil.isPositionPlaceable(position, this.raytrace.getValue()); + if (placeability == 1 && (this.retries.get(position) == null || this.retries.get(position) < 4)) { + this.placeBlock(position); + this.retries.put(position, this.retries.get(position) == null ? 1 : this.retries.get(position) + 1); + this.retryTimer.reset(); + continue; + } + if (placeability != 3) continue; + this.placeBlock(position); + } + } + + private boolean check() { + isPlacing = false; + this.didPlace = false; + this.placements = 0; + int obbySlot2 = InventoryUtil.findHotbarBlock(BlockObsidian.class); + if (obbySlot2 == -1) { + this.toggle(); + } + int obbySlot = InventoryUtil.findHotbarBlock(BlockObsidian.class); + if (this.isOff()) { + return true; + } + if (!this.startPos.equals(EntityUtil.getRoundedBlockPos(AutoTrap.mc.player))) { + this.disable(); + return true; + } + if (this.retryTimer.passedMs(2000L)) { + this.retries.clear(); + this.retryTimer.reset(); + } + if (obbySlot == -1) { + Command.sendMessage("<" + this.getDisplayName() + "> " + ChatFormatting.RED + "No Obsidian in hotbar disabling..."); + this.disable(); + return true; + } + if (AutoTrap.mc.player.inventory.currentItem != this.lastHotbarSlot && AutoTrap.mc.player.inventory.currentItem != obbySlot) { + this.lastHotbarSlot = AutoTrap.mc.player.inventory.currentItem; + } + this.isSneaking = EntityUtil.stopSneaking(this.isSneaking); + this.target = this.getTarget(10.0, true); + return this.target == null || !this.timer.passedMs(this.delay.getValue().intValue()); + } + + private EntityPlayer getTarget(double range, boolean trapped) { + EntityPlayer target = null; + double distance = Math.pow(range, 2.0) + 1.0; + for (EntityPlayer player : AutoTrap.mc.world.playerEntities) { + if (EntityUtil.isntValid(player, range) || trapped && EntityUtil.isTrapped(player, this.antiScaffold.getValue(), this.antiStep.getValue(), false, false, false) || InfinityLoop.speedManager.getPlayerSpeed(player) > 10.0) + continue; + if (target == null) { + target = player; + distance = AutoTrap.mc.player.getDistanceSq(player); + continue; + } + if (!(AutoTrap.mc.player.getDistanceSq(player) < distance)) continue; + target = player; + distance = AutoTrap.mc.player.getDistanceSq(player); + } + return target; + } + + private void placeBlock(BlockPos pos) { + if (this.placements < this.blocksPerPlace.getValue() && AutoTrap.mc.player.getDistanceSq(pos) <= MathUtil.square(5.0)) { + isPlacing = true; + int originalSlot = AutoTrap.mc.player.inventory.currentItem; + int obbySlot = InventoryUtil.findHotbarBlock(BlockObsidian.class); + int eChestSot = InventoryUtil.findHotbarBlock(BlockEnderChest.class); + if (obbySlot == -1 && eChestSot == -1) { + this.toggle(); + } + if (this.smartRotate) { + AutoTrap.mc.player.inventory.currentItem = obbySlot == -1 ? eChestSot : obbySlot; + AutoTrap.mc.playerController.updateController(); + this.isSneaking = BlockUtil.placeBlockSmartRotate(pos, EnumHand.MAIN_HAND, true, true, this.isSneaking); + AutoTrap.mc.player.inventory.currentItem = originalSlot; + AutoTrap.mc.playerController.updateController(); + } else { + AutoTrap.mc.player.inventory.currentItem = obbySlot == -1 ? eChestSot : obbySlot; + AutoTrap.mc.playerController.updateController(); + this.isSneaking = BlockUtil.placeBlock(pos, EnumHand.MAIN_HAND, this.rotate.getValue(), true, this.isSneaking); + AutoTrap.mc.player.inventory.currentItem = originalSlot; + AutoTrap.mc.playerController.updateController(); + } + this.didPlace = true; + ++this.placements; + } + } +} + diff --git a/src/main/java/me/loop/features/modules/combat/AutoWeb.java b/src/main/java/me/loop/features/modules/combat/AutoWeb.java new file mode 100644 index 0000000..9dab09b --- /dev/null +++ b/src/main/java/me/loop/features/modules/combat/AutoWeb.java @@ -0,0 +1,172 @@ +package me.loop.features.modules.combat; + +import com.mojang.realmsclient.gui.ChatFormatting; +import me.loop.InfinityLoop; +import me.loop.features.command.Command; +import me.loop.features.modules.Module; +import me.loop.features.setting.Setting; +import me.loop.util.impl.*; +import me.loop.util.init.Timer; +import net.minecraft.block.BlockWeb; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; + +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; + +public class AutoWeb + extends Module { + public static boolean isPlacing = false; + private final Setting delay = this.register(new Setting("Delay", 50, 0, 250)); + private final Setting blocksPerPlace = this.register(new Setting("BlocksPerTick", 8, 1, 30)); + private final Setting packet = this.register(new Setting("PacketPlace", false)); + private final Setting disable = this.register(new Setting("AutoDisable", false)); + private final Setting rotate = this.register(new Setting("Rotate", true)); + private final Setting raytrace = this.register(new Setting("Raytrace", false)); + private final Setting lowerbody = this.register(new Setting("Feet", true)); + private final Setting upperBody = this.register(new Setting("Face", false)); + private final Timer timer = new Timer(); + public EntityPlayer target; + private boolean didPlace = false; + private boolean switchedItem; + private boolean isSneaking; + private int lastHotbarSlot; + private int placements = 0; + private boolean smartRotate = false; + private BlockPos startPos = null; + + public AutoWeb() { + super("AutoWeb", "Traps other players in webs", Module.Category.COMBAT, true, false, false); + } + + @Override + public void onEnable() { + if (AutoWeb.fullNullCheck()) { + return; + } + this.startPos = EntityUtil.getRoundedBlockPos(AutoWeb.mc.player); + this.lastHotbarSlot = AutoWeb.mc.player.inventory.currentItem; + } + + @Override + public void onTick() { + this.smartRotate = false; + this.doTrap(); + } + + @Override + public String getDisplayInfo() { + if (this.target != null) { + return this.target.getName(); + } + return null; + } + + @Override + public void onDisable() { + isPlacing = false; + this.isSneaking = EntityUtil.stopSneaking(this.isSneaking); + this.switchItem(true); + } + + private void doTrap() { + if (this.check()) { + return; + } + this.doWebTrap(); + if (this.didPlace) { + this.timer.reset(); + } + } + + private void doWebTrap() { + List placeTargets = this.getPlacements(); + this.placeList(placeTargets); + } + + private List getPlacements() { + ArrayList list = new ArrayList(); + Vec3d baseVec = this.target.getPositionVector(); + if (this.lowerbody.getValue().booleanValue()) { + list.add(baseVec); + } + if (this.upperBody.getValue().booleanValue()) { + list.add(baseVec.add(0.0, 1.0, 0.0)); + } + return list; + } + + private void placeList(List list) { + list.sort((vec3d, vec3d2) -> Double.compare(AutoWeb.mc.player.getDistanceSq(vec3d2.x, vec3d2.y, vec3d2.z), AutoWeb.mc.player.getDistanceSq(vec3d.x, vec3d.y, vec3d.z))); + list.sort(Comparator.comparingDouble(vec3d -> vec3d.y)); + for (Vec3d vec3d3 : list) { + BlockPos position = new BlockPos(vec3d3); + int placeability = BlockUtil.isPositionPlaceable(position, this.raytrace.getValue()); + if (placeability != 3 && placeability != 1) continue; + this.placeBlock(position); + } + } + + private boolean check() { + isPlacing = false; + this.didPlace = false; + this.placements = 0; + int obbySlot = InventoryUtil.findHotbarBlock(BlockWeb.class); + if (this.isOff()) { + return true; + } + if (this.disable.getValue().booleanValue() && !this.startPos.equals(EntityUtil.getRoundedBlockPos(AutoWeb.mc.player))) { + this.disable(); + return true; + } + if (obbySlot == -1) { + Command.sendMessage("<" + this.getDisplayName() + "> " + ChatFormatting.RED + "No Webs in hotbar disabling..."); + this.toggle(); + return true; + } + if (AutoWeb.mc.player.inventory.currentItem != this.lastHotbarSlot && AutoWeb.mc.player.inventory.currentItem != obbySlot) { + this.lastHotbarSlot = AutoWeb.mc.player.inventory.currentItem; + } + this.switchItem(true); + this.isSneaking = EntityUtil.stopSneaking(this.isSneaking); + this.target = this.getTarget(10.0); + return this.target == null || !this.timer.passedMs(this.delay.getValue().intValue()); + } + + private EntityPlayer getTarget(double range) { + EntityPlayer target = null; + double distance = Math.pow(range, 2.0) + 1.0; + for (EntityPlayer player : AutoWeb.mc.world.playerEntities) { + if (EntityUtil.isntValid(player, range) || player.isInWeb || InfinityLoop.speedManager.getPlayerSpeed(player) > 30.0) + continue; + if (target == null) { + target = player; + distance = AutoWeb.mc.player.getDistanceSq(player); + continue; + } + if (!(AutoWeb.mc.player.getDistanceSq(player) < distance)) continue; + target = player; + distance = AutoWeb.mc.player.getDistanceSq(player); + } + return target; + } + + private void placeBlock(BlockPos pos) { + if (this.placements < this.blocksPerPlace.getValue() && AutoWeb.mc.player.getDistanceSq(pos) <= MathUtil.square(6.0) && this.switchItem(false)) { + isPlacing = true; + this.isSneaking = this.smartRotate ? BlockUtil.placeBlockSmartRotate(pos, EnumHand.MAIN_HAND, true, this.packet.getValue(), this.isSneaking) : BlockUtil.placeBlock(pos, EnumHand.MAIN_HAND, this.rotate.getValue(), this.packet.getValue(), this.isSneaking); + this.didPlace = true; + ++this.placements; + } + } + + private boolean switchItem(boolean back) { + boolean[] value = InventoryUtil.switchItem(back, this.lastHotbarSlot, this.switchedItem, InventoryUtil.Switch.NORMAL, BlockWeb.class); + this.switchedItem = value[0]; + return value[1]; + } +} + diff --git a/src/main/java/com/me/infinity/loop/features/modules/combat/Criticals.java b/src/main/java/me/loop/features/modules/combat/Criticals.java similarity index 89% rename from src/main/java/com/me/infinity/loop/features/modules/combat/Criticals.java rename to src/main/java/me/loop/features/modules/combat/Criticals.java index 6d08c38..4a58243 100644 --- a/src/main/java/com/me/infinity/loop/features/modules/combat/Criticals.java +++ b/src/main/java/me/loop/features/modules/combat/Criticals.java @@ -1,10 +1,9 @@ -package com.me.infinity.loop.features.modules.combat; +package me.loop.features.modules.combat; -import com.me.infinity.loop.event.events.network.EventPacket; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.setting.Setting; -import com.me.infinity.loop.util.utils.worlds.Timer; +import me.loop.event.events.PacketEvent; +import me.loop.features.modules.Module; +import me.loop.features.setting.Setting; +import me.loop.util.init.Timer; import net.minecraft.entity.EntityLivingBase; import net.minecraft.network.play.client.CPacketPlayer; import net.minecraft.network.play.client.CPacketUseEntity; @@ -19,13 +18,13 @@ public class Criticals private final boolean resetTimer = false; public Criticals() { - super("Criticals", "Scores criticals for you", ModuleCategory.COMBAT); + super("Criticals", "Scores criticals for you", Module.Category.COMBAT, true, false, false); } @SubscribeEvent - public void onPacketSend(EventPacket.Send event) { + public void onPacketSend(PacketEvent.Send event) { CPacketUseEntity packet; - if (event.getPacket() instanceof CPacketUseEntity && (packet = (CPacketUseEntity) event.getPacket()).getAction() == CPacketUseEntity.Action.ATTACK) { + if (event.getPacket() instanceof CPacketUseEntity && (packet = event.getPacket()).getAction() == CPacketUseEntity.Action.ATTACK) { if (this.resetTimer) { return; } diff --git a/src/main/java/com/me/infinity/loop/features/modules/combat/HoleFiller.java b/src/main/java/me/loop/features/modules/combat/HoleFiller.java similarity index 89% rename from src/main/java/com/me/infinity/loop/features/modules/combat/HoleFiller.java rename to src/main/java/me/loop/features/modules/combat/HoleFiller.java index 3489d62..100071a 100644 --- a/src/main/java/com/me/infinity/loop/features/modules/combat/HoleFiller.java +++ b/src/main/java/me/loop/features/modules/combat/HoleFiller.java @@ -2,16 +2,14 @@ // Decompiled by Procyon v0.5.36 // -package com.me.infinity.loop.features.modules.combat; - -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.setting.Setting; -import com.me.infinity.loop.util.utils.minecraft.BlockUtil; -import com.me.infinity.loop.util.utils.minecraft.InventoryUtil; -import com.me.infinity.loop.util.utils.EntityUtil; -import com.me.infinity.loop.util.utils.worlds.TestUtil; -import com.me.infinity.loop.util.utils.worlds.Timer; +package me.loop.features.modules.combat; + +import me.loop.features.Feature; +import me.loop.features.modules.Module; +import me.loop.features.setting.Setting; + +import me.loop.util.impl.*; +import me.loop.util.init.Timer; import net.minecraft.block.BlockEnderChest; import net.minecraft.block.BlockObsidian; import net.minecraft.block.material.Material; @@ -46,7 +44,7 @@ public class HoleFiller extends Module { private int trie; public HoleFiller() { - super("HoleFiller", "Fills holes around you.", ModuleCategory.COMBAT); + super("HoleFiller", "Fills holes around you.", Category.COMBAT, true, false, true); this.range = (Setting) this.register(new Setting("PlaceRange", 8, 0, 10)); this.delay = (Setting) this.register(new Setting("Delay", 50, 0, 250)); this.blocksPerTick = (Setting) this.register(new Setting("BlocksPerTick", 20, 8, 30)); @@ -72,7 +70,7 @@ private void setInstance() { @Override public void onEnable() { - if (fullNullCheck()) { + if (Feature.fullNullCheck()) { this.disable(); } this.offTimer.reset(); @@ -125,7 +123,7 @@ private void placeBlock(final BlockPos pos) { final int originalSlot = HoleFiller.mc.player.inventory.currentItem; HoleFiller.mc.player.inventory.currentItem = ((obbySlot == -1) ? eChestSot : obbySlot); HoleFiller.mc.playerController.updateController(); - TestUtil.placeBlock(pos); + PlaceUtil.placeBlock(pos); if (HoleFiller.mc.player.inventory.currentItem != originalSlot) { HoleFiller.mc.player.inventory.currentItem = originalSlot; HoleFiller.mc.playerController.updateController(); @@ -136,7 +134,7 @@ private void placeBlock(final BlockPos pos) { } private boolean check() { - if (fullNullCheck()) { + if (Feature.fullNullCheck()) { this.disable(); return true; } diff --git a/src/main/java/com/me/infinity/loop/features/modules/combat/Killaura.java b/src/main/java/me/loop/features/modules/combat/Killaura.java similarity index 73% rename from src/main/java/com/me/infinity/loop/features/modules/combat/Killaura.java rename to src/main/java/me/loop/features/modules/combat/Killaura.java index a98e533..82af42d 100644 --- a/src/main/java/com/me/infinity/loop/features/modules/combat/Killaura.java +++ b/src/main/java/me/loop/features/modules/combat/Killaura.java @@ -1,14 +1,11 @@ -package com.me.infinity.loop.features.modules.combat; +package me.loop.features.modules.combat; -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.event.events.player.EventMotionUpdate; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.setting.Setting; -import com.me.infinity.loop.util.utils.DamageUtil; -import com.me.infinity.loop.util.utils.EntityUtil; -import com.me.infinity.loop.util.utils.maths.MathUtil; -import com.me.infinity.loop.util.utils.worlds.Timer; +import me.loop.InfinityLoop; +import me.loop.event.events.UpdateWalkingPlayerEvent; +import me.loop.features.modules.Module; +import me.loop.features.setting.Setting; +import me.loop.util.impl.*; +import me.loop.util.init.Timer; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @@ -30,7 +27,7 @@ public class Killaura extends Module { public Setting packet = register(new Setting("Packet", Boolean.valueOf(false))); public Killaura() { - super("Killaura", "Kills aura.", ModuleCategory.COMBAT); + super("Killaura", "Kills aura.", Module.Category.COMBAT, true, false, false); } public void onTick() { @@ -39,17 +36,17 @@ public void onTick() { } @SubscribeEvent - public void onUpdateWalkingPlayerEvent(EventMotionUpdate event) { - if (event.isPre() && this.rotate.getValue().booleanValue()) + public void onUpdateWalkingPlayerEvent(UpdateWalkingPlayerEvent event) { + if (event.getStage() == 0 && this.rotate.getValue().booleanValue()) doKillaura(); } private void doKillaura() { - if (this.onlySharp.getValue().booleanValue() && !EntityUtil.holdingWeapon(mc.player)) { + if (this.onlySharp.getValue().booleanValue() && !EntityUtil.holdingWeapon(Util.mc.player)) { target = null; return; } - int wait = !this.delay.getValue().booleanValue() ? 0 : (int) (DamageUtil.getCooldownByWeapon(mc.player) * (this.tps.getValue().booleanValue() ? InfinityLoop.serverManager.getTpsFactor() : 1.0F)); + int wait = !this.delay.getValue().booleanValue() ? 0 : (int) (DamageUtil.getCooldownByWeapon(Util.mc.player) * (this.tps.getValue().booleanValue() ? InfinityLoop.serverManager.getTpsFactor() : 1.0F)); if (!this.timer.passedMs(wait)) return; target = getTarget(); @@ -65,15 +62,15 @@ private Entity getTarget() { Entity target = null; double distance = this.range.getValue().floatValue(); double maxHealth = 36.0D; - for (Entity entity : mc.world.playerEntities) { + for (Entity entity : Util.mc.world.playerEntities) { if (((!this.players.getValue().booleanValue() || !(entity instanceof EntityPlayer)) && (!this.animals.getValue().booleanValue() || !EntityUtil.isPassive(entity)) && (!this.mobs.getValue().booleanValue() || !EntityUtil.isMobAggressive(entity)) && (!this.vehicles.getValue().booleanValue() || !EntityUtil.isVehicle(entity)) && (!this.projectiles.getValue().booleanValue() || !EntityUtil.isProjectile(entity))) || (entity instanceof net.minecraft.entity.EntityLivingBase && EntityUtil.isntValid(entity, distance))) continue; - if (!mc.player.canEntityBeSeen(entity) && !EntityUtil.canEntityFeetBeSeen(entity) && mc.player.getDistanceSq(entity) > MathUtil.square(this.raytrace.getValue().floatValue())) + if (!Util.mc.player.canEntityBeSeen(entity) && !EntityUtil.canEntityFeetBeSeen(entity) && Util.mc.player.getDistanceSq(entity) > MathUtil.square(this.raytrace.getValue().floatValue())) continue; if (target == null) { target = entity; - distance = mc.player.getDistanceSq(entity); + distance = Util.mc.player.getDistanceSq(entity); maxHealth = EntityUtil.getHealth(entity); continue; } @@ -81,14 +78,14 @@ private Entity getTarget() { target = entity; break; } - if (mc.player.getDistanceSq(entity) < distance) { + if (Util.mc.player.getDistanceSq(entity) < distance) { target = entity; - distance = mc.player.getDistanceSq(entity); + distance = Util.mc.player.getDistanceSq(entity); maxHealth = EntityUtil.getHealth(entity); } if (EntityUtil.getHealth(entity) < maxHealth) { target = entity; - distance = mc.player.getDistanceSq(entity); + distance = Util.mc.player.getDistanceSq(entity); maxHealth = EntityUtil.getHealth(entity); } } diff --git a/src/main/java/com/me/infinity/loop/features/modules/combat/Offhand.java b/src/main/java/me/loop/features/modules/combat/Offhand.java similarity index 93% rename from src/main/java/com/me/infinity/loop/features/modules/combat/Offhand.java rename to src/main/java/me/loop/features/modules/combat/Offhand.java index 779e1e5..9fcfd9a 100644 --- a/src/main/java/com/me/infinity/loop/features/modules/combat/Offhand.java +++ b/src/main/java/me/loop/features/modules/combat/Offhand.java @@ -1,13 +1,12 @@ -package com.me.infinity.loop.features.modules.combat; - -import com.me.infinity.loop.event.events.network.EventPacket; -import com.me.infinity.loop.event.events.player.ProcessRightClickBlockEvent; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.setting.Setting; -import com.me.infinity.loop.util.utils.EntityUtil; -import com.me.infinity.loop.util.utils.minecraft.InventoryUtil; -import com.me.infinity.loop.util.utils.worlds.Timer; +package me.loop.features.modules.combat; + +import me.loop.event.events.PacketEvent; +import me.loop.event.events.ProcessRightClickBlockEvent; +import me.loop.features.modules.Module; +import me.loop.features.setting.Setting; +import me.loop.util.impl.EntityUtil; +import me.loop.util.impl.InventoryUtil; +import me.loop.util.init.Timer; import net.minecraft.block.BlockObsidian; import net.minecraft.block.BlockWeb; import net.minecraft.client.gui.inventory.GuiContainer; @@ -55,7 +54,7 @@ public class Offhand private boolean switchedForHealthReason = false; public Offhand() { - super("Offhand", "Allows you to switch up your Offhand.", ModuleCategory.COMBAT); + super("Offhand", "Allows you to switch up your Offhand.", Module.Category.COMBAT, true, false, false); instance = this; } @@ -96,11 +95,11 @@ public void onUpdate() { } @SubscribeEvent - public void onPacketSend(EventPacket.Send event) { + public void onPacketSend(PacketEvent.Send event) { if (!Offhand.fullNullCheck() && Offhand.mc.player.getHeldItemOffhand().getItem() == Items.GOLDEN_APPLE && Offhand.mc.player.getHeldItemMainhand().getItem() == Items.END_CRYSTAL && Offhand.mc.gameSettings.keyBindUseItem.isKeyDown()) { CPacketPlayerTryUseItem packet; if (event.getPacket() instanceof CPacketPlayerTryUseItemOnBlock) { - CPacketPlayerTryUseItemOnBlock packet2 = (CPacketPlayerTryUseItemOnBlock) event.getPacket(); + CPacketPlayerTryUseItemOnBlock packet2 = event.getPacket(); if (packet2.getHand() == EnumHand.MAIN_HAND) { if (this.timer.passedMs(50L)) { Offhand.mc.player.setActiveHand(EnumHand.OFF_HAND); @@ -108,7 +107,7 @@ public void onPacketSend(EventPacket.Send event) { } event.setCanceled(true); } - } else if (event.getPacket() instanceof CPacketPlayerTryUseItem && (packet = (CPacketPlayerTryUseItem) event.getPacket()).getHand() == EnumHand.OFF_HAND && !this.timer.passedMs(50L)) { + } else if (event.getPacket() instanceof CPacketPlayerTryUseItem && (packet = event.getPacket()).getHand() == EnumHand.OFF_HAND && !this.timer.passedMs(50L)) { event.setCanceled(true); } } diff --git a/src/main/java/com/me/infinity/loop/features/modules/combat/SelfFill.java b/src/main/java/me/loop/features/modules/combat/SelfFill.java similarity index 77% rename from src/main/java/com/me/infinity/loop/features/modules/combat/SelfFill.java rename to src/main/java/me/loop/features/modules/combat/SelfFill.java index a9d92f4..4d2d64a 100644 --- a/src/main/java/com/me/infinity/loop/features/modules/combat/SelfFill.java +++ b/src/main/java/me/loop/features/modules/combat/SelfFill.java @@ -1,9 +1,8 @@ -package com.me.infinity.loop.features.modules.combat; +package me.loop.features.modules.combat; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.setting.Setting; -import com.me.infinity.loop.util.utils.minecraft.BlockUtil; +import me.loop.features.modules.Module; +import me.loop.features.setting.Setting; +import me.loop.util.impl.BlockUtil; import net.minecraft.init.Blocks; import net.minecraft.network.play.client.CPacketPlayer; import net.minecraft.util.EnumHand; @@ -14,7 +13,7 @@ public class SelfFill private final Setting packet = this.register(new Setting("PacketPlace", Boolean.FALSE)); public SelfFill() { - super("SelfFill", "SelfFills yourself in a hole.", ModuleCategory.COMBAT); + super("SelfFill", "SelfFills yourself in a hole.", Module.Category.COMBAT, true, false, true); } @Override @@ -26,7 +25,7 @@ public void onEnable() { @Override public void onUpdate() { BlockPos pos = new BlockPos(SelfFill.mc.player.posX, SelfFill.mc.player.posY, SelfFill.mc.player.posZ); - if (SelfFill.mc.world.getBlockState(pos.down()).getBlock() == Blocks.AIR && BlockUtil.isPositionPlaceable(pos.down(), true, true)) { + if (SelfFill.mc.world.getBlockState(pos.down()).getBlock() == Blocks.AIR && BlockUtil.isPositionPlaceable(pos.down(), false) == 3) { BlockUtil.placeBlock(pos.down(), EnumHand.MAIN_HAND, false, this.packet.getValue(), false); } if (SelfFill.mc.world.getBlockState(pos.down()).getBlock() == Blocks.OBSIDIAN) { diff --git a/src/main/java/me/loop/features/modules/combat/Selftrap.java b/src/main/java/me/loop/features/modules/combat/Selftrap.java new file mode 100644 index 0000000..0bb2d9e --- /dev/null +++ b/src/main/java/me/loop/features/modules/combat/Selftrap.java @@ -0,0 +1,154 @@ +package me.loop.features.modules.combat; + +import me.loop.event.events.UpdateWalkingPlayerEvent; +import me.loop.features.modules.Module; +import me.loop.features.setting.Setting; +import me.loop.util.impl.BlockUtil; +import me.loop.util.impl.EntityUtil; +import me.loop.util.impl.InventoryUtil; +import me.loop.util.init.Timer; +import net.minecraft.block.BlockEnderChest; +import net.minecraft.block.BlockObsidian; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3i; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +import java.util.*; + +public class Selftrap + extends Module { + private final Setting blocksPerTick = this.register(new Setting("BlocksPerTick", 8, 1, 20)); + private final Setting delay = this.register(new Setting("Delay", 50, 0, 250)); + private final Setting rotate = this.register(new Setting("Rotate", true)); + private final Setting disableTime = this.register(new Setting("DisableTime", 200, 50, 300)); + private final Setting disable = this.register(new Setting("AutoDisable", true)); + private final Setting packet = this.register(new Setting("PacketPlace", false)); + private final Timer offTimer = new Timer(); + private final Timer timer = new Timer(); + private final Map retries = new HashMap(); + private final Timer retryTimer = new Timer(); + private int blocksThisTick = 0; + private boolean isSneaking; + private boolean hasOffhand = false; + + public Selftrap() { + super("Selftrap", "Lure your enemies in!", Module.Category.COMBAT, true, false, true); + } + + @Override + public void onEnable() { + if (Selftrap.fullNullCheck()) { + this.disable(); + } + this.offTimer.reset(); + } + + @Override + public void onTick() { + if (this.isOn() && (this.blocksPerTick.getValue() != 1 || !this.rotate.getValue().booleanValue())) { + this.doHoleFill(); + } + } + + @SubscribeEvent + public void onUpdateWalkingPlayer(UpdateWalkingPlayerEvent event) { + if (this.isOn() && event.getStage() == 0 && this.blocksPerTick.getValue() == 1 && this.rotate.getValue().booleanValue()) { + this.doHoleFill(); + } + } + + @Override + public void onDisable() { + this.isSneaking = EntityUtil.stopSneaking(this.isSneaking); + this.retries.clear(); + this.hasOffhand = false; + } + + private void doHoleFill() { + if (this.check()) { + return; + } + for (BlockPos position : this.getPositions()) { + int placeability = BlockUtil.isPositionPlaceable(position, false); + if (placeability == 1 && (this.retries.get(position) == null || this.retries.get(position) < 4)) { + this.placeBlock(position); + this.retries.put(position, this.retries.get(position) == null ? 1 : this.retries.get(position) + 1); + } + if (placeability != 3) continue; + this.placeBlock(position); + } + } + + private List getPositions() { + ArrayList positions = new ArrayList(); + positions.add(new BlockPos(Selftrap.mc.player.posX, Selftrap.mc.player.posY + 2.0, Selftrap.mc.player.posZ)); + int placeability = BlockUtil.isPositionPlaceable(positions.get(0), false); + switch (placeability) { + case 0: { + return new ArrayList(); + } + case 3: { + return positions; + } + case 1: { + if (BlockUtil.isPositionPlaceable(positions.get(0), false, false) == 3) { + return positions; + } + } + case 2: { + positions.add(new BlockPos(Selftrap.mc.player.posX + 1.0, Selftrap.mc.player.posY + 1.0, Selftrap.mc.player.posZ)); + positions.add(new BlockPos(Selftrap.mc.player.posX + 1.0, Selftrap.mc.player.posY + 2.0, Selftrap.mc.player.posZ)); + } + } + positions.sort(Comparator.comparingDouble(Vec3i::getY)); + return positions; + } + + private void placeBlock(BlockPos pos) { + if (this.blocksThisTick < this.blocksPerTick.getValue()) { + boolean smartRotate = this.blocksPerTick.getValue() == 1 && this.rotate.getValue() != false; + int originalSlot = Selftrap.mc.player.inventory.currentItem; + int obbySlot = InventoryUtil.findHotbarBlock(BlockObsidian.class); + int eChestSot = InventoryUtil.findHotbarBlock(BlockEnderChest.class); + if (obbySlot == -1 && eChestSot == -1) { + this.toggle(); + } + Selftrap.mc.player.inventory.currentItem = obbySlot == -1 ? eChestSot : obbySlot; + Selftrap.mc.playerController.updateController(); + this.isSneaking = smartRotate ? BlockUtil.placeBlockSmartRotate(pos, this.hasOffhand ? EnumHand.OFF_HAND : EnumHand.MAIN_HAND, true, this.packet.getValue(), this.isSneaking) : BlockUtil.placeBlock(pos, this.hasOffhand ? EnumHand.OFF_HAND : EnumHand.MAIN_HAND, this.rotate.getValue(), this.packet.getValue(), this.isSneaking); + Selftrap.mc.player.inventory.currentItem = originalSlot; + Selftrap.mc.playerController.updateController(); + this.timer.reset(); + ++this.blocksThisTick; + } + } + + private boolean check() { + if (Selftrap.fullNullCheck()) { + this.disable(); + return true; + } + int obbySlot = InventoryUtil.findHotbarBlock(BlockObsidian.class); + int eChestSot = InventoryUtil.findHotbarBlock(BlockEnderChest.class); + if (obbySlot == -1 && eChestSot == -1) { + this.toggle(); + } + this.blocksThisTick = 0; + this.isSneaking = EntityUtil.stopSneaking(this.isSneaking); + if (this.retryTimer.passedMs(2000L)) { + this.retries.clear(); + this.retryTimer.reset(); + } + if (!EntityUtil.isSafe(Selftrap.mc.player)) { + this.offTimer.reset(); + return true; + } + if (this.disable.getValue().booleanValue() && this.offTimer.passedMs(this.disableTime.getValue().intValue())) { + this.disable(); + return true; + } + return !this.timer.passedMs(this.delay.getValue().intValue()); + } +} + diff --git a/src/main/java/me/loop/features/modules/combat/Surround.java b/src/main/java/me/loop/features/modules/combat/Surround.java new file mode 100644 index 0000000..5e13fac --- /dev/null +++ b/src/main/java/me/loop/features/modules/combat/Surround.java @@ -0,0 +1,237 @@ +package me.loop.features.modules.combat; + +import com.mojang.realmsclient.gui.ChatFormatting; +import me.loop.InfinityLoop; +import me.loop.features.command.Command; +import me.loop.features.modules.Module; +import me.loop.features.setting.Setting; +import me.loop.util.impl.BlockUtil; +import me.loop.util.impl.EntityUtil; +import me.loop.util.impl.InventoryUtil; +import me.loop.util.init.Timer; +import net.minecraft.block.BlockEnderChest; +import net.minecraft.block.BlockObsidian; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; + +import java.util.*; + +public class Surround + extends Module { + public static boolean isPlacing = false; + private final Setting blocksPerTick = this.register(new Setting("BlocksPerTick", 12, 1, 20)); + private final Setting delay = this.register(new Setting("Delay", 0, 0, 250)); + private final Setting noGhost = this.register(new Setting("PacketPlace", false)); + private final Setting center = this.register(new Setting("TPCenter", false)); + private final Setting rotate = this.register(new Setting("Rotate", true)); + private final Timer timer = new Timer(); + private final Timer retryTimer = new Timer(); + private final Set extendingBlocks = new HashSet(); + private final Map retries = new HashMap(); + private int isSafe; + private BlockPos startPos; + private boolean didPlace = false; + private boolean switchedItem; + private int lastHotbarSlot; + private boolean isSneaking; + private int placements = 0; + private int extenders = 1; + private int obbySlot = -1; + private boolean offHand = false; + + public Surround() { + super("Surround", "Surrounds you with Obsidian", Module.Category.COMBAT, true, false, false); + } + + @Override + public void onEnable() { + if (Surround.fullNullCheck()) { + this.disable(); + } + this.lastHotbarSlot = Surround.mc.player.inventory.currentItem; + this.startPos = EntityUtil.getRoundedBlockPos(Surround.mc.player); + if (this.center.getValue().booleanValue()) { + InfinityLoop.positionManager.setPositionPacket((double) this.startPos.getX() + 0.5, this.startPos.getY(), (double) this.startPos.getZ() + 0.5, true, true, true); + } + this.retries.clear(); + this.retryTimer.reset(); + } + + @Override + public void onTick() { + this.doFeetPlace(); + } + + @Override + public void onDisable() { + if (Surround.nullCheck()) { + return; + } + isPlacing = false; + this.isSneaking = EntityUtil.stopSneaking(this.isSneaking); + } + + @Override + public String getDisplayInfo() { + switch (this.isSafe) { + case 0: { + return ChatFormatting.RED + "Unsafe"; + } + case 1: { + return ChatFormatting.YELLOW + "Safe"; + } + } + return ChatFormatting.GREEN + "Safe"; + } + + private void doFeetPlace() { + if (this.check()) { + return; + } + if (!EntityUtil.isSafe(Surround.mc.player, 0, true)) { + this.isSafe = 0; + this.placeBlocks(Surround.mc.player.getPositionVector(), EntityUtil.getUnsafeBlockArray(Surround.mc.player, 0, true), true, false, false); + } else if (!EntityUtil.isSafe(Surround.mc.player, -1, false)) { + this.isSafe = 1; + this.placeBlocks(Surround.mc.player.getPositionVector(), EntityUtil.getUnsafeBlockArray(Surround.mc.player, -1, false), false, false, true); + } else { + this.isSafe = 2; + } + this.processExtendingBlocks(); + if (this.didPlace) { + this.timer.reset(); + } + } + + private void processExtendingBlocks() { + if (this.extendingBlocks.size() == 2 && this.extenders < 1) { + Vec3d[] array = new Vec3d[2]; + int i = 0; + Iterator iterator = this.extendingBlocks.iterator(); + while (iterator.hasNext()) { + Vec3d vec3d; + array[i] = vec3d = iterator.next(); + ++i; + } + int placementsBefore = this.placements; + if (this.areClose(array) != null) { + this.placeBlocks(this.areClose(array), EntityUtil.getUnsafeBlockArrayFromVec3d(this.areClose(array), 0, true), true, false, true); + } + if (placementsBefore < this.placements) { + this.extendingBlocks.clear(); + } + } else if (this.extendingBlocks.size() > 2 || this.extenders >= 1) { + this.extendingBlocks.clear(); + } + } + + private Vec3d areClose(Vec3d[] vec3ds) { + int matches = 0; + for (Vec3d vec3d : vec3ds) { + for (Vec3d pos : EntityUtil.getUnsafeBlockArray(Surround.mc.player, 0, true)) { + if (!vec3d.equals(pos)) continue; + ++matches; + } + } + if (matches == 2) { + return Surround.mc.player.getPositionVector().add(vec3ds[0].add(vec3ds[1])); + } + return null; + } + + private boolean placeBlocks(Vec3d pos, Vec3d[] vec3ds, boolean hasHelpingBlocks, boolean isHelping, boolean isExtending) { + boolean gotHelp = true; + block5: + for (Vec3d vec3d : vec3ds) { + gotHelp = true; + BlockPos position = new BlockPos(pos).add(vec3d.x, vec3d.y, vec3d.z); + switch (BlockUtil.isPositionPlaceable(position, false)) { + case 1: { + if (this.retries.get(position) == null || this.retries.get(position) < 4) { + this.placeBlock(position); + this.retries.put(position, this.retries.get(position) == null ? 1 : this.retries.get(position) + 1); + this.retryTimer.reset(); + continue block5; + } + if (InfinityLoop.speedManager.getSpeedKpH() != 0.0 || isExtending || this.extenders >= 1) continue block5; + this.placeBlocks(Surround.mc.player.getPositionVector().add(vec3d), EntityUtil.getUnsafeBlockArrayFromVec3d(Surround.mc.player.getPositionVector().add(vec3d), 0, true), hasHelpingBlocks, false, true); + this.extendingBlocks.add(vec3d); + ++this.extenders; + continue block5; + } + case 2: { + if (!hasHelpingBlocks) continue block5; + gotHelp = this.placeBlocks(pos, BlockUtil.getHelpingBlocks(vec3d), false, true, true); + } + case 3: { + if (gotHelp) { + this.placeBlock(position); + } + if (!isHelping) continue block5; + return true; + } + } + } + return false; + } + + private boolean check() { + if (Surround.nullCheck()) { + return true; + } + int obbySlot = InventoryUtil.findHotbarBlock(BlockObsidian.class); + int eChestSot = InventoryUtil.findHotbarBlock(BlockEnderChest.class); + if (obbySlot == -1 && eChestSot == -1) { + this.toggle(); + } + this.offHand = InventoryUtil.isBlock(Surround.mc.player.getHeldItemOffhand().getItem(), BlockObsidian.class); + isPlacing = false; + this.didPlace = false; + this.extenders = 1; + this.placements = 0; + this.obbySlot = InventoryUtil.findHotbarBlock(BlockObsidian.class); + int echestSlot = InventoryUtil.findHotbarBlock(BlockEnderChest.class); + if (this.isOff()) { + return true; + } + if (this.retryTimer.passedMs(2500L)) { + this.retries.clear(); + this.retryTimer.reset(); + } + if (this.obbySlot == -1 && !this.offHand && echestSlot == -1) { + Command.sendMessage("<" + this.getDisplayName() + "> " + ChatFormatting.RED + "No Obsidian in hotbar disabling..."); + this.disable(); + return true; + } + this.isSneaking = EntityUtil.stopSneaking(this.isSneaking); + if (Surround.mc.player.inventory.currentItem != this.lastHotbarSlot && Surround.mc.player.inventory.currentItem != this.obbySlot && Surround.mc.player.inventory.currentItem != echestSlot) { + this.lastHotbarSlot = Surround.mc.player.inventory.currentItem; + } + if (!this.startPos.equals(EntityUtil.getRoundedBlockPos(Surround.mc.player))) { + this.disable(); + return true; + } + return !this.timer.passedMs(this.delay.getValue().intValue()); + } + + private void placeBlock(BlockPos pos) { + if (this.placements < this.blocksPerTick.getValue()) { + int originalSlot = Surround.mc.player.inventory.currentItem; + int obbySlot = InventoryUtil.findHotbarBlock(BlockObsidian.class); + int eChestSot = InventoryUtil.findHotbarBlock(BlockEnderChest.class); + if (obbySlot == -1 && eChestSot == -1) { + this.toggle(); + } + isPlacing = true; + Surround.mc.player.inventory.currentItem = obbySlot == -1 ? eChestSot : obbySlot; + Surround.mc.playerController.updateController(); + this.isSneaking = BlockUtil.placeBlock(pos, this.offHand ? EnumHand.OFF_HAND : EnumHand.MAIN_HAND, this.rotate.getValue(), this.noGhost.getValue(), this.isSneaking); + Surround.mc.player.inventory.currentItem = originalSlot; + Surround.mc.playerController.updateController(); + this.didPlace = true; + ++this.placements; + } + } +} + diff --git a/src/main/java/com/me/infinity/loop/features/modules/misc/AutoGG.java b/src/main/java/me/loop/features/modules/misc/AutoGG.java similarity index 93% rename from src/main/java/com/me/infinity/loop/features/modules/misc/AutoGG.java rename to src/main/java/me/loop/features/modules/misc/AutoGG.java index 18c2db4..eb4f22c 100644 --- a/src/main/java/com/me/infinity/loop/features/modules/misc/AutoGG.java +++ b/src/main/java/me/loop/features/modules/misc/AutoGG.java @@ -1,8 +1,7 @@ -package com.me.infinity.loop.features.modules.misc; +package me.loop.features.modules.misc; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.setting.Setting; +import me.loop.features.modules.Module; +import me.loop.features.setting.Setting; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -21,7 +20,7 @@ public class AutoGG private ConcurrentHashMap targetedPlayers = null; public AutoGG() { - super("AutoGG", "Sends msg after you kill someone", ModuleCategory.MISC); + super("AutoGG", "Sends msg after you kill someone", Module.Category.MISC, true, false, false); this.setInstance(); } diff --git a/src/main/java/com/me/infinity/loop/features/modules/misc/ChatModifier.java b/src/main/java/me/loop/features/modules/misc/ChatModifier.java similarity index 71% rename from src/main/java/com/me/infinity/loop/features/modules/misc/ChatModifier.java rename to src/main/java/me/loop/features/modules/misc/ChatModifier.java index cb53339..1c1a885 100644 --- a/src/main/java/com/me/infinity/loop/features/modules/misc/ChatModifier.java +++ b/src/main/java/me/loop/features/modules/misc/ChatModifier.java @@ -1,10 +1,9 @@ -package com.me.infinity.loop.features.modules.misc; +package me.loop.features.modules.misc; -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.event.events.network.EventPacket; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.setting.Setting; +import me.loop.InfinityLoop; +import me.loop.event.events.PacketEvent; +import me.loop.features.modules.Module; +import me.loop.features.setting.Setting; import net.minecraft.network.play.client.CPacketChatMessage; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @@ -16,7 +15,7 @@ public class ChatModifier public boolean check; public ChatModifier() { - super("BetterChat", "Modifies your chat", ModuleCategory.MISC); + super("BetterChat", "Modifies your chat", Module.Category.MISC, true, false, false); this.setInstance(); } @@ -32,7 +31,7 @@ private void setInstance() { } @SubscribeEvent - public void onPacketSend(EventPacket.Send event) { + public void onPacketSend(PacketEvent.Send event) { if (event.getPacket() instanceof CPacketChatMessage) { String s = ((CPacketChatMessage) event.getPacket()).getMessage(); this.check = !s.startsWith(InfinityLoop.commandManager.getPrefix()); diff --git a/src/main/java/com/me/infinity/loop/features/modules/misc/MCF.java b/src/main/java/me/loop/features/modules/misc/MCF.java similarity index 81% rename from src/main/java/com/me/infinity/loop/features/modules/misc/MCF.java rename to src/main/java/me/loop/features/modules/misc/MCF.java index 6ad2111..2f5be01 100644 --- a/src/main/java/com/me/infinity/loop/features/modules/misc/MCF.java +++ b/src/main/java/me/loop/features/modules/misc/MCF.java @@ -1,10 +1,9 @@ -package com.me.infinity.loop.features.modules.misc; +package me.loop.features.modules.misc; -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.features.modules.ModuleCategory; import com.mojang.realmsclient.gui.ChatFormatting; -import com.me.infinity.loop.features.command.Command; -import com.me.infinity.loop.features.modules.Module; +import me.loop.InfinityLoop; +import me.loop.features.command.Command; +import me.loop.features.modules.Module; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.math.RayTraceResult; @@ -15,7 +14,7 @@ public class MCF private boolean clicked = false; public MCF() { - super("MCF", "Middleclick Friends.", ModuleCategory.MISC); + super("MCF", "Middleclick Friends.", Module.Category.MISC, true, false, false); } @Override diff --git a/src/main/java/com/me/infinity/loop/features/modules/misc/NoHandShake.java b/src/main/java/me/loop/features/modules/misc/NoHandShake.java similarity index 65% rename from src/main/java/com/me/infinity/loop/features/modules/misc/NoHandShake.java rename to src/main/java/me/loop/features/modules/misc/NoHandShake.java index 1ea4c7c..2c352d2 100644 --- a/src/main/java/com/me/infinity/loop/features/modules/misc/NoHandShake.java +++ b/src/main/java/me/loop/features/modules/misc/NoHandShake.java @@ -1,9 +1,8 @@ -package com.me.infinity.loop.features.modules.misc; +package me.loop.features.modules.misc; -import com.me.infinity.loop.event.events.network.EventPacket; -import com.me.infinity.loop.features.modules.ModuleCategory; import io.netty.buffer.Unpooled; -import com.me.infinity.loop.features.modules.Module; +import me.loop.event.events.PacketEvent; +import me.loop.features.modules.Module; import net.minecraft.network.PacketBuffer; import net.minecraft.network.play.client.CPacketCustomPayload; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @@ -12,16 +11,16 @@ public class NoHandShake extends Module { public NoHandShake() { - super("NoHandshake", "Doesnt send your modlist to the server.", ModuleCategory.MISC); + super("NoHandshake", "Doesnt send your modlist to the server.", Module.Category.MISC, true, false, false); } @SubscribeEvent - public void onPacketSend(EventPacket.Send event) { + public void onPacketSend(PacketEvent.Send event) { CPacketCustomPayload packet; if (event.getPacket() instanceof FMLProxyPacket && !mc.isSingleplayer()) { event.setCanceled(true); } - if (event.getPacket() instanceof CPacketCustomPayload && (packet = (CPacketCustomPayload) event.getPacket()).getChannelName().equals("MC|Brand")) { + if (event.getPacket() instanceof CPacketCustomPayload && (packet = event.getPacket()).getChannelName().equals("MC|Brand")) { packet.data = new PacketBuffer(Unpooled.buffer()).writeString("vanilla"); } } diff --git a/src/main/java/me/loop/features/modules/misc/NoHitBox.java b/src/main/java/me/loop/features/modules/misc/NoHitBox.java new file mode 100644 index 0000000..a6abba7 --- /dev/null +++ b/src/main/java/me/loop/features/modules/misc/NoHitBox.java @@ -0,0 +1,29 @@ +package me.loop.features.modules.misc; + +import me.loop.features.modules.Module; +import me.loop.features.setting.Setting; + +public class NoHitBox + extends Module { + private static NoHitBox INSTANCE = new NoHitBox(); + public Setting pickaxe = this.register(new Setting("Pickaxe", true)); + public Setting crystal = this.register(new Setting("Crystal", true)); + public Setting gapple = this.register(new Setting("Gapple", true)); + + public NoHitBox() { + super("NoHitBox", "NoHitBox.", Module.Category.MISC, false, false, false); + this.setInstance(); + } + + public static NoHitBox getINSTANCE() { + if (INSTANCE == null) { + INSTANCE = new NoHitBox(); + } + return INSTANCE; + } + + private void setInstance() { + INSTANCE = this; + } +} + diff --git a/src/main/java/me/loop/features/modules/misc/PearlNotify.java b/src/main/java/me/loop/features/modules/misc/PearlNotify.java new file mode 100644 index 0000000..c15e034 --- /dev/null +++ b/src/main/java/me/loop/features/modules/misc/PearlNotify.java @@ -0,0 +1,74 @@ +// +// Decompiled by Procyon v0.5.36 +// + +package me.loop.features.modules.misc; + +import com.mojang.realmsclient.gui.ChatFormatting; +import me.loop.InfinityLoop; +import me.loop.features.command.Command; +import me.loop.features.modules.Module; +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityEnderPearl; +import net.minecraft.entity.player.EntityPlayer; + +import java.util.HashMap; +import java.util.UUID; + +public class PearlNotify extends Module { + private final HashMap list; + private Entity enderPearl; + private boolean flag; + + public PearlNotify() { + super("PearlNotify", "Notify pearl throws.", Category.MISC, true, false, false); + this.list = new HashMap(); + } + + @Override + public void onEnable() { + this.flag = true; + } + + @Override + public void onUpdate() { + if (PearlNotify.mc.world == null || PearlNotify.mc.player == null) { + return; + } + this.enderPearl = null; + for (final Entity e : PearlNotify.mc.world.loadedEntityList) { + if (e instanceof EntityEnderPearl) { + this.enderPearl = e; + break; + } + } + if (this.enderPearl == null) { + this.flag = true; + return; + } + EntityPlayer closestPlayer = null; + for (final EntityPlayer entity : PearlNotify.mc.world.playerEntities) { + if (closestPlayer == null) { + closestPlayer = entity; + } else { + if (closestPlayer.getDistance(this.enderPearl) <= entity.getDistance(this.enderPearl)) { + continue; + } + closestPlayer = entity; + } + } + if (closestPlayer == PearlNotify.mc.player) { + this.flag = false; + } + if (closestPlayer != null && this.flag) { + String faceing = this.enderPearl.getHorizontalFacing().toString(); + if (faceing.equals("west")) { + faceing = "east"; + } else if (faceing.equals("east")) { + faceing = "west"; + } + Command.sendMessage(InfinityLoop.friendManager.isFriend(closestPlayer.getName()) ? (ChatFormatting.AQUA + closestPlayer.getName() + ChatFormatting.DARK_GRAY + " has just thrown a pearl heading " + faceing + "!") : (ChatFormatting.RED + closestPlayer.getName() + ChatFormatting.DARK_GRAY + " has just thrown a pearl heading " + faceing + "!")); + this.flag = false; + } + } +} \ No newline at end of file diff --git a/src/main/java/com/me/infinity/loop/features/modules/misc/PopCounter.java b/src/main/java/me/loop/features/modules/misc/PopCounter.java similarity index 90% rename from src/main/java/com/me/infinity/loop/features/modules/misc/PopCounter.java rename to src/main/java/me/loop/features/modules/misc/PopCounter.java index 67c4258..0c3afb6 100644 --- a/src/main/java/com/me/infinity/loop/features/modules/misc/PopCounter.java +++ b/src/main/java/me/loop/features/modules/misc/PopCounter.java @@ -1,9 +1,8 @@ -package com.me.infinity.loop.features.modules.misc; +package me.loop.features.modules.misc; -import com.me.infinity.loop.features.modules.ModuleCategory; import com.mojang.realmsclient.gui.ChatFormatting; -import com.me.infinity.loop.features.command.Command; -import com.me.infinity.loop.features.modules.Module; +import me.loop.features.command.Command; +import me.loop.features.modules.Module; import net.minecraft.entity.player.EntityPlayer; import java.util.HashMap; @@ -14,7 +13,7 @@ public class PopCounter private static PopCounter INSTANCE = new PopCounter(); public PopCounter() { - super("PopCounter", "Counts other players totem pops.", ModuleCategory.MISC); + super("PopCounter", "Counts other players totem pops.", Module.Category.MISC, true, false, false); this.setInstance(); } diff --git a/src/main/java/com/me/infinity/loop/features/modules/misc/ToolTips.java b/src/main/java/me/loop/features/modules/misc/ToolTips.java similarity index 91% rename from src/main/java/com/me/infinity/loop/features/modules/misc/ToolTips.java rename to src/main/java/me/loop/features/modules/misc/ToolTips.java index f4d7c3e..ae42a34 100644 --- a/src/main/java/com/me/infinity/loop/features/modules/misc/ToolTips.java +++ b/src/main/java/me/loop/features/modules/misc/ToolTips.java @@ -1,12 +1,11 @@ -package com.me.infinity.loop.features.modules.misc; +package me.loop.features.modules.misc; -import com.me.infinity.loop.event.events.render.Render2DEvent; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.modules.client.ClickGui.ClickGui; -import com.me.infinity.loop.util.utils.renders.ColorUtil; -import com.me.infinity.loop.util.utils.renders.RenderUtil; -import com.me.infinity.loop.util.utils.worlds.Timer; +import me.loop.event.events.Render2DEvent; +import me.loop.features.modules.Module; +import me.loop.features.modules.client.Colors; +import me.loop.util.impl.ColorUtil; +import me.loop.util.impl.RenderUtil; +import me.loop.util.init.Timer; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.entity.player.EntityPlayer; @@ -35,7 +34,7 @@ public class ToolTips private int textRadarY = 0; public ToolTips() { - super("ShulkerViewer", "Several tweaks for tooltips.", ModuleCategory.MISC); + super("ShulkerViewer", "Several tweaks for tooltips.", Module.Category.MISC, true, false, false); this.setInstance(); } @@ -134,7 +133,7 @@ public void renderShulkerToolTip(ItemStack stack, int x, int y, String name) { RenderUtil.drawTexturedRect(x, y + 16, 0, 16, 176, 57, 500); RenderUtil.drawTexturedRect(x, y + 16 + 54, 0, 160, 176, 8, 500); GlStateManager.disableDepth(); - Color color = new Color(ClickGui.getInstance().red.getValue(), ClickGui.getInstance().green.getValue(), ClickGui.getInstance().blue.getValue(), 200); + Color color = new Color(Colors.getInstance().c.getValue().getRed(), Colors.getInstance().c.getValue().getGreen(), Colors.getInstance().c.getValue().getBlue(), 200); this.renderer.drawStringWithShadow(name == null ? stack.getDisplayName() : name, x + 8, y + 6, ColorUtil.toRGBA(color)); GlStateManager.enableDepth(); RenderHelper.enableGUIStandardItemLighting(); diff --git a/src/main/java/com/me/infinity/loop/features/modules/movement/NoVoid.java b/src/main/java/me/loop/features/modules/movement/NoVoid.java similarity index 77% rename from src/main/java/com/me/infinity/loop/features/modules/movement/NoVoid.java rename to src/main/java/me/loop/features/modules/movement/NoVoid.java index 8f04a06..30b8840 100644 --- a/src/main/java/com/me/infinity/loop/features/modules/movement/NoVoid.java +++ b/src/main/java/me/loop/features/modules/movement/NoVoid.java @@ -1,14 +1,13 @@ -package com.me.infinity.loop.features.modules.movement; +package me.loop.features.modules.movement; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; +import me.loop.features.modules.Module; import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.Vec3d; public class NoVoid extends Module { public NoVoid() { - super("NoVoid", "Glitches you up from void.", ModuleCategory.MOVEMENT); + super("NoVoid", "Glitches you up from void.", Module.Category.MOVEMENT, false, false, false); } @Override diff --git a/src/main/java/com/me/infinity/loop/features/modules/movement/ReverseStep.java b/src/main/java/me/loop/features/modules/movement/ReverseStep.java similarity index 85% rename from src/main/java/com/me/infinity/loop/features/modules/movement/ReverseStep.java rename to src/main/java/me/loop/features/modules/movement/ReverseStep.java index 2467e7a..2f1a9e2 100644 --- a/src/main/java/com/me/infinity/loop/features/modules/movement/ReverseStep.java +++ b/src/main/java/me/loop/features/modules/movement/ReverseStep.java @@ -1,8 +1,7 @@ -package com.me.infinity.loop.features.modules.movement; +package me.loop.features.modules.movement; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.setting.Setting; +import me.loop.features.modules.Module; +import me.loop.features.setting.Setting; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; @@ -13,7 +12,7 @@ public class ReverseStep private final Setting twoBlocks = this.register(new Setting("2Blocks", Boolean.FALSE)); public ReverseStep() { - super("ReverseStep", "ReverseStep.", ModuleCategory.MOVEMENT); + super("ReverseStep", "ReverseStep.", Module.Category.MOVEMENT, true, false, false); this.setInstance(); } diff --git a/src/main/java/me/loop/features/modules/movement/Speed.java b/src/main/java/me/loop/features/modules/movement/Speed.java new file mode 100644 index 0000000..9aea585 --- /dev/null +++ b/src/main/java/me/loop/features/modules/movement/Speed.java @@ -0,0 +1,16 @@ +package me.loop.features.modules.movement; + +import me.loop.features.modules.Module; + +public class Speed + extends Module { + public Speed() { + super("Speed", "Speed.", Module.Category.MOVEMENT, true, false, false); + } + + @Override + public String getDisplayInfo() { + return "Strafe"; + } +} + diff --git a/src/main/java/me/loop/features/modules/movement/Step.java b/src/main/java/me/loop/features/modules/movement/Step.java new file mode 100644 index 0000000..c07afc5 --- /dev/null +++ b/src/main/java/me/loop/features/modules/movement/Step.java @@ -0,0 +1,11 @@ +package me.loop.features.modules.movement; + +import me.loop.features.modules.Module; + +public class Step + extends Module { + public Step() { + super("Step", "Step.", Module.Category.MOVEMENT, true, false, false); + } +} + diff --git a/src/main/java/me/loop/features/modules/player/FakePlayer.java b/src/main/java/me/loop/features/modules/player/FakePlayer.java new file mode 100644 index 0000000..98542a9 --- /dev/null +++ b/src/main/java/me/loop/features/modules/player/FakePlayer.java @@ -0,0 +1,79 @@ +package me.loop.features.modules.player; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import com.mojang.authlib.GameProfile; +import me.loop.features.command.Command; +import me.loop.features.modules.Module; +import net.minecraft.client.entity.EntityOtherPlayerMP; +import org.apache.commons.io.IOUtils; + +import java.net.URL; +import java.nio.charset.StandardCharsets; +import java.util.UUID; + +public class FakePlayer + extends Module { + private final String name = "NiggaHack.me"; + private EntityOtherPlayerMP _fakePlayer; + + public FakePlayer() { + super("FakePlayer", "Spawns a FakePlayer for testing", Module.Category.PLAYER, false, false, false); + } + + public static String getUuid(String name) { + JsonParser parser = new JsonParser(); + String url = "https://api.mojang.com/users/profiles/minecraft/" + name; + try { + String UUIDJson = IOUtils.toString(new URL(url), StandardCharsets.UTF_8); + if (UUIDJson.isEmpty()) { + return "invalid name"; + } + JsonObject UUIDObject = (JsonObject) parser.parse(UUIDJson); + return FakePlayer.reformatUuid(UUIDObject.get("id").toString()); + } catch (Exception e) { + e.printStackTrace(); + return "error"; + } + } + + private static String reformatUuid(String uuid) { + String longUuid = ""; + longUuid = longUuid + uuid.substring(1, 9) + "-"; + longUuid = longUuid + uuid.substring(9, 13) + "-"; + longUuid = longUuid + uuid.substring(13, 17) + "-"; + longUuid = longUuid + uuid.substring(17, 21) + "-"; + longUuid = longUuid + uuid.substring(21, 33); + return longUuid; + } + + @Override + public void onEnable() { + if (FakePlayer.fullNullCheck()) { + this.disable(); + return; + } + this._fakePlayer = null; + if (FakePlayer.mc.player != null) { + try { + this._fakePlayer = new EntityOtherPlayerMP(FakePlayer.mc.world, new GameProfile(UUID.fromString(FakePlayer.getUuid(this.name)), this.name)); + } catch (Exception e) { + this._fakePlayer = new EntityOtherPlayerMP(FakePlayer.mc.world, new GameProfile(UUID.fromString("70ee432d-0a96-4137-a2c0-37cc9df67f03"), this.name)); + Command.sendMessage("Failed to load uuid, setting another one."); + } + Command.sendMessage(String.format("%s has been spawned.", this.name)); + this._fakePlayer.copyLocationAndAnglesFrom(FakePlayer.mc.player); + this._fakePlayer.rotationYawHead = FakePlayer.mc.player.rotationYawHead; + FakePlayer.mc.world.addEntityToWorld(-100, this._fakePlayer); + } + } + + @Override + public void onDisable() { + if (FakePlayer.mc.world != null && FakePlayer.mc.player != null) { + super.onDisable(); + FakePlayer.mc.world.removeEntity(this._fakePlayer); + } + } +} + diff --git a/src/main/java/com/me/infinity/loop/features/modules/player/FastPlace.java b/src/main/java/me/loop/features/modules/player/FastPlace.java similarity index 54% rename from src/main/java/com/me/infinity/loop/features/modules/player/FastPlace.java rename to src/main/java/me/loop/features/modules/player/FastPlace.java index 2ca94e2..9543b7c 100644 --- a/src/main/java/com/me/infinity/loop/features/modules/player/FastPlace.java +++ b/src/main/java/me/loop/features/modules/player/FastPlace.java @@ -1,14 +1,13 @@ -package com.me.infinity.loop.features.modules.player; +package me.loop.features.modules.player; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.util.utils.minecraft.InventoryUtil; +import me.loop.features.modules.Module; +import me.loop.util.impl.InventoryUtil; import net.minecraft.item.ItemExpBottle; public class FastPlace extends Module { public FastPlace() { - super("FastPlace", "Fast everything.", ModuleCategory.PLAYER); + super("FastPlace", "Fast everything.", Module.Category.PLAYER, true, false, false); } @Override diff --git a/src/main/java/com/me/infinity/loop/features/modules/player/MCP.java b/src/main/java/me/loop/features/modules/player/MCP.java similarity index 81% rename from src/main/java/com/me/infinity/loop/features/modules/player/MCP.java rename to src/main/java/me/loop/features/modules/player/MCP.java index b937166..85e3317 100644 --- a/src/main/java/com/me/infinity/loop/features/modules/player/MCP.java +++ b/src/main/java/me/loop/features/modules/player/MCP.java @@ -1,8 +1,7 @@ -package com.me.infinity.loop.features.modules.player; +package me.loop.features.modules.player; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.util.utils.minecraft.InventoryUtil; +import me.loop.features.modules.Module; +import me.loop.util.impl.InventoryUtil; import net.minecraft.init.Items; import net.minecraft.item.ItemEnderPearl; import net.minecraft.util.EnumHand; @@ -13,7 +12,7 @@ public class MCP private boolean clicked = false; public MCP() { - super("MCP", "Throws a pearl", ModuleCategory.PLAYER); + super("MCP", "Throws a pearl", Module.Category.PLAYER, false, false, false); } @Override diff --git a/src/main/java/com/me/infinity/loop/features/modules/player/MultiTask.java b/src/main/java/me/loop/features/modules/player/MultiTask.java similarity index 70% rename from src/main/java/com/me/infinity/loop/features/modules/player/MultiTask.java rename to src/main/java/me/loop/features/modules/player/MultiTask.java index bc29c8a..6b6ec15 100644 --- a/src/main/java/com/me/infinity/loop/features/modules/player/MultiTask.java +++ b/src/main/java/me/loop/features/modules/player/MultiTask.java @@ -1,14 +1,13 @@ -package com.me.infinity.loop.features.modules.player; +package me.loop.features.modules.player; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; +import me.loop.features.modules.Module; public class MultiTask extends Module { private static MultiTask INSTANCE = new MultiTask(); public MultiTask() { - super("MultiTask", "Allows you to eat while mining.", ModuleCategory.PLAYER); + super("MultiTask", "Allows you to eat while mining.", Module.Category.PLAYER, false, false, false); this.setInstance(); } diff --git a/src/main/java/com/me/infinity/loop/features/modules/player/Replenish.java b/src/main/java/me/loop/features/modules/player/Replenish.java similarity index 89% rename from src/main/java/com/me/infinity/loop/features/modules/player/Replenish.java rename to src/main/java/me/loop/features/modules/player/Replenish.java index 89d3c73..13af7f3 100644 --- a/src/main/java/com/me/infinity/loop/features/modules/player/Replenish.java +++ b/src/main/java/me/loop/features/modules/player/Replenish.java @@ -1,9 +1,8 @@ -package com.me.infinity.loop.features.modules.player; +package me.loop.features.modules.player; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.setting.Setting; -import com.me.infinity.loop.util.utils.worlds.Timer; +import me.loop.features.modules.Module; +import me.loop.features.setting.Setting; +import me.loop.util.init.Timer; import net.minecraft.init.Items; import net.minecraft.inventory.ClickType; import net.minecraft.item.Item; @@ -20,12 +19,13 @@ public class Replenish private final ArrayList Hotbar = new ArrayList(); public Replenish() { - super("Replenish", "Replenishes your hotbar", ModuleCategory.PLAYER); + super("Replenish", "Replenishes your hotbar", Module.Category.PLAYER, false, false, false); } @Override public void onEnable() { if (Replenish.fullNullCheck()) { + return; } this.Hotbar.clear(); for (int l_I = 0; l_I < 9; ++l_I) { diff --git a/src/main/java/me/loop/features/modules/player/Speedmine.java b/src/main/java/me/loop/features/modules/player/Speedmine.java new file mode 100644 index 0000000..2495b13 --- /dev/null +++ b/src/main/java/me/loop/features/modules/player/Speedmine.java @@ -0,0 +1,145 @@ +package me.loop.features.modules.player; + +import me.loop.InfinityLoop; +import me.loop.event.events.BlockEvent; +import me.loop.event.events.Render3DEvent; +import me.loop.features.modules.Module; +import me.loop.features.setting.Setting; +import me.loop.util.impl.BlockUtil; +import me.loop.util.impl.InventoryUtil; +import me.loop.util.impl.RenderUtil; +import me.loop.util.init.Timer; +import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemPickaxe; +import net.minecraft.item.ItemSword; +import net.minecraft.network.play.client.CPacketPlayerDigging; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +import java.awt.*; + +public class Speedmine + extends Module { + private static Speedmine INSTANCE = new Speedmine(); + private final Timer timer = new Timer(); + public Setting mode = this.register(new Setting("Mode", Mode.PACKET)); + public Setting damage = this.register(new Setting("Damage", Float.valueOf(0.7f), Float.valueOf(0.0f), Float.valueOf(1.0f), v -> this.mode.getValue() == Mode.DAMAGE)); + public Setting webSwitch = this.register(new Setting("WebSwitch", false)); + public Setting doubleBreak = this.register(new Setting("DoubleBreak", false)); + public Setting render = this.register(new Setting("Render", false)); + public Setting box = this.register(new Setting("Box", Boolean.valueOf(false), v -> this.render.getValue())); + private final Setting boxAlpha = this.register(new Setting("BoxAlpha", Integer.valueOf(85), Integer.valueOf(0), Integer.valueOf(255), v -> this.box.getValue() != false && this.render.getValue() != false)); + public Setting outline = this.register(new Setting("Outline", Boolean.valueOf(true), v -> this.render.getValue())); + private final Setting lineWidth = this.register(new Setting("Width", Float.valueOf(1.0f), Float.valueOf(0.1f), Float.valueOf(5.0f), v -> this.outline.getValue() != false && this.render.getValue() != false)); + public BlockPos currentPos; + public IBlockState currentBlockState; + + public Speedmine() { + super("Speedmine", "Speeds up mining.", Module.Category.PLAYER, true, false, false); + this.setInstance(); + } + + public static Speedmine getInstance() { + if (INSTANCE == null) { + INSTANCE = new Speedmine(); + } + return INSTANCE; + } + + private void setInstance() { + INSTANCE = this; + } + + @Override + public void onTick() { + if (this.currentPos != null) { + if (!Speedmine.mc.world.getBlockState(this.currentPos).equals(this.currentBlockState) || Speedmine.mc.world.getBlockState(this.currentPos).getBlock() == Blocks.AIR) { + this.currentPos = null; + this.currentBlockState = null; + } else if (this.webSwitch.getValue().booleanValue() && this.currentBlockState.getBlock() == Blocks.WEB && Speedmine.mc.player.getHeldItemMainhand().getItem() instanceof ItemPickaxe) { + InventoryUtil.switchToHotbarSlot(ItemSword.class, false); + } + } + } + + @Override + public void onUpdate() { + if (Speedmine.fullNullCheck()) { + return; + } + Speedmine.mc.playerController.blockHitDelay = 0; + } + + @Override + public void onRender3D(Render3DEvent event) { + if (this.render.getValue().booleanValue() && this.currentPos != null && this.currentBlockState.getBlock() == Blocks.OBSIDIAN) { + Color color = new Color(this.timer.passedMs((int) (2000.0f * InfinityLoop.serverManager.getTpsFactor())) ? 0 : 255, this.timer.passedMs((int) (2000.0f * InfinityLoop.serverManager.getTpsFactor())) ? 255 : 0, 0, 255); + RenderUtil.drawBoxESP(this.currentPos, color, false, color, this.lineWidth.getValue().floatValue(), this.outline.getValue(), this.box.getValue(), this.boxAlpha.getValue(), false); + } + } + + @SubscribeEvent + public void onBlockEvent(BlockEvent event) { + if (Speedmine.fullNullCheck()) { + return; + } + if (event.getStage() == 3 && Speedmine.mc.playerController.curBlockDamageMP > 0.1f) { + Speedmine.mc.playerController.isHittingBlock = true; + } + if (event.getStage() == 4) { + BlockPos above; + if (BlockUtil.canBreak(event.pos)) { + Speedmine.mc.playerController.isHittingBlock = false; + switch (this.mode.getValue()) { + case PACKET: { + if (this.currentPos == null) { + this.currentPos = event.pos; + this.currentBlockState = Speedmine.mc.world.getBlockState(this.currentPos); + this.timer.reset(); + } + Speedmine.mc.player.swingArm(EnumHand.MAIN_HAND); + Speedmine.mc.player.connection.sendPacket(new CPacketPlayerDigging(CPacketPlayerDigging.Action.START_DESTROY_BLOCK, event.pos, event.facing)); + Speedmine.mc.player.connection.sendPacket(new CPacketPlayerDigging(CPacketPlayerDigging.Action.STOP_DESTROY_BLOCK, event.pos, event.facing)); + event.setCanceled(true); + break; + } + case DAMAGE: { + if (!(Speedmine.mc.playerController.curBlockDamageMP >= this.damage.getValue().floatValue())) + break; + Speedmine.mc.playerController.curBlockDamageMP = 1.0f; + break; + } + case INSTANT: { + Speedmine.mc.player.swingArm(EnumHand.MAIN_HAND); + Speedmine.mc.player.connection.sendPacket(new CPacketPlayerDigging(CPacketPlayerDigging.Action.START_DESTROY_BLOCK, event.pos, event.facing)); + Speedmine.mc.player.connection.sendPacket(new CPacketPlayerDigging(CPacketPlayerDigging.Action.STOP_DESTROY_BLOCK, event.pos, event.facing)); + Speedmine.mc.playerController.onPlayerDestroyBlock(event.pos); + Speedmine.mc.world.setBlockToAir(event.pos); + } + } + } + if (this.doubleBreak.getValue().booleanValue() && BlockUtil.canBreak(above = event.pos.add(0, 1, 0)) && Speedmine.mc.player.getDistance(above.getX(), above.getY(), above.getZ()) <= 5.0) { + Speedmine.mc.player.swingArm(EnumHand.MAIN_HAND); + Speedmine.mc.player.connection.sendPacket(new CPacketPlayerDigging(CPacketPlayerDigging.Action.START_DESTROY_BLOCK, above, event.facing)); + Speedmine.mc.player.connection.sendPacket(new CPacketPlayerDigging(CPacketPlayerDigging.Action.STOP_DESTROY_BLOCK, above, event.facing)); + Speedmine.mc.playerController.onPlayerDestroyBlock(above); + Speedmine.mc.world.setBlockToAir(above); + } + } + } + + @Override + public String getDisplayInfo() { + return this.mode.currentEnumName(); + } + + public enum Mode { + PACKET, + DAMAGE, + INSTANT + + } +} + diff --git a/src/main/java/com/me/infinity/loop/features/modules/player/TpsSync.java b/src/main/java/me/loop/features/modules/player/TpsSync.java similarity index 72% rename from src/main/java/com/me/infinity/loop/features/modules/player/TpsSync.java rename to src/main/java/me/loop/features/modules/player/TpsSync.java index 5cac4f5..21a0caa 100644 --- a/src/main/java/com/me/infinity/loop/features/modules/player/TpsSync.java +++ b/src/main/java/me/loop/features/modules/player/TpsSync.java @@ -1,8 +1,7 @@ -package com.me.infinity.loop.features.modules.player; +package me.loop.features.modules.player; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.setting.Setting; +import me.loop.features.modules.Module; +import me.loop.features.setting.Setting; public class TpsSync extends Module { @@ -11,7 +10,7 @@ public class TpsSync public Setting mining = this.register(new Setting("Mine", Boolean.TRUE)); public TpsSync() { - super("TpsSync", "Syncs your client with the TPS.", ModuleCategory.PLAYER); + super("TpsSync", "Syncs your client with the TPS.", Module.Category.PLAYER, true, false, false); this.setInstance(); } diff --git a/src/main/java/com/me/infinity/loop/features/modules/render/ArrowESP.java b/src/main/java/me/loop/features/modules/render/ArrowESP.java similarity index 90% rename from src/main/java/com/me/infinity/loop/features/modules/render/ArrowESP.java rename to src/main/java/me/loop/features/modules/render/ArrowESP.java index 60a9879..089fa81 100644 --- a/src/main/java/com/me/infinity/loop/features/modules/render/ArrowESP.java +++ b/src/main/java/me/loop/features/modules/render/ArrowESP.java @@ -1,13 +1,12 @@ -package com.me.infinity.loop.features.modules.render; +package me.loop.features.modules.render; import com.google.common.collect.Maps; -import com.me.infinity.loop.event.events.render.Render2DEvent; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.setting.Setting; -import com.me.infinity.loop.util.utils.EntityUtil; -import com.me.infinity.loop.util.utils.renders.RenderUtil; -import com.me.infinity.loop.util.utils.Util; +import me.loop.event.events.Render2DEvent; +import me.loop.features.modules.Module; +import me.loop.features.setting.Setting; +import me.loop.util.impl.EntityUtil; +import me.loop.util.impl.RenderUtil; +import me.loop.util.impl.Util; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -33,7 +32,7 @@ public class ArrowESP private final EntityListener entityListener = new EntityListener(); public ArrowESP() { - super("ArrowESP", "Arrow tracers ", ModuleCategory.RENDER); + super("ArrowESP", "Arrow tracers ", Module.Category.RENDER, true, false, false); } @Override @@ -60,9 +59,6 @@ public void onRender2D(Render2DEvent event) { }); } - public static double interp(double d, double d2) { - return d2 + (d - d2) * (double)mc.getRenderPartialTicks(); - } private boolean isOnScreen(Vec3d pos) { if (!(pos.x > -1.0)) return false; @@ -80,7 +76,7 @@ private boolean isOnScreen(Vec3d pos) { } private boolean isValid(EntityPlayer entity) { - return entity != ArrowESP.mc.player && (!entity.isInvisible() || this.invisibles.getValue()) && entity.isEntityAlive(); + return entity != ArrowESP.mc.player && (!entity.isInvisible() || this.invisibles.getValue() != false) && entity.isEntityAlive(); } private float getRotations(EntityLivingBase ent) { diff --git a/src/main/java/com/me/infinity/loop/features/modules/render/BlockHighlight.java b/src/main/java/me/loop/features/modules/render/BlockHighlight.java similarity index 92% rename from src/main/java/com/me/infinity/loop/features/modules/render/BlockHighlight.java rename to src/main/java/me/loop/features/modules/render/BlockHighlight.java index 40338e5..220644a 100644 --- a/src/main/java/com/me/infinity/loop/features/modules/render/BlockHighlight.java +++ b/src/main/java/me/loop/features/modules/render/BlockHighlight.java @@ -1,12 +1,11 @@ -package com.me.infinity.loop.features.modules.render; - -import com.me.infinity.loop.event.events.render.Render3DEvent; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.modules.client.Colors; -import com.me.infinity.loop.features.setting.Setting; -import com.me.infinity.loop.util.utils.renders.ColorUtil; -import com.me.infinity.loop.util.utils.renders.RenderUtil; +package me.loop.features.modules.render; + +import me.loop.event.events.Render3DEvent; +import me.loop.features.modules.Module; +import me.loop.features.modules.client.Colors; +import me.loop.features.setting.Setting; +import me.loop.util.impl.ColorUtil; +import me.loop.util.impl.RenderUtil; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; @@ -45,7 +44,7 @@ public class BlockHighlight private int color; public BlockHighlight() { - super("BlockHighlight", "Highlights the block u look at.", ModuleCategory.RENDER); + super("BlockHighlight", "Highlights the block u look at.", Category.RENDER, true, false, false); this.setInstance(); } @@ -78,18 +77,4 @@ public enum RenderMode { Defaut, Gradient, } -} - - - - - - - - - - - - - - +} \ No newline at end of file diff --git a/src/main/java/com/me/infinity/loop/features/modules/render/ESP.java b/src/main/java/me/loop/features/modules/render/ESP.java similarity index 95% rename from src/main/java/com/me/infinity/loop/features/modules/render/ESP.java rename to src/main/java/me/loop/features/modules/render/ESP.java index 559ffee..54a5bf4 100644 --- a/src/main/java/com/me/infinity/loop/features/modules/render/ESP.java +++ b/src/main/java/me/loop/features/modules/render/ESP.java @@ -1,11 +1,10 @@ -package com.me.infinity.loop.features.modules.render; +package me.loop.features.modules.render; -import com.me.infinity.loop.event.events.render.Render3DEvent; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.setting.Setting; -import com.me.infinity.loop.util.utils.EntityUtil; -import com.me.infinity.loop.util.utils.renders.RenderUtil; +import me.loop.event.events.Render3DEvent; +import me.loop.features.modules.Module; +import me.loop.features.setting.Setting; +import me.loop.util.impl.EntityUtil; +import me.loop.util.impl.RenderUtil; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.RenderGlobal; import net.minecraft.entity.Entity; @@ -33,7 +32,7 @@ public class ESP private final Setting alpha = this.register(new Setting("Alpha", 255, 0, 255)); public ESP() { - super("ESP", "Renders a nice ESP.", ModuleCategory.RENDER); + super("ESP", "Renders a nice ESP.", Module.Category.RENDER, false, false, false); this.setInstance(); } diff --git a/src/main/java/com/me/infinity/loop/features/modules/render/HandChams.java b/src/main/java/me/loop/features/modules/render/HandChams.java similarity index 75% rename from src/main/java/com/me/infinity/loop/features/modules/render/HandChams.java rename to src/main/java/me/loop/features/modules/render/HandChams.java index 6bc4409..8b3ef58 100644 --- a/src/main/java/com/me/infinity/loop/features/modules/render/HandChams.java +++ b/src/main/java/me/loop/features/modules/render/HandChams.java @@ -1,8 +1,7 @@ -package com.me.infinity.loop.features.modules.render; +package me.loop.features.modules.render; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.setting.Setting; +import me.loop.features.modules.Module; +import me.loop.features.setting.Setting; public class HandChams extends Module { @@ -14,7 +13,7 @@ public class HandChams public Setting alpha = this.register(new Setting("Alpha", 240, 0, 255)); public HandChams() { - super("HandChams", "Changes your hand color.", ModuleCategory.RENDER); + super("HandChams", "Changes your hand color.", Module.Category.RENDER, false, false, false); this.setInstance(); } diff --git a/src/main/java/me/loop/features/modules/render/HoleESP.java b/src/main/java/me/loop/features/modules/render/HoleESP.java new file mode 100644 index 0000000..17ea380 --- /dev/null +++ b/src/main/java/me/loop/features/modules/render/HoleESP.java @@ -0,0 +1,81 @@ +package me.loop.features.modules.render; + +import me.loop.event.events.Render3DEvent; +import me.loop.features.modules.Module; +import me.loop.features.setting.Setting; +import me.loop.util.impl.BlockUtil; +import me.loop.util.impl.RenderUtil; +import net.minecraft.init.Blocks; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3i; + +import java.awt.*; + +public class HoleESP + extends Module { + private static HoleESP INSTANCE = new HoleESP(); + private final Setting range = this.register(new Setting("RangeX", 0, 0, 10)); + private final Setting rangeY = this.register(new Setting("RangeY", 0, 0, 10)); + private final Setting red = this.register(new Setting("Red", 0, 0, 255)); + private final Setting green = this.register(new Setting("Green", 255, 0, 255)); + private final Setting blue = this.register(new Setting("Blue", 0, 0, 255)); + private final Setting alpha = this.register(new Setting("Alpha", 255, 0, 255)); + private final Setting boxAlpha = this.register(new Setting("BoxAlpha", 125, 0, 255)); + private final Setting lineWidth = this.register(new Setting("LineWidth", Float.valueOf(1.0f), Float.valueOf(0.1f), Float.valueOf(5.0f))); + private final Setting safeRed = this.register(new Setting("BedrockRed", 0, 0, 255)); + private final Setting safeGreen = this.register(new Setting("BedrockGreen", 255, 0, 255)); + private final Setting safeBlue = this.register(new Setting("BedrockBlue", 0, 0, 255)); + private final Setting safeAlpha = this.register(new Setting("BedrockAlpha", 255, 0, 255)); + public Setting future = this.register(new Setting("FutureRender", true)); + public Setting fov = this.register(new Setting("InFov", true)); + public Setting renderOwn = this.register(new Setting("RenderOwn", true)); + public Setting box = this.register(new Setting("Box", true)); + public Setting outline = this.register(new Setting("Outline", true)); + private final Setting cRed = this.register(new Setting("OL-Red", Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(255), v -> this.outline.getValue())); + private final Setting cGreen = this.register(new Setting("OL-Green", Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(255), v -> this.outline.getValue())); + private final Setting cBlue = this.register(new Setting("OL-Blue", Integer.valueOf(255), Integer.valueOf(0), Integer.valueOf(255), v -> this.outline.getValue())); + private final Setting cAlpha = this.register(new Setting("OL-Alpha", Integer.valueOf(255), Integer.valueOf(0), Integer.valueOf(255), v -> this.outline.getValue())); + private final Setting safecRed = this.register(new Setting("OL-BedrockRed", Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(255), v -> this.outline.getValue())); + private final Setting safecGreen = this.register(new Setting("OL-BedrockGreen", Integer.valueOf(255), Integer.valueOf(0), Integer.valueOf(255), v -> this.outline.getValue())); + private final Setting safecBlue = this.register(new Setting("OL-BedrockBlue", Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(255), v -> this.outline.getValue())); + private final Setting safecAlpha = this.register(new Setting("OL-BedrockAlpha", Integer.valueOf(255), Integer.valueOf(0), Integer.valueOf(255), v -> this.outline.getValue())); + + public HoleESP() { + super("HoleESP", "Shows safe spots.", Module.Category.RENDER, false, false, false); + this.setInstance(); + } + + public static HoleESP getInstance() { + if (INSTANCE == null) { + INSTANCE = new HoleESP(); + } + return INSTANCE; + } + + private void setInstance() { + INSTANCE = this; + } + + @Override + public void onRender3D(Render3DEvent event) { + assert (HoleESP.mc.renderViewEntity != null); + Vec3i playerPos = new Vec3i(HoleESP.mc.renderViewEntity.posX, HoleESP.mc.renderViewEntity.posY, HoleESP.mc.renderViewEntity.posZ); + for (int x = playerPos.getX() - this.range.getValue(); x < playerPos.getX() + this.range.getValue(); ++x) { + for (int z = playerPos.getZ() - this.range.getValue(); z < playerPos.getZ() + this.range.getValue(); ++z) { + for (int y = playerPos.getY() + this.rangeY.getValue(); y > playerPos.getY() - this.rangeY.getValue(); --y) { + BlockPos pos = new BlockPos(x, y, z); + if (!HoleESP.mc.world.getBlockState(pos).getBlock().equals(Blocks.AIR) || !HoleESP.mc.world.getBlockState(pos.add(0, 1, 0)).getBlock().equals(Blocks.AIR) || !HoleESP.mc.world.getBlockState(pos.add(0, 2, 0)).getBlock().equals(Blocks.AIR) || pos.equals(new BlockPos(HoleESP.mc.player.posX, HoleESP.mc.player.posY, HoleESP.mc.player.posZ)) && !this.renderOwn.getValue().booleanValue() || !BlockUtil.isPosInFov(pos).booleanValue() && this.fov.getValue().booleanValue()) + continue; + if (HoleESP.mc.world.getBlockState(pos.north()).getBlock() == Blocks.BEDROCK && HoleESP.mc.world.getBlockState(pos.east()).getBlock() == Blocks.BEDROCK && HoleESP.mc.world.getBlockState(pos.west()).getBlock() == Blocks.BEDROCK && HoleESP.mc.world.getBlockState(pos.south()).getBlock() == Blocks.BEDROCK && HoleESP.mc.world.getBlockState(pos.down()).getBlock() == Blocks.BEDROCK) { + RenderUtil.drawBoxESP(this.future.getValue() != false ? pos.down() : pos, new Color(this.safeRed.getValue(), this.safeGreen.getValue(), this.safeBlue.getValue(), this.safeAlpha.getValue()), this.outline.getValue(), new Color(this.safecRed.getValue(), this.safecGreen.getValue(), this.safecBlue.getValue(), this.safecAlpha.getValue()), this.lineWidth.getValue().floatValue(), this.outline.getValue(), this.box.getValue(), this.boxAlpha.getValue(), true); + continue; + } + if (!BlockUtil.isBlockUnSafe(HoleESP.mc.world.getBlockState(pos.down()).getBlock()) || !BlockUtil.isBlockUnSafe(HoleESP.mc.world.getBlockState(pos.east()).getBlock()) || !BlockUtil.isBlockUnSafe(HoleESP.mc.world.getBlockState(pos.west()).getBlock()) || !BlockUtil.isBlockUnSafe(HoleESP.mc.world.getBlockState(pos.south()).getBlock()) || !BlockUtil.isBlockUnSafe(HoleESP.mc.world.getBlockState(pos.north()).getBlock())) + continue; + RenderUtil.drawBoxESP(this.future.getValue() != false ? pos.down() : pos, new Color(this.red.getValue(), this.green.getValue(), this.blue.getValue(), this.alpha.getValue()), this.outline.getValue(), new Color(this.cRed.getValue(), this.cGreen.getValue(), this.cBlue.getValue(), this.cAlpha.getValue()), this.lineWidth.getValue().floatValue(), this.outline.getValue(), this.box.getValue(), this.boxAlpha.getValue(), true); + } + } + } + } +} + diff --git a/src/main/java/com/me/infinity/loop/features/modules/render/Skeleton.java b/src/main/java/me/loop/features/modules/render/Skeleton.java similarity index 92% rename from src/main/java/com/me/infinity/loop/features/modules/render/Skeleton.java rename to src/main/java/me/loop/features/modules/render/Skeleton.java index 628d65d..d7897f3 100644 --- a/src/main/java/com/me/infinity/loop/features/modules/render/Skeleton.java +++ b/src/main/java/me/loop/features/modules/render/Skeleton.java @@ -1,12 +1,11 @@ -package com.me.infinity.loop.features.modules.render; +package me.loop.features.modules.render; -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.event.events.render.Render3DEvent; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.modules.client.ClickGui.ClickGui; -import com.me.infinity.loop.features.setting.Setting; -import com.me.infinity.loop.util.utils.minecraft.BlockUtil; +import me.loop.InfinityLoop; +import me.loop.event.events.Render3DEvent; +import me.loop.features.modules.Module; +import me.loop.features.modules.client.Colors; +import me.loop.features.setting.Setting; +import me.loop.util.impl.BlockUtil; import net.minecraft.client.gui.Gui; import net.minecraft.client.model.ModelPlayer; import net.minecraft.client.renderer.GlStateManager; @@ -25,7 +24,7 @@ public class Skeleton private final Setting alpha = this.register(new Setting("Alpha", 255, 0, 255)); public Skeleton() { - super("Skeleton", "Draws a skeleton inside the player.", ModuleCategory.RENDER); + super("Skeleton", "Draws a skeleton inside the player.", Module.Category.RENDER, false, false, false); } public static void addEntity(EntityPlayer e, ModelPlayer model) { @@ -69,7 +68,7 @@ private void drawSkeleton(Render3DEvent event, EntityPlayer e) { if (InfinityLoop.friendManager.isFriend(e.getName())) { GlStateManager.color(0.0f, 191.0f, 230.0f, (float) this.alpha.getValue().intValue()); } else { - GlStateManager.color((float) ClickGui.getInstance().red.getValue().intValue() / 255.0f, (float) ClickGui.getInstance().green.getValue().intValue() / 255.0f, (float) ClickGui.getInstance().blue.getValue().intValue() / 255.0f, (float) this.alpha.getValue().intValue()); + GlStateManager.color((float) Colors.getInstance().c.getValue().getRed() / 255.0f, (float) Colors.getInstance().c.getValue().getGreen() / 255.0f, (float) Colors.getInstance().c.getValue().getBlue() / 255.0f, (float) this.alpha.getValue().intValue()); } Vec3d vec = this.getVec3(event, e); double x = vec.x - Skeleton.mc.getRenderManager().renderPosX; diff --git a/src/main/java/com/me/infinity/loop/features/modules/render/SmallShield.java b/src/main/java/me/loop/features/modules/render/SmallShield.java similarity index 76% rename from src/main/java/com/me/infinity/loop/features/modules/render/SmallShield.java rename to src/main/java/me/loop/features/modules/render/SmallShield.java index 5f5e89b..0725b1d 100644 --- a/src/main/java/com/me/infinity/loop/features/modules/render/SmallShield.java +++ b/src/main/java/me/loop/features/modules/render/SmallShield.java @@ -1,8 +1,7 @@ -package com.me.infinity.loop.features.modules.render; +package me.loop.features.modules.render; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.setting.Setting; +import me.loop.features.modules.Module; +import me.loop.features.setting.Setting; public class SmallShield extends Module { @@ -13,7 +12,7 @@ public class SmallShield public Setting mainY = this.register(new Setting("MainHandY", Float.valueOf(0.0f), Float.valueOf(-1.0f), Float.valueOf(1.0f))); public SmallShield() { - super("SmallShield", "Makes you offhand lower.", ModuleCategory.RENDER); + super("SmallShield", "Makes you offhand lower.", Module.Category.RENDER, false, false, false); this.setInstance(); } diff --git a/src/main/java/com/me/infinity/loop/features/modules/render/Trajectories.java b/src/main/java/me/loop/features/modules/render/Trajectories.java similarity index 86% rename from src/main/java/com/me/infinity/loop/features/modules/render/Trajectories.java rename to src/main/java/me/loop/features/modules/render/Trajectories.java index 8982bfa..93358e8 100644 --- a/src/main/java/com/me/infinity/loop/features/modules/render/Trajectories.java +++ b/src/main/java/me/loop/features/modules/render/Trajectories.java @@ -2,18 +2,19 @@ // Decompiled by Procyon v0.5.36 // -package com.me.infinity.loop.features.modules.render; +package me.loop.features.modules.render; -import com.me.infinity.loop.event.events.render.Render3DEvent; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.setting.Setting; +import me.loop.event.events.Render3DEvent; +import me.loop.features.modules.Module; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.Entity; import net.minecraft.init.Items; import net.minecraft.item.*; import net.minecraft.util.EnumHand; -import net.minecraft.util.math.*; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.math.Vec3d; import org.lwjgl.opengl.GL11; import org.lwjgl.util.glu.Cylinder; @@ -21,13 +22,8 @@ import java.util.List; public class Trajectories extends Module { - private final Setting circle = this.register(new Setting<>("circle", false)); - private final Setting lineWidth = this.register(new Setting<>("LineWidth", Float.valueOf(1.0f), Float.valueOf(0.1f), Float.valueOf(5.0f))); - private final Setting red = this.register(new Setting<>("Red", Float.valueOf(0.0f), Float.valueOf(0.0f), Float.valueOf(255.0f))); - private final Setting green = this.register(new Setting<>("Green", Float.valueOf(255.0f), Float.valueOf(0.0f), Float.valueOf(255.0f))); - private final Setting blue = this.register(new Setting<>("Blue", Float.valueOf(0.0f), Float.valueOf(0.0f), Float.valueOf(255.0f))); public Trajectories() { - super("Trajectories", "Draws trajectories.", ModuleCategory.RENDER); + super("Trajectories", "Draws trajectories.", Category.RENDER, false, false, false); } @Override @@ -61,7 +57,7 @@ public void onRender3D(final Render3DEvent event) { motionY *= pow * ((item instanceof ItemFishingRod) ? 0.75f : ((Trajectories.mc.player.getHeldItem(EnumHand.MAIN_HAND).getItem() == Items.EXPERIENCE_BOTTLE) ? 0.75f : 1.5f)); motionZ *= pow * ((item instanceof ItemFishingRod) ? 0.75f : ((Trajectories.mc.player.getHeldItem(EnumHand.MAIN_HAND).getItem() == Items.EXPERIENCE_BOTTLE) ? 0.75f : 1.5f)); this.enableGL3D(2.0f); - GlStateManager.color(this.red.getValue().intValue(), this.green.getValue().intValue(),this.blue.getValue().intValue()); + GlStateManager.color(0.0f, 1.0f, 0.0f, 1.0f); GL11.glEnable(2848); final float size = (float) ((item instanceof ItemBow) ? 0.3 : 0.25); boolean hasLanded = false; @@ -92,7 +88,7 @@ public void onRender3D(final Render3DEvent event) { } } if (landingOnEntity != null) { - GlStateManager.color(225.0f, 0.0f, 0.0f, 255.0f); + GlStateManager.color(1.0f, 0.0f, 0.0f, 1.0f); } posX += motionX; posY += motionY; @@ -121,9 +117,9 @@ public void onRender3D(final Render3DEvent event) { c.setDrawStyle(100011); if (landingOnEntity != null) { GlStateManager.color(0.0f, 0.0f, 0.0f, 1.0f); - GL11.glLineWidth(this.lineWidth.getValue() - 2.5f); + GL11.glLineWidth(2.5f); c.draw(0.6f, 0.3f, 0.0f, 4, 1); - GL11.glLineWidth(this.lineWidth.getValue() - 0.1f); + GL11.glLineWidth(0.1f); GlStateManager.color(1.0f, 0.0f, 0.0f, 1.0f); } c.draw(0.6f, 0.3f, 0.0f, 4, 1); @@ -146,7 +142,7 @@ public void enableGL3D(final float lineWidth) { GL11.glEnable(2848); GL11.glHint(3154, 4354); GL11.glHint(3155, 4354); - GL11.glLineWidth(this.lineWidth.getValue()); + GL11.glLineWidth(lineWidth); } public void disableGL3D() { diff --git a/src/main/java/com/me/infinity/loop/features/setting/impl/Bind.java b/src/main/java/me/loop/features/setting/Bind.java similarity index 86% rename from src/main/java/com/me/infinity/loop/features/setting/impl/Bind.java rename to src/main/java/me/loop/features/setting/Bind.java index 90efaf3..350ad7a 100644 --- a/src/main/java/com/me/infinity/loop/features/setting/impl/Bind.java +++ b/src/main/java/me/loop/features/setting/Bind.java @@ -1,4 +1,4 @@ -package com.me.infinity.loop.features.setting.impl; +package me.loop.features.setting; import com.google.common.base.Converter; import com.google.gson.JsonElement; @@ -29,7 +29,7 @@ public boolean isEmpty() { } public String toString() { - return this.isEmpty() ? " " : (this.key < 0 ? " " : this.capitalise(Keyboard.getKeyName(this.key))); + return this.isEmpty() ? "None" : (this.key < 0 ? "None" : this.capitalise(Keyboard.getKeyName(this.key))); } public boolean isDown() { @@ -43,14 +43,9 @@ private String capitalise(String str) { return Character.toUpperCase(str.charAt(0)) + (str.length() != 1 ? str.substring(1).toLowerCase() : ""); } - public boolean isHold() { - return hold; - } - public void setHold(boolean hold) { this.hold = hold; } - public static class BindConverter extends Converter { public JsonElement doForward(Bind bind) { @@ -59,7 +54,7 @@ public JsonElement doForward(Bind bind) { public Bind doBackward(JsonElement jsonElement) { String s = jsonElement.getAsString(); - if (s.equalsIgnoreCase(" ")) { + if (s.equalsIgnoreCase("None")) { return Bind.none(); } int key = -1; diff --git a/src/main/java/com/me/infinity/loop/features/setting/impl/EnumConverter.java b/src/main/java/me/loop/features/setting/EnumConverter.java similarity index 96% rename from src/main/java/com/me/infinity/loop/features/setting/impl/EnumConverter.java rename to src/main/java/me/loop/features/setting/EnumConverter.java index 4725a72..2145f96 100644 --- a/src/main/java/com/me/infinity/loop/features/setting/impl/EnumConverter.java +++ b/src/main/java/me/loop/features/setting/EnumConverter.java @@ -1,4 +1,4 @@ -package com.me.infinity.loop.features.setting.impl; +package me.loop.features.setting; import com.google.common.base.Converter; import com.google.gson.JsonElement; diff --git a/src/main/java/com/me/infinity/loop/features/setting/Setting.java b/src/main/java/me/loop/features/setting/Setting.java similarity index 77% rename from src/main/java/com/me/infinity/loop/features/setting/Setting.java rename to src/main/java/me/loop/features/setting/Setting.java index 3943fa5..502da45 100644 --- a/src/main/java/com/me/infinity/loop/features/setting/Setting.java +++ b/src/main/java/me/loop/features/setting/Setting.java @@ -1,30 +1,22 @@ -package com.me.infinity.loop.features.setting; +package me.loop.features.setting; -import com.me.infinity.loop.event.events.client.ClientEvent; -import com.me.infinity.loop.features.Feature; -import com.me.infinity.loop.features.setting.impl.*; -import net.minecraft.client.Minecraft; +import me.loop.event.events.ClientEvent; +import me.loop.features.Feature; import net.minecraftforge.common.MinecraftForge; +import java.awt.*; import java.util.function.Predicate; public class Setting { - private final String name; - private final T defaultValue; - public Minecraft mc; - - public boolean isOpen; - private T value; - private T plannedValue; - private T min; - private T max; - private Setting parent = null; - private boolean hasRestriction; - private boolean shouldRenderStringName; + private Feature feature; + private final String name; private Predicate visibility; + private final T defaultValue; + private T value, plannedValue, min, max; + public boolean isOpen, hasRestriction, shouldRenderStringName, booleanValue, hideAlpha; private String description; - private Feature feature; + public Setting(String name, T defaultValue) { this.name = name; @@ -50,6 +42,7 @@ public Setting(String name, T defaultValue, T min, T max, String description) { this.max = max; this.plannedValue = defaultValue; this.description = description; + this.hasRestriction = true; } @@ -61,6 +54,7 @@ public Setting(String name, T defaultValue, T min, T max) { this.max = max; this.plannedValue = defaultValue; this.description = ""; + this.hasRestriction = true; } @@ -73,6 +67,7 @@ public Setting(String name, T defaultValue, T min, T max, Predicate visibilit this.plannedValue = defaultValue; this.visibility = visibility; this.description = description; + this.hasRestriction = true; } @@ -85,6 +80,7 @@ public Setting(String name, T defaultValue, T min, T max, Predicate visibilit this.plannedValue = defaultValue; this.visibility = visibility; this.description = ""; + this.hasRestriction = true; } @@ -101,7 +97,26 @@ public String getName() { } public T getValue() { - return value; + return this.value; + } + + public void setValue(T value) { + this.setPlannedValue(value); + if (this.hasRestriction) { + if (((Number) this.min).floatValue() > ((Number) value).floatValue()) { + this.setPlannedValue(this.min); + } + if (((Number) this.max).floatValue() < ((Number) value).floatValue()) { + this.setPlannedValue(this.max); + } + } + ClientEvent event = new ClientEvent(this); + MinecraftForge.EVENT_BUS.post(event); + if (!event.isCanceled()) { + this.value = this.plannedValue; + } else { + this.plannedValue = this.value; + } } public T getPlannedValue() { @@ -116,32 +131,21 @@ public T getMin() { return this.min; } + public void setMin(T min) { + this.min = min; + } + public T getMax() { return this.max; } - public void reset() - { - value = defaultValue; + public void setMax(T max) { + this.max = max; } - public void setValue(T value) { - this.setPlannedValue(value); - if (this.hasRestriction) { - if (((Number) this.min).floatValue() > ((Number) value).floatValue()) { - this.setPlannedValue(this.min); - } - if (((Number) this.max).floatValue() < ((Number) value).floatValue()) { - this.setPlannedValue(this.max); - } - } - ClientEvent event = new ClientEvent(this); - MinecraftForge.EVENT_BUS.post(event); - if (!event.isCanceled()) { - this.value = this.plannedValue; - } else { - this.plannedValue = this.value; - } + public Setting setRenderName(boolean renderName) { + this.shouldRenderStringName = renderName; + return this; } @@ -158,14 +162,6 @@ public void setValueNoEvent(T value) { this.value = this.plannedValue; } - public void setMin(T min) { - this.min = min; - } - - public void setMax(T max) { - this.max = max; - } - public Feature getFeature() { return this.feature; } @@ -184,7 +180,7 @@ public int getEnum(String input) { } public void setEnumValue(String value) { - for (Enum e : ((Enum) this.value).getClass().getEnumConstants()) { + for (Enum e : (Enum[]) ((Enum) this.value).getClass().getEnumConstants()) { if (!e.name().equalsIgnoreCase(value)) continue; this.value = (T) e; } @@ -217,9 +213,6 @@ public String getType() { if (this.isEnumSetting()) { return "Enum"; } - if(this.isPositionSetting()){ - return "PositionSetting"; - } return this.getClassName(this.defaultValue); } @@ -235,21 +228,20 @@ public String getDescription() { } public boolean isNumberSetting() { - return this.value instanceof Double || this.value instanceof Integer || this.value instanceof Short || this.value instanceof Long || this.value instanceof Float; + return this.value instanceof Double + || this.value instanceof Integer + || this.value instanceof Short + || this.value instanceof Long + || this.value instanceof Float; } - - public boolean isEnumSetting() { - return !this.isNumberSetting() &&!(this.value instanceof PositionSetting) && !(this.value instanceof String) && !(this.value instanceof Parent) && !(this.value instanceof Bind) && !(this.value instanceof SubBind)&& !(this.value instanceof Character) && !(this.value instanceof Boolean); - } - - public boolean isBindSetting() { - return this.value instanceof Bind; - } - - public boolean isPositionSetting() { - return this.value instanceof PositionSetting; + return !this.isNumberSetting() + && !(this.value instanceof String) + && !(this.value instanceof Bind) + && !(this.value instanceof Character) + && !(this.value instanceof Boolean) + && !(this.value instanceof Color); } public boolean isStringSetting() { @@ -272,41 +264,37 @@ public void setVisibility(Predicate visibility) { this.visibility = visibility; } - public Setting setRenderName(boolean renderName) { - this.shouldRenderStringName = renderName; - return this; - } - - public boolean shouldRenderName() { - if (!this.isStringSetting()) { - return true; - } - return this.shouldRenderStringName; - } - public Setting withParent(Setting parent) { - this.parent = parent; - return this; - } - - public Setting getParent() { - return parent; - } - public boolean isVisible() { - if (parent != null) { - if (!parent.getValue().isExtended()) { - return false; - } - } if (this.visibility == null) { return true; } return this.visibility.test(this.getValue()); } - public boolean nullCheck() { - return Feature.mc.player == null; + //Color picker setters + + /** + * injectBoolean() is for adding a boolean value to a color picker (i.e. to add an option to enable/disable a color). + * @param valueIn is the boolean value that'll be set by default. + */ + + public Setting injectBoolean(boolean valueIn) { + if (value instanceof Color) { + hasRestriction = true; + booleanValue = valueIn; + } + + return this; } + /** + * hideAlpha() is for disabling the alpha slider in color pickers which don't need it. + */ + + public Setting hideAlpha() { + hideAlpha = true; + + return this; + } } diff --git a/src/main/java/com/me/infinity/loop/manager/ColorManager.java b/src/main/java/me/loop/manager/ColorManager.java similarity index 77% rename from src/main/java/com/me/infinity/loop/manager/ColorManager.java rename to src/main/java/me/loop/manager/ColorManager.java index 8523c85..04347e8 100644 --- a/src/main/java/com/me/infinity/loop/manager/ColorManager.java +++ b/src/main/java/me/loop/manager/ColorManager.java @@ -1,8 +1,9 @@ -package com.me.infinity.loop.manager; +package me.loop.manager; -import com.me.infinity.loop.features.gui.components.Component; -import com.me.infinity.loop.features.modules.client.Colors; -import com.me.infinity.loop.util.utils.renders.ColorUtil; +import me.loop.features.gui.click.Component; +import me.loop.features.modules.client.Colors; +import me.loop.features.modules.client.clickgui.ClickGui; +import me.loop.util.impl.ColorUtil; import java.awt.*; @@ -11,15 +12,7 @@ public class ColorManager { private float green = 1.0f; private float blue = 1.0f; private float alpha = 1.0f; - - private Color color; - public ColorManager() { - this.red = 1.0f; - this.green = 1.0f; - this.blue = 1.0f; - this.alpha = 1.0f; - this.color = new Color(this.red, this.green, this.blue, this.alpha); - } + private Color color = new Color(this.red, this.green, this.blue, this.alpha); public Color getColor() { return this.color; @@ -38,7 +31,7 @@ public int getColorAsIntFullAlpha() { } public int getColorWithAlpha(int alpha) { - if (Colors.getInstance().rainbow.getValue().booleanValue()) { + if (ClickGui.getInstance().colorSync.getValue() && Colors.getInstance().rainbow.getValue()) { return ColorUtil.rainbow(Component.counter1[0] * Colors.getInstance().rainbowHue.getValue()).getRGB(); } return ColorUtil.toRGBA(new Color(this.red, this.green, this.blue, (float) alpha / 255.0f)); diff --git a/src/main/java/com/me/infinity/loop/manager/CommandManager.java b/src/main/java/me/loop/manager/CommandManager.java similarity index 87% rename from src/main/java/com/me/infinity/loop/manager/CommandManager.java rename to src/main/java/me/loop/manager/CommandManager.java index c6ab50d..93f1514 100644 --- a/src/main/java/com/me/infinity/loop/manager/CommandManager.java +++ b/src/main/java/me/loop/manager/CommandManager.java @@ -1,9 +1,9 @@ -package com.me.infinity.loop.manager; +package me.loop.manager; -import com.me.infinity.loop.features.command.commands.*; import com.mojang.realmsclient.gui.ChatFormatting; -import com.me.infinity.loop.features.Feature; -import com.me.infinity.loop.features.command.Command; +import me.loop.features.Feature; +import me.loop.features.command.Command; +import me.loop.features.command.commands.*; import java.util.ArrayList; import java.util.LinkedList; @@ -11,13 +11,11 @@ public class CommandManager extends Feature { private final ArrayList commands = new ArrayList(); + private String clientMessage = ""; private String prefix = "."; public CommandManager() { super("Command"); - this.commands.add(new HistoryCommand()); - this.commands.add(new SearchCommand()); - this.commands.add(new loginCommand()); this.commands.add(new BindCommand()); this.commands.add(new ModuleCommand()); this.commands.add(new PrefixCommand()); @@ -74,8 +72,13 @@ public ArrayList getCommands() { } public String getClientMessage() { - return "[Loop]"; + return this.clientMessage; } + + public void setClientMessage(String clientMessage) { + this.clientMessage = clientMessage; + } + public String getPrefix() { return this.prefix; } diff --git a/src/main/java/com/me/infinity/loop/manager/ConfigManager.java b/src/main/java/me/loop/manager/ConfigManager.java similarity index 59% rename from src/main/java/com/me/infinity/loop/manager/ConfigManager.java rename to src/main/java/me/loop/manager/ConfigManager.java index 356384b..6a796c8 100644 --- a/src/main/java/com/me/infinity/loop/manager/ConfigManager.java +++ b/src/main/java/me/loop/manager/ConfigManager.java @@ -1,53 +1,41 @@ -package com.me.infinity.loop.manager; +package me.loop.manager; import com.google.gson.*; -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.features.command.Command; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.render.Search; -import com.me.infinity.loop.features.setting.Setting; -import com.me.infinity.loop.features.setting.impl.Bind; -import com.me.infinity.loop.features.setting.impl.EnumConverter; -import com.me.infinity.loop.features.setting.impl.PositionSetting; -import com.me.infinity.loop.features.setting.impl.SubBind; -import com.me.infinity.loop.util.utils.Util; +import me.loop.InfinityLoop; +import me.loop.features.command.Command; +import me.loop.features.modules.Module; +import me.loop.features.setting.Bind; +import me.loop.features.setting.EnumConverter; +import me.loop.features.setting.Setting; +import me.loop.util.impl.Util; import net.minecraft.block.Block; import net.minecraft.util.ResourceLocation; import java.awt.*; import java.io.*; -import java.util.ArrayList; -import java.util.Arrays; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.StandardOpenOption; import java.util.List; -import java.util.Scanner; +import java.util.*; import java.util.stream.Collectors; - public class ConfigManager implements Util { - public static File MainFolder = new File(mc.gameDir, "loop"); - public static File ConfigsFolder = new File(MainFolder, "configs"); - public static File CustomImages = new File(MainFolder, "images"); - public static File TempFolder = new File(MainFolder, "temp"); - public static File SkinsFolder = new File(TempFolder, "skins"); - public static File CapesFolder = new File(TempFolder, "capes"); - public static File HeadsFolder = new File(TempFolder, "heads"); - public static File DiscordEmbeds = new File(TempFolder, "embeds"); - public static File MiscFolder = new File(MainFolder, "misc"); - public static File KitsFolder = new File(MiscFolder, "kits"); - //friends - //enemies - //webhook - //rpc - //autoEz - //currentcfg - //macro - //search - //alts - - - - public static void init(){ + public static File MainFolder = new File(mc.gameDir, "loop"); + public static File ConfigsFolder = new File(MainFolder, "configs"); + public static File CustomImages = new File(MainFolder, "images"); + public static File TempFolder = new File(MainFolder, "temp"); + public static File SkinsFolder = new File(TempFolder, "skins"); + public static File CapesFolder = new File(TempFolder, "capes"); + public static File HeadsFolder = new File(TempFolder, "heads"); + public static File DiscordEmbeds = new File(TempFolder, "embeds"); + public static File MiscFolder = new File(MainFolder, "misc"); + public static File KitsFolder = new File(MiscFolder, "kits"); + + public static void init() { if (!MainFolder.exists()) MainFolder.mkdirs(); if (!ConfigsFolder.exists()) ConfigsFolder.mkdirs(); if (!CustomImages.exists()) CustomImages.mkdirs(); @@ -71,14 +59,13 @@ public static void load(String name) { return; } - if(currentConfig != null){ + if (currentConfig != null) { save(currentConfig); } - InfinityLoop.moduleManager.onUnload(); InfinityLoop.moduleManager.onUnloadPost(); load(file); - InfinityLoop.moduleManager.onLoad(); + InfinityLoop.moduleManager.onUnload(); } @@ -119,6 +106,27 @@ public static void load(File config) { saveCurrentConfig(); } + public static boolean appendTextFile(String data, String file) { + try { + Path path = Paths.get(file); + Files.write(path, Collections.singletonList(data), StandardCharsets.UTF_8, Files.exists(path) ? StandardOpenOption.APPEND : StandardOpenOption.CREATE); + } catch (IOException e) { + System.out.println("WARNING: Unable to write file: " + file); + return false; + } + return true; + } + + public static List readTextFileAllLines(String file) { + try { + Path path = Paths.get(file); + return Files.readAllLines(path, StandardCharsets.UTF_8); + } catch (IOException e) { + System.out.println("WARNING: Unable to read file, creating new file: " + file); + appendTextFile("", file); + return Collections.emptyList(); + } + } public static void save(String name) { File file = new File(ConfigsFolder, name + ".if"); @@ -140,7 +148,6 @@ public static void save(File config) { config.createNewFile(); } JsonArray array = new JsonArray(); - JsonObject modulesObj = new JsonObject(); modulesObj.add("Modules", getModuleArray()); array.add(modulesObj); @@ -160,60 +167,57 @@ public static void save(File config) { private static void parseModule(JsonObject object) throws NullPointerException { - Module module = InfinityLoop.moduleManager.modules.stream() + Module module = ModuleManager.modules.stream() .filter(m -> object.getAsJsonObject(m.getName()) != null) .findFirst().orElse(null); if (module != null) { JsonObject mobject = object.getAsJsonObject(module.getName()); - for(Setting setting2 : module.getSettings()){ + for (Setting setting2 : module.getSettings()) { try { switch (setting2.getType()) { - case "Parent": - continue; - case "Boolean": + case "Boolean": { setting2.setValue(mobject.getAsJsonPrimitive(setting2.getName()).getAsBoolean()); - continue; - case "Double": + break; + } + case "Double": { setting2.setValue(mobject.getAsJsonPrimitive(setting2.getName()).getAsDouble()); - continue; - case "Float": + break; + } + case "Float": { setting2.setValue(mobject.getAsJsonPrimitive(setting2.getName()).getAsFloat()); - continue; - case "Integer": + break; + } + case "Integer": { setting2.setValue(mobject.getAsJsonPrimitive(setting2.getName()).getAsInt()); - continue; - case "String": + break; + } + case "String": { setting2.setValue(mobject.getAsJsonPrimitive(setting2.getName()).getAsString().replace("_", " ")); - continue; - case "Bind": + break; + } + case "Bind": { JsonArray array4 = mobject.getAsJsonArray("Keybind"); setting2.setValue((new Bind.BindConverter()).doBackward(array4.get(0))); ((Bind) setting2.getValue()).setHold(array4.get(1).getAsBoolean()); - continue; - case "Color": - JsonArray array = mobject.getAsJsonArray(setting2.getName()); - setting2.setValue(new Color(array.get(2).getAsInt(), true)); - continue; - - case "PositionSetting": - JsonArray array3 = mobject.getAsJsonArray(setting2.getName()); - ((PositionSetting) setting2.getValue()).setX(array3.get(0).getAsFloat()); - ((PositionSetting) setting2.getValue()).setY(array3.get(1).getAsFloat()); - continue; - case "SubBind": - setting2.setValue((new SubBind.SubBindConverter()).doBackward(mobject.getAsJsonPrimitive(setting2.getName()))); - continue; - case "Enum": + break; + } + case "Color": { + setting2.setValue(new Color(mobject.getAsInt(), true)); + break; + } + case "Enum": { try { EnumConverter converter = new EnumConverter(((Enum) setting2.getValue()).getClass()); Enum value = converter.doBackward(mobject.getAsJsonPrimitive(setting2.getName())); - setting2.setValue((value == null) ? setting2.getDefaultValue() : value); - } catch (Exception ignored) { + setting2.setValue(value == null ? setting2.getDefaultValue() : value); + } catch (Exception e) { } + break; + } } - } catch (Exception e){ + } catch (Exception e) { System.out.println(module.getName()); System.out.println(setting2); e.printStackTrace(); @@ -224,7 +228,7 @@ private static void parseModule(JsonObject object) throws NullPointerException { private static JsonArray getModuleArray() { JsonArray modulesArray = new JsonArray(); - for (Module m : InfinityLoop.moduleManager.modules) { + for (Module m : ModuleManager.modules) { modulesArray.add(getModuleObject(m)); } return modulesArray; @@ -235,6 +239,10 @@ public static JsonObject getModuleObject(Module m) { JsonParser jp = new JsonParser(); for (Setting setting : m.getSettings()) { + if (setting.getValue() instanceof Color) { + attrs.add(setting.getName(), jp.parse(String.valueOf(((Color) setting.getValue()).getRGB()))); + continue; + } if (setting.isEnumSetting()) { EnumConverter converter = new EnumConverter(((Enum) setting.getValue()).getClass()); attrs.add(setting.getName(), converter.doForward((Enum) setting.getValue())); @@ -244,34 +252,6 @@ public static JsonObject getModuleObject(Module m) { String str = (String) setting.getValue(); setting.setValue(str.replace(" ", "_")); } - if (setting.getValue() instanceof Color) { - JsonArray array = new JsonArray(); - array.add(new JsonPrimitive(((Color) setting.getValue()).getRGB())); - array.add(new JsonPrimitive(((Color) setting.getValue()).getTransparency())); - attrs.add(setting.getName(), array); - //attrs.add(setting.getName(), jp.parse(String.valueOf(((Color) setting.getValue()).getRGB()))); - continue; - } - if(setting.isPositionSetting()){ - JsonArray array = new JsonArray(); - float num2 = ((PositionSetting) setting.getValue()).getX(); - float num1 = ((PositionSetting) setting.getValue()).getY(); - array.add(new JsonPrimitive(num2)); - array.add(new JsonPrimitive(num1)); - - attrs.add(setting.getName(), array); - continue; - } - if(setting.isBindSetting()){ - JsonArray array = new JsonArray(); - String key = setting.getValueAsString(); - boolean hold = ((Bind) setting.getValue()).isHold(); - array.add(new JsonPrimitive(key)); - array.add(new JsonPrimitive(hold)); - - attrs.add(setting.getName(), array); - continue; - } try { attrs.add(setting.getName(), jp.parse(setting.getValueAsString())); } catch (Exception ignored) { @@ -302,8 +282,8 @@ public static List getConfigList() { List list = new ArrayList<>(); if (ConfigsFolder.listFiles() != null) { - for(File file : Arrays.stream(ConfigsFolder.listFiles()).filter(f -> f.getName().endsWith(".if")).collect(Collectors.toList())){ - list.add(file.getName().replace(".if","")); + for (File file : Arrays.stream(ConfigsFolder.listFiles()).filter(f -> f.getName().endsWith(".if")).collect(Collectors.toList())) { + list.add(file.getName().replace(".if", "")); } } return list; @@ -315,12 +295,12 @@ public static void saveCurrentConfig() { try { if (file.exists()) { FileWriter writer = new FileWriter(file); - writer.write(currentConfig.getName().replace(".if","")); + writer.write(currentConfig.getName().replace(".if", "")); writer.close(); } else { file.createNewFile(); FileWriter writer = new FileWriter(file); - writer.write(currentConfig.getName().replace(".if","")); + writer.write(currentConfig.getName().replace(".if", "")); writer.close(); } } catch (Exception e) { @@ -328,7 +308,7 @@ public static void saveCurrentConfig() { } } - public static File getCurrentConfig() { + public static File getCurrentConfig() { File file = new File("loop/misc/currentcfg.txt"); String name = "config"; try { @@ -341,13 +321,15 @@ public static File getCurrentConfig() { } catch (Exception e) { e.printStackTrace(); } - currentConfig = new File(ConfigsFolder,name + ".if"); + currentConfig = new File(ConfigsFolder, name + ".if"); return currentConfig; } + private static Block getRegisteredBlock(String blockName) { + return (Block) Block.REGISTRY.getObject(new ResourceLocation(blockName)); + } - - public static void loadAlts(){ + public static void loadAlts() { try { File file = new File("loop/misc/alts.txt"); @@ -360,7 +342,8 @@ public static void loadAlts(){ } } - } catch (Exception ignored) {} + } catch (Exception ignored) { + } } public static void saveAlts() { @@ -368,49 +351,15 @@ public static void saveAlts() { try { new File("loop").mkdirs(); file.createNewFile(); - } catch (Exception e){ + } catch (Exception e) { } try (BufferedWriter writer = new BufferedWriter(new FileWriter(file))) { for (String name : InfinityLoop.alts) { writer.write(name + "\n"); } - } catch (Exception ignored){} - } - - - public static void loadSearch(){ - try { - File file = new File("loop/misc/search.txt"); - - if (file.exists()) { - try (BufferedReader reader = new BufferedReader(new FileReader(file))) { - while (reader.ready()) { - String name = reader.readLine(); - Search.defaultBlocks.add(getRegisteredBlock(name)); - } - - } - } - } catch (Exception ignored) {} - } - - public static void saveSearch() { - File file = new File("loop/misc/search.txt"); - try { - new File("loop").mkdirs(); - file.createNewFile(); - } catch (Exception e){ - + } catch (Exception ignored) { } - try (BufferedWriter writer = new BufferedWriter(new FileWriter(file))) { - for (Block name : Search.defaultBlocks) { - writer.write(name.getRegistryName() + "\n"); - } - } catch (Exception ignored){} } - private static Block getRegisteredBlock(String blockName) { - return (Block)Block.REGISTRY.getObject(new ResourceLocation(blockName)); - } -} \ No newline at end of file +} diff --git a/src/main/java/com/me/infinity/loop/manager/EventManager.java b/src/main/java/me/loop/manager/EventManager.java similarity index 56% rename from src/main/java/com/me/infinity/loop/manager/EventManager.java rename to src/main/java/me/loop/manager/EventManager.java index 8b05da9..659e2cb 100644 --- a/src/main/java/com/me/infinity/loop/manager/EventManager.java +++ b/src/main/java/me/loop/manager/EventManager.java @@ -1,32 +1,22 @@ -package com.me.infinity.loop.manager; +package me.loop.manager; import com.google.common.base.Strings; -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.event.events.network.ConnectionEvent; -import com.me.infinity.loop.event.events.network.EventDeath; -import com.me.infinity.loop.event.events.TotemPopEvent; -import com.me.infinity.loop.event.events.network.EventPacket; -import com.me.infinity.loop.event.events.player.EventMotionUpdate; -import com.me.infinity.loop.event.events.render.Render2DEvent; -import com.me.infinity.loop.event.events.render.Render3DEvent; -import com.me.infinity.loop.features.modules.client.ClickGui.ClickGui; import com.mojang.realmsclient.gui.ChatFormatting; -import com.me.infinity.loop.features.Feature; -import com.me.infinity.loop.features.command.Command; -import com.me.infinity.loop.features.modules.client.HUD; -import com.me.infinity.loop.features.modules.misc.PopCounter; -import com.me.infinity.loop.util.utils.renders.GLUProjection; -import com.me.infinity.loop.util.utils.worlds.Timer; +import me.loop.InfinityLoop; +import me.loop.event.events.*; +import me.loop.features.Feature; +import me.loop.features.command.Command; +import me.loop.features.modules.client.HUD; +import me.loop.features.modules.client.clickgui.ClickGui; +import me.loop.features.modules.misc.PopCounter; +import me.loop.util.init.Timer; import me.zero.alpine.fork.listener.Listenable; import me.zero.alpine.fork.listener.Listener; -import net.minecraft.client.Minecraft; import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.client.renderer.GLAllocation; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.network.play.server.SPacketEntityStatus; import net.minecraft.network.play.server.SPacketPlayerListItem; -import net.minecraft.network.play.server.SPacketTimeUpdate; import net.minecraftforge.client.event.ClientChatEvent; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.client.event.RenderWorldLastEvent; @@ -38,10 +28,7 @@ import net.minecraftforge.fml.common.gameevent.TickEvent; import net.minecraftforge.fml.common.network.FMLNetworkEvent; import org.lwjgl.input.Keyboard; -import org.lwjgl.opengl.GL11; -import java.nio.FloatBuffer; -import java.nio.IntBuffer; import java.util.List; import java.util.Map; import java.util.Objects; @@ -49,44 +36,10 @@ import java.util.concurrent.ConcurrentHashMap; public class EventManager extends Feature { - public static float visualYaw, visualPitch, prevVisualYaw, prevVisualPitch; + private final Map> SUBSCRIPTION_CACHE; private final Map, List> SUBSCRIPTION_MAP; - - private final Timer timer = new Timer(); private final Timer logoutTimer = new Timer(); - private boolean keyTimeout; - private final Timer switchTimer = new Timer(); - - public EventManager() { - this.SUBSCRIPTION_CACHE = new ConcurrentHashMap>(); - this.SUBSCRIPTION_MAP = new ConcurrentHashMap, List>(); - } - - private float yaw; - private float pitch; - - public void updateRotations() { - this.yaw = EventManager.mc.player.rotationYaw; - this.pitch = EventManager.mc.player.rotationPitch; - prevVisualPitch = visualPitch; - prevVisualYaw = visualYaw; - } - - public void restoreRotations() { - visualPitch = mc.player.rotationPitch; - visualYaw = mc.player.rotationYaw; - EventManager.mc.player.rotationYaw = this.yaw; - EventManager.mc.player.rotationYawHead = this.yaw; - EventManager.mc.player.rotationPitch = this.pitch; - } - - public void post(final Object event) { - final List listeners = this.SUBSCRIPTION_MAP.get(event.getClass()); - if (listeners != null) { - listeners.forEach(listener -> listener.invoke(event)); - } - } public void init() { MinecraftForge.EVENT_BUS.register(this); @@ -100,23 +53,32 @@ public void onUnload() { public void onUpdate(LivingEvent.LivingUpdateEvent event) { if (!fullNullCheck() && (event.getEntity().getEntityWorld()).isRemote && event.getEntityLiving().equals(mc.player)) { InfinityLoop.inventoryManager.update(); - InfinityLoop.holeManager.update(); InfinityLoop.moduleManager.onUpdate(); - InfinityLoop.timerManager.update(); if ((HUD.getInstance()).renderingMode.getValue() == HUD.RenderingMode.Length) { InfinityLoop.moduleManager.sortModules(true); } else { InfinityLoop.moduleManager.sortModulesABC(); } - } - if(!fullNullCheck()){ - if(InfinityLoop.moduleManager.getModuleByClass(ClickGui.class).getBind().getKey() == -1){ - Command.sendMessage(ChatFormatting.DARK_RED + "Default clickgui keybind --> P"); - InfinityLoop.moduleManager.getModuleByClass(ClickGui.class).setBind(Keyboard.getKeyIndex("P")); + if (!fullNullCheck()) { + if (InfinityLoop.moduleManager.getModuleByClass(ClickGui.class).getBind().getKey() == -1) { + Command.sendMessage(ChatFormatting.GRAY + "Default clickgui keybind is: " + ChatFormatting.LIGHT_PURPLE + "P"); + InfinityLoop.moduleManager.getModuleByClass(ClickGui.class).setBind(Keyboard.getKeyIndex("P")); + } } } } - + + public EventManager() { + this.SUBSCRIPTION_CACHE = new ConcurrentHashMap>(); + this.SUBSCRIPTION_MAP = new ConcurrentHashMap, List>(); + } + + public void post(final Object event) { + final List listeners = this.SUBSCRIPTION_MAP.get(event.getClass()); + if (listeners != null) { + listeners.forEach(listener -> listener.invoke(event)); + } + } @SubscribeEvent public void onClientConnect(FMLNetworkEvent.ClientConnectedToServerEvent event) { @@ -137,103 +99,84 @@ public void onTick(TickEvent.ClientTickEvent event) { for (EntityPlayer player : mc.world.playerEntities) { if (player == null || player.getHealth() > 0.0F) continue; - MinecraftForge.EVENT_BUS.post(new EventDeath(player)); + MinecraftForge.EVENT_BUS.post(new DeathEvent(player)); PopCounter.getInstance().onDeath(player); } } @SubscribeEvent - public void onUpdateWalkingPlayer(EventMotionUpdate event) { + public void onUpdateWalkingPlayer(UpdateWalkingPlayerEvent event) { if (fullNullCheck()) return; - if (event.isPre()) { + if (event.getStage() == 0) { InfinityLoop.speedManager.updateValues(); InfinityLoop.rotationManager.updateRotations(); InfinityLoop.positionManager.updatePosition(); } - if (event.isPre()) { + if (event.getStage() == 1) { InfinityLoop.rotationManager.restoreRotations(); InfinityLoop.positionManager.restorePosition(); } } @SubscribeEvent - public void onPacketReceive(final EventPacket.Receive event) { - if (event.isPre()) { + public void onPacketReceive(PacketEvent.Receive event) { + if (event.getStage() != 0) return; - } InfinityLoop.serverManager.onPacketReceived(); if (event.getPacket() instanceof SPacketEntityStatus) { - final SPacketEntityStatus packet = (SPacketEntityStatus) event.getPacket(); - if (packet.getOpCode() == 35 && packet.getEntity(EventManager.mc.world) instanceof EntityPlayer) { - final EntityPlayer player = (EntityPlayer)packet.getEntity(EventManager.mc.world); + SPacketEntityStatus packet = event.getPacket(); + if (packet.getOpCode() == 35 && packet.getEntity(mc.world) instanceof EntityPlayer) { + EntityPlayer player = (EntityPlayer) packet.getEntity(mc.world); MinecraftForge.EVENT_BUS.post(new TotemPopEvent(player)); PopCounter.getInstance().onTotemPop(player); - InfinityLoop.positionManager.onTotemPop(player); } } - else if (event.getPacket() instanceof SPacketPlayerListItem && !Feature.fullNullCheck() && this.logoutTimer.passedS(1.0)) { - final SPacketPlayerListItem packet = (SPacketPlayerListItem) event.getPacket(); - if (!SPacketPlayerListItem.Action.ADD_PLAYER.equals(packet.getAction()) && !SPacketPlayerListItem.Action.REMOVE_PLAYER.equals(packet.getAction())) { + if (event.getPacket() instanceof SPacketPlayerListItem && !fullNullCheck() && this.logoutTimer.passedS(1.0D)) { + SPacketPlayerListItem packet = event.getPacket(); + if (!SPacketPlayerListItem.Action.ADD_PLAYER.equals(packet.getAction()) && !SPacketPlayerListItem.Action.REMOVE_PLAYER.equals(packet.getAction())) return; - } - packet.getEntries().stream().filter(Objects::nonNull).filter(data -> !Strings.isNullOrEmpty(data.getProfile().getName()) || data.getProfile().getId() != null).forEach(data -> { - final UUID id; - final SPacketPlayerListItem sPacketPlayerListItem = (SPacketPlayerListItem) event.getPacket( ); - final String name; - final EntityPlayer entity; - String logoutName; - id = data.getProfile().getId(); - switch (sPacketPlayerListItem.getAction()) { - case ADD_PLAYER: { - name = data.getProfile().getName(); - MinecraftForge.EVENT_BUS.post(new ConnectionEvent( id, name)); - break; - } - case REMOVE_PLAYER: { - entity = EventManager.mc.world.getPlayerEntityByUUID(id); - if (entity != null) { - logoutName = entity.getName(); - MinecraftForge.EVENT_BUS.post(new ConnectionEvent( entity, id, logoutName)); - break; - } - else { - MinecraftForge.EVENT_BUS.post(new ConnectionEvent( id, null)); - break; + packet.getEntries().stream().filter(Objects::nonNull).filter(data -> (!Strings.isNullOrEmpty(data.getProfile().getName()) || data.getProfile().getId() != null)) + .forEach(data -> { + String name; + EntityPlayer entity; + UUID id = data.getProfile().getId(); + switch (packet.getAction()) { + case ADD_PLAYER: + name = data.getProfile().getName(); + MinecraftForge.EVENT_BUS.post(new ConnectionEvent(0, id, name)); + break; + case REMOVE_PLAYER: + entity = mc.world.getPlayerEntityByUUID(id); + if (entity != null) { + String logoutName = entity.getName(); + MinecraftForge.EVENT_BUS.post(new ConnectionEvent(1, entity, id, logoutName)); + break; + } + MinecraftForge.EVENT_BUS.post(new ConnectionEvent(2, id, null)); + break; } - } - } - }); + }); } - else if (event.getPacket() instanceof SPacketTimeUpdate) { + if (event.getPacket() instanceof net.minecraft.network.play.server.SPacketTimeUpdate) InfinityLoop.serverManager.update(); - } } @SubscribeEvent public void onWorldRender(RenderWorldLastEvent event) { if (event.isCanceled()) return; - mc.profiler.startSection("loop"); + mc.profiler.startSection("oyvey"); GlStateManager.disableTexture2D(); GlStateManager.enableBlend(); GlStateManager.disableAlpha(); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); GlStateManager.shadeModel(7425); GlStateManager.disableDepth(); - GlStateManager.glLineWidth(1.0f); + GlStateManager.glLineWidth(1.0F); Render3DEvent render3dEvent = new Render3DEvent(event.getPartialTicks()); - GLUProjection projection = GLUProjection.getInstance(); - IntBuffer viewPort = GLAllocation.createDirectIntBuffer(16); - FloatBuffer modelView = GLAllocation.createDirectFloatBuffer(16); - FloatBuffer projectionPort = GLAllocation.createDirectFloatBuffer(16); - GL11.glGetFloat(2982, modelView); - GL11.glGetFloat(2983, projectionPort); - GL11.glGetInteger(2978, viewPort); - ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - projection.updateMatrices(viewPort, modelView, projectionPort, (double)scaledResolution.getScaledWidth() / (double) Minecraft.getMinecraft().displayWidth, (double)scaledResolution.getScaledHeight() / (double)Minecraft.getMinecraft().displayHeight); InfinityLoop.moduleManager.onRender3D(render3dEvent); - GlStateManager.glLineWidth(1.0f); + GlStateManager.glLineWidth(1.0F); GlStateManager.shadeModel(7424); GlStateManager.disableBlend(); GlStateManager.enableAlpha(); @@ -245,7 +188,7 @@ public void onWorldRender(RenderWorldLastEvent event) { GlStateManager.enableTexture2D(); GlStateManager.enableBlend(); GlStateManager.enableDepth(); - EventManager.mc.profiler.endSection(); + mc.profiler.endSection(); } @SubscribeEvent diff --git a/src/main/java/me/loop/manager/FpsManager.java b/src/main/java/me/loop/manager/FpsManager.java new file mode 100644 index 0000000..aade2bf --- /dev/null +++ b/src/main/java/me/loop/manager/FpsManager.java @@ -0,0 +1,32 @@ +package me.loop.manager; + +import java.util.LinkedList; + +public final class FpsManager { + + private int fps; + private final LinkedList frames = new LinkedList<>(); + + public void update() { + long time = System.nanoTime(); + + frames.add(time); + + while (true) { + long f = frames.getFirst(); + final long ONE_SECOND = 1000000L * 1000L; + if (time - f > ONE_SECOND) frames.remove(); + else break; + } + + fps = frames.size(); + } + + public int getFPS() { + return fps; + } + + public float getFrametime() { + return 1.0f / 240; + } +} diff --git a/src/main/java/com/me/infinity/loop/manager/FriendManager.java b/src/main/java/me/loop/manager/FriendManager.java similarity index 91% rename from src/main/java/com/me/infinity/loop/manager/FriendManager.java rename to src/main/java/me/loop/manager/FriendManager.java index 91cc661..4ba8c66 100644 --- a/src/main/java/com/me/infinity/loop/manager/FriendManager.java +++ b/src/main/java/me/loop/manager/FriendManager.java @@ -1,8 +1,8 @@ -package com.me.infinity.loop.manager; +package me.loop.manager; -import com.me.infinity.loop.features.Feature; -import com.me.infinity.loop.features.command.Command; -import com.me.infinity.loop.util.LoopUtil; +import me.loop.features.Feature; +import me.loop.features.command.Command; +import me.loop.util.LoopUtil; import net.minecraft.entity.player.EntityPlayer; import java.io.*; @@ -83,4 +83,5 @@ public void addFriend(String friend) { public void clear() { friends.clear(); } -} \ No newline at end of file +} + diff --git a/src/main/java/com/me/infinity/loop/manager/HoleManager.java b/src/main/java/me/loop/manager/HoleManager.java similarity index 93% rename from src/main/java/com/me/infinity/loop/manager/HoleManager.java rename to src/main/java/me/loop/manager/HoleManager.java index 6917e00..cf86361 100644 --- a/src/main/java/com/me/infinity/loop/manager/HoleManager.java +++ b/src/main/java/me/loop/manager/HoleManager.java @@ -1,8 +1,8 @@ -package com.me.infinity.loop.manager; +package me.loop.manager; -import com.me.infinity.loop.features.Feature; -import com.me.infinity.loop.util.utils.minecraft.BlockUtil; -import com.me.infinity.loop.util.utils.EntityUtil; +import me.loop.features.Feature; +import me.loop.util.impl.BlockUtil; +import me.loop.util.impl.EntityUtil; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; diff --git a/src/main/java/me/loop/manager/InventoryManager.java b/src/main/java/me/loop/manager/InventoryManager.java new file mode 100644 index 0000000..3db8dfa --- /dev/null +++ b/src/main/java/me/loop/manager/InventoryManager.java @@ -0,0 +1,29 @@ +package me.loop.manager; + +import me.loop.util.impl.Util; +import net.minecraft.network.play.client.CPacketHeldItemChange; + +public class InventoryManager + implements Util { + public int currentPlayerItem; + private int recoverySlot = -1; + + public void update() { + if (this.recoverySlot != -1) { + mc.player.connection.sendPacket(new CPacketHeldItemChange(this.recoverySlot == 8 ? 7 : this.recoverySlot + 1)); + mc.player.connection.sendPacket(new CPacketHeldItemChange(this.recoverySlot)); + mc.player.inventory.currentItem = this.recoverySlot; + int i = mc.player.inventory.currentItem; + if (i != this.currentPlayerItem) { + this.currentPlayerItem = i; + mc.player.connection.sendPacket(new CPacketHeldItemChange(this.currentPlayerItem)); + } + this.recoverySlot = -1; + } + } + + public void recoverSilent(int slot) { + this.recoverySlot = slot; + } +} + diff --git a/src/main/java/com/me/infinity/loop/manager/ModuleManager.java b/src/main/java/me/loop/manager/ModuleManager.java similarity index 62% rename from src/main/java/com/me/infinity/loop/manager/ModuleManager.java rename to src/main/java/me/loop/manager/ModuleManager.java index e0f30e1..43f8508 100644 --- a/src/main/java/com/me/infinity/loop/manager/ModuleManager.java +++ b/src/main/java/me/loop/manager/ModuleManager.java @@ -1,24 +1,20 @@ -package com.me.infinity.loop.manager; - -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.event.events.render.Render2DEvent; -import com.me.infinity.loop.event.events.render.Render3DEvent; -import com.me.infinity.loop.features.Feature; -import com.me.infinity.loop.features.gui.InfinityLoopGui; -import com.me.infinity.loop.features.modules.Module; -import com.me.infinity.loop.features.modules.ModuleCategory; -import com.me.infinity.loop.features.modules.client.*; -import com.me.infinity.loop.features.modules.client.ClickGui.ClickGui; -import com.me.infinity.loop.features.modules.combat.*; -import com.me.infinity.loop.features.modules.misc.*; -import com.me.infinity.loop.features.modules.movement.*; -import com.me.infinity.loop.features.modules.player.*; -import com.me.infinity.loop.features.modules.render.*; -import com.me.infinity.loop.features.modules.render.deatheffects.DeathEffects; -import com.me.infinity.loop.features.modules.render.motionblur.MotionBlur; -import com.me.infinity.loop.features.modules.test.Test; -import com.me.infinity.loop.util.utils.Util; +package me.loop.manager; + import com.mojang.realmsclient.gui.ChatFormatting; +import me.loop.InfinityLoop; +import me.loop.event.events.Render2DEvent; +import me.loop.event.events.Render3DEvent; +import me.loop.features.Feature; +import me.loop.features.gui.InfinityLoopGui; +import me.loop.features.modules.Module; +import me.loop.features.modules.client.*; +import me.loop.features.modules.client.clickgui.ClickGui; +import me.loop.features.modules.combat.*; +import me.loop.features.modules.misc.*; +import me.loop.features.modules.movement.*; +import me.loop.features.modules.player.*; +import me.loop.features.modules.render.*; +import me.loop.util.impl.Util; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.eventhandler.EventBus; import org.lwjgl.input.Keyboard; @@ -40,87 +36,53 @@ public class ModuleManager public Animation animationThread; public void init() { - // Test - modules.add(new Test()); - - // Client - modules.add(new CSGui()); - modules.add(new ClickGui()); - modules.add(new RPC()); - modules.add(new GameChanger()); - modules.add(new Colors()); - modules.add(new FontMod()); - modules.add(new HUD()); - modules.add(new MainSettings()); - modules.add(new Windows()); - - // Combat - modules.add(new AutoArmor()); - modules.add(new AutoCrystal()); - modules.add(new Criticals()); - modules.add(new HoleFiller()); - modules.add(new Killaura()); - modules.add(new Offhand()); - modules.add(new SelfFill()); - modules.add(new Surround()); - - // Misc - modules.add(new AutoGG()); - modules.add(new BlockTweaks()); - modules.add(new ChatModifier()); - modules.add(new ExtraTab()); - modules.add(new MCF()); - modules.add(new NoHandShake()); - modules.add(new PopCounter()); - modules.add(new ToolTips()); - - // Movement - modules.add(new NoSlow()); - modules.add(new NoVoid()); - modules.add(new ReverseStep()); - modules.add(new Step()); - modules.add(new TimerSpeed()); - - // Player - modules.add(new AutoDoSmth()); - modules.add(new FakePlayer()); - modules.add(new FastPlace()); - modules.add(new LiquidInteract()); - modules.add(new MCP()); - modules.add(new MultiTask()); - modules.add(new Replenish()); - modules.add(new Search()); - modules.add(new TpsSync()); - - // Render - //modules.add(new ShaderESP()); - modules.add(new MotionBlur()); - modules.add(new PlayerTrails()); - modules.add(new DeathEffects()); - //modules.add(new NoCluster()); - modules.add(new ShadowESP()); - modules.add(new com.me.infinity.loop.features.modules.render.Animation()); - modules.add(new ArrowESP()); - modules.add(new BlockHighlight()); - modules.add(new BreadCrumbs()); - modules.add(new BurrowESP()); - modules.add(new CameraClip()); - //modules.add(new Dismemberment()); - modules.add(new ESP()); - modules.add(new FogColor()); - modules.add(new HandChams()); - modules.add(new HoleESP()); - modules.add(new ItemPhysics()); - modules.add(new PearlRender()); - modules.add(new Skeleton()); - modules.add(new SmallShield()); - modules.add(new Trajectories()); - modules.add(new ViewModel()); - modules.add(new Wireframe()); + this.modules.add(new BlurExtends()); + this.modules.add(new MainSettings()); + this.modules.add(new Windows()); + this.modules.add(new ClickGui()); + this.modules.add(new FontMod()); + this.modules.add(new HUD()); + this.modules.add(new BlockHighlight()); + this.modules.add(new HoleESP()); + this.modules.add(new Skeleton()); + this.modules.add(new Replenish()); + this.modules.add(new SmallShield()); + this.modules.add(new HandChams()); + this.modules.add(new Trajectories()); + this.modules.add(new FakePlayer()); + this.modules.add(new TpsSync()); + this.modules.add(new MultiTask()); + this.modules.add(new MCP()); + this.modules.add(new Speedmine()); + this.modules.add(new ReverseStep()); + this.modules.add(new NoVoid()); + this.modules.add(new NoHandShake()); + this.modules.add(new ChatModifier()); + this.modules.add(new MCF()); + this.modules.add(new PearlNotify()); + this.modules.add(new AutoGG()); + this.modules.add(new ToolTips()); + this.modules.add(new PopCounter()); + this.modules.add(new Offhand()); + this.modules.add(new Surround()); + this.modules.add(new AutoTrap()); + this.modules.add(new AutoWeb()); + this.modules.add(new AutoCrystal()); + this.modules.add(new Killaura()); + this.modules.add(new Criticals()); + this.modules.add(new HoleFiller()); + this.modules.add(new Speed()); + this.modules.add(new Step()); + this.modules.add(new FastPlace()); + this.modules.add(new ESP()); + this.modules.add(new Selftrap()); + this.modules.add(new NoHitBox()); + this.modules.add(new SelfFill()); + this.modules.add(new ArrowESP()); } public Module getModuleByName(String name) { - for (Module module : modules) { + for (Module module : this.modules) { if (!module.getName().equalsIgnoreCase(name)) continue; return module; } @@ -128,7 +90,7 @@ public Module getModuleByName(String name) { } public T getModuleByClass(Class clazz) { - for (Module module : modules) { + for (Module module : this.modules) { if (!clazz.isInstance(module)) continue; return (T) module; } @@ -174,7 +136,7 @@ public boolean isModuleEnabled(Class clazz) { } public Module getModuleByDisplayName(String displayName) { - for (Module module : modules) { + for (Module module : this.modules) { if (!module.getDisplayName().equalsIgnoreCase(displayName)) continue; return module; } @@ -183,7 +145,7 @@ public Module getModuleByDisplayName(String displayName) { public ArrayList getEnabledModules() { ArrayList enabledModules = new ArrayList(); - for (Module module : modules) { + for (Module module : this.modules) { if (!module.isEnabled()) continue; enabledModules.add(module); } @@ -192,16 +154,16 @@ public ArrayList getEnabledModules() { public ArrayList getEnabledModulesName() { ArrayList enabledModules = new ArrayList(); - for (Module module : modules) { + for (Module module : this.modules) { if (!module.isEnabled() || !module.isDrawn()) continue; enabledModules.add(module.getFullArrayString()); } return enabledModules; } - public ArrayList getModulesByCategory(ModuleCategory category) { + public ArrayList getModulesByCategory(Module.Category category) { ArrayList modulesCategory = new ArrayList(); - modules.forEach(module -> { + this.modules.forEach(module -> { if (module.getCategory() == category) { modulesCategory.add(module); } @@ -209,29 +171,29 @@ public ArrayList getModulesByCategory(ModuleCategory category) { return modulesCategory; } - public List getCategories() { - return Arrays.asList(ModuleCategory.values()); + public List getCategories() { + return Arrays.asList(Module.Category.values()); } public void onLoad() { - modules.stream().filter(Module::listening).forEach(((EventBus) MinecraftForge.EVENT_BUS)::register); - modules.forEach(Module::onLoad); + this.modules.stream().filter(Module::listening).forEach(((EventBus) MinecraftForge.EVENT_BUS)::register); + this.modules.forEach(Module::onLoad); } public void onUpdate() { - modules.stream().filter(Feature::isEnabled).forEach(Module::onUpdate); + this.modules.stream().filter(Feature::isEnabled).forEach(Module::onUpdate); } public void onTick() { - modules.stream().filter(Feature::isEnabled).forEach(Module::onTick); + this.modules.stream().filter(Feature::isEnabled).forEach(Module::onTick); } public void onRender2D(Render2DEvent event) { - modules.stream().filter(Feature::isEnabled).forEach(module -> module.onRender2D(event)); + this.modules.stream().filter(Feature::isEnabled).forEach(module -> module.onRender2D(event)); } public void onRender3D(Render3DEvent event) { - modules.stream().filter(Feature::isEnabled).forEach(module -> module.onRender3D(event)); + this.modules.stream().filter(Feature::isEnabled).forEach(module -> module.onRender3D(event)); } public void sortModules(boolean reverse) { @@ -244,20 +206,20 @@ public void sortModulesABC() { } public void onLogout() { - modules.forEach(Module::onLogout); + this.modules.forEach(Module::onLogout); } public void onLogin() { - modules.forEach(Module::onLogin); + this.modules.forEach(Module::onLogin); } public void onUnload() { - modules.forEach(MinecraftForge.EVENT_BUS::unregister); - modules.forEach(Module::onUnload); + this.modules.forEach(MinecraftForge.EVENT_BUS::unregister); + this.modules.forEach(Module::onUnload); } public void onUnloadPost() { - for (Module module : modules) { + for (Module module : this.modules) { module.enabled.setValue(false); } } @@ -266,7 +228,7 @@ public void onKeyPressed(int eventKey) { if (eventKey == 0 || !Keyboard.getEventKeyState() || ModuleManager.mc.currentScreen instanceof InfinityLoopGui) { return; } - modules.forEach(module -> { + this.modules.forEach(module -> { if (module.getBind().getKey() == eventKey) { module.toggle(); } diff --git a/src/main/java/com/me/infinity/loop/manager/PacketManager.java b/src/main/java/me/loop/manager/PacketManager.java similarity index 88% rename from src/main/java/com/me/infinity/loop/manager/PacketManager.java rename to src/main/java/me/loop/manager/PacketManager.java index 57ef287..74fcbc3 100644 --- a/src/main/java/com/me/infinity/loop/manager/PacketManager.java +++ b/src/main/java/me/loop/manager/PacketManager.java @@ -1,6 +1,6 @@ -package com.me.infinity.loop.manager; +package me.loop.manager; -import com.me.infinity.loop.features.Feature; +import me.loop.features.Feature; import net.minecraft.network.Packet; import java.util.ArrayList; diff --git a/src/main/java/com/me/infinity/loop/manager/PositionManager.java b/src/main/java/me/loop/manager/PositionManager.java similarity index 75% rename from src/main/java/com/me/infinity/loop/manager/PositionManager.java rename to src/main/java/me/loop/manager/PositionManager.java index 8b05fe5..d996a43 100644 --- a/src/main/java/com/me/infinity/loop/manager/PositionManager.java +++ b/src/main/java/me/loop/manager/PositionManager.java @@ -1,18 +1,10 @@ -package com.me.infinity.loop.manager; +package me.loop.manager; -import com.me.infinity.loop.features.Feature; -import net.minecraft.entity.player.EntityPlayer; +import me.loop.features.Feature; import net.minecraft.network.play.client.CPacketPlayer; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -public class PositionManager extends Feature { - private final Map potions; - - public PositionManager() { - this.potions = new ConcurrentHashMap(); - } +public class PositionManager + extends Feature { private double x; private double y; private double z; @@ -45,11 +37,6 @@ public void setPlayerPosition(double x, double y, double z, boolean onground) { PositionManager.mc.player.onGround = onground; } - public void onTotemPop(final EntityPlayer player) { - final PotionManager.PotionList list = new PotionManager.PotionList(); - this.potions.put(player, list); - } - public void setPositionPacket(double x, double y, double z, boolean onGround, boolean setPos, boolean noLagBack) { PositionManager.mc.player.connection.sendPacket(new CPacketPlayer.Position(x, y, z, onGround)); if (setPos) { diff --git a/src/main/java/com/me/infinity/loop/manager/PotionManager.java b/src/main/java/me/loop/manager/PotionManager.java similarity index 96% rename from src/main/java/com/me/infinity/loop/manager/PotionManager.java rename to src/main/java/me/loop/manager/PotionManager.java index efcbb53..b83108e 100644 --- a/src/main/java/com/me/infinity/loop/manager/PotionManager.java +++ b/src/main/java/me/loop/manager/PotionManager.java @@ -1,7 +1,7 @@ -package com.me.infinity.loop.manager; +package me.loop.manager; import com.mojang.realmsclient.gui.ChatFormatting; -import com.me.infinity.loop.features.Feature; +import me.loop.features.Feature; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.potion.Potion; diff --git a/src/main/java/com/me/infinity/loop/manager/ReloadManager.java b/src/main/java/me/loop/manager/ReloadManager.java similarity index 58% rename from src/main/java/com/me/infinity/loop/manager/ReloadManager.java rename to src/main/java/me/loop/manager/ReloadManager.java index d0f7a6b..276763d 100644 --- a/src/main/java/com/me/infinity/loop/manager/ReloadManager.java +++ b/src/main/java/me/loop/manager/ReloadManager.java @@ -1,10 +1,10 @@ -package com.me.infinity.loop.manager; +package me.loop.manager; -import com.me.infinity.loop.InfinityLoop; import com.mojang.realmsclient.gui.ChatFormatting; -import com.me.infinity.loop.event.events.network.EventPacket; -import com.me.infinity.loop.features.Feature; -import com.me.infinity.loop.features.command.Command; +import me.loop.InfinityLoop; +import me.loop.event.events.PacketEvent; +import me.loop.features.Feature; +import me.loop.features.command.Command; import net.minecraft.network.play.client.CPacketChatMessage; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @@ -17,7 +17,7 @@ public void init(String prefix) { this.prefix = prefix; MinecraftForge.EVENT_BUS.register(this); if (!ReloadManager.fullNullCheck()) { - Command.sendMessage(ChatFormatting.RED + "Loop has been unloaded. Type " + prefix + "reload to reload."); + Command.sendMessage(ChatFormatting.RED + "OyVey has been unloaded. Type " + prefix + "reload to reload."); } } @@ -26,9 +26,9 @@ public void unload() { } @SubscribeEvent - public void onPacketSend(EventPacket.Send event) { + public void onPacketSend(PacketEvent.Send event) { CPacketChatMessage packet; - if (event.getPacket() instanceof CPacketChatMessage && (packet = (CPacketChatMessage) event.getPacket()).getMessage().startsWith(this.prefix) && packet.getMessage().contains("reload")) { + if (event.getPacket() instanceof CPacketChatMessage && (packet = event.getPacket()).getMessage().startsWith(this.prefix) && packet.getMessage().contains("reload")) { InfinityLoop.load(); event.setCanceled(true); } diff --git a/src/main/java/com/me/infinity/loop/manager/RotationManager.java b/src/main/java/me/loop/manager/RotationManager.java similarity index 93% rename from src/main/java/com/me/infinity/loop/manager/RotationManager.java rename to src/main/java/me/loop/manager/RotationManager.java index d4150d4..4a2c189 100644 --- a/src/main/java/com/me/infinity/loop/manager/RotationManager.java +++ b/src/main/java/me/loop/manager/RotationManager.java @@ -1,8 +1,8 @@ -package com.me.infinity.loop.manager; +package me.loop.manager; -import com.me.infinity.loop.features.Feature; -import com.me.infinity.loop.util.utils.maths.MathUtil; -import com.me.infinity.loop.util.utils.RotationUtil; +import me.loop.features.Feature; +import me.loop.util.impl.MathUtil; +import me.loop.util.impl.RotationUtil; import net.minecraft.entity.Entity; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; diff --git a/src/main/java/com/me/infinity/loop/manager/ServerManager.java b/src/main/java/me/loop/manager/ServerManager.java similarity index 92% rename from src/main/java/com/me/infinity/loop/manager/ServerManager.java rename to src/main/java/me/loop/manager/ServerManager.java index 8102af2..cbdea93 100644 --- a/src/main/java/com/me/infinity/loop/manager/ServerManager.java +++ b/src/main/java/me/loop/manager/ServerManager.java @@ -1,8 +1,8 @@ -package com.me.infinity.loop.manager; +package me.loop.manager; -import com.me.infinity.loop.features.Feature; -import com.me.infinity.loop.features.modules.client.HUD; -import com.me.infinity.loop.util.utils.worlds.Timer; +import me.loop.features.Feature; +import me.loop.features.modules.client.HUD; +import me.loop.util.init.Timer; import java.text.DecimalFormat; import java.util.Arrays; diff --git a/src/main/java/com/me/infinity/loop/manager/SpeedManager.java b/src/main/java/me/loop/manager/SpeedManager.java similarity index 97% rename from src/main/java/com/me/infinity/loop/manager/SpeedManager.java rename to src/main/java/me/loop/manager/SpeedManager.java index c9c7ec9..7de878a 100644 --- a/src/main/java/com/me/infinity/loop/manager/SpeedManager.java +++ b/src/main/java/me/loop/manager/SpeedManager.java @@ -1,6 +1,6 @@ -package com.me.infinity.loop.manager; +package me.loop.manager; -import com.me.infinity.loop.features.Feature; +import me.loop.features.Feature; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.math.MathHelper; diff --git a/src/main/java/com/me/infinity/loop/manager/TextManager.java b/src/main/java/me/loop/manager/TextManager.java similarity index 82% rename from src/main/java/com/me/infinity/loop/manager/TextManager.java rename to src/main/java/me/loop/manager/TextManager.java index de87cc3..27976db 100644 --- a/src/main/java/com/me/infinity/loop/manager/TextManager.java +++ b/src/main/java/me/loop/manager/TextManager.java @@ -1,10 +1,10 @@ -package com.me.infinity.loop.manager; +package me.loop.manager; -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.features.Feature; -import com.me.infinity.loop.features.gui.font.CustomFont; -import com.me.infinity.loop.features.modules.client.FontMod; -import com.me.infinity.loop.util.utils.worlds.Timer; +import me.loop.InfinityLoop; +import me.loop.features.Feature; +import me.loop.features.gui.font.CustomFont; +import me.loop.features.modules.client.FontMod; +import me.loop.util.init.Timer; import net.minecraft.util.math.MathHelper; import java.awt.*; @@ -35,17 +35,16 @@ public void drawStringWithShadow(String text, float x, float y, int color) { this.drawString(text, x, y, color, true); } - public float drawString(String text, float x, float y, int color, boolean shadow) { + public void drawString(String text, float x, float y, int color, boolean shadow) { if (InfinityLoop.moduleManager.isModuleEnabled(FontMod.getInstance().getName())) { if (shadow) { this.customFont.drawStringWithShadow(text, x, y, color); } else { this.customFont.drawString(text, x, y, color); } - return x; + return; } TextManager.mc.fontRenderer.drawString(text, x, y, color, shadow); - return x; } public int getStringWidth(String text) { @@ -102,13 +101,5 @@ public String getIdleSign() { } return ""; } - - public static float drawString3(String text, float x, float y, int color) { - return InfinityLoop.textManager.drawString(text, x, y, color); - } - - public float drawString(String text, float x, float y, int color) { - return this.drawString(text, x, y, color, false); - } } diff --git a/src/main/java/com/me/infinity/loop/mixin/LoopMixinLoader.java b/src/main/java/me/loop/mixin/InfinityLoopLoader.java similarity index 84% rename from src/main/java/com/me/infinity/loop/mixin/LoopMixinLoader.java rename to src/main/java/me/loop/mixin/InfinityLoopLoader.java index 8709571..ab98da3 100644 --- a/src/main/java/com/me/infinity/loop/mixin/LoopMixinLoader.java +++ b/src/main/java/me/loop/mixin/InfinityLoopLoader.java @@ -1,6 +1,6 @@ -package com.me.infinity.loop.mixin; +package me.loop.mixin; -import com.me.infinity.loop.InfinityLoop; +import me.loop.InfinityLoop; import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin; import org.spongepowered.asm.launch.MixinBootstrap; import org.spongepowered.asm.mixin.MixinEnvironment; @@ -8,14 +8,14 @@ import java.util.Map; -public class LoopMixinLoader +public class InfinityLoopLoader implements IFMLLoadingPlugin { private static boolean isObfuscatedEnvironment = false; - public LoopMixinLoader() { + public InfinityLoopLoader() { InfinityLoop.LOGGER.info("\n\nLoading mixins by KuroHere"); MixinBootstrap.init(); - Mixins.addConfiguration("mixins.loop.json"); + Mixins.addConfiguration("mixins.infinityloop.json"); MixinEnvironment.getDefaultEnvironment().setObfuscationContext("searge"); InfinityLoop.LOGGER.info(MixinEnvironment.getDefaultEnvironment().getObfuscationContext()); } diff --git a/src/main/java/com/me/infinity/loop/util/utils/interfaces/IShaderGroup.java b/src/main/java/me/loop/mixin/mixins/IShaderGroup.java similarity index 81% rename from src/main/java/com/me/infinity/loop/util/utils/interfaces/IShaderGroup.java rename to src/main/java/me/loop/mixin/mixins/IShaderGroup.java index 65a7dfc..e0a233e 100644 --- a/src/main/java/com/me/infinity/loop/util/utils/interfaces/IShaderGroup.java +++ b/src/main/java/me/loop/mixin/mixins/IShaderGroup.java @@ -1,4 +1,4 @@ -package com.me.infinity.loop.util.utils.interfaces; +package me.loop.mixin.mixins; import net.minecraft.client.shader.Framebuffer; import net.minecraft.client.shader.Shader; diff --git a/src/main/java/me/loop/mixin/mixins/MixinBlockLiquid.java b/src/main/java/me/loop/mixin/mixins/MixinBlockLiquid.java new file mode 100644 index 0000000..0e4f05a --- /dev/null +++ b/src/main/java/me/loop/mixin/mixins/MixinBlockLiquid.java @@ -0,0 +1,15 @@ +package me.loop.mixin.mixins; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockLiquid; +import net.minecraft.block.material.Material; +import org.spongepowered.asm.mixin.Mixin; + +@Mixin(value = {BlockLiquid.class}) +public class MixinBlockLiquid + extends Block { + protected MixinBlockLiquid(Material materialIn) { + super(materialIn); + } +} + diff --git a/src/main/java/com/me/infinity/loop/mixin/mixins/MixinEntityPlayer.java b/src/main/java/me/loop/mixin/mixins/MixinEntityPlayer.java similarity index 89% rename from src/main/java/com/me/infinity/loop/mixin/mixins/MixinEntityPlayer.java rename to src/main/java/me/loop/mixin/mixins/MixinEntityPlayer.java index 7051090..67ee193 100644 --- a/src/main/java/com/me/infinity/loop/mixin/mixins/MixinEntityPlayer.java +++ b/src/main/java/me/loop/mixin/mixins/MixinEntityPlayer.java @@ -1,8 +1,8 @@ -package com.me.infinity.loop.mixin.mixins; +package me.loop.mixin.mixins; -import com.me.infinity.loop.InfinityLoop; import com.mojang.authlib.GameProfile; -import com.me.infinity.loop.features.modules.player.TpsSync; +import me.loop.InfinityLoop; +import me.loop.features.modules.player.TpsSync; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.player.EntityPlayer; diff --git a/src/main/java/com/me/infinity/loop/mixin/mixins/MixinEntityPlayerSP.java b/src/main/java/me/loop/mixin/mixins/MixinEntityPlayerSP.java similarity index 58% rename from src/main/java/com/me/infinity/loop/mixin/mixins/MixinEntityPlayerSP.java rename to src/main/java/me/loop/mixin/mixins/MixinEntityPlayerSP.java index e0ac3fc..199978d 100644 --- a/src/main/java/com/me/infinity/loop/mixin/mixins/MixinEntityPlayerSP.java +++ b/src/main/java/me/loop/mixin/mixins/MixinEntityPlayerSP.java @@ -1,10 +1,7 @@ -package com.me.infinity.loop.mixin.mixins; +package me.loop.mixin.mixins; -import com.me.infinity.loop.event.Event; -import com.me.infinity.loop.event.events.ChatEvent; -import com.me.infinity.loop.event.events.player.EventMotionUpdate; -import com.me.infinity.loop.features.modules.player.AutoDoSmth; -import com.me.infinity.loop.util.utils.Util; +import me.loop.event.events.ChatEvent; +import me.loop.event.events.UpdateWalkingPlayerEvent; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.AbstractClientPlayer; import net.minecraft.client.entity.EntityPlayerSP; @@ -16,7 +13,6 @@ import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(value = {EntityPlayerSP.class}, priority = 9998) @@ -32,24 +28,15 @@ public void sendChatMessage(String message, CallbackInfo callback) { MinecraftForge.EVENT_BUS.post(chatEvent); } - @Redirect(method={"onLivingUpdate"}, at=@At(value="INVOKE", target="Lnet/minecraft/client/entity/EntityPlayerSP;setSprinting(Z)V", ordinal=2)) - public void onLivingUpdate(EntityPlayerSP entityPlayerSP, boolean sprinting) { - if (AutoDoSmth.getINSTANCE().isOn() && AutoDoSmth.getINSTANCE().autoSprint.getValue() == AutoDoSmth.Sprint.Rage && (Util.mc.player.movementInput.moveForward != 0.0f || Util.mc.player.movementInput.moveStrafe != 0.0f)) { - entityPlayerSP.setSprinting(true); - } else { - entityPlayerSP.setSprinting(sprinting); - } - } - @Inject(method = {"onUpdateWalkingPlayer"}, at = {@At(value = "HEAD")}) private void preMotion(CallbackInfo info) { - EventMotionUpdate event = new EventMotionUpdate(Event.Stage.PRE); + UpdateWalkingPlayerEvent event = new UpdateWalkingPlayerEvent(0); MinecraftForge.EVENT_BUS.post(event); } @Inject(method = {"onUpdateWalkingPlayer"}, at = {@At(value = "RETURN")}) private void postMotion(CallbackInfo info) { - EventMotionUpdate event = new EventMotionUpdate(Event.Stage.PRE); + UpdateWalkingPlayerEvent event = new UpdateWalkingPlayerEvent(1); MinecraftForge.EVENT_BUS.post(event); } } diff --git a/src/main/java/me/loop/mixin/mixins/MixinEntityRenderer.java b/src/main/java/me/loop/mixin/mixins/MixinEntityRenderer.java new file mode 100644 index 0000000..3d37646 --- /dev/null +++ b/src/main/java/me/loop/mixin/mixins/MixinEntityRenderer.java @@ -0,0 +1,29 @@ +package me.loop.mixin.mixins; + +import com.google.common.base.Predicate; +import me.loop.features.modules.misc.NoHitBox; +import net.minecraft.client.Minecraft; +import net.minecraft.client.multiplayer.WorldClient; +import net.minecraft.client.renderer.EntityRenderer; +import net.minecraft.entity.Entity; +import net.minecraft.init.Items; +import net.minecraft.item.ItemPickaxe; +import net.minecraft.util.math.AxisAlignedBB; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +import java.util.ArrayList; +import java.util.List; + +@Mixin(value = {EntityRenderer.class}) +public class MixinEntityRenderer { + @Redirect(method = {"getMouseOver"}, at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/WorldClient;getEntitiesInAABBexcluding(Lnet/minecraft/entity/Entity;Lnet/minecraft/util/math/AxisAlignedBB;Lcom/google/common/base/Predicate;)Ljava/util/List;")) + public List getEntitiesInAABBexcluding(WorldClient worldClient, Entity entityIn, AxisAlignedBB boundingBox, Predicate predicate) { + if (NoHitBox.getINSTANCE().isOn() && (Minecraft.getMinecraft().player.getHeldItemMainhand().getItem() instanceof ItemPickaxe && NoHitBox.getINSTANCE().pickaxe.getValue() != false || Minecraft.getMinecraft().player.getHeldItemMainhand().getItem() == Items.END_CRYSTAL && NoHitBox.getINSTANCE().crystal.getValue() != false || Minecraft.getMinecraft().player.getHeldItemMainhand().getItem() == Items.GOLDEN_APPLE && NoHitBox.getINSTANCE().gapple.getValue() != false || Minecraft.getMinecraft().player.getHeldItemMainhand().getItem() == Items.FLINT_AND_STEEL || Minecraft.getMinecraft().player.getHeldItemMainhand().getItem() == Items.TNT_MINECART)) { + return new ArrayList(); + } + return worldClient.getEntitiesInAABBexcluding(entityIn, boundingBox, predicate); + } +} + diff --git a/src/main/java/com/me/infinity/loop/mixin/mixins/MixinGuiNewChat.java b/src/main/java/me/loop/mixin/mixins/MixinGuiNewChat.java similarity index 82% rename from src/main/java/com/me/infinity/loop/mixin/mixins/MixinGuiNewChat.java rename to src/main/java/me/loop/mixin/mixins/MixinGuiNewChat.java index b2ae11f..c0f5482 100644 --- a/src/main/java/com/me/infinity/loop/mixin/mixins/MixinGuiNewChat.java +++ b/src/main/java/me/loop/mixin/mixins/MixinGuiNewChat.java @@ -1,6 +1,6 @@ -package com.me.infinity.loop.mixin.mixins; +package me.loop.mixin.mixins; -import com.me.infinity.loop.features.modules.misc.ChatModifier; +import me.loop.features.modules.misc.ChatModifier; import net.minecraft.client.gui.ChatLine; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.GuiNewChat; @@ -15,17 +15,17 @@ public class MixinGuiNewChat extends Gui { @Redirect(method = {"drawChat"}, at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiNewChat;drawRect(IIIII)V")) private void drawRectHook(int left, int top, int right, int bottom, int color) { - Gui.drawRect(left, top, right, bottom, ChatModifier.getInstance().isOn() && ChatModifier.getInstance().clean.getValue() ? 0 : color); + Gui.drawRect(left, top, right, bottom, ChatModifier.getInstance().isOn() && ChatModifier.getInstance().clean.getValue() != false ? 0 : color); } @Redirect(method = {"setChatLine"}, at = @At(value = "INVOKE", target = "Ljava/util/List;size()I", ordinal = 0)) public int drawnChatLinesSize(List list) { - return ChatModifier.getInstance().isOn() && ChatModifier.getInstance().infinite.getValue() ? -2147483647 : list.size(); + return ChatModifier.getInstance().isOn() && ChatModifier.getInstance().infinite.getValue() != false ? -2147483647 : list.size(); } @Redirect(method = {"setChatLine"}, at = @At(value = "INVOKE", target = "Ljava/util/List;size()I", ordinal = 2)) public int chatLinesSize(List list) { - return ChatModifier.getInstance().isOn() && ChatModifier.getInstance().infinite.getValue() ? -2147483647 : list.size(); + return ChatModifier.getInstance().isOn() && ChatModifier.getInstance().infinite.getValue() != false ? -2147483647 : list.size(); } } diff --git a/src/main/java/me/loop/mixin/mixins/MixinGuiPlayerTabOverlay.java b/src/main/java/me/loop/mixin/mixins/MixinGuiPlayerTabOverlay.java new file mode 100644 index 0000000..1d06a5e --- /dev/null +++ b/src/main/java/me/loop/mixin/mixins/MixinGuiPlayerTabOverlay.java @@ -0,0 +1,9 @@ +package me.loop.mixin.mixins; + +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.GuiPlayerTabOverlay; +import org.spongepowered.asm.mixin.Mixin; + +@Mixin({GuiPlayerTabOverlay.class}) +public class MixinGuiPlayerTabOverlay extends Gui { +} diff --git a/src/main/java/com/me/infinity/loop/mixin/mixins/MixinGuiScreen.java b/src/main/java/me/loop/mixin/mixins/MixinGuiScreen.java similarity index 74% rename from src/main/java/com/me/infinity/loop/mixin/mixins/MixinGuiScreen.java rename to src/main/java/me/loop/mixin/mixins/MixinGuiScreen.java index 1225ab1..ce12af1 100644 --- a/src/main/java/com/me/infinity/loop/mixin/mixins/MixinGuiScreen.java +++ b/src/main/java/me/loop/mixin/mixins/MixinGuiScreen.java @@ -1,26 +1,18 @@ -package com.me.infinity.loop.mixin.mixins; +package me.loop.mixin.mixins; -import com.me.infinity.loop.features.modules.misc.ToolTips; +import me.loop.features.modules.misc.ToolTips; import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.item.ItemShulkerBox; import net.minecraft.item.ItemStack; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import java.util.List; - @Mixin(value = {GuiScreen.class}) public class MixinGuiScreen extends Gui { - @Shadow public int width; - - @Shadow protected List buttonList; - @Inject(method = {"renderToolTip"}, at = {@At(value = "HEAD")}, cancellable = true) public void renderToolTipHook(ItemStack stack, int x, int y, CallbackInfo info) { if (ToolTips.getInstance().isOn() && stack.getItem() instanceof ItemShulkerBox) { diff --git a/src/main/java/com/me/infinity/loop/mixin/mixins/MixinItemRenderer.java b/src/main/java/me/loop/mixin/mixins/MixinItemRenderer.java similarity index 62% rename from src/main/java/com/me/infinity/loop/mixin/mixins/MixinItemRenderer.java rename to src/main/java/me/loop/mixin/mixins/MixinItemRenderer.java index 3a72971..b64c465 100644 --- a/src/main/java/com/me/infinity/loop/mixin/mixins/MixinItemRenderer.java +++ b/src/main/java/me/loop/mixin/mixins/MixinItemRenderer.java @@ -1,13 +1,10 @@ -package com.me.infinity.loop.mixin.mixins; +package me.loop.mixin.mixins; -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.event.Event; -import com.me.infinity.loop.event.events.player.TransformFirstPersonEvent; -import com.me.infinity.loop.features.modules.client.Colors; -import com.me.infinity.loop.features.modules.render.HandChams; -import com.me.infinity.loop.features.modules.render.SmallShield; -import com.me.infinity.loop.features.modules.render.ViewModel; -import com.me.infinity.loop.util.utils.renders.ColorUtil; +import me.loop.features.modules.client.Colors; +import me.loop.features.modules.client.clickgui.ClickGui; +import me.loop.features.modules.render.HandChams; +import me.loop.features.modules.render.SmallShield; +import me.loop.util.impl.ColorUtil; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.AbstractClientPlayer; import net.minecraft.client.renderer.GlStateManager; @@ -72,7 +69,7 @@ public void renderItemInFirstPersonHook(AbstractClientPlayer player, float p_187 GL11.glEnable(2848); GL11.glEnable(3042); } - GL11.glColor4f(Colors.getInstance().rainbow.getValue() ? (float) ColorUtil.rainbow(Colors.getInstance().rainbowHue.getValue()).getRed() / 255.0f : (float) HandChams.getINSTANCE().red.getValue().intValue() / 255.0f, Colors.getInstance().rainbow.getValue() ? (float) ColorUtil.rainbow(Colors.getInstance().rainbowHue.getValue()).getGreen() / 255.0f : (float) HandChams.getINSTANCE().green.getValue().intValue() / 255.0f, Colors.getInstance().rainbow.getValue() ? (float) ColorUtil.rainbow(Colors.getInstance().rainbowHue.getValue()).getBlue() / 255.0f : (float) HandChams.getINSTANCE().blue.getValue().intValue() / 255.0f, (float) HandChams.getINSTANCE().alpha.getValue().intValue() / 255.0f); + GL11.glColor4f(ClickGui.getInstance().colorSync.getValue() && Colors.getInstance().rainbow.getValue() != false ? (float) ColorUtil.rainbow(Colors.getInstance().rainbowHue.getValue()).getRed() / 255.0f : (float) HandChams.getINSTANCE().red.getValue().intValue() / 255.0f, Colors.getInstance().rainbow.getValue() != false ? (float) ColorUtil.rainbow(Colors.getInstance().rainbowHue.getValue()).getGreen() / 255.0f : (float) HandChams.getINSTANCE().green.getValue().intValue() / 255.0f, Colors.getInstance().rainbow.getValue() != false ? (float) ColorUtil.rainbow(Colors.getInstance().rainbowHue.getValue()).getBlue() / 255.0f : (float) HandChams.getINSTANCE().blue.getValue().intValue() / 255.0f, (float) HandChams.getINSTANCE().alpha.getValue().intValue() / 255.0f); this.renderItemInFirstPerson(player, p_187457_2_, p_187457_3_, hand, p_187457_5_ + xOffset, stack, p_187457_7_ + yOffset); GlStateManager.popAttrib(); GlStateManager.popMatrix(); @@ -85,27 +82,5 @@ public void renderItemInFirstPersonHook(AbstractClientPlayer player, float p_187 this.injection = true; } } - - @Inject(method = { "transformSideFirstPerson" }, at = { @At("HEAD") }) - public void transformSideFirstPerson(final EnumHandSide hand, final float p_187459_2_, final CallbackInfo callbackInfo) { - final TransformFirstPersonEvent event = new TransformFirstPersonEvent(Event.Stage.PRE, hand); - InfinityLoop.eventManager.post(event); - } - - @Inject(method = { "transformEatFirstPerson" }, at = { @At("HEAD") }, cancellable = true) - public void transformEatFirstPerson(final float p_187454_1_, final EnumHandSide hand, final ItemStack stack, final CallbackInfo callbackInfo) { - final TransformFirstPersonEvent event = new TransformFirstPersonEvent(Event.Stage.PRE, hand); - InfinityLoop.eventManager.post(event); - if (ViewModel.getINSTANCE().cancelEating.getValue()) { - callbackInfo.cancel(); - } - } - - @Inject(method = { "transformFirstPerson" }, at = { @At("HEAD") }) - public void transformFirstPerson(final EnumHandSide hand, final float p_187453_2_, final CallbackInfo callbackInfo) { - final TransformFirstPersonEvent event = new TransformFirstPersonEvent(Event.Stage.PRE, hand); - InfinityLoop.eventManager.post(event); - } - } diff --git a/src/main/java/me/loop/mixin/mixins/MixinMinecraft.java b/src/main/java/me/loop/mixin/mixins/MixinMinecraft.java new file mode 100644 index 0000000..15022c7 --- /dev/null +++ b/src/main/java/me/loop/mixin/mixins/MixinMinecraft.java @@ -0,0 +1,56 @@ +package me.loop.mixin.mixins; + +import me.loop.InfinityLoop; +import me.loop.event.events.KeyEvent; +import me.loop.features.modules.player.MultiTask; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.multiplayer.PlayerControllerMP; +import net.minecraft.crash.CrashReport; +import net.minecraftforge.common.MinecraftForge; +import org.lwjgl.input.Keyboard; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.Redirect; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(value = {Minecraft.class}) +public abstract class MixinMinecraft { + @Inject(method = {"shutdownMinecraftApplet"}, at = {@At(value = "HEAD")}) + private void stopClient(CallbackInfo callbackInfo) { + this.unload(); + } + + @Redirect(method = {"run"}, at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;displayCrashReport(Lnet/minecraft/crash/CrashReport;)V")) + public void displayCrashReport(Minecraft minecraft, CrashReport crashReport) { + this.unload(); + } + + @Inject(method = {"runTickKeyboard"}, at = {@At(value = "INVOKE", remap = false, target = "Lorg/lwjgl/input/Keyboard;getEventKey()I", ordinal = 0, shift = At.Shift.BEFORE)}) + private void onKeyboard(CallbackInfo callbackInfo) { + int i; + int n = i = Keyboard.getEventKey() == 0 ? Keyboard.getEventCharacter() + 256 : Keyboard.getEventKey(); + if (Keyboard.getEventKeyState()) { + KeyEvent event = new KeyEvent(i); + MinecraftForge.EVENT_BUS.post(event); + } + } + + private void unload() { + InfinityLoop.LOGGER.info("Initiated client shutdown."); + InfinityLoop.onUnload(); + InfinityLoop.LOGGER.info("Finished client shutdown."); + } + + @Redirect(method = {"sendClickBlockToController"}, at = @At(value = "INVOKE", target = "Lnet/minecraft/client/entity/EntityPlayerSP;isHandActive()Z")) + private boolean isHandActiveWrapper(EntityPlayerSP playerSP) { + return !MultiTask.getInstance().isOn() && playerSP.isHandActive(); + } + + @Redirect(method = {"rightClickMouse"}, at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/PlayerControllerMP;getIsHittingBlock()Z", ordinal = 0)) + private boolean isHittingBlockHook(PlayerControllerMP playerControllerMP) { + return !MultiTask.getInstance().isOn() && playerControllerMP.getIsHittingBlock(); + } +} + diff --git a/src/main/java/com/me/infinity/loop/mixin/mixins/MixinModelPlayer.java b/src/main/java/me/loop/mixin/mixins/MixinModelPlayer.java similarity index 76% rename from src/main/java/com/me/infinity/loop/mixin/mixins/MixinModelPlayer.java rename to src/main/java/me/loop/mixin/mixins/MixinModelPlayer.java index de0aada..5697fbd 100644 --- a/src/main/java/com/me/infinity/loop/mixin/mixins/MixinModelPlayer.java +++ b/src/main/java/me/loop/mixin/mixins/MixinModelPlayer.java @@ -1,17 +1,14 @@ -package com.me.infinity.loop.mixin.mixins; +package me.loop.mixin.mixins; -import com.me.infinity.loop.features.modules.render.Animation; -import com.me.infinity.loop.features.modules.render.Skeleton; +import me.loop.features.modules.render.Skeleton; import net.minecraft.client.Minecraft; import net.minecraft.client.model.ModelPlayer; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.MobEffects; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin({ModelPlayer.class}) public class MixinModelPlayer { @@ -21,4 +18,3 @@ public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageI Skeleton.addEntity((EntityPlayer) entityIn, ModelPlayer.class.cast(this)); } } - diff --git a/src/main/java/me/loop/mixin/mixins/MixinNetworkManager.java b/src/main/java/me/loop/mixin/mixins/MixinNetworkManager.java new file mode 100644 index 0000000..a573aa3 --- /dev/null +++ b/src/main/java/me/loop/mixin/mixins/MixinNetworkManager.java @@ -0,0 +1,33 @@ +package me.loop.mixin.mixins; + +import io.netty.channel.ChannelHandlerContext; +import me.loop.event.events.PacketEvent; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.Packet; +import net.minecraftforge.common.MinecraftForge; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(value = {NetworkManager.class}) +public class MixinNetworkManager { + @Inject(method = {"sendPacket(Lnet/minecraft/network/Packet;)V"}, at = {@At(value = "HEAD")}, cancellable = true) + private void onSendPacketPre(Packet packet, CallbackInfo info) { + PacketEvent.Send event = new PacketEvent.Send(0, packet); + MinecraftForge.EVENT_BUS.post(event); + if (event.isCanceled()) { + info.cancel(); + } + } + + @Inject(method = {"channelRead0"}, at = {@At(value = "HEAD")}, cancellable = true) + private void onChannelReadPre(ChannelHandlerContext context, Packet packet, CallbackInfo info) { + PacketEvent.Receive event = new PacketEvent.Receive(0, packet); + MinecraftForge.EVENT_BUS.post(event); + if (event.isCanceled()) { + info.cancel(); + } + } +} + diff --git a/src/main/java/me/loop/mixin/mixins/MixinPlayerControllerMP.java b/src/main/java/me/loop/mixin/mixins/MixinPlayerControllerMP.java new file mode 100644 index 0000000..9c99d76 --- /dev/null +++ b/src/main/java/me/loop/mixin/mixins/MixinPlayerControllerMP.java @@ -0,0 +1,54 @@ +package me.loop.mixin.mixins; + +import me.loop.InfinityLoop; +import me.loop.event.events.BlockEvent; +import me.loop.event.events.ProcessRightClickBlockEvent; +import me.loop.features.modules.player.TpsSync; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.multiplayer.PlayerControllerMP; +import net.minecraft.client.multiplayer.WorldClient; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.EnumActionResult; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; +import net.minecraft.world.World; +import net.minecraftforge.common.MinecraftForge; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.Redirect; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@Mixin(value = {PlayerControllerMP.class}) +public class MixinPlayerControllerMP { + @Redirect(method = {"onPlayerDamageBlock"}, at = @At(value = "INVOKE", target = "Lnet/minecraft/block/state/IBlockState;getPlayerRelativeBlockHardness(Lnet/minecraft/entity/player/EntityPlayer;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;)F")) + public float getPlayerRelativeBlockHardnessHook(IBlockState state, EntityPlayer player, World worldIn, BlockPos pos) { + return state.getPlayerRelativeBlockHardness(player, worldIn, pos) * (TpsSync.getInstance().isOn() && TpsSync.getInstance().mining.getValue() != false ? 1.0f / InfinityLoop.serverManager.getTpsFactor() : 1.0f); + } + + @Inject(method = {"clickBlock"}, at = {@At(value = "HEAD")}, cancellable = true) + private void clickBlockHook(BlockPos pos, EnumFacing face, CallbackInfoReturnable info) { + BlockEvent event = new BlockEvent(3, pos, face); + MinecraftForge.EVENT_BUS.post(event); + } + + @Inject(method = {"onPlayerDamageBlock"}, at = {@At(value = "HEAD")}, cancellable = true) + private void onPlayerDamageBlockHook(BlockPos pos, EnumFacing face, CallbackInfoReturnable info) { + BlockEvent event = new BlockEvent(4, pos, face); + MinecraftForge.EVENT_BUS.post(event); + } + + @Inject(method = {"processRightClickBlock"}, at = {@At(value = "HEAD")}, cancellable = true) + public void processRightClickBlock(EntityPlayerSP player, WorldClient worldIn, BlockPos pos, EnumFacing direction, Vec3d vec, EnumHand hand, CallbackInfoReturnable cir) { + ProcessRightClickBlockEvent event = new ProcessRightClickBlockEvent(pos, hand, Minecraft.instance.player.getHeldItem(hand)); + MinecraftForge.EVENT_BUS.post(event); + if (event.isCanceled()) { + cir.cancel(); + } + } +} + diff --git a/src/main/java/me/loop/mixin/mixins/MixinRenderEnderCrystal.java b/src/main/java/me/loop/mixin/mixins/MixinRenderEnderCrystal.java new file mode 100644 index 0000000..498c983 --- /dev/null +++ b/src/main/java/me/loop/mixin/mixins/MixinRenderEnderCrystal.java @@ -0,0 +1,34 @@ +package me.loop.mixin.mixins; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelEnderCrystal; +import net.minecraft.client.renderer.entity.Render; +import net.minecraft.client.renderer.entity.RenderEnderCrystal; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.entity.item.EntityEnderCrystal; +import net.minecraft.util.ResourceLocation; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; + +import javax.annotation.Nullable; + +@Mixin({RenderEnderCrystal.class}) +public class MixinRenderEnderCrystal extends Render { + @Shadow + private static final ResourceLocation ENDER_CRYSTAL_TEXTURES = new ResourceLocation("textures/entity/endercrystal/endercrystal.png"); + + @Shadow + private final ModelBase modelEnderCrystal = new ModelEnderCrystal(0.0F, true); + + @Shadow + private final ModelBase modelEnderCrystalNoBase = new ModelEnderCrystal(0.0F, false); + + protected MixinRenderEnderCrystal(RenderManager renderManager) { + super(renderManager); + } + + @Nullable + protected ResourceLocation getEntityTexture(EntityEnderCrystal entityEnderCrystal) { + return null; + } +} diff --git a/src/main/java/me/loop/mixin/mixins/MixinRenderLivingBase.java b/src/main/java/me/loop/mixin/mixins/MixinRenderLivingBase.java new file mode 100644 index 0000000..8637294 --- /dev/null +++ b/src/main/java/me/loop/mixin/mixins/MixinRenderLivingBase.java @@ -0,0 +1,73 @@ +package me.loop.mixin.mixins; + +import me.loop.util.impl.Util; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.renderer.entity.Render; +import net.minecraft.client.renderer.entity.RenderLivingBase; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.entity.EntityLivingBase; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; + +@Mixin(value = { RenderLivingBase.class }, priority = 10001) +public abstract class MixinRenderLivingBase extends Render implements Util { + @Shadow + private static final Logger LOGGER = LogManager.getLogger(); + @Shadow + protected ModelBase mainModel; + @Shadow + protected boolean renderMarker; + + float red; + float green; + float blue; + + protected MixinRenderLivingBase(RenderManager renderManager) { + super(renderManager); + this.red = 0.0F; + this.green = 0.0F; + this.blue = 0.0F; + } + + @Shadow + protected abstract boolean isVisible(EntityLivingBase paramEntityLivingBase); + + @Shadow + protected abstract float getSwingProgress(T paramT, float paramFloat); + + @Shadow + protected abstract float interpolateRotation(float paramFloat1, float paramFloat2, float paramFloat3); + + @Shadow + protected abstract float handleRotationFloat(T paramT, float paramFloat); + + @Shadow + protected abstract void applyRotations(T paramT, float paramFloat1, float paramFloat2, float paramFloat3); + + @Shadow + public abstract float prepareScale(T paramT, float paramFloat); + + @Shadow + protected abstract void unsetScoreTeamColor(); + + @Shadow + protected abstract boolean setScoreTeamColor(T paramT); + + @Shadow + protected abstract void renderLivingAt(T paramT, double paramDouble1, double paramDouble2, double paramDouble3); + + @Shadow + protected abstract void unsetBrightness(); + + @Shadow + protected abstract void renderModel(T paramT, float paramFloat1, float paramFloat2, float paramFloat3, float paramFloat4, float paramFloat5, float paramFloat6); + + @Shadow + protected abstract void renderLayers(T paramT, float paramFloat1, float paramFloat2, float paramFloat3, float paramFloat4, float paramFloat5, float paramFloat6, float paramFloat7); + + @Shadow + protected abstract boolean setDoRenderBrightness(T paramT, float paramFloat); +} + diff --git a/src/main/java/com/me/infinity/loop/mixin/mixins/MixinWorld.java b/src/main/java/me/loop/mixin/mixins/MixinWorld.java similarity index 96% rename from src/main/java/com/me/infinity/loop/mixin/mixins/MixinWorld.java rename to src/main/java/me/loop/mixin/mixins/MixinWorld.java index 655d4dc..7da38af 100644 --- a/src/main/java/com/me/infinity/loop/mixin/mixins/MixinWorld.java +++ b/src/main/java/me/loop/mixin/mixins/MixinWorld.java @@ -1,4 +1,4 @@ -package com.me.infinity.loop.mixin.mixins; +package me.loop.mixin.mixins; import com.google.common.base.Predicate; import net.minecraft.entity.Entity; diff --git a/src/main/java/com/me/infinity/loop/util/LoopUtil.java b/src/main/java/me/loop/util/LoopUtil.java similarity index 97% rename from src/main/java/com/me/infinity/loop/util/LoopUtil.java rename to src/main/java/me/loop/util/LoopUtil.java index 01b49aa..adab172 100644 --- a/src/main/java/com/me/infinity/loop/util/LoopUtil.java +++ b/src/main/java/me/loop/util/LoopUtil.java @@ -1,9 +1,9 @@ -package com.me.infinity.loop.util; +package me.loop.util; import com.google.common.collect.Maps; -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.features.modules.client.MainSettings; import javafx.util.Pair; +import me.loop.InfinityLoop; +import me.loop.features.modules.client.MainSettings; import org.apache.commons.io.IOUtils; import org.json.simple.JSONArray; import org.json.simple.JSONObject; @@ -15,11 +15,13 @@ import java.io.*; import java.net.URL; import java.net.URLConnection; -import java.util.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; import java.util.concurrent.atomic.AtomicReference; -import static com.me.infinity.loop.util.utils.Util.mc; - +import static me.loop.util.impl.Util.mc; public class LoopUtil { diff --git a/src/main/java/com/me/infinity/loop/util/utils/minecraft/BlockUtil.java b/src/main/java/me/loop/util/impl/BlockUtil.java similarity index 50% rename from src/main/java/com/me/infinity/loop/util/utils/minecraft/BlockUtil.java rename to src/main/java/me/loop/util/impl/BlockUtil.java index f0fd5a1..b530027 100644 --- a/src/main/java/com/me/infinity/loop/util/utils/minecraft/BlockUtil.java +++ b/src/main/java/me/loop/util/impl/BlockUtil.java @@ -1,12 +1,8 @@ -package com.me.infinity.loop.util.utils.minecraft; +package me.loop.util.impl; import com.google.common.util.concurrent.AtomicDouble; -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.features.command.Command; -import com.me.infinity.loop.util.utils.EntityUtil; -import com.me.infinity.loop.util.utils.RotationUtil; -import com.me.infinity.loop.util.utils.Util; -import com.me.infinity.loop.util.utils.maths.MathUtil; +import me.loop.InfinityLoop; +import me.loop.features.command.Command; import net.minecraft.block.*; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; @@ -16,15 +12,15 @@ import net.minecraft.entity.item.EntityXPOrb; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; -import net.minecraft.network.Packet; -import net.minecraft.network.play.client.CPacketAnimation; import net.minecraft.network.play.client.CPacketEntityAction; import net.minecraft.network.play.client.CPacketPlayerTryUseItemOnBlock; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.NonNullList; -import net.minecraft.util.math.*; -import net.minecraft.world.IBlockAccess; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.math.Vec3d; import java.util.ArrayList; import java.util.Arrays; @@ -35,7 +31,6 @@ public class BlockUtil implements Util { - public static List emptyBlocks = Arrays.asList(Blocks.AIR, Blocks.FLOWING_LAVA, Blocks.LAVA, Blocks.FLOWING_WATER, Blocks.WATER, Blocks.VINE, Blocks.SNOW_LAYER, Blocks.TALLGRASS, Blocks.FIRE); public static final List blackList = Arrays.asList(Blocks.ENDER_CHEST, Blocks.CHEST, Blocks.TRAPPED_CHEST, Blocks.CRAFTING_TABLE, Blocks.ANVIL, Blocks.BREWING_STAND, Blocks.HOPPER, Blocks.DROPPER, Blocks.DISPENSER, Blocks.TRAPDOOR, Blocks.ENCHANTING_TABLE); public static final List shulkerList = Arrays.asList(Blocks.WHITE_SHULKER_BOX, Blocks.ORANGE_SHULKER_BOX, Blocks.MAGENTA_SHULKER_BOX, Blocks.LIGHT_BLUE_SHULKER_BOX, Blocks.YELLOW_SHULKER_BOX, Blocks.LIME_SHULKER_BOX, Blocks.PINK_SHULKER_BOX, Blocks.GRAY_SHULKER_BOX, Blocks.SILVER_SHULKER_BOX, Blocks.CYAN_SHULKER_BOX, Blocks.PURPLE_SHULKER_BOX, Blocks.BLUE_SHULKER_BOX, Blocks.BROWN_SHULKER_BOX, Blocks.GREEN_SHULKER_BOX, Blocks.RED_SHULKER_BOX, Blocks.BLACK_SHULKER_BOX); public static final List unSafeBlocks = Arrays.asList(Blocks.OBSIDIAN, Blocks.BEDROCK, Blocks.ENDER_CHEST, Blocks.ANVIL); @@ -43,7 +38,7 @@ public class BlockUtil public static List getBlockSphere(float breakRange, Class clazz) { NonNullList positions = NonNullList.create(); - positions.addAll(BlockUtil.getSphere(EntityUtil.getPlayerPos(BlockUtil.mc.player), breakRange, (int) breakRange, false, true, 0).stream().filter(pos -> clazz.isInstance(BlockUtil.mc.world.getBlockState(pos).getBlock())).collect(Collectors.toList())); + positions.addAll(BlockUtil.getSphere(EntityUtil.getPlayerPos(mc.player), breakRange, (int) breakRange, false, true, 0).stream().filter(pos -> clazz.isInstance(mc.world.getBlockState(pos).getBlock())).collect(Collectors.toList())); return positions; } @@ -52,7 +47,7 @@ public static List getPossibleSides(BlockPos pos) { for (EnumFacing side : EnumFacing.values()) { IBlockState blockState; BlockPos neighbour = pos.offset(side); - if (!BlockUtil.mc.world.getBlockState(neighbour).getBlock().canCollideCheck(BlockUtil.mc.world.getBlockState(neighbour), false) || (blockState = BlockUtil.mc.world.getBlockState(neighbour)).getMaterial().isReplaceable()) + if (!mc.world.getBlockState(neighbour).getBlock().canCollideCheck(mc.world.getBlockState(neighbour), false) || (blockState = mc.world.getBlockState(neighbour)).getMaterial().isReplaceable()) continue; facings.add(side); } @@ -68,30 +63,20 @@ public static EnumFacing getFirstFacing(BlockPos pos) { return null; } - public static void openBlock(BlockPos pos) { - EnumFacing[] facings; - for (EnumFacing f : facings = EnumFacing.values()) { - Block neighborBlock = BlockUtil.mc.world.getBlockState(pos.offset(f)).getBlock(); - if (!emptyBlocks.contains(neighborBlock)) continue; - BlockUtil.mc.playerController.processRightClickBlock(BlockUtil.mc.player, BlockUtil.mc.world, pos, f.getOpposite(), new Vec3d(pos), EnumHand.MAIN_HAND); - return; - } - } - public static EnumFacing getRayTraceFacing(BlockPos pos) { - RayTraceResult result = BlockUtil.mc.world.rayTraceBlocks(new Vec3d(BlockUtil.mc.player.posX, BlockUtil.mc.player.posY + (double) BlockUtil.mc.player.getEyeHeight(), BlockUtil.mc.player.posZ), new Vec3d((double) pos.getX() + 0.5, (double) pos.getX() - 0.5, (double) pos.getX() + 0.5)); + RayTraceResult result = mc.world.rayTraceBlocks(new Vec3d(mc.player.posX, mc.player.posY + (double) mc.player.getEyeHeight(), mc.player.posZ), new Vec3d((double) pos.getX() + 0.5, (double) pos.getX() - 0.5, (double) pos.getX() + 0.5)); if (result == null || result.sideHit == null) { return EnumFacing.UP; } return result.sideHit; } - public static boolean isPositionPlaceable(BlockPos pos, boolean rayTrace) { + public static int isPositionPlaceable(BlockPos pos, boolean rayTrace) { return BlockUtil.isPositionPlaceable(pos, rayTrace, true); } - /*public static int isPositionPlaceable(BlockPos pos, boolean rayTrace, boolean entityCheck) { - Block block = BlockUtil.mc.world.getBlockState(pos).getBlock(); + public static int isPositionPlaceable(BlockPos pos, boolean rayTrace, boolean entityCheck) { + Block block = mc.world.getBlockState(pos).getBlock(); if (!(block instanceof BlockAir || block instanceof BlockLiquid || block instanceof BlockTallGrass || block instanceof BlockFire || block instanceof BlockDeadBush || block instanceof BlockSnow)) { return 0; } @@ -99,7 +84,7 @@ public static boolean isPositionPlaceable(BlockPos pos, boolean rayTrace) { return -1; } if (entityCheck) { - for (Entity entity : BlockUtil.mc.world.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(pos))) { + for (Entity entity : mc.world.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(pos))) { if (entity instanceof EntityItem || entity instanceof EntityXPOrb) continue; return 1; } @@ -109,122 +94,39 @@ public static boolean isPositionPlaceable(BlockPos pos, boolean rayTrace) { return 3; } return 2; - }*/ - - public static boolean isPositionPlaceable(final BlockPos position, final boolean entityCheck, final boolean sideCheck) { - if (!BlockUtil.mc.world.getBlockState(position).getBlock().isReplaceable((IBlockAccess)BlockUtil.mc.world, position)) { - return false; - } - if (entityCheck) { - for (final Object entity : BlockUtil.mc.world.getEntitiesWithinAABB((Class)Entity.class, new AxisAlignedBB(position))) { - if (!(entity instanceof EntityItem)) { - if (entity instanceof EntityXPOrb) { - continue; - } - return false; - } - } - } - return !sideCheck || getPlaceableSide(position) != null; - } - - public static boolean isPositionPlaceable(final BlockPos position, final boolean entityCheck, final boolean sideCheck, final boolean ignoreCrystals) { - if (!BlockUtil.mc.world.getBlockState(position).getBlock().isReplaceable((IBlockAccess)BlockUtil.mc.world, position)) { - return false; - } - if (entityCheck) { - for (final Object entity : BlockUtil.mc.world.getEntitiesWithinAABB((Class)Entity.class, new AxisAlignedBB(position))) { - if (!(entity instanceof EntityItem)) { - if (entity instanceof EntityXPOrb) { - continue; - } - if (entity instanceof EntityEnderCrystal && ignoreCrystals) { - continue; - } - return false; - } - } - } - return !sideCheck || getPlaceableSide(position) != null; - } - - - public static boolean isPositionPlaceable(final BlockPos pos, final boolean entityCheck, final double distance) { - final Block block = BlockUtil.mc.world.getBlockState(pos).getBlock(); - if (!(block instanceof BlockAir)) { - if (!(block instanceof BlockLiquid)) { - if (!(block instanceof BlockTallGrass) && !(block instanceof BlockFire)) { - if (!(block instanceof BlockDeadBush)) { - if (!(block instanceof BlockSnow)) { - return false; - } - } - } - } - } - if (entityCheck) { - for (final Object entity : BlockUtil.mc.world.getEntitiesWithinAABB((Class)Entity.class, new AxisAlignedBB(pos))) { - if (BlockUtil.mc.player.getDistance((Entity) entity) > distance) { - continue; - } - if (entity instanceof EntityItem) { - continue; - } - if (entity instanceof EntityXPOrb) { - continue; - } - return false; - } - } - return true; } public static void rightClickBlock(BlockPos pos, Vec3d vec, EnumHand hand, EnumFacing direction, boolean packet) { if (packet) { - float f = (float)(vec.x - (double)pos.getX()); - float f1 = (float)(vec.y - (double)pos.getY()); - float f2 = (float)(vec.z - (double)pos.getZ()); - BlockUtil.mc.player.connection.sendPacket(new CPacketPlayerTryUseItemOnBlock(pos, direction, hand, f, f1, f2)); + float f = (float) (vec.x - (double) pos.getX()); + float f1 = (float) (vec.y - (double) pos.getY()); + float f2 = (float) (vec.z - (double) pos.getZ()); + mc.player.connection.sendPacket(new CPacketPlayerTryUseItemOnBlock(pos, direction, hand, f, f1, f2)); } else { - BlockUtil.mc.playerController.processRightClickBlock(BlockUtil.mc.player, BlockUtil.mc.world, pos, direction, vec, hand); - } - BlockUtil.mc.player.swingArm(EnumHand.MAIN_HAND); - BlockUtil.mc.rightClickDelayTimer = 4; - } - - public static void rightClickBed(BlockPos pos, float range, boolean rotate, EnumHand hand, AtomicDouble yaw, AtomicDouble pitch, AtomicBoolean rotating, boolean packet) { - Vec3d posVec = new Vec3d(pos).add(0.5, 0.5, 0.5); - RayTraceResult result = BlockUtil.mc.world.rayTraceBlocks(new Vec3d(BlockUtil.mc.player.posX, BlockUtil.mc.player.posY + (double)BlockUtil.mc.player.getEyeHeight(), BlockUtil.mc.player.posZ), posVec); - EnumFacing face = result == null || result.sideHit == null ? EnumFacing.UP : result.sideHit; - Vec3d eyesPos = RotationUtil.getEyesPos(); - if (rotate) { - float[] rotations = RotationUtil.getLegitRotations(posVec); - yaw.set(rotations[0]); - pitch.set(rotations[1]); - rotating.set(true); + mc.playerController.processRightClickBlock(mc.player, mc.world, pos, direction, vec, hand); } - BlockUtil.rightClickBlock(pos, posVec, hand, face, packet); - BlockUtil.mc.player.swingArm(hand); - BlockUtil.mc.rightClickDelayTimer = 4; + mc.player.swingArm(EnumHand.MAIN_HAND); + mc.rightClickDelayTimer = 4; } - public static void rightClickBlockLegit(BlockPos pos, float range, boolean rotate, EnumHand hand, AtomicDouble Yaw2, AtomicDouble Pitch, AtomicBoolean rotating, boolean packet) { + public static void rightClickBlockLegit(BlockPos pos, float range, boolean rotate, EnumHand hand, AtomicDouble Yaw, AtomicDouble Pitch, AtomicBoolean rotating) { Vec3d eyesPos = RotationUtil.getEyesPos(); Vec3d posVec = new Vec3d(pos).add(0.5, 0.5, 0.5); double distanceSqPosVec = eyesPos.squareDistanceTo(posVec); for (EnumFacing side : EnumFacing.values()) { Vec3d hitVec = posVec.add(new Vec3d(side.getDirectionVec()).scale(0.5)); double distanceSqHitVec = eyesPos.squareDistanceTo(hitVec); - if (distanceSqHitVec > MathUtil.square(range) || distanceSqHitVec >= distanceSqPosVec || BlockUtil.mc.world.rayTraceBlocks(eyesPos, hitVec, false, true, false) != null) continue; + if (!(distanceSqHitVec <= MathUtil.square(range)) || !(distanceSqHitVec < distanceSqPosVec) || mc.world.rayTraceBlocks(eyesPos, hitVec, false, true, false) != null) + continue; if (rotate) { float[] rotations = RotationUtil.getLegitRotations(hitVec); - Yaw2.set(rotations[0]); + Yaw.set(rotations[0]); Pitch.set(rotations[1]); rotating.set(true); } - BlockUtil.rightClickBlock(pos, hitVec, hand, side, packet); - BlockUtil.mc.player.swingArm(hand); - BlockUtil.mc.rightClickDelayTimer = 4; + mc.playerController.processRightClickBlock(mc.player, mc.world, pos, side, hitVec, hand); + mc.player.swingArm(hand); + mc.rightClickDelayTimer = 4; break; } } @@ -238,18 +140,18 @@ public static boolean placeBlock(BlockPos pos, EnumHand hand, boolean rotate, bo BlockPos neighbour = pos.offset(side); EnumFacing opposite = side.getOpposite(); Vec3d hitVec = new Vec3d(neighbour).add(0.5, 0.5, 0.5).add(new Vec3d(opposite.getDirectionVec()).scale(0.5)); - Block neighbourBlock = BlockUtil.mc.world.getBlockState(neighbour).getBlock(); - if (!BlockUtil.mc.player.isSneaking() && (blackList.contains(neighbourBlock) || shulkerList.contains(neighbourBlock))) { - BlockUtil.mc.player.connection.sendPacket(new CPacketEntityAction(BlockUtil.mc.player, CPacketEntityAction.Action.START_SNEAKING)); - BlockUtil.mc.player.setSneaking(true); + Block neighbourBlock = mc.world.getBlockState(neighbour).getBlock(); + if (!mc.player.isSneaking() && (blackList.contains(neighbourBlock) || shulkerList.contains(neighbourBlock))) { + mc.player.connection.sendPacket(new CPacketEntityAction(mc.player, CPacketEntityAction.Action.START_SNEAKING)); + mc.player.setSneaking(true); sneaking = true; } if (rotate) { RotationUtil.faceVector(hitVec, true); } BlockUtil.rightClickBlock(neighbour, hitVec, hand, opposite, packet); - BlockUtil.mc.player.swingArm(EnumHand.MAIN_HAND); - BlockUtil.mc.rightClickDelayTimer = 4; + mc.player.swingArm(EnumHand.MAIN_HAND); + mc.rightClickDelayTimer = 4; return sneaking || isSneaking; } @@ -263,24 +165,24 @@ public static boolean placeBlockSmartRotate(BlockPos pos, EnumHand hand, boolean BlockPos neighbour = pos.offset(side); EnumFacing opposite = side.getOpposite(); Vec3d hitVec = new Vec3d(neighbour).add(0.5, 0.5, 0.5).add(new Vec3d(opposite.getDirectionVec()).scale(0.5)); - Block neighbourBlock = BlockUtil.mc.world.getBlockState(neighbour).getBlock(); - if (!BlockUtil.mc.player.isSneaking() && (blackList.contains(neighbourBlock) || shulkerList.contains(neighbourBlock))) { - BlockUtil.mc.player.connection.sendPacket(new CPacketEntityAction(BlockUtil.mc.player, CPacketEntityAction.Action.START_SNEAKING)); + Block neighbourBlock = mc.world.getBlockState(neighbour).getBlock(); + if (!mc.player.isSneaking() && (blackList.contains(neighbourBlock) || shulkerList.contains(neighbourBlock))) { + mc.player.connection.sendPacket(new CPacketEntityAction(mc.player, CPacketEntityAction.Action.START_SNEAKING)); sneaking = true; } if (rotate) { InfinityLoop.rotationManager.lookAtVec3d(hitVec); } BlockUtil.rightClickBlock(neighbour, hitVec, hand, opposite, packet); - BlockUtil.mc.player.swingArm(EnumHand.MAIN_HAND); - BlockUtil.mc.rightClickDelayTimer = 4; + mc.player.swingArm(EnumHand.MAIN_HAND); + mc.rightClickDelayTimer = 4; return sneaking || isSneaking; } public static void placeBlockStopSneaking(BlockPos pos, EnumHand hand, boolean rotate, boolean packet, boolean isSneaking) { boolean sneaking = BlockUtil.placeBlockSmartRotate(pos, hand, rotate, packet, isSneaking); if (!isSneaking && sneaking) { - BlockUtil.mc.player.connection.sendPacket(new CPacketEntityAction(BlockUtil.mc.player, CPacketEntityAction.Action.STOP_SNEAKING)); + mc.player.connection.sendPacket(new CPacketEntityAction(mc.player, CPacketEntityAction.Action.STOP_SNEAKING)); } } @@ -290,7 +192,7 @@ public static Vec3d[] getHelpingBlocks(Vec3d vec3d) { public static List possiblePlacePositions(float placeRange) { NonNullList positions = NonNullList.create(); - positions.addAll(BlockUtil.getSphere(EntityUtil.getPlayerPos(BlockUtil.mc.player), placeRange, (int) placeRange, false, true, 0).stream().filter(BlockUtil::canPlaceCrystal).collect(Collectors.toList())); + positions.addAll(BlockUtil.getSphere(EntityUtil.getPlayerPos(mc.player), placeRange, (int) placeRange, false, true, 0).stream().filter(BlockUtil::canPlaceCrystal).collect(Collectors.toList())); return positions; } @@ -326,7 +228,7 @@ public static boolean canPlaceCrystal(BlockPos blockPos) { BlockPos boost = blockPos.add(0, 1, 0); BlockPos boost2 = blockPos.add(0, 2, 0); try { - return (BlockUtil.mc.world.getBlockState(blockPos).getBlock() == Blocks.BEDROCK || BlockUtil.mc.world.getBlockState(blockPos).getBlock() == Blocks.OBSIDIAN) && BlockUtil.mc.world.getBlockState(boost).getBlock() == Blocks.AIR && BlockUtil.mc.world.getBlockState(boost2).getBlock() == Blocks.AIR && BlockUtil.mc.world.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(boost)).isEmpty() && BlockUtil.mc.world.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(boost2)).isEmpty(); + return (mc.world.getBlockState(blockPos).getBlock() == Blocks.BEDROCK || mc.world.getBlockState(blockPos).getBlock() == Blocks.OBSIDIAN) && mc.world.getBlockState(boost).getBlock() == Blocks.AIR && mc.world.getBlockState(boost2).getBlock() == Blocks.AIR && mc.world.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(boost)).isEmpty() && mc.world.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(boost2)).isEmpty(); } catch (Exception e) { return false; } @@ -334,7 +236,7 @@ public static boolean canPlaceCrystal(BlockPos blockPos) { public static List possiblePlacePositions(float placeRange, boolean specialEntityCheck) { NonNullList positions = NonNullList.create(); - positions.addAll(BlockUtil.getSphere(EntityUtil.getPlayerPos(BlockUtil.mc.player), placeRange, (int) placeRange, false, true, 0).stream().filter(pos -> BlockUtil.canPlaceCrystal(pos, specialEntityCheck)).collect(Collectors.toList())); + positions.addAll(BlockUtil.getSphere(EntityUtil.getPlayerPos(mc.player), placeRange, (int) placeRange, false, true, 0).stream().filter(pos -> BlockUtil.canPlaceCrystal(pos, specialEntityCheck)).collect(Collectors.toList())); return positions; } @@ -344,24 +246,24 @@ public static boolean canPlaceCrystal(BlockPos blockPos, boolean specialEntityCh BlockPos boost = blockPos.add(0, 1, 0); BlockPos boost2 = blockPos.add(0, 2, 0); try { - if (BlockUtil.mc.world.getBlockState(blockPos).getBlock() != Blocks.BEDROCK && BlockUtil.mc.world.getBlockState(blockPos).getBlock() != Blocks.OBSIDIAN) { + if (mc.world.getBlockState(blockPos).getBlock() != Blocks.BEDROCK && mc.world.getBlockState(blockPos).getBlock() != Blocks.OBSIDIAN) { return false; } - if (BlockUtil.mc.world.getBlockState(boost).getBlock() != Blocks.AIR || BlockUtil.mc.world.getBlockState(boost2).getBlock() != Blocks.AIR) { + if (mc.world.getBlockState(boost).getBlock() != Blocks.AIR || mc.world.getBlockState(boost2).getBlock() != Blocks.AIR) { return false; } if (specialEntityCheck) { - for (Entity entity : BlockUtil.mc.world.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(boost))) { + for (Entity entity : mc.world.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(boost))) { if (entity instanceof EntityEnderCrystal) continue; return false; } - for (Entity entity : BlockUtil.mc.world.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(boost2))) { + for (Entity entity : mc.world.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(boost2))) { if (entity instanceof EntityEnderCrystal) continue; return false; } break block7; } - return BlockUtil.mc.world.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(boost)).isEmpty() && BlockUtil.mc.world.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(boost2)).isEmpty(); + return mc.world.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(boost)).isEmpty() && mc.world.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(boost2)).isEmpty(); } catch (Exception ignored) { return false; } @@ -369,20 +271,16 @@ public static boolean canPlaceCrystal(BlockPos blockPos, boolean specialEntityCh return true; } - public static Block getBlock(double x, double y, double z) { - return mc.world.getBlockState(new BlockPos(x, y, z)).getBlock(); - } - public static boolean canBeClicked(BlockPos pos) { return BlockUtil.getBlock(pos).canCollideCheck(BlockUtil.getState(pos), false); } - public static Block getBlock(BlockPos pos) { + private static Block getBlock(BlockPos pos) { return BlockUtil.getState(pos).getBlock(); } private static IBlockState getState(BlockPos pos) { - return BlockUtil.mc.world.getBlockState(pos); + return mc.world.getBlockState(pos); } public static boolean isBlockAboveEntitySolid(Entity entity) { @@ -398,9 +296,9 @@ public static void debugPos(String message, BlockPos pos) { } public static void placeCrystalOnBlock(BlockPos pos, EnumHand hand) { - RayTraceResult result = BlockUtil.mc.world.rayTraceBlocks(new Vec3d(BlockUtil.mc.player.posX, BlockUtil.mc.player.posY + (double) BlockUtil.mc.player.getEyeHeight(), BlockUtil.mc.player.posZ), new Vec3d((double) pos.getX() + 0.5, (double) pos.getY() - 0.5, (double) pos.getZ() + 0.5)); + RayTraceResult result = mc.world.rayTraceBlocks(new Vec3d(mc.player.posX, mc.player.posY + (double) mc.player.getEyeHeight(), mc.player.posZ), new Vec3d((double) pos.getX() + 0.5, (double) pos.getY() - 0.5, (double) pos.getZ() + 0.5)); EnumFacing facing = result == null || result.sideHit == null ? EnumFacing.UP : result.sideHit; - BlockUtil.mc.player.connection.sendPacket(new CPacketPlayerTryUseItemOnBlock(pos, facing, hand, 0.0f, 0.0f, 0.0f)); + mc.player.connection.sendPacket(new CPacketPlayerTryUseItemOnBlock(pos, facing, hand, 0.0f, 0.0f, 0.0f)); } public static BlockPos[] toBlockPos(Vec3d[] vec3ds) { @@ -421,16 +319,16 @@ public static BlockPos vec3dToPos(Vec3d vec3d) { public static Boolean isPosInFov(BlockPos pos) { int dirnumber = RotationUtil.getDirection4D(); - if (dirnumber == 0 && (double) pos.getZ() - BlockUtil.mc.player.getPositionVector().z < 0.0) { + if (dirnumber == 0 && (double) pos.getZ() - mc.player.getPositionVector().z < 0.0) { return false; } - if (dirnumber == 1 && (double) pos.getX() - BlockUtil.mc.player.getPositionVector().x > 0.0) { + if (dirnumber == 1 && (double) pos.getX() - mc.player.getPositionVector().x > 0.0) { return false; } - if (dirnumber == 2 && (double) pos.getZ() - BlockUtil.mc.player.getPositionVector().z > 0.0) { + if (dirnumber == 2 && (double) pos.getZ() - mc.player.getPositionVector().z > 0.0) { return false; } - return dirnumber != 3 || (double) pos.getX() - BlockUtil.mc.player.getPositionVector().x >= 0.0; + return dirnumber != 3 || (double) pos.getX() - mc.player.getPositionVector().x >= 0.0; } public static boolean isBlockBelowEntitySolid(Entity entity) { @@ -446,7 +344,7 @@ public static boolean isBlockSolid(BlockPos pos) { } public static boolean isBlockUnSolid(BlockPos pos) { - return BlockUtil.isBlockUnSolid(BlockUtil.mc.world.getBlockState(pos).getBlock()); + return isBlockUnSolid(mc.world.getBlockState(pos).getBlock()); } public static boolean isBlockUnSolid(Block block) { @@ -470,22 +368,22 @@ public static Vec3d[] convertVec3ds(EntityPlayer entity, Vec3d[] input) { } public static boolean canBreak(BlockPos pos) { - IBlockState blockState = BlockUtil.mc.world.getBlockState(pos); + IBlockState blockState = mc.world.getBlockState(pos); Block block = blockState.getBlock(); - return block.getBlockHardness(blockState, BlockUtil.mc.world, pos) != -1.0f; + return block.getBlockHardness(blockState, mc.world, pos) != -1.0f; } public static boolean isValidBlock(BlockPos pos) { - Block block = BlockUtil.mc.world.getBlockState(pos).getBlock(); + Block block = mc.world.getBlockState(pos).getBlock(); return !(block instanceof BlockLiquid) && block.getMaterial(null) != Material.AIR; } public static boolean isScaffoldPos(BlockPos pos) { - return BlockUtil.mc.world.isAirBlock(pos) || BlockUtil.mc.world.getBlockState(pos).getBlock() == Blocks.SNOW_LAYER || BlockUtil.mc.world.getBlockState(pos).getBlock() == Blocks.TALLGRASS || BlockUtil.mc.world.getBlockState(pos).getBlock() instanceof BlockLiquid; + return mc.world.isAirBlock(pos) || mc.world.getBlockState(pos).getBlock() == Blocks.SNOW_LAYER || mc.world.getBlockState(pos).getBlock() == Blocks.TALLGRASS || mc.world.getBlockState(pos).getBlock() instanceof BlockLiquid; } public static boolean rayTracePlaceCheck(BlockPos pos, boolean shouldCheck, float height) { - return !shouldCheck || BlockUtil.mc.world.rayTraceBlocks(new Vec3d(BlockUtil.mc.player.posX, BlockUtil.mc.player.posY + (double) BlockUtil.mc.player.getEyeHeight(), BlockUtil.mc.player.posZ), new Vec3d(pos.getX(), (float) pos.getY() + height, pos.getZ()), false, true, false) == null; + return !shouldCheck || mc.world.rayTraceBlocks(new Vec3d(mc.player.posX, mc.player.posY + (double) mc.player.getEyeHeight(), mc.player.posZ), new Vec3d(pos.getX(), (float) pos.getY() + height, pos.getZ()), false, true, false) == null; } public static boolean rayTracePlaceCheck(BlockPos pos, boolean shouldCheck) { @@ -495,39 +393,5 @@ public static boolean rayTracePlaceCheck(BlockPos pos, boolean shouldCheck) { public static boolean rayTracePlaceCheck(BlockPos pos) { return BlockUtil.rayTracePlaceCheck(pos, true); } - - public static void placeBlock(final BlockPos position, final EnumHand hand, final boolean packet) { - if (!BlockUtil.mc.world.getBlockState(position).getBlock().isReplaceable((IBlockAccess)BlockUtil.mc.world, position)) { - return; - } - if (getPlaceableSide(position) == null) { - return; - } - clickBlock(position, getPlaceableSide(position), hand, packet); - BlockUtil.mc.player.connection.sendPacket((Packet)new CPacketAnimation(hand)); - } - - public static void clickBlock(final BlockPos position, final EnumFacing side, final EnumHand hand, final boolean packet) { - if (packet) { - BlockUtil.mc.player.connection.sendPacket((Packet)new CPacketPlayerTryUseItemOnBlock(position.offset(side), side.getOpposite(), hand, Float.intBitsToFloat(Float.floatToIntBits(17.735476f) ^ 0x7E8DE241), Float.intBitsToFloat(Float.floatToIntBits(26.882437f) ^ 0x7ED70F3B), Float.intBitsToFloat(Float.floatToIntBits(3.0780227f) ^ 0x7F44FE53))); - } - else { - BlockUtil.mc.playerController.processRightClickBlock(BlockUtil.mc.player, BlockUtil.mc.world, position.offset(side), side.getOpposite(), new Vec3d((Vec3i)position), hand); - } - } - - public static EnumFacing getPlaceableSide(final BlockPos pos) { - for (final EnumFacing side : EnumFacing.values()) { - final BlockPos neighbour = pos.offset(side); - if (BlockUtil.mc.world.getBlockState(neighbour).getBlock().canCollideCheck(BlockUtil.mc.world.getBlockState(neighbour), false)) { - final IBlockState blockState = BlockUtil.mc.world.getBlockState(neighbour); - if (!blockState.getMaterial().isReplaceable()) { - return side; - } - } - } - return null; - } - } diff --git a/src/main/java/com/me/infinity/loop/util/utils/renders/ColorUtil.java b/src/main/java/me/loop/util/impl/ColorUtil.java similarity index 83% rename from src/main/java/com/me/infinity/loop/util/utils/renders/ColorUtil.java rename to src/main/java/me/loop/util/impl/ColorUtil.java index f273d82..04e3f3f 100644 --- a/src/main/java/com/me/infinity/loop/util/utils/renders/ColorUtil.java +++ b/src/main/java/me/loop/util/impl/ColorUtil.java @@ -1,28 +1,53 @@ -package com.me.infinity.loop.util.utils.renders; +package me.loop.util.impl; -import com.me.infinity.loop.features.modules.client.Colors; +import me.loop.features.modules.client.Colors; import java.awt.*; public class ColorUtil { - private static Color color; - private boolean rainbow; + public static int toARGB(int r, int g, int b, int a) { + return new Color(r, g, b, a).getRGB(); + } + + public static int toRGBA(int r, int g, int b) { + return ColorUtil.toRGBA(r, g, b, 255); + } + + public static int toRGBA(int r, int g, int b, int a) { + return (r << 16) + (g << 8) + b + (a << 24); + } + + public static int toRGBA(float r, float g, float b, float a) { + return ColorUtil.toRGBA((int) (r * 255.0f), (int) (g * 255.0f), (int) (b * 255.0f), (int) (a * 255.0f)); + } + + public static Color rainbow(int delay) { + double rainbowState = Math.ceil((double) (System.currentTimeMillis() + (long) delay) / 20.0); + return Color.getHSBColor((float) ((rainbowState %= 360.0) / 360.0), Colors.getInstance().rainbowSaturation.getValue().floatValue() / 255.0f, Colors.getInstance().rainbowBrightness.getValue().floatValue() / 255.0f); + } - public ColorUtil(Color color, boolean rainbow) { - ColorUtil.color = color; - this.rainbow = rainbow; + public static int toRGBA(float[] colors) { + if (colors.length != 4) { + throw new IllegalArgumentException("colors[] must have a length of 4!"); + } + return ColorUtil.toRGBA(colors[0], colors[1], colors[2], colors[3]); } - public ColorUtil(int r, int g, int b, boolean rainbow) { - color = new Color(r,g,b); - this.rainbow = rainbow; + public static int toRGBA(double[] colors) { + if (colors.length != 4) { + throw new IllegalArgumentException("colors[] must have a length of 4!"); + } + return ColorUtil.toRGBA((float) colors[0], (float) colors[1], (float) colors[2], (float) colors[3]); } - public ColorUtil(int r, int g, int b, int a, boolean rainbow) { - color = new Color(r,g,b, a); - this.rainbow = rainbow; + public static int toRGBA(Color color) { + return ColorUtil.toRGBA(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()); + } + + public static Color injectAlpha(final Color color, final int alpha) { + return new Color(color.getRed(), color.getGreen(), color.getBlue(), alpha); } public static Color interpolateColorC(Color color1, Color color2, float amount) { @@ -44,7 +69,6 @@ public static int interpolateInt(int oldValue, int newValue, double interpolatio public static Color getColor() { return color; } - public static int changeAlpha(int origColor, int userInputedAlpha) { origColor = origColor & 0x00FFFFFF; return (userInputedAlpha << 24) | origColor; @@ -66,66 +90,28 @@ public static int fade(int startColor, int endColor, float progress) { return (a & 0xFF) << 24 | (r & 0xFF) << 16 | (g & 0xFF) << 8 | (b & 0xFF); } - public boolean isRainbow() { - return rainbow; - } - - public void setRainbow(boolean rainbow) { - this.rainbow = rainbow; - } - - public void setColor(Color color) { - ColorUtil.color = color; - } + public static Color interpolate(float value, Color start, Color end) { + float sr = (float)start.getRed() / 255.0F; + float sg = (float)start.getGreen() / 255.0F; + float sb = (float)start.getBlue() / 255.0F; + float sa = (float)start.getAlpha() / 255.0F; - public static int toARGB(int r, int g, int b, int a) { - return new Color(r, g, b, a).getRGB(); - } + float er = (float)end.getRed() / 255.0F; + float eg = (float)end.getGreen() / 255.0F; + float eb = (float)end.getBlue() / 255.0F; + float ea = (float)end.getAlpha() / 255.0F; - public static int toRGBA(int r, int g, int b) { - return ColorUtil.toRGBA(r, g, b, 255); - } - - public static int toRGBA(int r, int g, int b, int a) { - return (r << 16) + (g << 8) + b + (a << 24); - } + float r = sr * value + er * (1.0F - value); + float g = sg * value + eg * (1.0F - value); + float b = sb * value + eb * (1.0F - value); + float a = sa * value + ea * (1.0F - value); - public static int toRGBA(float r, float g, float b, float a) { - return ColorUtil.toRGBA((int) (r * 255.0f), (int) (g * 255.0f), (int) (b * 255.0f), (int) (a * 255.0f)); - } - - public static Color injectAlpha(final Color color, final int alpha) { - return new Color(color.getRed(), color.getGreen(), color.getBlue(), alpha); - } - - - public static Color rainbow(int delay) { - double rainbowState = Math.ceil((double) (System.currentTimeMillis() + (long) delay) / 20.0); - return Color.getHSBColor((float) ((rainbowState %= 360.0) / 360.0), Colors.getInstance().rainbowSaturation.getValue().floatValue() / 255.0f, Colors.getInstance().rainbowBrightness.getValue().floatValue() / 255.0f); + return new Color(r, g, b, a); } public static Color rainbow(int delay, Integer value) { double rainbowState = Math.ceil((double) (System.currentTimeMillis() + (long) delay) / 20.0); return Color.getHSBColor((float) ((rainbowState %= 360.0) / 360.0), Colors.getInstance().rainbowSaturation.getValue().floatValue() / 255.0f, Colors.getInstance().rainbowBrightness.getValue().floatValue() / 255.0f); } - - public static int toRGBA(float[] colors) { - if (colors.length != 4) { - throw new IllegalArgumentException("colors[] must have a length of 4!"); - } - return ColorUtil.toRGBA(colors[0], colors[1], colors[2], colors[3]); - } - - public static int toRGBA(double[] colors) { - if (colors.length != 4) { - throw new IllegalArgumentException("colors[] must have a length of 4!"); - } - return ColorUtil.toRGBA((float) colors[0], (float) colors[1], (float) colors[2], (float) colors[3]); - } - - public static int toRGBA(Color color) { - return ColorUtil.toRGBA(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()); - } - } diff --git a/src/main/java/com/me/infinity/loop/util/utils/DamageUtil.java b/src/main/java/me/loop/util/impl/DamageUtil.java similarity index 95% rename from src/main/java/com/me/infinity/loop/util/utils/DamageUtil.java rename to src/main/java/me/loop/util/impl/DamageUtil.java index c001a02..80c31e6 100644 --- a/src/main/java/com/me/infinity/loop/util/utils/DamageUtil.java +++ b/src/main/java/me/loop/util/impl/DamageUtil.java @@ -1,4 +1,4 @@ -package com.me.infinity.loop.util.utils; +package me.loop.util.impl; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.Entity; @@ -41,7 +41,7 @@ public static int getItemDamage(ItemStack stack) { } public static boolean canTakeDamage(boolean suicide) { - return !DamageUtil.mc.player.capabilities.isCreativeMode && !suicide; + return !mc.player.capabilities.isCreativeMode && !suicide; } public static float calculateDamage(double posX, double posY, double posZ, Entity entity) { @@ -58,7 +58,7 @@ public static float calculateDamage(double posX, double posY, double posZ, Entit float damage = (int) ((v * v + v) / 2.0 * 7.0 * (double) doubleExplosionSize + 1.0); double finald = 1.0; if (entity instanceof EntityLivingBase) { - finald = DamageUtil.getBlastReduction((EntityLivingBase) entity, DamageUtil.getDamageMultiplied(damage), new Explosion(DamageUtil.mc.world, null, posX, posY, posZ, 6.0f, false, true)); + finald = DamageUtil.getBlastReduction((EntityLivingBase) entity, DamageUtil.getDamageMultiplied(damage), new Explosion(mc.world, null, posX, posY, posZ, 6.0f, false, true)); } return (float) finald; } @@ -88,7 +88,7 @@ public static float getBlastReduction(EntityLivingBase entity, float damageI, Ex } public static float getDamageMultiplied(float damage) { - int diff = DamageUtil.mc.world.getDifficulty().getId(); + int diff = mc.world.getDifficulty().getId(); return damage * (diff == 0 ? 0.0f : (diff == 2 ? 1.0f : (diff == 1 ? 0.5f : 1.5f))); } diff --git a/src/main/java/com/me/infinity/loop/util/utils/EntityUtil.java b/src/main/java/me/loop/util/impl/EntityUtil.java similarity index 75% rename from src/main/java/com/me/infinity/loop/util/utils/EntityUtil.java rename to src/main/java/me/loop/util/impl/EntityUtil.java index 2f590a6..68e29b1 100644 --- a/src/main/java/com/me/infinity/loop/util/utils/EntityUtil.java +++ b/src/main/java/me/loop/util/impl/EntityUtil.java @@ -1,8 +1,7 @@ -package com.me.infinity.loop.util.utils; +package me.loop.util.impl; -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.util.utils.maths.MathUtil; import com.mojang.realmsclient.gui.ChatFormatting; +import me.loop.InfinityLoop; import net.minecraft.block.*; import net.minecraft.block.state.IBlockState; import net.minecraft.enchantment.EnchantmentHelper; @@ -53,35 +52,15 @@ public class EntityUtil public static void attackEntity(Entity entity, boolean packet, boolean swingArm) { if (packet) { - EntityUtil.mc.player.connection.sendPacket(new CPacketUseEntity(entity)); + mc.player.connection.sendPacket(new CPacketUseEntity(entity)); } else { - EntityUtil.mc.playerController.attackEntity(EntityUtil.mc.player, entity); + mc.playerController.attackEntity(mc.player, entity); } if (swingArm) { - EntityUtil.mc.player.swingArm(EnumHand.MAIN_HAND); - } - } - - public static java.util.List getSphere(BlockPos loc, float r, int h, boolean hollow, boolean sphere, int plusY) { - List circleBlocks = new ArrayList<>(); - int cx = loc.getX(); - int cy = loc.getY(); - int cz = loc.getZ(); - for (int x = cx - (int) r; x <= cx + r; x++) { - for (int z = cz - (int) r; z <= cz + r; z++) { - for (int y = (sphere ? cy - (int) r : cy); y < (sphere ? cy + r : cy + h); y++) { - double dist = (cx - x) * (cx - x) + (cz - z) * (cz - z) + (sphere ? (cy - y) * (cy - y) : 0); - if (dist < r * r && !(hollow && dist < (r - 1) * (r - 1))) { - BlockPos l = new BlockPos(x, y + plusY, z); - circleBlocks.add(l); - } - } - } + mc.player.swingArm(EnumHand.MAIN_HAND); } - return circleBlocks; } - public static Vec3d interpolateEntity(Entity entity, float time) { return new Vec3d(entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double) time, entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double) time, entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double) time); } @@ -91,11 +70,11 @@ public static Vec3d getInterpolatedPos(Entity entity, float partialTicks) { } public static Vec3d getInterpolatedRenderPos(Entity entity, float partialTicks) { - return EntityUtil.getInterpolatedPos(entity, partialTicks).subtract(EntityUtil.mc.getRenderManager().renderPosX, EntityUtil.mc.getRenderManager().renderPosY, EntityUtil.mc.getRenderManager().renderPosZ); + return EntityUtil.getInterpolatedPos(entity, partialTicks).subtract(mc.getRenderManager().renderPosX, mc.getRenderManager().renderPosY, mc.getRenderManager().renderPosZ); } public static Vec3d getInterpolatedRenderPos(Vec3d vec) { - return new Vec3d(vec.x, vec.y, vec.z).subtract(EntityUtil.mc.getRenderManager().renderPosX, EntityUtil.mc.getRenderManager().renderPosY, EntityUtil.mc.getRenderManager().renderPosZ); + return new Vec3d(vec.x, vec.y, vec.z).subtract(mc.getRenderManager().renderPosX, mc.getRenderManager().renderPosY, mc.getRenderManager().renderPosZ); } public static Vec3d getInterpolatedAmount(Entity entity, double x, double y, double z) { @@ -125,8 +104,8 @@ public static boolean isSafe(Entity entity, int height, boolean floor) { } public static boolean stopSneaking(boolean isSneaking) { - if (isSneaking && EntityUtil.mc.player != null) { - EntityUtil.mc.player.connection.sendPacket(new CPacketEntityAction(EntityUtil.mc.player, CPacketEntityAction.Action.STOP_SNEAKING)); + if (isSneaking && mc.player != null) { + mc.player.connection.sendPacket(new CPacketEntityAction(mc.player, CPacketEntityAction.Action.STOP_SNEAKING)); } return false; } @@ -150,7 +129,7 @@ public static boolean isMobAggressive(Entity entity) { } } else { if (entity instanceof EntityWolf) { - return ((EntityWolf) entity).isAngry() && !EntityUtil.mc.player.equals(((EntityWolf) entity).getOwner()); + return ((EntityWolf) entity).isAngry() && !mc.player.equals(((EntityWolf) entity).getOwner()); } if (entity instanceof EntityEnderman) { return ((EntityEnderman) entity).isScreaming(); @@ -183,7 +162,7 @@ public static List getUnsafeBlocksFromVec3d(Vec3d pos, int height, boolea ArrayList vec3ds = new ArrayList(); for (Vec3d vector : EntityUtil.getOffsets(height, floor)) { BlockPos targetPos = new BlockPos(pos).add(vector.x, vector.y, vector.z); - Block block = EntityUtil.mc.world.getBlockState(targetPos).getBlock(); + Block block = mc.world.getBlockState(targetPos).getBlock(); if (!(block instanceof BlockAir) && !(block instanceof BlockLiquid) && !(block instanceof BlockTallGrass) && !(block instanceof BlockFire) && !(block instanceof BlockDeadBush) && !(block instanceof BlockSnow)) continue; vec3ds.add(vector); @@ -202,7 +181,7 @@ public static boolean isBlockValid(BlockPos blockPos) { public static boolean isObbyHole(BlockPos blockPos) { BlockPos[] touchingBlocks; for (BlockPos pos : touchingBlocks = new BlockPos[]{blockPos.north(), blockPos.south(), blockPos.east(), blockPos.west(), blockPos.down()}) { - IBlockState touchingState = EntityUtil.mc.world.getBlockState(pos); + IBlockState touchingState = mc.world.getBlockState(pos); if (touchingState.getBlock() != Blocks.AIR && touchingState.getBlock() == Blocks.OBSIDIAN) continue; return false; } @@ -212,7 +191,7 @@ public static boolean isObbyHole(BlockPos blockPos) { public static boolean isBedrockHole(BlockPos blockPos) { BlockPos[] touchingBlocks; for (BlockPos pos : touchingBlocks = new BlockPos[]{blockPos.north(), blockPos.south(), blockPos.east(), blockPos.west(), blockPos.down()}) { - IBlockState touchingState = EntityUtil.mc.world.getBlockState(pos); + IBlockState touchingState = mc.world.getBlockState(pos); if (touchingState.getBlock() != Blocks.AIR && touchingState.getBlock() == Blocks.BEDROCK) continue; return false; } @@ -222,7 +201,7 @@ public static boolean isBedrockHole(BlockPos blockPos) { public static boolean isBothHole(BlockPos blockPos) { BlockPos[] touchingBlocks; for (BlockPos pos : touchingBlocks = new BlockPos[]{blockPos.north(), blockPos.south(), blockPos.east(), blockPos.west(), blockPos.down()}) { - IBlockState touchingState = EntityUtil.mc.world.getBlockState(pos); + IBlockState touchingState = mc.world.getBlockState(pos); if (touchingState.getBlock() != Blocks.AIR && (touchingState.getBlock() == Blocks.BEDROCK || touchingState.getBlock() == Blocks.OBSIDIAN)) continue; return false; @@ -243,13 +222,17 @@ public static Vec3d[] getUnsafeBlockArrayFromVec3d(Vec3d pos, int height, boolea } public static double getDst(Vec3d vec) { - return EntityUtil.mc.player.getPositionVector().distanceTo(vec); + return mc.player.getPositionVector().distanceTo(vec); } public static boolean isTrapped(EntityPlayer player, boolean antiScaffold, boolean antiStep, boolean legs, boolean platform, boolean antiDrop) { return EntityUtil.getUntrappedBlocks(player, antiScaffold, antiStep, legs, platform, antiDrop).size() == 0; } + public static boolean isTrappedExtended(int extension, EntityPlayer player, boolean antiScaffold, boolean antiStep, boolean legs, boolean platform, boolean antiDrop, boolean raytrace) { + return EntityUtil.getUntrappedBlocksExtended(extension, player, antiScaffold, antiStep, legs, platform, antiDrop, raytrace).size() == 0; + } + public static List getUntrappedBlocks(EntityPlayer player, boolean antiScaffold, boolean antiStep, boolean legs, boolean platform, boolean antiDrop) { ArrayList vec3ds = new ArrayList(); if (!antiStep && EntityUtil.getUnsafeBlocks(player, 2, false).size() == 4) { @@ -258,7 +241,7 @@ public static List getUntrappedBlocks(EntityPlayer player, boolean antiSc for (int i = 0; i < EntityUtil.getTrapOffsets(antiScaffold, antiStep, legs, platform, antiDrop).length; ++i) { Vec3d vector = EntityUtil.getTrapOffsets(antiScaffold, antiStep, legs, platform, antiDrop)[i]; BlockPos targetPos = new BlockPos(player.getPositionVector()).add(vector.x, vector.y, vector.z); - Block block = EntityUtil.mc.world.getBlockState(targetPos).getBlock(); + Block block = mc.world.getBlockState(targetPos).getBlock(); if (!(block instanceof BlockAir) && !(block instanceof BlockLiquid) && !(block instanceof BlockTallGrass) && !(block instanceof BlockFire) && !(block instanceof BlockDeadBush) && !(block instanceof BlockSnow)) continue; vec3ds.add(vector); @@ -274,7 +257,7 @@ public static boolean isInWater(Entity entity) { for (int x = MathHelper.floor(entity.posX); x < MathHelper.ceil(entity.posX); ++x) { for (int z = MathHelper.floor(entity.posZ); z < MathHelper.ceil(entity.posZ); ++z) { BlockPos pos = new BlockPos(x, (int) y, z); - if (!(EntityUtil.mc.world.getBlockState(pos).getBlock() instanceof BlockLiquid)) continue; + if (!(mc.world.getBlockState(pos).getBlock() instanceof BlockLiquid)) continue; return true; } } @@ -282,7 +265,7 @@ public static boolean isInWater(Entity entity) { } public static boolean isDrivenByPlayer(Entity entityIn) { - return EntityUtil.mc.player != null && entityIn != null && entityIn.equals(EntityUtil.mc.player.getRidingEntity()); + return mc.player != null && entityIn != null && entityIn.equals(mc.player.getRidingEntity()); } public static boolean isPlayer(Entity entity) { @@ -301,13 +284,84 @@ public static boolean isAboveWater(Entity entity, boolean packet) { for (int x = MathHelper.floor(entity.posX); x < MathHelper.ceil(entity.posX); ++x) { for (int z = MathHelper.floor(entity.posZ); z < MathHelper.ceil(entity.posZ); ++z) { BlockPos pos = new BlockPos(x, MathHelper.floor(y), z); - if (!(EntityUtil.mc.world.getBlockState(pos).getBlock() instanceof BlockLiquid)) continue; + if (!(mc.world.getBlockState(pos).getBlock() instanceof BlockLiquid)) continue; return true; } } return false; } + public static List getUntrappedBlocksExtended(int extension, EntityPlayer player, boolean antiScaffold, boolean antiStep, boolean legs, boolean platform, boolean antiDrop, boolean raytrace) { + ArrayList placeTargets = new ArrayList(); + if (extension == 1) { + placeTargets.addAll(EntityUtil.targets(player.getPositionVector(), antiScaffold, antiStep, legs, platform, antiDrop, raytrace)); + } else { + int extend = 1; + for (Vec3d vec3d : MathUtil.getBlockBlocks(player)) { + if (extend > extension) break; + placeTargets.addAll(EntityUtil.targets(vec3d, antiScaffold, antiStep, legs, platform, antiDrop, raytrace)); + ++extend; + } + } + ArrayList removeList = new ArrayList(); + for (Vec3d vec3d : placeTargets) { + BlockPos pos = new BlockPos(vec3d); + if (BlockUtil.isPositionPlaceable(pos, raytrace) != -1) continue; + removeList.add(vec3d); + } + for (Vec3d vec3d : removeList) { + placeTargets.remove(vec3d); + } + return placeTargets; + } + + public static List targets(Vec3d vec3d, boolean antiScaffold, boolean antiStep, boolean legs, boolean platform, boolean antiDrop, boolean raytrace) { + ArrayList placeTargets = new ArrayList(); + if (antiDrop) { + Collections.addAll(placeTargets, BlockUtil.convertVec3ds(vec3d, antiDropOffsetList)); + } + if (platform) { + Collections.addAll(placeTargets, BlockUtil.convertVec3ds(vec3d, platformOffsetList)); + } + if (legs) { + Collections.addAll(placeTargets, BlockUtil.convertVec3ds(vec3d, legOffsetList)); + } + Collections.addAll(placeTargets, BlockUtil.convertVec3ds(vec3d, OffsetList)); + if (antiStep) { + Collections.addAll(placeTargets, BlockUtil.convertVec3ds(vec3d, antiStepOffsetList)); + } else { + List vec3ds = EntityUtil.getUnsafeBlocksFromVec3d(vec3d, 2, false); + if (vec3ds.size() == 4) { + block5: + for (Vec3d vector : vec3ds) { + BlockPos position = new BlockPos(vec3d).add(vector.x, vector.y, vector.z); + switch (BlockUtil.isPositionPlaceable(position, raytrace)) { + case 0: { + break; + } + case -1: + case 1: + case 2: { + continue block5; + } + case 3: { + placeTargets.add(vec3d.add(vector)); + break; + } + } + if (antiScaffold) { + Collections.addAll(placeTargets, BlockUtil.convertVec3ds(vec3d, antiScaffoldOffsetList)); + } + return placeTargets; + } + } + } + if (antiScaffold) { + Collections.addAll(placeTargets, BlockUtil.convertVec3ds(vec3d, antiScaffoldOffsetList)); + } + return placeTargets; + } + public static List getOffsetList(int y, boolean floor) { ArrayList offsets = new ArrayList(); offsets.add(new Vec3d(-1.0, y, 0.0)); @@ -396,11 +450,11 @@ public static float getHealth(Entity entity, boolean absorption) { } public static boolean canEntityFeetBeSeen(Entity entityIn) { - return EntityUtil.mc.world.rayTraceBlocks(new Vec3d(EntityUtil.mc.player.posX, EntityUtil.mc.player.posX + (double) EntityUtil.mc.player.getEyeHeight(), EntityUtil.mc.player.posZ), new Vec3d(entityIn.posX, entityIn.posY, entityIn.posZ), false, true, false) == null; + return mc.world.rayTraceBlocks(new Vec3d(mc.player.posX, mc.player.posX + (double) mc.player.getEyeHeight(), mc.player.posZ), new Vec3d(entityIn.posX, entityIn.posY, entityIn.posZ), false, true, false) == null; } public static boolean isntValid(Entity entity, double range) { - return entity == null || EntityUtil.isDead(entity) || entity.equals(EntityUtil.mc.player) || entity instanceof EntityPlayer && InfinityLoop.friendManager.isFriend(entity.getName()) || EntityUtil.mc.player.getDistanceSq(entity) > MathUtil.square(range); + return entity == null || EntityUtil.isDead(entity) || entity.equals(mc.player) || entity instanceof EntityPlayer && InfinityLoop.friendManager.isFriend(entity.getName()) || mc.player.getDistanceSq(entity) > MathUtil.square(range); } public static boolean isValid(Entity entity, double range) { @@ -413,8 +467,8 @@ public static boolean holdingWeapon(EntityPlayer player) { public static double getMaxSpeed() { double maxModifier = 0.2873; - if (EntityUtil.mc.player.isPotionActive(Objects.requireNonNull(Potion.getPotionById(1)))) { - maxModifier *= 1.0 + 0.2 * (double) (Objects.requireNonNull(EntityUtil.mc.player.getActivePotionEffect(Objects.requireNonNull(Potion.getPotionById(1)))).getAmplifier() + 1); + if (mc.player.isPotionActive(Objects.requireNonNull(Potion.getPotionById(1)))) { + maxModifier *= 1.0 + 0.2 * (double) (Objects.requireNonNull(mc.player.getActivePotionEffect(Objects.requireNonNull(Potion.getPotionById(1)))).getAmplifier() + 1); } return maxModifier; } @@ -431,7 +485,7 @@ public static boolean isEntityMoving(Entity entity) { return false; } if (entity instanceof EntityPlayer) { - return EntityUtil.mc.gameSettings.keyBindForward.isKeyDown() || EntityUtil.mc.gameSettings.keyBindBack.isKeyDown() || EntityUtil.mc.gameSettings.keyBindLeft.isKeyDown() || EntityUtil.mc.gameSettings.keyBindRight.isKeyDown(); + return mc.gameSettings.keyBindForward.isKeyDown() || mc.gameSettings.keyBindBack.isKeyDown() || mc.gameSettings.keyBindLeft.isKeyDown() || mc.gameSettings.keyBindRight.isKeyDown(); } return entity.motionX != 0.0 || entity.motionY != 0.0 || entity.motionZ != 0.0; } @@ -452,10 +506,10 @@ public static boolean is32k(ItemStack stack) { public static void moveEntityStrafe(double speed, Entity entity) { if (entity != null) { - MovementInput movementInput = EntityUtil.mc.player.movementInput; + MovementInput movementInput = mc.player.movementInput; double forward = movementInput.moveForward; double strafe = movementInput.moveStrafe; - float yaw = EntityUtil.mc.player.rotationYaw; + float yaw = mc.player.rotationYaw; if (forward == 0.0 && strafe == 0.0) { entity.motionX = 0.0; entity.motionZ = 0.0; @@ -480,7 +534,7 @@ public static void moveEntityStrafe(double speed, Entity entity) { } public static boolean rayTraceHitCheck(Entity entity, boolean shouldCheck) { - return !shouldCheck || EntityUtil.mc.player.canEntityBeSeen(entity); + return !shouldCheck || mc.player.canEntityBeSeen(entity); } public static Color getColor(Entity entity, int red, int green, int blue, int alpha, boolean colorFriends) { @@ -492,18 +546,18 @@ public static Color getColor(Entity entity, int red, int green, int blue, int al } public static boolean isMoving() { - return (double) EntityUtil.mc.player.moveForward != 0.0 || (double) EntityUtil.mc.player.moveStrafing != 0.0; + return (double) mc.player.moveForward != 0.0 || (double) mc.player.moveStrafing != 0.0; } public static EntityPlayer getClosestEnemy(double distance) { EntityPlayer closest = null; - for (EntityPlayer player : EntityUtil.mc.world.playerEntities) { + for (EntityPlayer player : mc.world.playerEntities) { if (EntityUtil.isntValid(player, distance)) continue; if (closest == null) { closest = player; continue; } - if (!(EntityUtil.mc.player.getDistanceSq(player) < EntityUtil.mc.player.getDistanceSq(closest))) + if (!(mc.player.getDistanceSq(player) < mc.player.getDistanceSq(closest))) continue; closest = player; } @@ -511,23 +565,23 @@ public static EntityPlayer getClosestEnemy(double distance) { } public static boolean checkCollide() { - if (EntityUtil.mc.player.isSneaking()) { + if (mc.player.isSneaking()) { return false; } - if (EntityUtil.mc.player.getRidingEntity() != null && EntityUtil.mc.player.getRidingEntity().fallDistance >= 3.0f) { + if (mc.player.getRidingEntity() != null && mc.player.getRidingEntity().fallDistance >= 3.0f) { return false; } - return EntityUtil.mc.player.fallDistance < 3.0f; + return mc.player.fallDistance < 3.0f; } public static BlockPos getPlayerPosWithEntity() { - return new BlockPos(EntityUtil.mc.player.getRidingEntity() != null ? EntityUtil.mc.player.getRidingEntity().posX : EntityUtil.mc.player.posX, EntityUtil.mc.player.getRidingEntity() != null ? EntityUtil.mc.player.getRidingEntity().posY : EntityUtil.mc.player.posY, EntityUtil.mc.player.getRidingEntity() != null ? EntityUtil.mc.player.getRidingEntity().posZ : EntityUtil.mc.player.posZ); + return new BlockPos(mc.player.getRidingEntity() != null ? mc.player.getRidingEntity().posX : mc.player.posX, mc.player.getRidingEntity() != null ? mc.player.getRidingEntity().posY : mc.player.posY, mc.player.getRidingEntity() != null ? mc.player.getRidingEntity().posZ : mc.player.posZ); } public static double[] forward(double speed) { - float forward = EntityUtil.mc.player.movementInput.moveForward; - float side = EntityUtil.mc.player.movementInput.moveStrafe; - float yaw = EntityUtil.mc.player.prevRotationYaw + (EntityUtil.mc.player.rotationYaw - EntityUtil.mc.player.prevRotationYaw) * mc.getRenderPartialTicks(); + float forward = mc.player.movementInput.moveForward; + float side = mc.player.movementInput.moveStrafe; + float yaw = mc.player.prevRotationYaw + (mc.player.rotationYaw - mc.player.prevRotationYaw) * mc.getRenderPartialTicks(); if (forward != 0.0f) { if (side > 0.0f) { yaw += (float) (forward > 0.0f ? -45 : 45); @@ -556,8 +610,8 @@ public static Map getTextRadarPlayers() { dfDistance.setRoundingMode(RoundingMode.CEILING); StringBuilder healthSB = new StringBuilder(); StringBuilder distanceSB = new StringBuilder(); - for (EntityPlayer player : EntityUtil.mc.world.playerEntities) { - if (player.isInvisible() || player.getName().equals(EntityUtil.mc.player.getName())) continue; + for (EntityPlayer player : mc.world.playerEntities) { + if (player.isInvisible() || player.getName().equals(mc.player.getName())) continue; int hpRaw = (int) EntityUtil.getHealth(player); String hp = dfHealth.format(hpRaw); healthSB.append("\u00c2\u00a7"); @@ -571,7 +625,7 @@ public static Map getTextRadarPlayers() { healthSB.append("c"); } healthSB.append(hp); - int distanceInt = (int) EntityUtil.mc.player.getDistance(player); + int distanceInt = (int) mc.player.getDistance(player); String distance = dfDistance.format(distanceInt); distanceSB.append("\u00c2\u00a7"); if (distanceInt >= 25) { @@ -582,7 +636,7 @@ public static Map getTextRadarPlayers() { distanceSB.append("c"); } distanceSB.append(distance); - output.put(healthSB + " " + (InfinityLoop.friendManager.isFriend(player) ? ChatFormatting.AQUA : ChatFormatting.RED) + player.getName() + " " + distanceSB + " \u00c2\u00a7f0", (int) EntityUtil.mc.player.getDistance(player)); + output.put(healthSB.toString() + " " + (InfinityLoop.friendManager.isFriend(player) ? ChatFormatting.AQUA : ChatFormatting.RED) + player.getName() + " " + distanceSB.toString() + " \u00c2\u00a7f0", (int) mc.player.getDistance(player)); healthSB.setLength(0); distanceSB.setLength(0); } diff --git a/src/main/java/me/loop/util/impl/IconUtil.java b/src/main/java/me/loop/util/impl/IconUtil.java new file mode 100644 index 0000000..b821df2 --- /dev/null +++ b/src/main/java/me/loop/util/impl/IconUtil.java @@ -0,0 +1,21 @@ +package me.loop.util.impl; + +import javax.imageio.ImageIO; +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.io.InputStream; +import java.nio.ByteBuffer; +import java.util.Arrays; + +public class IconUtil { + public static final IconUtil INSTANCE = new IconUtil(); + + public ByteBuffer readImageToBuffer(InputStream inputStream) throws IOException { + BufferedImage bufferedimage = ImageIO.read(inputStream); + int[] aint = bufferedimage.getRGB(0, 0, bufferedimage.getWidth(), bufferedimage.getHeight(), null, 0, bufferedimage.getWidth()); + ByteBuffer bytebuffer = ByteBuffer.allocate(4 * aint.length); + Arrays.stream(aint).map(i -> i << 8 | (i >> 24 & 255)).forEach(bytebuffer::putInt); + bytebuffer.flip(); + return bytebuffer; + } +} diff --git a/src/main/java/com/me/infinity/loop/util/utils/maths/ImageUtil.java b/src/main/java/me/loop/util/impl/ImageUtil.java similarity index 90% rename from src/main/java/com/me/infinity/loop/util/utils/maths/ImageUtil.java rename to src/main/java/me/loop/util/impl/ImageUtil.java index db895f3..2d072f9 100644 --- a/src/main/java/com/me/infinity/loop/util/utils/maths/ImageUtil.java +++ b/src/main/java/me/loop/util/impl/ImageUtil.java @@ -1,6 +1,5 @@ -package com.me.infinity.loop.util.utils.maths; +package me.loop.util.impl; -import com.me.infinity.loop.util.utils.Util; import net.minecraft.client.gui.Gui; import org.lwjgl.opengl.GL11; diff --git a/src/main/java/com/me/infinity/loop/util/utils/minecraft/InventoryUtil.java b/src/main/java/me/loop/util/impl/InventoryUtil.java similarity index 76% rename from src/main/java/com/me/infinity/loop/util/utils/minecraft/InventoryUtil.java rename to src/main/java/me/loop/util/impl/InventoryUtil.java index 71e32f6..a65fe84 100644 --- a/src/main/java/com/me/infinity/loop/util/utils/minecraft/InventoryUtil.java +++ b/src/main/java/me/loop/util/impl/InventoryUtil.java @@ -1,18 +1,15 @@ -package com.me.infinity.loop.util.utils.minecraft; +package me.loop.util.impl; -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.util.utils.Util; +import me.loop.InfinityLoop; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.enchantment.EnchantmentHelper; -import net.minecraft.init.Blocks; import net.minecraft.init.Enchantments; import net.minecraft.init.Items; import net.minecraft.inventory.ClickType; import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.inventory.Slot; import net.minecraft.item.*; -import net.minecraft.network.Packet; import net.minecraft.network.play.client.CPacketHeldItemChange; import java.util.ArrayList; @@ -24,16 +21,16 @@ public class InventoryUtil implements Util { public static void switchToHotbarSlot(int slot, boolean silent) { - if (InventoryUtil.mc.player.inventory.currentItem == slot || slot < 0) { + if (mc.player.inventory.currentItem == slot || slot < 0) { return; } if (silent) { - InventoryUtil.mc.player.connection.sendPacket(new CPacketHeldItemChange(slot)); - InventoryUtil.mc.playerController.updateController(); + mc.player.connection.sendPacket(new CPacketHeldItemChange(slot)); + mc.playerController.updateController(); } else { - InventoryUtil.mc.player.connection.sendPacket(new CPacketHeldItemChange(slot)); - InventoryUtil.mc.player.inventory.currentItem = slot; - InventoryUtil.mc.playerController.updateController(); + mc.player.connection.sendPacket(new CPacketHeldItemChange(slot)); + mc.player.inventory.currentItem = slot; + mc.playerController.updateController(); } } @@ -51,7 +48,7 @@ public static boolean isNull(ItemStack stack) { public static int findHotbarBlock(Class clazz) { for (int i = 0; i < 9; ++i) { Block block; - ItemStack stack = InventoryUtil.mc.player.inventory.getStackInSlot(i); + ItemStack stack = mc.player.inventory.getStackInSlot(i); if (stack == ItemStack.EMPTY) continue; if (clazz.isInstance(stack.getItem())) { return i; @@ -66,7 +63,7 @@ public static int findHotbarBlock(Class clazz) { public static int findHotbarBlock(Block blockIn) { for (int i = 0; i < 9; ++i) { Block block; - ItemStack stack = InventoryUtil.mc.player.inventory.getStackInSlot(i); + ItemStack stack = mc.player.inventory.getStackInSlot(i); if (stack == ItemStack.EMPTY || !(stack.getItem() instanceof ItemBlock) || (block = ((ItemBlock) stack.getItem()).getBlock()) != blockIn) continue; return i; @@ -76,7 +73,7 @@ public static int findHotbarBlock(Block blockIn) { public static int getItemHotbar(Item input) { for (int i = 0; i < 9; ++i) { - Item item = InventoryUtil.mc.player.inventory.getStackInSlot(i).getItem(); + Item item = mc.player.inventory.getStackInSlot(i).getItem(); if (Item.getIdFromItem(item) != Item.getIdFromItem(input)) continue; return i; } @@ -91,7 +88,7 @@ public static int findStackInventory(Item input, boolean withHotbar) { int i; int n = i = withHotbar ? 0 : 9; while (i < 36) { - Item item = InventoryUtil.mc.player.inventory.getStackInSlot(i).getItem(); + Item item = mc.player.inventory.getStackInSlot(i).getItem(); if (Item.getIdFromItem(input) == Item.getIdFromItem(item)) { return i + (i < 9 ? 36 : 0); } @@ -119,7 +116,7 @@ public static List findEmptySlots(boolean withXCarry) { } if (withXCarry) { for (int i = 1; i < 5; ++i) { - Slot craftingSlot = InventoryUtil.mc.player.inventoryContainer.inventorySlots.get(i); + Slot craftingSlot = mc.player.inventoryContainer.inventorySlots.get(i); ItemStack craftingStack = craftingSlot.getStack(); if (!craftingStack.isEmpty() && craftingStack.getItem() != Items.AIR) continue; outPut.add(i); @@ -148,9 +145,9 @@ public static boolean isBlock(Item item, Class clazz) { } public static void confirmSlot(int slot) { - InventoryUtil.mc.player.connection.sendPacket(new CPacketHeldItemChange(slot)); - InventoryUtil.mc.player.inventory.currentItem = slot; - InventoryUtil.mc.playerController.updateController(); + mc.player.connection.sendPacket(new CPacketHeldItemChange(slot)); + mc.player.inventory.currentItem = slot; + mc.playerController.updateController(); } public static Map getInventoryAndHotbarSlots() { @@ -160,7 +157,7 @@ public static Map getInventoryAndHotbarSlots() { private static Map getInventorySlots(int currentI, int last) { HashMap fullInventorySlots = new HashMap(); for (int current = currentI; current <= last; ++current) { - fullInventorySlots.put(current, InventoryUtil.mc.player.inventoryContainer.getInventory().get(current)); + fullInventorySlots.put(current, mc.player.inventoryContainer.getInventory().get(current)); } return fullInventorySlots; } @@ -191,7 +188,7 @@ public static boolean[] switchItem(boolean back, int lastHotbarSlot, boolean swi break; } case NONE: { - switchedItemSwitched[1] = back || InventoryUtil.mc.player.inventory.currentItem == InventoryUtil.findHotbarBlock(clazz); + switchedItemSwitched[1] = back || mc.player.inventory.currentItem == InventoryUtil.findHotbarBlock(clazz); } } return switchedItemSwitched; @@ -223,7 +220,7 @@ public static boolean[] switchItemToItem(boolean back, int lastHotbarSlot, boole break; } case NONE: { - switchedItemSwitched[1] = back || InventoryUtil.mc.player.inventory.currentItem == InventoryUtil.getItemHotbar(item); + switchedItemSwitched[1] = back || mc.player.inventory.currentItem == InventoryUtil.getItemHotbar(item); } } return switchedItemSwitched; @@ -231,10 +228,10 @@ public static boolean[] switchItemToItem(boolean back, int lastHotbarSlot, boole public static boolean holdingItem(Class clazz) { boolean result = false; - ItemStack stack = InventoryUtil.mc.player.getHeldItemMainhand(); + ItemStack stack = mc.player.getHeldItemMainhand(); result = InventoryUtil.isInstanceOf(stack, clazz); if (!result) { - ItemStack offhand = InventoryUtil.mc.player.getHeldItemOffhand(); + ItemStack offhand = mc.player.getHeldItemOffhand(); result = InventoryUtil.isInstanceOf(stack, clazz); } return result; @@ -257,7 +254,7 @@ public static boolean isInstanceOf(ItemStack stack, Class clazz) { public static int getEmptyXCarry() { for (int i = 1; i < 5; ++i) { - Slot craftingSlot = InventoryUtil.mc.player.inventoryContainer.inventorySlots.get(i); + Slot craftingSlot = mc.player.inventoryContainer.inventorySlots.get(i); ItemStack craftingStack = craftingSlot.getStack(); if (!craftingStack.isEmpty() && craftingStack.getItem() != Items.AIR) continue; return i; @@ -266,7 +263,7 @@ public static int getEmptyXCarry() { } public static boolean isSlotEmpty(int i) { - Slot slot = InventoryUtil.mc.player.inventoryContainer.inventorySlots.get(i); + Slot slot = mc.player.inventoryContainer.inventorySlots.get(i); ItemStack stack = slot.getStack(); return stack.isEmpty(); } @@ -330,7 +327,7 @@ public static int findArmorSlot(EntityEquipmentSlot type, boolean binding, boole for (int i = 1; i < 5; ++i) { boolean cursed; ItemArmor armor; - Slot craftingSlot = InventoryUtil.mc.player.inventoryContainer.inventorySlots.get(i); + Slot craftingSlot = mc.player.inventoryContainer.inventorySlots.get(i); ItemStack craftingStack = craftingSlot.getStack(); if (craftingStack.getItem() == Items.AIR || !(craftingStack.getItem() instanceof ItemArmor) || (armor = (ItemArmor) craftingStack.getItem()).getEquipmentSlot() != type) continue; @@ -349,7 +346,7 @@ public static int findItemInventorySlot(Item item, boolean offHand, boolean with if (slot == -1 && withXCarry) { for (int i = 1; i < 5; ++i) { Item craftingStackItem; - Slot craftingSlot = InventoryUtil.mc.player.inventoryContainer.inventorySlots.get(i); + Slot craftingSlot = mc.player.inventoryContainer.inventorySlots.get(i); ItemStack craftingStack = craftingSlot.getStack(); if (craftingStack.getItem() == Items.AIR || (craftingStackItem = craftingStack.getItem()) != item) continue; @@ -364,7 +361,7 @@ public static int findBlockSlotInventory(Class clazz, boolean offHand, boolean w if (slot == -1 && withXCarry) { for (int i = 1; i < 5; ++i) { Block block; - Slot craftingSlot = InventoryUtil.mc.player.inventoryContainer.inventorySlots.get(i); + Slot craftingSlot = mc.player.inventoryContainer.inventorySlots.get(i); ItemStack craftingStack = craftingSlot.getStack(); if (craftingStack.getItem() == Items.AIR) continue; Item craftingStackItem = craftingStack.getItem(); @@ -380,69 +377,10 @@ public static int findBlockSlotInventory(Class clazz, boolean offHand, boolean w return slot; } - public static void switchSlot(final int slot, final boolean silent) { - if (silent) { - InventoryUtil.mc.player.connection.sendPacket((Packet)new CPacketHeldItemChange(slot)); - } - else { - InventoryUtil.mc.player.connection.sendPacket((Packet)new CPacketHeldItemChange(slot)); - InventoryUtil.mc.player.inventory.currentItem = slot; - } - } - - public static int getCombatBlock(final String input) { - final int obsidianSlot = findBlock(Blocks.OBSIDIAN, 0, 9); - final int chestSlot = findBlock(Blocks.ENDER_CHEST, 0, 9); - if (obsidianSlot == -1 && chestSlot == -1) { - return -1; - } - if (obsidianSlot != -1 && chestSlot == -1) { - return obsidianSlot; - } - if (obsidianSlot == -1) { - return chestSlot; - } - if (input.equals("Obsidian")) { - return obsidianSlot; - } - return chestSlot; - } - - public static int findBlock(final Block block, final int minimum, final int maximum) { - for (int i = minimum; i <= maximum; ++i) { - final ItemStack stack = InventoryUtil.mc.player.inventory.getStackInSlot(i); - if (stack.getItem() instanceof ItemBlock) { - final ItemBlock item = (ItemBlock)stack.getItem(); - if (item.getBlock() == block) { - return i; - } - } - } - return -1; - } - - public enum The_Item - { - Obsidian, - Chest; - - public static The_Item[] $VALUES; - - static { - The_Item.$VALUES = new The_Item[] { The_Item.Obsidian, The_Item.Chest }; - } - } - public enum Switch { NORMAL, SILENT, - NONE; - - public static Switch[] $VALUES; - - static { - Switch.$VALUES = new Switch[] { Switch.NORMAL, Switch.SILENT, Switch.NONE }; - } + NONE } @@ -471,10 +409,10 @@ public Task(int slot, boolean quickClick) { public void run() { if (this.update) { - Util.mc.playerController.updateController(); + mc.playerController.updateController(); } if (this.slot != -1) { - Util.mc.playerController.windowClick(0, this.slot, 0, this.quickClick ? ClickType.QUICK_MOVE : ClickType.PICKUP, Util.mc.player); + mc.playerController.windowClick(0, this.slot, 0, this.quickClick ? ClickType.QUICK_MOVE : ClickType.PICKUP, mc.player); } } diff --git a/src/main/java/com/me/infinity/loop/util/utils/maths/MathUtil.java b/src/main/java/me/loop/util/impl/MathUtil.java similarity index 97% rename from src/main/java/com/me/infinity/loop/util/utils/maths/MathUtil.java rename to src/main/java/me/loop/util/impl/MathUtil.java index 70daba6..0d5d64a 100644 --- a/src/main/java/com/me/infinity/loop/util/utils/maths/MathUtil.java +++ b/src/main/java/me/loop/util/impl/MathUtil.java @@ -1,6 +1,5 @@ -package com.me.infinity.loop.util.utils.maths; +package me.loop.util.impl; -import com.me.infinity.loop.util.utils.Util; import net.minecraft.entity.Entity; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; @@ -13,8 +12,7 @@ public class MathUtil implements Util { - private static final Random random = new Random(); - + public static final Random random = new Random(); public static int getRandom(int min, int max) { return min + random.nextInt(max - min + 1); } @@ -254,5 +252,9 @@ public static double roundToPlaces(final double number, final int places) { public static Vec3d roundVector(final Vec3d vec3d, final int places) { return new Vec3d(roundToPlaces(vec3d.x, places), roundToPlaces(vec3d.y, places), roundToPlaces(vec3d.z, places)); } + + public static double normalize(double value, double min, double max) { + return (value - min) / (max - min); + } } diff --git a/src/main/java/com/me/infinity/loop/util/utils/worlds/TestUtil.java b/src/main/java/me/loop/util/impl/PlaceUtil.java similarity index 62% rename from src/main/java/com/me/infinity/loop/util/utils/worlds/TestUtil.java rename to src/main/java/me/loop/util/impl/PlaceUtil.java index 344912d..8566c06 100644 --- a/src/main/java/com/me/infinity/loop/util/utils/worlds/TestUtil.java +++ b/src/main/java/me/loop/util/impl/PlaceUtil.java @@ -1,4 +1,4 @@ -package com.me.infinity.loop.util.utils.worlds; +package me.loop.util.impl; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; @@ -18,56 +18,56 @@ import java.util.Iterator; import java.util.List; -public class TestUtil { +public class PlaceUtil { private static final Minecraft mc = Minecraft.getMinecraft(); public static List emptyBlocks = Arrays.asList(Blocks.AIR, Blocks.FLOWING_LAVA, Blocks.LAVA, Blocks.FLOWING_WATER, Blocks.WATER, Blocks.VINE, Blocks.SNOW_LAYER, Blocks.TALLGRASS, Blocks.FIRE); public static List rightclickableBlocks = Arrays.asList(Blocks.CHEST, Blocks.TRAPPED_CHEST, Blocks.ENDER_CHEST, Blocks.WHITE_SHULKER_BOX, Blocks.ORANGE_SHULKER_BOX, Blocks.MAGENTA_SHULKER_BOX, Blocks.LIGHT_BLUE_SHULKER_BOX, Blocks.YELLOW_SHULKER_BOX, Blocks.LIME_SHULKER_BOX, Blocks.PINK_SHULKER_BOX, Blocks.GRAY_SHULKER_BOX, Blocks.SILVER_SHULKER_BOX, Blocks.CYAN_SHULKER_BOX, Blocks.PURPLE_SHULKER_BOX, Blocks.BLUE_SHULKER_BOX, Blocks.BROWN_SHULKER_BOX, Blocks.GREEN_SHULKER_BOX, Blocks.RED_SHULKER_BOX, Blocks.BLACK_SHULKER_BOX, Blocks.ANVIL, Blocks.WOODEN_BUTTON, Blocks.STONE_BUTTON, Blocks.UNPOWERED_COMPARATOR, Blocks.UNPOWERED_REPEATER, Blocks.POWERED_REPEATER, Blocks.POWERED_COMPARATOR, Blocks.OAK_FENCE_GATE, Blocks.SPRUCE_FENCE_GATE, Blocks.BIRCH_FENCE_GATE, Blocks.JUNGLE_FENCE_GATE, Blocks.DARK_OAK_FENCE_GATE, Blocks.ACACIA_FENCE_GATE, Blocks.BREWING_STAND, Blocks.DISPENSER, Blocks.DROPPER, Blocks.LEVER, Blocks.NOTEBLOCK, Blocks.JUKEBOX, Blocks.BEACON, Blocks.BED, Blocks.FURNACE, Blocks.OAK_DOOR, Blocks.SPRUCE_DOOR, Blocks.BIRCH_DOOR, Blocks.JUNGLE_DOOR, Blocks.ACACIA_DOOR, Blocks.DARK_OAK_DOOR, Blocks.CAKE, Blocks.ENCHANTING_TABLE, Blocks.DRAGON_EGG, Blocks.HOPPER, Blocks.REPEATING_COMMAND_BLOCK, Blocks.COMMAND_BLOCK, Blocks.CHAIN_COMMAND_BLOCK, Blocks.CRAFTING_TABLE); public static boolean canSeeBlock(BlockPos p_Pos) { - return TestUtil.mc.player != null && TestUtil.mc.world.rayTraceBlocks(new Vec3d(TestUtil.mc.player.posX, TestUtil.mc.player.posY + (double) TestUtil.mc.player.getEyeHeight(), TestUtil.mc.player.posZ), new Vec3d(p_Pos.getX(), p_Pos.getY(), p_Pos.getZ()), false, true, false) == null; + return PlaceUtil.mc.player != null && PlaceUtil.mc.world.rayTraceBlocks(new Vec3d(PlaceUtil.mc.player.posX, PlaceUtil.mc.player.posY + (double) PlaceUtil.mc.player.getEyeHeight(), PlaceUtil.mc.player.posZ), new Vec3d(p_Pos.getX(), p_Pos.getY(), p_Pos.getZ()), false, true, false) == null; } public static void placeCrystalOnBlock(BlockPos pos, EnumHand hand) { - RayTraceResult result = TestUtil.mc.world.rayTraceBlocks(new Vec3d(TestUtil.mc.player.posX, TestUtil.mc.player.posY + (double) TestUtil.mc.player.getEyeHeight(), TestUtil.mc.player.posZ), new Vec3d((double) pos.getX() + 0.5, (double) pos.getY() - 0.5, (double) pos.getZ() + 0.5)); + RayTraceResult result = PlaceUtil.mc.world.rayTraceBlocks(new Vec3d(PlaceUtil.mc.player.posX, PlaceUtil.mc.player.posY + (double) PlaceUtil.mc.player.getEyeHeight(), PlaceUtil.mc.player.posZ), new Vec3d((double) pos.getX() + 0.5, (double) pos.getY() - 0.5, (double) pos.getZ() + 0.5)); EnumFacing facing = result == null || result.sideHit == null ? EnumFacing.UP : result.sideHit; - TestUtil.mc.player.connection.sendPacket(new CPacketPlayerTryUseItemOnBlock(pos, facing, hand, 0.0f, 0.0f, 0.0f)); + PlaceUtil.mc.player.connection.sendPacket(new CPacketPlayerTryUseItemOnBlock(pos, facing, hand, 0.0f, 0.0f, 0.0f)); } public static boolean rayTracePlaceCheck(BlockPos pos, boolean shouldCheck, float height) { - return !shouldCheck || TestUtil.mc.world.rayTraceBlocks(new Vec3d(TestUtil.mc.player.posX, TestUtil.mc.player.posY + (double) TestUtil.mc.player.getEyeHeight(), TestUtil.mc.player.posZ), new Vec3d(pos.getX(), (float) pos.getY() + height, pos.getZ()), false, true, false) == null; + return !shouldCheck || PlaceUtil.mc.world.rayTraceBlocks(new Vec3d(PlaceUtil.mc.player.posX, PlaceUtil.mc.player.posY + (double) PlaceUtil.mc.player.getEyeHeight(), PlaceUtil.mc.player.posZ), new Vec3d(pos.getX(), (float) pos.getY() + height, pos.getZ()), false, true, false) == null; } public static boolean rayTracePlaceCheck(BlockPos pos, boolean shouldCheck) { - return TestUtil.rayTracePlaceCheck(pos, shouldCheck, 1.0f); + return PlaceUtil.rayTracePlaceCheck(pos, shouldCheck, 1.0f); } public static void openBlock(BlockPos pos) { EnumFacing[] facings; for (EnumFacing f : facings = EnumFacing.values()) { - Block neighborBlock = TestUtil.mc.world.getBlockState(pos.offset(f)).getBlock(); + Block neighborBlock = PlaceUtil.mc.world.getBlockState(pos.offset(f)).getBlock(); if (!emptyBlocks.contains(neighborBlock)) continue; - TestUtil.mc.playerController.processRightClickBlock(TestUtil.mc.player, TestUtil.mc.world, pos, f.getOpposite(), new Vec3d(pos), EnumHand.MAIN_HAND); + PlaceUtil.mc.playerController.processRightClickBlock(PlaceUtil.mc.player, PlaceUtil.mc.world, pos, f.getOpposite(), new Vec3d(pos), EnumHand.MAIN_HAND); return; } } public static boolean placeBlock(BlockPos pos) { - if (TestUtil.isBlockEmpty(pos)) { + if (PlaceUtil.isBlockEmpty(pos)) { EnumFacing[] facings; for (EnumFacing f : facings = EnumFacing.values()) { - Block neighborBlock = TestUtil.mc.world.getBlockState(pos.offset(f)).getBlock(); + Block neighborBlock = PlaceUtil.mc.world.getBlockState(pos.offset(f)).getBlock(); Vec3d vec = new Vec3d((double) pos.getX() + 0.5 + (double) f.getXOffset() * 0.5, (double) pos.getY() + 0.5 + (double) f.getYOffset() * 0.5, (double) pos.getZ() + 0.5 + (double) f.getZOffset() * 0.5); - if (emptyBlocks.contains(neighborBlock) || !(TestUtil.mc.player.getPositionEyes(mc.getRenderPartialTicks()).distanceTo(vec) <= 4.25)) + if (emptyBlocks.contains(neighborBlock) || !(PlaceUtil.mc.player.getPositionEyes(mc.getRenderPartialTicks()).distanceTo(vec) <= 4.25)) continue; - float[] rot = new float[]{TestUtil.mc.player.rotationYaw, TestUtil.mc.player.rotationPitch}; + float[] rot = new float[]{PlaceUtil.mc.player.rotationYaw, PlaceUtil.mc.player.rotationPitch}; if (rightclickableBlocks.contains(neighborBlock)) { - TestUtil.mc.player.connection.sendPacket(new CPacketEntityAction(TestUtil.mc.player, CPacketEntityAction.Action.START_SNEAKING)); + PlaceUtil.mc.player.connection.sendPacket(new CPacketEntityAction(PlaceUtil.mc.player, CPacketEntityAction.Action.START_SNEAKING)); } - TestUtil.mc.playerController.processRightClickBlock(TestUtil.mc.player, TestUtil.mc.world, pos.offset(f), f.getOpposite(), new Vec3d(pos), EnumHand.MAIN_HAND); + PlaceUtil.mc.playerController.processRightClickBlock(PlaceUtil.mc.player, PlaceUtil.mc.world, pos.offset(f), f.getOpposite(), new Vec3d(pos), EnumHand.MAIN_HAND); if (rightclickableBlocks.contains(neighborBlock)) { - TestUtil.mc.player.connection.sendPacket(new CPacketEntityAction(TestUtil.mc.player, CPacketEntityAction.Action.STOP_SNEAKING)); + PlaceUtil.mc.player.connection.sendPacket(new CPacketEntityAction(PlaceUtil.mc.player, CPacketEntityAction.Action.STOP_SNEAKING)); } - TestUtil.mc.player.swingArm(EnumHand.MAIN_HAND); + PlaceUtil.mc.player.swingArm(EnumHand.MAIN_HAND); return true; } } @@ -76,10 +76,10 @@ public static boolean placeBlock(BlockPos pos) { public static boolean isBlockEmpty(BlockPos pos) { try { - if (emptyBlocks.contains(TestUtil.mc.world.getBlockState(pos).getBlock())) { + if (emptyBlocks.contains(PlaceUtil.mc.world.getBlockState(pos).getBlock())) { Entity e; AxisAlignedBB box = new AxisAlignedBB(pos); - Iterator entityIter = TestUtil.mc.world.loadedEntityList.iterator(); + Iterator entityIter = PlaceUtil.mc.world.loadedEntityList.iterator(); do { if (entityIter.hasNext()) continue; return true; @@ -92,12 +92,12 @@ public static boolean isBlockEmpty(BlockPos pos) { } public static boolean canPlaceBlock(BlockPos pos) { - if (TestUtil.isBlockEmpty(pos)) { + if (PlaceUtil.isBlockEmpty(pos)) { EnumFacing[] facings; for (EnumFacing f : facings = EnumFacing.values()) { - if (emptyBlocks.contains(TestUtil.mc.world.getBlockState(pos.offset(f)).getBlock())) continue; + if (emptyBlocks.contains(PlaceUtil.mc.world.getBlockState(pos.offset(f)).getBlock())) continue; Vec3d vec3d = new Vec3d((double) pos.getX() + 0.5 + (double) f.getXOffset() * 0.5, (double) pos.getY() + 0.5 + (double) f.getYOffset() * 0.5, (double) pos.getZ() + 0.5 + (double) f.getZOffset() * 0.5); - if (!(TestUtil.mc.player.getPositionEyes(mc.getRenderPartialTicks()).distanceTo(vec3d) <= 4.25)) + if (!(PlaceUtil.mc.player.getPositionEyes(mc.getRenderPartialTicks()).distanceTo(vec3d) <= 4.25)) continue; return true; } diff --git a/src/main/java/com/me/infinity/loop/util/utils/PlayerUtil.java b/src/main/java/me/loop/util/impl/PlayerUtil.java similarity index 87% rename from src/main/java/com/me/infinity/loop/util/utils/PlayerUtil.java rename to src/main/java/me/loop/util/impl/PlayerUtil.java index 28a89c7..ca275ca 100644 --- a/src/main/java/com/me/infinity/loop/util/utils/PlayerUtil.java +++ b/src/main/java/me/loop/util/impl/PlayerUtil.java @@ -1,4 +1,4 @@ -package com.me.infinity.loop.util.utils; +package me.loop.util.impl; import com.google.common.collect.Lists; import com.google.gson.JsonArray; @@ -6,13 +6,11 @@ import com.google.gson.JsonObject; import com.google.gson.JsonParser; import com.mojang.util.UUIDTypeAdapter; -import com.me.infinity.loop.features.command.Command; -import com.me.infinity.loop.util.utils.worlds.Timer; +import me.loop.features.command.Command; +import me.loop.util.init.Timer; import net.minecraft.advancements.AdvancementManager; import net.minecraft.client.network.NetworkPlayerInfo; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.util.math.BlockPos; import org.apache.commons.io.IOUtils; import javax.net.ssl.HttpsURLConnection; @@ -23,17 +21,8 @@ import java.util.*; public class PlayerUtil implements Util { - - public static Timer timer = new Timer(); private static final JsonParser PARSER = new JsonParser(); - - public static BlockPos getPlayerPos() { - return new BlockPos(Math.floor(mc.player.posX), Math.floor(mc.player.posY), Math.floor(mc.player.posZ)); - } - - public static BlockPos getPlayerPos(double pY) { - return new BlockPos(Math.floor(mc.player.posX), Math.floor(mc.player.posY + pY), Math.floor(mc.player.posZ)); - } + public static Timer timer; public static String getNameFromUUID(UUID uuid) { try { @@ -99,16 +88,6 @@ public static String convertStreamToString(InputStream is) { return s.hasNext() ? s.next() : "/"; } - public static boolean isInHole() { - - BlockPos player_block = getPlayerPos(); - - return mc.world.getBlockState(player_block.east()).getBlock() != Blocks.AIR - && mc.world.getBlockState(player_block.west()).getBlock() != Blocks.AIR - && mc.world.getBlockState(player_block.north()).getBlock() != Blocks.AIR - && mc.world.getBlockState(player_block.south()).getBlock() != Blocks.AIR; - } - public static List getHistoryOfNames(UUID id) { try { JsonArray array = getResources(new URL("https://api.mojang.com/user/profiles/" + getIdNoHyphens(id) + "/names"), "GET").getAsJsonArray(); @@ -117,7 +96,7 @@ public static List getHistoryOfNames(UUID id) { JsonObject node = e.getAsJsonObject(); String name = node.get("name").getAsString(); long changedAt = node.has("changedToAt") ? node.get("changedToAt").getAsLong() : 0L; - temp.add(name + "§8" + (new Date(changedAt))); + temp.add(name + "§8" + (new Date(changedAt)).toString()); } Collections.sort(temp); return temp; @@ -173,7 +152,7 @@ public lookUpUUID(String name) { public void run() { NetworkPlayerInfo profile; try { - ArrayList infoMap = new ArrayList<>(Objects.requireNonNull(Util.mc.getConnection()).getPlayerInfoMap()); + ArrayList infoMap = new ArrayList<>(Objects.requireNonNull(mc.getConnection()).getPlayerInfoMap()); profile = infoMap.stream().filter(networkPlayerInfo -> networkPlayerInfo.getGameProfile().getName().equalsIgnoreCase(this.name)).findFirst().orElse(null); assert profile != null; this.uuid = profile.getGameProfile().getId(); diff --git a/src/main/java/com/me/infinity/loop/util/utils/renders/builder/Render2DBuilder.java b/src/main/java/me/loop/util/impl/Render2DBuilder.java similarity index 90% rename from src/main/java/com/me/infinity/loop/util/utils/renders/builder/Render2DBuilder.java rename to src/main/java/me/loop/util/impl/Render2DBuilder.java index 9bfc7d8..982e6eb 100644 --- a/src/main/java/com/me/infinity/loop/util/utils/renders/builder/Render2DBuilder.java +++ b/src/main/java/me/loop/util/impl/Render2DBuilder.java @@ -1,6 +1,5 @@ -package com.me.infinity.loop.util.utils.renders.builder; +package me.loop.util.impl; -import com.me.infinity.loop.mixin.MixinInterface; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.renderer.GlStateManager; import org.lwjgl.opengl.GL11; @@ -10,7 +9,7 @@ * @since 02/07/2021 */ -public class Render2DBuilder implements MixinInterface { +public class Render2DBuilder implements Util { public static void prepareScissor(int x, double y, int width, double height) { GL11.glPushAttrib(GL11.GL_SCISSOR_BIT); diff --git a/src/main/java/com/me/infinity/loop/util/utils/renders/RenderUtil.java b/src/main/java/me/loop/util/impl/RenderUtil.java similarity index 97% rename from src/main/java/com/me/infinity/loop/util/utils/renders/RenderUtil.java rename to src/main/java/me/loop/util/impl/RenderUtil.java index 905698b..4fac502 100644 --- a/src/main/java/com/me/infinity/loop/util/utils/renders/RenderUtil.java +++ b/src/main/java/me/loop/util/impl/RenderUtil.java @@ -1,10 +1,7 @@ -package com.me.infinity.loop.util.utils.renders; +package me.loop.util.impl; -import com.me.infinity.loop.InfinityLoop; -import com.me.infinity.loop.util.utils.interfaces.IShaderGroup; -import com.me.infinity.loop.util.utils.EntityUtil; -import com.me.infinity.loop.util.utils.Util; -import com.me.infinity.loop.util.utils.PlayerUtil; +import me.loop.InfinityLoop; +import me.loop.mixin.mixins.IShaderGroup; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; @@ -61,7 +58,7 @@ public class RenderUtil protected static int lastScaleWidth; protected static int lastScaleHeight; protected static Framebuffer buffer; - protected static final ResourceLocation shader = new ResourceLocation("loop:shaders/blur.json"); + protected static final ResourceLocation shader = new ResourceLocation("loop","shaders/blur.json"); static { @@ -484,6 +481,40 @@ public static void drawGradientPlane(BlockPos pos, EnumFacing face, Color startC GlStateManager.popMatrix(); } + public static void drawGradientRectTwo(float left, float top, float right, float bottom, int coltl, int coltr, int colbl, int colbr) { + GlStateManager.disableTexture2D(); + GlStateManager.enableBlend(); + GlStateManager.disableAlpha(); + GlStateManager.tryBlendFuncSeparate((int)770, (int)771, (int)1, (int)0); + GlStateManager.shadeModel((int)7425); + Tessellator tessellator = Tessellator.getInstance(); + BufferBuilder buffer = tessellator.getBuffer(); + buffer.begin(7, DefaultVertexFormats.POSITION_COLOR); + buffer.pos((double)right, (double)top, 0.0).color((coltr & 0xFF0000) >> 16, (coltr & 0xFF00) >> 8, coltr & 0xFF, (coltr & 0xFF000000) >>> 24).endVertex(); + buffer.pos((double)left, (double)top, 0.0).color((coltl & 0xFF0000) >> 16, (coltl & 0xFF00) >> 8, coltl & 0xFF, (coltl & 0xFF000000) >>> 24).endVertex(); + buffer.pos((double)left, (double)bottom, 0.0).color((colbl & 0xFF0000) >> 16, (colbl & 0xFF00) >> 8, colbl & 0xFF, (colbl & 0xFF000000) >>> 24).endVertex(); + buffer.pos((double)right, (double)bottom, 0.0).color((colbr & 0xFF0000) >> 16, (colbr & 0xFF00) >> 8, colbr & 0xFF, (colbr & 0xFF000000) >>> 24).endVertex(); + tessellator.draw(); + GlStateManager.shadeModel((int)7424); + GlStateManager.disableBlend(); + GlStateManager.enableAlpha(); + GlStateManager.enableTexture2D(); + } + + public static void drawColorShader(int x1, int y1, int x2, int y2, int color, int radius) { + int a = 50; + float f = (float) (color >> 16 & 0xFF) / 255.0f; + float f1 = (float) (color >> 8 & 0xFF) / 255.0f; + float f2 = (float) (color >> 0 & 0xFF) / 255.0f; + RenderUtil.drawGradientRectTwo(x1 - radius, y1, x1, y2, ColorUtil.toRGBA(f, f1, f2, 0.0f), ColorUtil.toRGBA(f, f1, f2, (float) a), ColorUtil.toRGBA(f, f1, f2, 0.0f), ColorUtil.toRGBA(f, f1, f2, (float) a)); + RenderUtil.drawGradientRectTwo(x2, y1, x2 + radius, y2, ColorUtil.toRGBA(f, f1, f2, (float) a), ColorUtil.toRGBA(f, f1, f2, 0.0f), ColorUtil.toRGBA(f, f1, f2, (float) a), ColorUtil.toRGBA(f, f1, f2, 0.0f)); + RenderUtil.drawGradientRectTwo(x1, y1 - radius, x2, y1, ColorUtil.toRGBA(f, f1, f2, 0.0f), ColorUtil.toRGBA(f, f1, f2, 0.0f), ColorUtil.toRGBA(f, f1, f2, (float) a), ColorUtil.toRGBA(f, f1, f2, (float) a)); + RenderUtil.drawGradientRectTwo(x1, y2, x2, y2 + radius, ColorUtil.toRGBA(f, f1, f2, (float) a), ColorUtil.toRGBA(f, f1, f2, (float) a), ColorUtil.toRGBA(f, f1, f2, 0.0f), ColorUtil.toRGBA(f, f1, f2, 0.0f)); + RenderUtil.drawGradientRectTwo(x1 - radius, y1 - radius, x1, y1, ColorUtil.toRGBA(f, f1, f2, 0.0f), ColorUtil.toRGBA(f, f1, f2, 0.0f), ColorUtil.toRGBA(f, f1, f2, 0.0f), ColorUtil.toRGBA(f, f1, f2, (float) a)); + RenderUtil.drawGradientRectTwo(x2, y1 - radius, x2 + radius, y1, ColorUtil.toRGBA(f, f1, f2, 0.0f), ColorUtil.toRGBA(f, f1, f2, 0.0f), ColorUtil.toRGBA(f, f1, f2, (float) a), ColorUtil.toRGBA(f, f1, f2, 0.0f)); + RenderUtil.drawGradientRectTwo(x1 - radius, y2, x1, y2 + radius, ColorUtil.toRGBA(f, f1, f2, 0.0f), ColorUtil.toRGBA(f, f1, f2, (float) a), ColorUtil.toRGBA(f, f1, f2, 0.0f), ColorUtil.toRGBA(f, f1, f2, 0.0f)); + RenderUtil.drawGradientRectTwo(x2, y2, x2 + radius, y2 + radius, ColorUtil.toRGBA(f, f1, f2, (float) a), ColorUtil.toRGBA(f, f1, f2, 0.0f), ColorUtil.toRGBA(f, f1, f2, 0.0f), ColorUtil.toRGBA(f, f1, f2, 0.0f)); + } public static void initFboAndShader() { try { if (buffer != null) { @@ -2601,3 +2632,5 @@ public static void drawHalfBox(BlockPos blockPos, int r, int g, int b, int a, in } } + + diff --git a/src/main/java/me/loop/util/impl/RotationUtil.java b/src/main/java/me/loop/util/impl/RotationUtil.java new file mode 100644 index 0000000..9609279 --- /dev/null +++ b/src/main/java/me/loop/util/impl/RotationUtil.java @@ -0,0 +1,77 @@ +package me.loop.util.impl; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.network.play.client.CPacketPlayer; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.Vec3d; + +public class RotationUtil + implements Util { + public static Vec3d getEyesPos() { + return new Vec3d(mc.player.posX, mc.player.posY + (double) mc.player.getEyeHeight(), mc.player.posZ); + } + + public static double[] calculateLookAt(double px, double py, double pz, EntityPlayer me) { + double dirx = me.posX - px; + double diry = me.posY - py; + double dirz = me.posZ - pz; + double len = Math.sqrt(dirx * dirx + diry * diry + dirz * dirz); + double pitch = Math.asin(diry /= len); + double yaw = Math.atan2(dirz /= len, dirx /= len); + pitch = pitch * 180.0 / Math.PI; + yaw = yaw * 180.0 / Math.PI; + return new double[]{yaw += 90.0, pitch}; + } + + public static float[] getLegitRotations(Vec3d vec) { + Vec3d eyesPos = RotationUtil.getEyesPos(); + double diffX = vec.x - eyesPos.x; + double diffY = vec.y - eyesPos.y; + double diffZ = vec.z - eyesPos.z; + double diffXZ = Math.sqrt(diffX * diffX + diffZ * diffZ); + float yaw = (float) Math.toDegrees(Math.atan2(diffZ, diffX)) - 90.0f; + float pitch = (float) (-Math.toDegrees(Math.atan2(diffY, diffXZ))); + return new float[]{mc.player.rotationYaw + MathHelper.wrapDegrees(yaw - mc.player.rotationYaw), mc.player.rotationPitch + MathHelper.wrapDegrees(pitch - mc.player.rotationPitch)}; + } + + public static void faceYawAndPitch(float yaw, float pitch) { + mc.player.connection.sendPacket(new CPacketPlayer.Rotation(yaw, pitch, mc.player.onGround)); + } + + public static void faceVector(Vec3d vec, boolean normalizeAngle) { + float[] rotations = RotationUtil.getLegitRotations(vec); + mc.player.connection.sendPacket(new CPacketPlayer.Rotation(rotations[0], normalizeAngle ? (float) MathHelper.normalizeAngle((int) rotations[1], 360) : rotations[1], mc.player.onGround)); + } + + public static void faceEntity(Entity entity) { + float[] angle = MathUtil.calcAngle(mc.player.getPositionEyes(mc.getRenderPartialTicks()), entity.getPositionEyes(mc.getRenderPartialTicks())); + RotationUtil.faceYawAndPitch(angle[0], angle[1]); + } + + public static float[] getAngle(Entity entity) { + return MathUtil.calcAngle(mc.player.getPositionEyes(mc.getRenderPartialTicks()), entity.getPositionEyes(mc.getRenderPartialTicks())); + } + + public static int getDirection4D() { + return MathHelper.floor((double) (mc.player.rotationYaw * 4.0f / 360.0f) + 0.5) & 3; + } + + public static String getDirection4D(boolean northRed) { + int dirnumber = RotationUtil.getDirection4D(); + if (dirnumber == 0) { + return "South (+Z)"; + } + if (dirnumber == 1) { + return "West (-X)"; + } + if (dirnumber == 2) { + return (northRed ? "\u00c2\u00a7c" : "") + "North (-Z)"; + } + if (dirnumber == 3) { + return "East (+X)"; + } + return "Loading..."; + } +} + diff --git a/src/main/java/com/me/infinity/loop/util/utils/renders/shaders/ShaderUtil.java b/src/main/java/me/loop/util/impl/ShaderUtil.java similarity index 98% rename from src/main/java/com/me/infinity/loop/util/utils/renders/shaders/ShaderUtil.java rename to src/main/java/me/loop/util/impl/ShaderUtil.java index 34cf0c5..a88ad25 100644 --- a/src/main/java/com/me/infinity/loop/util/utils/renders/shaders/ShaderUtil.java +++ b/src/main/java/me/loop/util/impl/ShaderUtil.java @@ -1,6 +1,6 @@ -package com.me.infinity.loop.util.utils.renders.shaders; +package me.loop.util.impl; -import com.me.infinity.loop.util.utils.Util; +import me.loop.util.impl.Util; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.util.ResourceLocation; diff --git a/src/main/java/com/me/infinity/loop/util/utils/renders/TextUtil.java b/src/main/java/me/loop/util/impl/TextUtil.java similarity index 94% rename from src/main/java/com/me/infinity/loop/util/utils/renders/TextUtil.java rename to src/main/java/me/loop/util/impl/TextUtil.java index 579196e..ac47d5c 100644 --- a/src/main/java/com/me/infinity/loop/util/utils/renders/TextUtil.java +++ b/src/main/java/me/loop/util/impl/TextUtil.java @@ -1,4 +1,4 @@ -package com.me.infinity.loop.util.utils.renders; +package me.loop.util.impl; import com.mojang.realmsclient.gui.ChatFormatting; @@ -107,18 +107,6 @@ public static String coloredString(String string, Color color) { return coloredString; } - public static String get32BitString(int value) - { - StringBuilder r = new StringBuilder(Integer.toHexString(value)); - - while (r.length() < 8) - { - r.insert(0, 0); - } - - return r.toString().toUpperCase(); - } - public static String cropMaxLengthMessage(String s, int i) { String output = ""; if (s.length() >= 256 - i) { diff --git a/src/main/java/me/loop/util/impl/Util.java b/src/main/java/me/loop/util/impl/Util.java new file mode 100644 index 0000000..8c821d1 --- /dev/null +++ b/src/main/java/me/loop/util/impl/Util.java @@ -0,0 +1,8 @@ +package me.loop.util.impl; + +import net.minecraft.client.Minecraft; + +public interface Util { + Minecraft mc = Minecraft.getMinecraft(); +} + diff --git a/src/main/java/com/me/infinity/loop/util/utils/renders/Drawable.java b/src/main/java/me/loop/util/init/Drawable.java similarity index 98% rename from src/main/java/com/me/infinity/loop/util/utils/renders/Drawable.java rename to src/main/java/me/loop/util/init/Drawable.java index 2897963..335bb50 100644 --- a/src/main/java/com/me/infinity/loop/util/utils/renders/Drawable.java +++ b/src/main/java/me/loop/util/init/Drawable.java @@ -1,21 +1,20 @@ -package com.me.infinity.loop.util.utils.renders; +package me.loop.util.init; -import static org.lwjgl.opengl.GL11.glDisable; -import java.awt.Color; -import java.awt.Graphics; -import java.awt.Rectangle; -import java.awt.image.BufferedImage; -import java.util.HashMap; - -import com.me.infinity.loop.util.utils.Util; -import org.lwjgl.opengl.GL11; import com.jhlabs.image.GaussianFilter; +import me.loop.util.impl.Util; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.texture.TextureUtil; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; + +import java.awt.*; +import java.awt.image.BufferedImage; +import java.util.HashMap; + +import static org.lwjgl.opengl.GL11.glDisable; public class Drawable { diff --git a/src/main/java/com/me/infinity/loop/util/utils/worlds/Timer.java b/src/main/java/me/loop/util/init/Timer.java similarity index 96% rename from src/main/java/com/me/infinity/loop/util/utils/worlds/Timer.java rename to src/main/java/me/loop/util/init/Timer.java index 49d6062..20c32c7 100644 --- a/src/main/java/com/me/infinity/loop/util/utils/worlds/Timer.java +++ b/src/main/java/me/loop/util/init/Timer.java @@ -1,4 +1,4 @@ -package com.me.infinity.loop.util.utils.worlds; +package me.loop.util.init; public class Timer { @@ -61,7 +61,3 @@ public long convertToNS(final long time) { return time * 1000000L; } } - - - - diff --git a/src/main/java/me/loop/util/init/shaders/GLSLShader.java b/src/main/java/me/loop/util/init/shaders/GLSLShader.java new file mode 100644 index 0000000..a764995 --- /dev/null +++ b/src/main/java/me/loop/util/init/shaders/GLSLShader.java @@ -0,0 +1,81 @@ +package me.loop.util.init.shaders; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; + +import static org.lwjgl.opengl.GL20.*; + +public class GLSLShader { + + private final int programId; + private final int timeUniform; + private final int mouseUniform; + private final int resolutionUniform; + + public GLSLShader(String fragmentShaderLocation) throws IOException { + int program = glCreateProgram(); + + glAttachShader(program, createShader("shaders/passthrough.vsh", GLSLShader.class.getResourceAsStream("shaders/passthrough.vsh"), GL_VERTEX_SHADER)); + glAttachShader(program, createShader(fragmentShaderLocation, GLSLShader.class.getResourceAsStream(fragmentShaderLocation), GL_FRAGMENT_SHADER)); + + glLinkProgram(program); + + int linked = glGetProgrami(program, GL_LINK_STATUS); + + if (linked == 0) { + throw new IllegalStateException("Shader failed to link"); + } + + programId = program; + + glUseProgram(program); + + timeUniform = glGetUniformLocation(program, "time"); + mouseUniform = glGetUniformLocation(program, "mouse"); + resolutionUniform = glGetUniformLocation(program, "resolution"); + + glUseProgram(0); + } + + public void useShader(int width, int height, float mouseX, float mouseY, float time) { + glUseProgram(programId); + + glUniform2f(resolutionUniform, width, height); + glUniform2f(mouseUniform, mouseX / width, 1.0f - mouseY / height); + glUniform1f(timeUniform, time); + } + + private int createShader(String check, InputStream inputStream, int shaderType) throws IOException { + int shader = glCreateShader(shaderType); + + glShaderSource(shader, readStreamToString(inputStream)); + + glCompileShader(shader); + + int compiled = glGetShaderi(shader, GL_COMPILE_STATUS); + + if (compiled == 0) { + System.err.println(glGetShaderInfoLog(shader, glGetShaderi(shader, GL_INFO_LOG_LENGTH))); + System.err.println("Caused by " + check); + throw new IllegalStateException("Failed to compile shader: " + check); + } + + return shader; + } + + private String readStreamToString(InputStream inputStream) throws IOException { + ByteArrayOutputStream out = new ByteArrayOutputStream(); + + byte[] buffer = new byte[512]; + + int read; + + while ((read = inputStream.read(buffer, 0, buffer.length)) != -1) { + out.write(buffer, 0, read); + } + + return new String(out.toByteArray(), StandardCharsets.UTF_8); + } +} diff --git a/src/main/java/com/me/infinity/loop/util/utils/renders/shaders/PNGtoResourceLocation.java b/src/main/java/me/loop/util/init/shaders/PNGtoResourceLocation.java similarity index 97% rename from src/main/java/com/me/infinity/loop/util/utils/renders/shaders/PNGtoResourceLocation.java rename to src/main/java/me/loop/util/init/shaders/PNGtoResourceLocation.java index 1007b3b..217d759 100644 --- a/src/main/java/com/me/infinity/loop/util/utils/renders/shaders/PNGtoResourceLocation.java +++ b/src/main/java/me/loop/util/init/shaders/PNGtoResourceLocation.java @@ -1,4 +1,4 @@ -package com.me.infinity.loop.util.utils.renders.shaders; +package me.loop.util.init.shaders; import net.minecraft.client.renderer.texture.DynamicTexture; import net.minecraft.util.ResourceLocation; diff --git a/src/main/java/com/me/infinity/loop/util/utils/renders/helper/RoundedShader.java b/src/main/java/me/loop/util/init/shaders/RoundedShader.java similarity index 97% rename from src/main/java/com/me/infinity/loop/util/utils/renders/helper/RoundedShader.java rename to src/main/java/me/loop/util/init/shaders/RoundedShader.java index 27e83ee..814a7b5 100644 --- a/src/main/java/com/me/infinity/loop/util/utils/renders/helper/RoundedShader.java +++ b/src/main/java/me/loop/util/init/shaders/RoundedShader.java @@ -1,7 +1,7 @@ -package com.me.infinity.loop.util.utils.renders.helper; +package me.loop.util.init.shaders; -import com.me.infinity.loop.util.utils.renders.ColorUtil; -import com.me.infinity.loop.util.utils.renders.shaders.ShaderUtil; +import me.loop.util.impl.ColorUtil; +import me.loop.util.impl.ShaderUtil; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.renderer.GlStateManager; diff --git a/src/main/resources/loop_at.cfg b/src/main/resources/infinityloop_at.cfg similarity index 97% rename from src/main/resources/loop_at.cfg rename to src/main/resources/infinityloop_at.cfg index 01219d4..ce9adc2 100644 --- a/src/main/resources/loop_at.cfg +++ b/src/main/resources/infinityloop_at.cfg @@ -38,7 +38,6 @@ public net.minecraft.tileentity.TileEntity field_145854_h # blockType public net.minecraft.item.ItemBlock field_150939_a # block public net.minecraft.client.renderer.RenderGlobal field_72738_E # damagedBlocks public net.minecraft.item.ItemTool field_77865_bY # attackDamage -public net.minecraft.util.Timer field_194149_e #TODO: target more specifically #public net.minecraft.network.NetworkManager * diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index 5e947be..7a3170e 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -1,6 +1,6 @@ [ { - "modid": "loop", + "modid": "infinityloop", "name": "InfinityLoop", "description": "1.12.2 Anarchy PvP Client", "version": "0.0.3", diff --git a/src/main/resources/mixins.loop.json b/src/main/resources/mixins.infinityloop.json similarity index 57% rename from src/main/resources/mixins.loop.json rename to src/main/resources/mixins.infinityloop.json index 523de7c..795c4c2 100644 --- a/src/main/resources/mixins.loop.json +++ b/src/main/resources/mixins.infinityloop.json @@ -1,20 +1,14 @@ { "required": true, "compatibilityLevel": "JAVA_8", - "package": "com.me.infinity.loop.mixin.mixins", - "refmap": "mixins.loop.refmap.json", + "package": "me.loop.mixin.mixins", + "refmap": "mixins.infinityloop.refmap.json", "mixins": [ "MixinBlockLiquid", "MixinEntityPlayer", - "IEntityRenderer", - "IRenderManager", "MixinEntityPlayerSP", - "MixinGuiMainMenu", "MixinEntityRenderer", - "MixinRenderPlayer", - "MixinEntityLivingBase", "MixinGuiNewChat", - "MixinKeyBinding", "MixinGuiPlayerTabOverlay", "MixinGuiScreen", "MixinItemRenderer", @@ -24,9 +18,6 @@ "MixinPlayerControllerMP", "MixinRenderEnderCrystal", "MixinRenderLivingBase", - "MixinRenderEntityItem", - "MixinRenderer", - "MixinWorld", - "MixinShaderGroup" + "MixinWorld" ] }