data) {
- isObfuscatedEnvironment = (boolean) (Boolean) data.get("runtimeDeobfuscationEnabled");
+ OBFUSCATED = (Boolean) data.get("runtimeDeobfuscationEnabled");
}
@Override
diff --git a/src/main/java/net/daporkchop/pepsimod/asm/core/minecraft/client/MixinMinecraft.java b/src/main/java/net/daporkchop/pepsimod/asm/core/minecraft/client/MixinMinecraft.java
new file mode 100644
index 0000000..cc3f470
--- /dev/null
+++ b/src/main/java/net/daporkchop/pepsimod/asm/core/minecraft/client/MixinMinecraft.java
@@ -0,0 +1,74 @@
+/*
+ * Adapted from The MIT License (MIT)
+ *
+ * Copyright (c) 2016-2020 DaPorkchop_
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions:
+ *
+ * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
+ * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+package net.daporkchop.pepsimod.asm.core.minecraft.client;
+
+import net.daporkchop.pepsimod.asm.PepsimodMixinLoader;
+import net.daporkchop.pepsimod.util.PepsiUtil;
+import net.minecraft.client.Minecraft;
+import net.minecraft.util.Util;
+import org.lwjgl.opengl.Display;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.Overwrite;
+import org.spongepowered.asm.mixin.injection.Constant;
+import org.spongepowered.asm.mixin.injection.ModifyConstant;
+
+import java.awt.image.BufferedImage;
+import java.nio.ByteBuffer;
+
+/**
+ * @author DaPorkchop_
+ */
+@Mixin(Minecraft.class)
+abstract class MixinMinecraft {
+ @ModifyConstant(
+ method = "Lnet/minecraft/client/Minecraft;createDisplay()V",
+ constant = @Constant(stringValue = "Minecraft 1.12.2")
+ )
+ private String changeWindowTitle(String oldTitle) {
+ return String.format("pepsimod %s", PepsimodMixinLoader.OBFUSCATED ? "VERSION_FULL" : "(dev environment)");
+ }
+
+ /**
+ * Use the Pepsi logo as the window icon instead of the default crafting table.
+ *
+ * @author DaPorkchop_
+ * @reason we change the whole thing!
+ */
+ @Overwrite
+ private void setWindowIcon() {
+ if (Util.getOSType() != Util.EnumOS.OSX) {
+ ByteBuffer[] buffers = new ByteBuffer[PepsiUtil.PEPSI_LOGOS.length];
+ for (int i = buffers.length - 1; i >= 0; i--) {
+ int size = PepsiUtil.PEPSI_LOGO_SIZES[i];
+ ByteBuffer buffer = ByteBuffer.allocate((size * size) << 2);
+ BufferedImage img = PepsiUtil.PEPSI_LOGOS[i];
+ for (int y = 0; y < size; y++) {
+ for (int x = 0; x < size; x++) {
+ int c = img.getRGB(x, y);
+ buffer.putInt(c << 8 | ((c >> 24) & 255));
+ }
+ }
+ buffers[i] = (ByteBuffer) buffer.flip();
+ }
+ Display.setIcon(buffers);
+ }
+ }
+}
diff --git a/src/main/java/net/daporkchop/pepsimod/asm/core/minecraft/client/gui/MixinGuiBossOverlay.java b/src/main/java/net/daporkchop/pepsimod/asm/core/minecraft/client/gui/MixinGuiBossOverlay.java
new file mode 100644
index 0000000..34b5b01
--- /dev/null
+++ b/src/main/java/net/daporkchop/pepsimod/asm/core/minecraft/client/gui/MixinGuiBossOverlay.java
@@ -0,0 +1,175 @@
+/*
+ * Adapted from The MIT License (MIT)
+ *
+ * Copyright (c) 2016-2020 DaPorkchop_
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions:
+ *
+ * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
+ * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+package net.daporkchop.pepsimod.asm.core.minecraft.client.gui;
+
+import net.daporkchop.pepsimod.util.mixin.client.gui.GuiBossOverlay.MergedBossInfo;
+import net.minecraft.client.gui.BossInfoClient;
+import net.minecraft.client.gui.Gui;
+import net.minecraft.client.gui.GuiBossOverlay;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.network.play.server.SPacketUpdateBossInfo;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.world.BossInfo;
+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.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import static net.daporkchop.pepsimod.util.PepsiConstants.RESOLUTION;
+import static net.daporkchop.pepsimod.util.PepsiConstants.mc;
+
+/**
+ * Inspired by the version I made for Future.
+ *
+ * This merges boss bars with identical names together and adds a count behind boss bars that appear multiple times.
+ *
+ * A major difference from the Future version (aside from the implementation, which is basically completely different) is that it renders all boss bars
+ * simultaneously, adjusting the opacity according to the count.
+ *
+ * @author DaPorkchop_
+ */
+@Mixin(GuiBossOverlay.class)
+abstract class MixinGuiBossOverlay extends Gui {
+ @Shadow
+ @Final
+ private static ResourceLocation GUI_BARS_TEXTURES;
+ @Shadow
+ @Final
+ private Map mapBossInfos;
+
+ private final Map mergedBossInfos = new HashMap<>();
+
+ /**
+ * This method is overwritten because I change nearly the whole thing.
+ *
+ * @author DaPorkchop_
+ * @reason efficiency
+ */
+ @Overwrite
+ public void renderBossHealth() {
+ if (!this.mergedBossInfos.isEmpty()) {
+ int abortHeight = RESOLUTION.height() / 3; //the Y position at which we will stop rendering boss bars to avoid filling the screen
+
+ int center = RESOLUTION.width() >> 1;
+ int x = center - 91;
+ int y = 12;
+
+ for (MergedBossInfo merged : this.mergedBossInfos.values()) {
+ { //render boss bars
+ mc.getTextureManager().bindTexture(GUI_BARS_TEXTURES);
+ GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
+
+ //draw background
+ this.drawTexturedModalRect(x, y, 0, merged.color().ordinal() * 10, 182, 5);
+
+ //draw health bars
+ //we use an alpha level equal to 1/count to make sure that one can see the health of all of the bars individually, even though they're drawn on top of each other.
+ //TODO: for whatever reason the alpha seems to be more of an exponential curve than a linear one, or maybe that's just an illusion. either way it's hard to differentiate between individual boss bars, maybe i need to improve the contrast somehow or add a marker.
+ GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f / merged.entries().size());
+ for (BossInfoClient info : merged.entries()) {
+ int progress = (int) (info.getPercent() * 183.0f);
+ if (progress > 0) {
+ this.drawTexturedModalRect(x, y, 0, info.getColor().ordinal() * 10 + 5, progress, 5);
+ }
+ }
+
+ //draw progress overlay thing (has notches for steps)
+ GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
+ if (merged.overlay() != BossInfo.Overlay.PROGRESS) {
+ this.drawTexturedModalRect(x, y, 0, 80 + (merged.overlay().ordinal() - 1) * 10, 182, 5);
+ }
+ }
+
+ { //draw name
+ //we only add the count suffix if there's multiple boss bars on top of each other
+ String s = merged.count() == 1 ? merged.name() : String.format("%s§r §7(§fx%d§7)", merged.name(), merged.count());
+ mc.fontRenderer.drawStringWithShadow(s, center - mc.fontRenderer.getStringWidth(s) * 0.5f, y - 9.0f, 16777215);
+ }
+
+ //move down
+ y += 10 + mc.fontRenderer.FONT_HEIGHT;
+ if (y >= abortHeight) {
+ //abort if the vertical position is too far down the screen
+ break;
+ }
+ }
+ }
+ }
+
+ /**
+ * This method is overwritten because I change nearly the whole thing.
+ *
+ * @author DaPorkchop_
+ * @reason efficiency
+ */
+ @Overwrite
+ public void read(SPacketUpdateBossInfo packetIn) {
+ switch (packetIn.getOperation()) {
+ case ADD: {
+ BossInfoClient info = new BossInfoClient(packetIn);
+ this.mapBossInfos.put(packetIn.getUniqueId(), info);
+ this.mergedBossInfos.computeIfAbsent(info.getName().getFormattedText(), MergedBossInfo::new).add(info);
+ }
+ break;
+ case REMOVE: {
+ BossInfoClient info = this.mapBossInfos.remove(packetIn.getUniqueId());
+ String text = info.getName().getFormattedText();
+ MergedBossInfo merged = this.mergedBossInfos.get(text);
+ if (merged != null && merged.remove(info)) { //remove the old MergedBossInfo if it's empty
+ this.mergedBossInfos.remove(text);
+ }
+ }
+ break;
+ case UPDATE_NAME: {
+ //remove this entry from the old name and add it to the new name
+ BossInfoClient info = this.mapBossInfos.get(packetIn.getUniqueId());
+ String text = info.getName().getFormattedText();
+ MergedBossInfo merged = this.mergedBossInfos.get(text);
+ if (merged != null && merged.remove(info)) {
+ this.mergedBossInfos.remove(text);
+ }
+ info.setName(packetIn.getName());
+ this.mergedBossInfos.computeIfAbsent(info.getName().getFormattedText(), MergedBossInfo::new).add(info);
+ }
+ break;
+ default:
+ //otherwise we let the packet handle it
+ this.mapBossInfos.get(packetIn.getUniqueId()).updateFromPacket(packetIn);
+ }
+ }
+
+ /**
+ * This method is overwritten for efficiency since I add one line.
+ *
+ * @author DaPorkchop_
+ * @reason efficiency
+ */
+ @Overwrite
+ public void clearBossInfos() {
+ this.mapBossInfos.clear();
+ this.mergedBossInfos.clear();
+ }
+}
+
diff --git a/src/main/java/net/daporkchop/pepsimod/asm/core/minecraft/client/gui/MixinGuiMainMenu.java b/src/main/java/net/daporkchop/pepsimod/asm/core/minecraft/client/gui/MixinGuiMainMenu.java
new file mode 100644
index 0000000..a6c2688
--- /dev/null
+++ b/src/main/java/net/daporkchop/pepsimod/asm/core/minecraft/client/gui/MixinGuiMainMenu.java
@@ -0,0 +1,199 @@
+/*
+ * Adapted from The MIT License (MIT)
+ *
+ * Copyright (c) 2016-2020 DaPorkchop_
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions:
+ *
+ * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
+ * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+package net.daporkchop.pepsimod.asm.core.minecraft.client.gui;
+
+import net.daporkchop.pepsimod.asm.PepsimodMixinLoader;
+import net.daporkchop.pepsimod.util.render.text.RainbowTextRenderer;
+import net.daporkchop.pepsimod.util.render.texture.Texture;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.FontRenderer;
+import net.minecraft.client.gui.GuiMainMenu;
+import net.minecraft.client.gui.GuiScreen;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraftforge.fml.common.FMLCommonHandler;
+import org.spongepowered.asm.lib.Opcodes;
+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 java.util.Collections;
+import java.util.List;
+import java.util.concurrent.ThreadLocalRandom;
+
+import static net.daporkchop.pepsimod.util.PepsiUtil.*;
+
+/**
+ * This makes lots of changes to the main menu, most notably replacing the Minecraft banner with the pepsimod logo and changing lots of text.
+ *
+ * @author DaPorkchop_
+ */
+@Mixin(GuiMainMenu.class)
+abstract class MixinGuiMainMenu extends GuiScreen {
+ protected String[] versionText;
+ private int scaledBannerHeight;
+
+ @Shadow
+ private String splashText;
+
+ @Inject(
+ method = "Lnet/minecraft/client/gui/GuiMainMenu;()V",
+ at = @At("RETURN"))
+ private void setSplashText(CallbackInfo ci) {
+ this.versionText = new String[]{
+ "pepsimod ", VERSION_FULL, null,
+ "Made by DaPorkchop_"
+ };
+
+ this.splashText = String.format(
+ "§%c%s",
+ RANDOM_COLORS[ThreadLocalRandom.current().nextInt(RANDOM_COLORS.length)],
+ pepsimod.resources().mainMenu().randomSplash()
+ );
+ }
+
+ @Redirect(
+ method = "Lnet/minecraft/client/gui/GuiMainMenu;initGui()V",
+ at = @At(
+ value = "FIELD",
+ target = "Lnet/minecraft/client/gui/GuiMainMenu;splashText:Ljava/lang/String;",
+ opcode = Opcodes.PUTFIELD
+ ))
+ private void preventSettingSplashInInitGui(GuiMainMenu menu, String val) {
+ }
+
+ @Redirect(
+ method = "Lnet/minecraft/client/gui/GuiMainMenu;drawScreen(IIF)V",
+ at = @At(
+ value = "INVOKE",
+ target = "Lnet/minecraftforge/client/ForgeHooksClient;renderMainMenu(Lnet/minecraft/client/gui/GuiMainMenu;Lnet/minecraft/client/gui/FontRenderer;IILjava/lang/String;)Ljava/lang/String;"
+ ))
+ private String skipForgeDrawMainMenu(GuiMainMenu gui, FontRenderer font, int width, int height, String splashText) {
+ return this.splashText;
+ }
+
+ @Redirect(
+ method = "Lnet/minecraft/client/gui/GuiMainMenu;drawScreen(IIF)V",
+ at = @At(
+ value = "INVOKE",
+ target = "Lnet/minecraft/client/gui/GuiMainMenu;drawTexturedModalRect(IIIIII)V"
+ ))
+ private void removeMenuLogoRendering(GuiMainMenu guiMainMenu, int x, int y, int textureX, int textureY, int width, int height) {
+ }
+
+ @Redirect(
+ method = "Lnet/minecraft/client/gui/GuiMainMenu;drawScreen(IIF)V",
+ at = @At(
+ value = "INVOKE",
+ target = "Lnet/minecraft/client/gui/GuiMainMenu;drawModalRectWithCustomSizedTexture(IIFFIIFF)V"
+ ))
+ private void removeSubLogoRenderingAndDrawBanner(int x, int y, float a, float b, int c, int d, float e, float f) {
+ GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
+
+ Texture banner = pepsimod.resources().mainMenu().banner();
+ this.scaledBannerHeight = (int) (banner.height() * (300.0f / banner.width()));
+ banner.draw(this.width / 2 - 150, (this.height / 4 + 48 - this.scaledBannerHeight) / 2, 300, this.scaledBannerHeight);
+ }
+
+ @Redirect(
+ method = "Lnet/minecraft/client/gui/GuiMainMenu;drawScreen(IIF)V",
+ at = @At(
+ value = "INVOKE",
+ target = "Lnet/minecraft/client/gui/GuiMainMenu;drawString(Lnet/minecraft/client/gui/FontRenderer;Ljava/lang/String;III)V"
+ ))
+ private void removeAllDrawStrings(GuiMainMenu guiMainMenu, FontRenderer fontRenderer1, String string, int i1, int i2, int i3) {
+ }
+
+ @Redirect(
+ method = "Lnet/minecraft/client/gui/GuiMainMenu;drawScreen(IIF)V",
+ at = @At(
+ value = "INVOKE",
+ target = "Lnet/minecraft/client/gui/GuiMainMenu;drawRect(IIIII)V",
+ ordinal = 0
+ ))
+ private void skipDrawCopyrightUnderline(int left, int top, int right, int bottom, int color) {
+ }
+
+ /**
+ * Moves the splash text to a position that lines up better with the pepsimod logo.
+ */
+ @Redirect(
+ method = "Lnet/minecraft/client/gui/GuiMainMenu;drawScreen(IIF)V",
+ at = @At(
+ value = "INVOKE",
+ target = "Lnet/minecraft/client/renderer/GlStateManager;translate(FFF)V"
+ ))
+ private void moveSplashText(float x, float y, float z) {
+ GlStateManager.translate(this.width / 2 + 300.0f / 2.0f, this.height / 4 + this.scaledBannerHeight * 0.5f * 0.0f, 0.0f);
+ }
+
+ /**
+ * Draws some text on the screen lol
+ */
+ @Inject(
+ method = "Lnet/minecraft/client/gui/GuiMainMenu;drawScreen(IIF)V",
+ at = @At("TAIL")
+ )
+ private void addDrawPepsiStuff(int mouseX, int mouseY, float partialTicks, CallbackInfo ci) {
+ ((RainbowTextRenderer) TEXT_RENDERER).scale(0.003f);
+ TEXT_RENDERER
+ .renderLinesSmart(this.versionText, 2, this.height - 10 * 2)
+ .render("Copyright Mojang AB. Do not distribute!", this.width - this.fontRenderer.getStringWidth("Copyright Mojang AB. Do not distribute!") - 2, this.height - 10);
+ }
+
+ @Redirect(
+ method = "Lnet/minecraft/client/gui/GuiMainMenu;drawScreen(IIF)V",
+ at = @At(
+ value = "INVOKE",
+ target = "Lnet/minecraftforge/fml/common/FMLCommonHandler;getBrandings(Z)Ljava/util/List;"
+ ))
+ private List skipObtainingForgeBrandingList(FMLCommonHandler handler, boolean includeMC) {
+ return Collections.emptyList();
+ }
+
+ @Redirect(
+ method = "Lnet/minecraft/client/gui/GuiMainMenu;drawScreen(IIF)V",
+ at = @At(
+ value = "INVOKE",
+ target = "Lcom/google/common/collect/Lists;reverse(Ljava/util/List;)Ljava/util/List;"
+ ))
+ private List skipReverseForgeBrandingList(List list) {
+ return list;
+ }
+
+ @Redirect(
+ method = "Lnet/minecraft/client/gui/GuiMainMenu;actionPerformed(Lnet/minecraft/client/gui/GuiButton;)V",
+ at = @At(
+ value = "INVOKE",
+ target = "Lnet/minecraft/client/Minecraft;displayGuiScreen(Lnet/minecraft/client/gui/GuiScreen;)V",
+ ordinal = 1
+ ),
+ require = 0)
+ private void debug_reloadRainbowTextOnLanguageButton(Minecraft mc, GuiScreen screen) {
+ if (PepsimodMixinLoader.OBFUSCATED) {
+ mc.displayGuiScreen(screen);
+ } else {
+ ((RainbowTextRenderer) TEXT_RENDERER).reloadShader();
+ }
+ }
+}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/BetterScaledResolution.java b/src/main/java/net/daporkchop/pepsimod/asm/core/minecraft/client/gui/MixinScaledResolution.java
similarity index 50%
rename from src/main/java/net/daporkchop/pepsimod/util/BetterScaledResolution.java
rename to src/main/java/net/daporkchop/pepsimod/asm/core/minecraft/client/gui/MixinScaledResolution.java
index dd1d483..6b590f5 100644
--- a/src/main/java/net/daporkchop/pepsimod/util/BetterScaledResolution.java
+++ b/src/main/java/net/daporkchop/pepsimod/asm/core/minecraft/client/gui/MixinScaledResolution.java
@@ -18,27 +18,62 @@
*
*/
-package net.daporkchop.pepsimod.util;
+package net.daporkchop.pepsimod.asm.core.minecraft.client.gui;
+import net.daporkchop.pepsimod.util.render.BetterScaledResolution;
+import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.util.math.MathHelper;
+import org.spongepowered.asm.mixin.Final;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.Mutable;
+import org.spongepowered.asm.mixin.Shadow;
-public class BetterScaledResolution extends PepsiConstants {
- public static BetterScaledResolution INSTANCE;
+import static net.daporkchop.pepsimod.util.PepsiConstants.mc;
- public int scaledWidth;
- public int scaledHeight;
- public int scaleFactor;
+/**
+ * This modifies {@link ScaledResolution} to implement {@link BetterScaledResolution}, which in turn allows me to re-use the same ScaledResolution instance
+ * forever instead of the vanilla behavior of every GUI and renderer creating their own new instance every frame.
+ *
+ * @author DaPorkchop_
+ */
+@Mixin(ScaledResolution.class)
+abstract class MixinScaledResolution implements BetterScaledResolution {
+ @Shadow
+ private int scaledWidth;
+ @Shadow
+ private int scaledHeight;
+ @Shadow
+ private int scaleFactor;
+ @Shadow
+ @Final
+ @Mutable
+ private double scaledWidthD;
+ @Shadow
+ @Final
+ @Mutable
+ private double scaledHeightD;
+
+ @Override
+ public int width() {
+ return this.scaledWidth;
+ }
+
+ @Override
+ public int height() {
+ return this.scaledHeight;
+ }
- public BetterScaledResolution() {
- this.update();
- INSTANCE = this;
+ @Override
+ public ScaledResolution getAsMinecraft() throws UnsupportedOperationException {
+ return (ScaledResolution) (Object) this;
}
+ @Override
public void update() {
this.scaledWidth = mc.displayWidth;
this.scaledHeight = mc.displayHeight;
this.scaleFactor = 1;
- boolean flag = mc.isUnicode();
+ boolean unicode = mc.isUnicode();
int i = mc.gameSettings.guiScale;
if (i == 0) {
@@ -49,13 +84,13 @@ public void update() {
++this.scaleFactor;
}
- if (flag && this.scaleFactor % 2 != 0 && this.scaleFactor != 1) {
+ if (unicode && this.scaleFactor % 2 != 0 && this.scaleFactor != 1) {
--this.scaleFactor;
}
- double scaledWidthD = (double) this.scaledWidth / (double) this.scaleFactor;
- double scaledHeightD = (double) this.scaledHeight / (double) this.scaleFactor;
- this.scaledWidth = MathHelper.ceil(scaledWidthD);
- this.scaledHeight = MathHelper.ceil(scaledHeightD);
+ this.scaledWidthD = (double) this.scaledWidth / (double) this.scaleFactor;
+ this.scaledHeightD = (double) this.scaledHeight / (double) this.scaleFactor;
+ this.scaledWidth = MathHelper.ceil(this.scaledWidthD);
+ this.scaledHeight = MathHelper.ceil(this.scaledHeightD);
}
}
diff --git a/src/main/java/net/daporkchop/pepsimod/mixin/util/text/translation/MixinLanguageMap.java b/src/main/java/net/daporkchop/pepsimod/asm/core/minecraft/client/renderer/MixinOpenGlHelper.java
similarity index 68%
rename from src/main/java/net/daporkchop/pepsimod/mixin/util/text/translation/MixinLanguageMap.java
rename to src/main/java/net/daporkchop/pepsimod/asm/core/minecraft/client/renderer/MixinOpenGlHelper.java
index db97424..005fccc 100644
--- a/src/main/java/net/daporkchop/pepsimod/mixin/util/text/translation/MixinLanguageMap.java
+++ b/src/main/java/net/daporkchop/pepsimod/asm/core/minecraft/client/renderer/MixinOpenGlHelper.java
@@ -18,32 +18,30 @@
*
*/
-package net.daporkchop.pepsimod.mixin.util.text.translation;
+package net.daporkchop.pepsimod.asm.core.minecraft.client.renderer;
-import net.minecraft.util.text.translation.LanguageMap;
+import net.daporkchop.pepsimod.util.render.OpenGL;
+import net.minecraft.client.renderer.OpenGlHelper;
+import org.lwjgl.opengl.ContextCapabilities;
+import org.lwjgl.opengl.GLContext;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
-import java.util.Map;
-
-import static net.daporkchop.pepsimod.util.PepsiConstants.pepsimod;
-
/**
* @author DaPorkchop_
*/
-@Mixin(LanguageMap.class)
-public abstract class MixinLanguageMap {
+@Mixin(OpenGlHelper.class)
+abstract class MixinOpenGlHelper {
@Redirect(
- method = "Lnet/minecraft/util/text/translation/LanguageMap;replaceWith(Ljava/util/Map;)V",
+ method = "Lnet/minecraft/client/renderer/OpenGlHelper;initializeTextures()V",
at = @At(
value = "INVOKE",
- target = "Ljava/util/Map;putAll(Ljava/util/Map;)V"
+ target = "Lorg/lwjgl/opengl/GLContext;getCapabilities()Lorg/lwjgl/opengl/ContextCapabilities;"
))
- private static void postReplaceWith(Map languageList, Map newMap) {
- languageList.putAll(newMap);
- if (pepsimod != null) {
- languageList.putAll(pepsimod.data.localeKeys);
- }
+ private static ContextCapabilities initPepsimodOpenGL() {
+ ContextCapabilities capabilities = GLContext.getCapabilities();
+ OpenGL.init(capabilities);
+ return capabilities;
}
}
diff --git a/src/main/java/net/daporkchop/pepsimod/mixin/client/resources/MixinLocale.java b/src/main/java/net/daporkchop/pepsimod/asm/core/minecraft/client/resources/MixinLocale.java
similarity index 55%
rename from src/main/java/net/daporkchop/pepsimod/mixin/client/resources/MixinLocale.java
rename to src/main/java/net/daporkchop/pepsimod/asm/core/minecraft/client/resources/MixinLocale.java
index b0ba23f..83c53fc 100644
--- a/src/main/java/net/daporkchop/pepsimod/mixin/client/resources/MixinLocale.java
+++ b/src/main/java/net/daporkchop/pepsimod/asm/core/minecraft/client/resources/MixinLocale.java
@@ -18,35 +18,54 @@
*
*/
-package net.daporkchop.pepsimod.mixin.client.resources;
+package net.daporkchop.pepsimod.asm.core.minecraft.client.resources;
-import net.minecraft.client.resources.IResourceManager;
+import net.daporkchop.pepsimod.util.PepsiConstants;
import net.minecraft.client.resources.Locale;
import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.Overwrite;
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.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.List;
+import java.util.Map;
+/**
+ * @author DaPorkchop_
+ */
@Mixin(Locale.class)
-public abstract class MixinLocale {
+abstract class MixinLocale {
@Shadow
- private void loadLocaleData(InputStream inputStreamIn) throws IOException {
- }
+ Map properties;
- @Inject(
+ /*@Inject(
method = "Lnet/minecraft/client/resources/Locale;loadLocaleDataFiles(Lnet/minecraft/client/resources/IResourceManager;Ljava/util/List;)V",
- at = @At("RETURN")
- )
- public void postLoad(IResourceManager resourceManager, List languageList, CallbackInfo callbackInfo) {
- try (InputStream in = new URL("https://gist.githubusercontent.com/DaMatrix/f7106cad11fa86495915941d6c308f5e/raw/273c86250f74f3258c39789d5b0984e539609888/en_US.lang").openStream()) {
- this.loadLocaleData(in);
- } catch (IOException e) {
- }
+ at = @At(
+ value = "INVOKE",
+ target = "Lnet/minecraft/client/resources/Locale;checkUnicode()V"
+ ))
+ private void injectPepsimodResources(CallbackInfo ci) {
+ PepsiConstants.pepsimod.resources().lang().inject(this.properties);
+ }*/
+
+ /**
+ * Lots of injects would be slower lol
+ *
+ * @return efficiency
+ * @author DaPorkchop_
+ */
+ @Overwrite
+ private String translateKeyPrivate(String translateKey) {
+ String s = this.properties.get(translateKey);
+ return s != null ? s : PepsiConstants.pepsimod.resources().lang().translations().getOrDefault(translateKey, translateKey);
+ }
+
+ /**
+ * Lots of injects would be slower lol
+ *
+ * @return efficiency
+ * @author DaPorkchop_
+ */
+ @Overwrite
+ public boolean hasKey(String key) {
+ return this.properties.containsKey(key) || PepsiConstants.pepsimod.resources().lang().translations().containsKey(key);
}
}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/api/ModuleLaunchState.java b/src/main/java/net/daporkchop/pepsimod/asm/core/package-info.java
similarity index 86%
rename from src/main/java/net/daporkchop/pepsimod/module/api/ModuleLaunchState.java
rename to src/main/java/net/daporkchop/pepsimod/asm/core/package-info.java
index 40c196f..cccd014 100644
--- a/src/main/java/net/daporkchop/pepsimod/module/api/ModuleLaunchState.java
+++ b/src/main/java/net/daporkchop/pepsimod/asm/core/package-info.java
@@ -18,10 +18,9 @@
*
*/
-package net.daporkchop.pepsimod.module.api;
-
-public enum ModuleLaunchState {
- ENABLED,
- DISABLED,
- AUTO
-}
+/**
+ * Mixins required for the core of pepsimod to load. This does things such as resource injection and modifying GUIs.
+ *
+ * @author DaPorkchop_
+ */
+package net.daporkchop.pepsimod.asm.core;
\ No newline at end of file
diff --git a/src/main/java/net/daporkchop/pepsimod/asm/event/forge/client/MixinGuiIngameForge.java b/src/main/java/net/daporkchop/pepsimod/asm/event/forge/client/MixinGuiIngameForge.java
new file mode 100644
index 0000000..1b89d58
--- /dev/null
+++ b/src/main/java/net/daporkchop/pepsimod/asm/event/forge/client/MixinGuiIngameForge.java
@@ -0,0 +1,76 @@
+/*
+ * Adapted from The MIT License (MIT)
+ *
+ * Copyright (c) 2016-2020 DaPorkchop_
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions:
+ *
+ * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
+ * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+package net.daporkchop.pepsimod.asm.event.forge.client;
+
+import net.daporkchop.pepsimod.util.event.EventStatus;
+import net.minecraft.client.gui.GuiIngame;
+import net.minecraftforge.client.GuiIngameForge;
+import net.minecraftforge.client.event.RenderGameOverlayEvent;
+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.Redirect;
+
+import static net.daporkchop.pepsimod.util.PepsiConstants.EVENT_MANAGER;
+import static net.daporkchop.pepsimod.util.PepsiConstants.RESOLUTION;
+
+/**
+ * @author DaPorkchop_
+ */
+@Mixin(GuiIngameForge.class)
+abstract class MixinGuiIngameForge extends GuiIngame {
+ public MixinGuiIngameForge() {
+ super(null);
+ }
+
+ /**
+ * Calls {@link net.daporkchop.pepsimod.util.event.EventManager#firePreRenderHUD(float, int, int)} before the Minecraft Forge event is called.
+ */
+ @Redirect(
+ method = "Lnet/minecraftforge/client/GuiIngameForge;renderGameOverlay(F)V",
+ at = @At(
+ value = "INVOKE",
+ target = "Lnet/minecraftforge/client/GuiIngameForge;pre(Lnet/minecraftforge/client/event/RenderGameOverlayEvent$ElementType;)Z"
+ ))
+ private boolean inject_preRenderHUD(GuiIngameForge gui, RenderGameOverlayEvent.ElementType type, float partialTicks) {
+ return EVENT_MANAGER.firePreRenderHUD(partialTicks, RESOLUTION.width(), RESOLUTION.height()) != EventStatus.OK | this.pre(type);
+ }
+
+ /**
+ * Calls {@link net.daporkchop.pepsimod.util.event.EventManager#firePostRenderHUD(float, int, int)} after the Minecraft Forge event is called.
+ */
+ @Redirect(
+ method = "Lnet/minecraftforge/client/GuiIngameForge;renderGameOverlay(F)V",
+ at = @At(
+ value = "INVOKE",
+ target = "Lnet/minecraftforge/client/GuiIngameForge;post(Lnet/minecraftforge/client/event/RenderGameOverlayEvent$ElementType;)V"
+ ))
+ private void inject_postRenderHUD(GuiIngameForge gui, RenderGameOverlayEvent.ElementType type, float partialTicks) {
+ this.post(type);
+ EVENT_MANAGER.firePostRenderHUD(partialTicks, RESOLUTION.width(), RESOLUTION.height());
+ }
+
+ @Shadow
+ protected abstract boolean pre(RenderGameOverlayEvent.ElementType type);
+
+ @Shadow
+ protected abstract void post(RenderGameOverlayEvent.ElementType type);
+}
diff --git a/src/main/java/net/daporkchop/pepsimod/mixin/client/settings/MixinKeyBinding.java b/src/main/java/net/daporkchop/pepsimod/asm/event/minecraft/client/MixinMinecraft.java
similarity index 62%
rename from src/main/java/net/daporkchop/pepsimod/mixin/client/settings/MixinKeyBinding.java
rename to src/main/java/net/daporkchop/pepsimod/asm/event/minecraft/client/MixinMinecraft.java
index f550240..380351d 100644
--- a/src/main/java/net/daporkchop/pepsimod/mixin/client/settings/MixinKeyBinding.java
+++ b/src/main/java/net/daporkchop/pepsimod/asm/event/minecraft/client/MixinMinecraft.java
@@ -18,49 +18,42 @@
*
*/
-package net.daporkchop.pepsimod.mixin.client.settings;
+package net.daporkchop.pepsimod.asm.event.minecraft.client;
-import net.daporkchop.pepsimod.optimization.OverrideCounter;
-import net.minecraft.client.settings.KeyBinding;
+import net.minecraft.client.Minecraft;
+import net.minecraft.util.Timer;
+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.Redirect;
+import static net.daporkchop.pepsimod.util.PepsiConstants.EVENT_MANAGER;
+
/**
* @author DaPorkchop_
*/
-@Mixin(KeyBinding.class)
-public abstract class MixinKeyBinding implements OverrideCounter {
+@Mixin(Minecraft.class)
+abstract class MixinMinecraft {
@Shadow
- private boolean pressed;
-
- public int overrideCounter = 0;
-
- @Override
- public void incrementOverride() {
- this.overrideCounter++;
- }
-
- @Override
- public void decrementOverride() {
- if (--this.overrideCounter < 0) {
- this.overrideCounter = 0;
- }
- }
-
- @Override
- public int getOverride() {
- return this.overrideCounter;
- }
+ @Final
+ private Timer timer;
+ /**
+ * Calls {@link net.daporkchop.pepsimod.util.event.EventManager#firePreRender(float)} (float, int, int)} before rendering the next frame.
+ */
@Redirect(
- method = "Lnet/minecraft/client/settings/KeyBinding;isKeyDown()Z",
+ method = "Lnet/minecraft/client/Minecraft;runGameLoop()V",
at = @At(
- value = "FIELD",
- target = "Lnet/minecraft/client/settings/KeyBinding;pressed:Z"
+ value = "INVOKE",
+ target = "Lnet/minecraft/client/Minecraft;checkGLError(Ljava/lang/String;)V",
+ ordinal = 0
))
- public boolean modifyIsKeyDown(KeyBinding binding) {
- return this.pressed || this.isOverriden();
+ private void firePreRender(Minecraft mc, String msg) {
+ this.checkGLError(msg);
+ EVENT_MANAGER.firePreRender(this.timer.renderPartialTicks);
}
+
+ @Shadow
+ protected abstract void checkGLError(String message);
}
diff --git a/src/main/java/net/daporkchop/pepsimod/optimization/OverrideCounter.java b/src/main/java/net/daporkchop/pepsimod/asm/event/package-info.java
similarity index 83%
rename from src/main/java/net/daporkchop/pepsimod/optimization/OverrideCounter.java
rename to src/main/java/net/daporkchop/pepsimod/asm/event/package-info.java
index 94ffc69..166d6eb 100644
--- a/src/main/java/net/daporkchop/pepsimod/optimization/OverrideCounter.java
+++ b/src/main/java/net/daporkchop/pepsimod/asm/event/package-info.java
@@ -18,19 +18,11 @@
*
*/
-package net.daporkchop.pepsimod.optimization;
-
/**
+ * These Mixins inject all of the events into the required places.
+ *
* @author DaPorkchop_
+ * @see net.daporkchop.pepsimod.util.event.impl.AllEvents
+ * @see net.daporkchop.pepsimod.util.event.EventManager
*/
-public interface OverrideCounter {
- void incrementOverride();
-
- void decrementOverride();
-
- int getOverride();
-
- default boolean isOverriden() {
- return this.getOverride() > 0;
- }
-}
+package net.daporkchop.pepsimod.asm.event;
\ No newline at end of file
diff --git a/src/main/java/net/daporkchop/pepsimod/util/BossinfoCounted.java b/src/main/java/net/daporkchop/pepsimod/asm/feature/package-info.java
similarity index 83%
rename from src/main/java/net/daporkchop/pepsimod/util/BossinfoCounted.java
rename to src/main/java/net/daporkchop/pepsimod/asm/feature/package-info.java
index 2956e83..eb61705 100644
--- a/src/main/java/net/daporkchop/pepsimod/util/BossinfoCounted.java
+++ b/src/main/java/net/daporkchop/pepsimod/asm/feature/package-info.java
@@ -18,14 +18,11 @@
*
*/
-package net.daporkchop.pepsimod.util;
-
-import net.minecraft.client.gui.BossInfoClient;
-
/**
- * Used by the boss bar merger thing to remember stuff
+ * These Mixins make all required modifications to game code to make the various features work.
+ *
+ * They are sorted into subpackages, corresponding to which feature they're used by.
+ *
+ * @author DaPorkchop_
*/
-public class BossinfoCounted {
- public BossInfoClient info;
- public int count = 0;
-}
+package net.daporkchop.pepsimod.asm.feature;
\ No newline at end of file
diff --git a/src/main/java/net/daporkchop/pepsimod/mixin/block/MixinBlockSlab.java b/src/main/java/net/daporkchop/pepsimod/asm/optimization/forge/client/MixinGuiIngameForge.java
similarity index 56%
rename from src/main/java/net/daporkchop/pepsimod/mixin/block/MixinBlockSlab.java
rename to src/main/java/net/daporkchop/pepsimod/asm/optimization/forge/client/MixinGuiIngameForge.java
index 5719014..7f157dd 100644
--- a/src/main/java/net/daporkchop/pepsimod/mixin/block/MixinBlockSlab.java
+++ b/src/main/java/net/daporkchop/pepsimod/asm/optimization/forge/client/MixinGuiIngameForge.java
@@ -18,36 +18,38 @@
*
*/
-package net.daporkchop.pepsimod.mixin.block;
+package net.daporkchop.pepsimod.asm.optimization.forge.client;
-import net.daporkchop.pepsimod.module.impl.misc.FreecamMod;
-import net.minecraft.block.Block;
-import net.minecraft.block.BlockSlab;
-import net.minecraft.block.state.IBlockState;
+import net.daporkchop.pepsimod.util.PepsiConstants;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.GuiIngame;
+import net.minecraft.client.gui.ScaledResolution;
+import net.minecraftforge.client.GuiIngameForge;
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 org.spongepowered.asm.mixin.injection.Redirect;
-import static net.daporkchop.pepsimod.util.PepsiConstants.pepsimod;
+import static net.daporkchop.pepsimod.util.PepsiConstants.RESOLUTION;
-@Mixin(BlockSlab.class)
-public abstract class MixinBlockSlab extends Block {
- protected MixinBlockSlab() {
+/**
+ * @author DaPorkchop_
+ */
+@Mixin(GuiIngameForge.class)
+abstract class MixinGuiIngameForge extends GuiIngame {
+ public MixinGuiIngameForge() {
super(null);
}
- @Inject(
- method = "Lnet/minecraft/block/BlockSlab;isFullCube(Lnet/minecraft/block/state/IBlockState;)Z",
- at = @At("HEAD"),
- cancellable = true
- )
- public void preIsFullCube(IBlockState state, CallbackInfoReturnable callbackInfoReturnable) {
- if (pepsimod.hasInitializedModules) {
- if (FreecamMod.INSTANCE.state.enabled) {
- callbackInfoReturnable.setReturnValue(false);
- }
- }
+ /**
+ * Prevents creation of a new {@link ScaledResolution} instance.
+ */
+ @Redirect(
+ method = "Lnet/minecraftforge/client/GuiIngameForge;renderGameOverlay(F)V",
+ at = @At(
+ value = "NEW",
+ target = "(Lnet/minecraft/client/Minecraft;)Lnet/minecraft/client/gui/ScaledResolution;"
+ ))
+ private ScaledResolution noScaledResolutionInstances_renderGameOverlay(Minecraft mc) {
+ return RESOLUTION.getAsMinecraft();
}
}
diff --git a/src/main/java/net/daporkchop/pepsimod/asm/optimization/minecraft/client/MixinMinecraft.java b/src/main/java/net/daporkchop/pepsimod/asm/optimization/minecraft/client/MixinMinecraft.java
new file mode 100644
index 0000000..34a09ed
--- /dev/null
+++ b/src/main/java/net/daporkchop/pepsimod/asm/optimization/minecraft/client/MixinMinecraft.java
@@ -0,0 +1,75 @@
+/*
+ * Adapted from The MIT License (MIT)
+ *
+ * Copyright (c) 2016-2020 DaPorkchop_
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions:
+ *
+ * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
+ * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+package net.daporkchop.pepsimod.asm.optimization.minecraft.client;
+
+import net.daporkchop.pepsimod.util.render.BetterScaledResolution;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.ScaledResolution;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Redirect;
+
+import static net.daporkchop.pepsimod.util.PepsiConstants.RESOLUTION;
+
+/**
+ * @author DaPorkchop_
+ */
+@Mixin(Minecraft.class)
+abstract class MixinMinecraft {
+ /**
+ * Prevents creation of a new {@link ScaledResolution} instance.
+ */
+ @Redirect(
+ method = "Lnet/minecraft/client/Minecraft;displayGuiScreen(Lnet/minecraft/client/gui/GuiScreen;)V",
+ at = @At(
+ value = "NEW",
+ target = "(Lnet/minecraft/client/Minecraft;)Lnet/minecraft/client/gui/ScaledResolution;"
+ ))
+ private ScaledResolution noScaledResolutionInstances_displayGuiScreen(Minecraft mc) {
+ return RESOLUTION.getAsMinecraft();
+ }
+
+ /**
+ * Prevents creation of a new {@link ScaledResolution} instance.
+ */
+ @Redirect(
+ method = "Lnet/minecraft/client/Minecraft;resize(II)V",
+ at = @At(
+ value = "NEW",
+ target = "(Lnet/minecraft/client/Minecraft;)Lnet/minecraft/client/gui/ScaledResolution;"
+ ))
+ private ScaledResolution noScaledResolutionInstances_resize(Minecraft mc) {
+ return RESOLUTION == BetterScaledResolution.NOOP ? new ScaledResolution(mc) : RESOLUTION.updateChained().getAsMinecraft(); //don't create new instance if pepsimod isn't initialized yet
+ }
+
+ /**
+ * Prevents creation of a new {@link ScaledResolution} instance.
+ */
+ @Redirect(
+ method = "Lnet/minecraft/client/Minecraft;runGameLoop()V",
+ at = @At(
+ value = "NEW",
+ target = "(Lnet/minecraft/client/Minecraft;)Lnet/minecraft/client/gui/ScaledResolution;"
+ ))
+ private ScaledResolution noScaledResolutionInstances_runGameLoop(Minecraft mc) {
+ return RESOLUTION.getAsMinecraft();
+ }
+}
diff --git a/src/main/java/net/daporkchop/pepsimod/optimization/SizeSettable.java b/src/main/java/net/daporkchop/pepsimod/asm/optimization/package-info.java
similarity index 90%
rename from src/main/java/net/daporkchop/pepsimod/optimization/SizeSettable.java
rename to src/main/java/net/daporkchop/pepsimod/asm/optimization/package-info.java
index b0f7300..6c2353b 100644
--- a/src/main/java/net/daporkchop/pepsimod/optimization/SizeSettable.java
+++ b/src/main/java/net/daporkchop/pepsimod/asm/optimization/package-info.java
@@ -18,11 +18,9 @@
*
*/
-package net.daporkchop.pepsimod.optimization;
-
/**
+ * These Mixins make various optimizations to the game code.
+ *
* @author DaPorkchop_
*/
-public interface SizeSettable {
- void forceSetSize(float width, float height);
-}
+package net.daporkchop.pepsimod.asm.optimization;
\ No newline at end of file
diff --git a/src/main/java/net/daporkchop/pepsimod/asm/package-info.java b/src/main/java/net/daporkchop/pepsimod/asm/package-info.java
new file mode 100644
index 0000000..ea37854
--- /dev/null
+++ b/src/main/java/net/daporkchop/pepsimod/asm/package-info.java
@@ -0,0 +1,30 @@
+/*
+ * Adapted from The MIT License (MIT)
+ *
+ * Copyright (c) 2016-2020 DaPorkchop_
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions:
+ *
+ * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
+ * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+/**
+ * Each of the sub-packages in this package contain a single category of Mixins. They're organized into sub-sub packages, which are defined
+ * as follows (sorted alphabetically):
+ *
+ * - the {@code forge} packages contain Mixins to Minecraft Forge classes, which are arranged relative to {@link net.minecraftforge}.
+ * - the {@code minecraft} packages contain Mixins to Minecraft classes, which are arranged relative to {@link net.minecraft}.
+ *
+ * @author DaPorkchop_
+ */
+package net.daporkchop.pepsimod.asm;
\ No newline at end of file
diff --git a/src/main/java/net/daporkchop/pepsimod/command/BaseCommand.java b/src/main/java/net/daporkchop/pepsimod/command/BaseCommand.java
deleted file mode 100644
index 069ef78..0000000
--- a/src/main/java/net/daporkchop/pepsimod/command/BaseCommand.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.command;
-
-import net.daporkchop.pepsimod.command.api.Command;
-
-public class BaseCommand extends Command {
- public BaseCommand() {
- super("delet_this");
- }
-
- @Override
- public void execute(String cmd, String[] args) {
-
- }
-
- @Override
- public String getSuggestion(String cmd, String[] args) {
- return ".delet_this";
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/command/CommandRegistry.java b/src/main/java/net/daporkchop/pepsimod/command/CommandRegistry.java
deleted file mode 100644
index 9125eb0..0000000
--- a/src/main/java/net/daporkchop/pepsimod/command/CommandRegistry.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.command;
-
-import net.daporkchop.pepsimod.Pepsimod;
-import net.daporkchop.pepsimod.command.api.Command;
-import net.daporkchop.pepsimod.util.PepsiConstants;
-import net.daporkchop.pepsimod.util.PepsiUtils;
-import net.minecraft.util.text.TextComponentString;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public class CommandRegistry extends PepsiConstants {
- /**
- * All registered commands are here :P
- */
- public static HashMap commandNames = new HashMap<>();
-
- /**
- * Gets a completion suggestion for a command
- *
- * @param input the current text input
- * @return a suggestion, or "" if nothing could be recommended
- */
- public static String getSuggestionFor(String input) {
- if (input.length() == 1) {
- return "." + commandNames.values().iterator().next().name;
- }
- String[] split = input.replace(" ", " \u0000").split("\\s+");
- for (int i = split.length - 1; i >= 0; i--) {
- split[i] = split[i].replace("\u0000", "");
- }
- try {
- String commandName = split[0].substring(1);
- Command command = commandNames.get(commandName);
- if (command != null) {
- return command.getSuggestion(input, split);
- }
-
- for (Map.Entry entry : commandNames.entrySet()) {
- if (entry.getKey().startsWith(commandName)) {
- return "." + entry.getKey();
- }
- }
- } catch (StringIndexOutOfBoundsException e) {
- }
- return "";
- }
-
- /**
- * Registers a command.
- *
- * @param command the command to register
- */
- public static void registerCommand(Command command) {
- if (!commandNames.values().contains(command)) {
- for (String s : command.aliases()) {
- commandNames.put(s, command);
- }
- }
- }
-
- public static void registerCommands(Command... toRegister) {
- for (Command command : toRegister) {
- registerCommand(command);
- }
- }
-
- /**
- * Runs a command
- *
- * @param command the command given in chat
- */
- public static void runCommand(String command) {
- try {
- String split[] = command.split(" "), commandName = split[0].substring(1);
- for (Map.Entry entry : commandNames.entrySet()) {
- if (entry.getKey().equals(commandName)) {
- entry.getValue().execute(command, split);
- return;
- }
- }
-
- mc.player.sendMessage(new TextComponentString(Pepsimod.CHAT_PREFIX + PepsiUtils.COLOR_ESCAPE + "cUnknown command! Use .help for a list of commands!"));
- } catch (ArrayIndexOutOfBoundsException | StringIndexOutOfBoundsException e) {
- }
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/command/api/Command.java b/src/main/java/net/daporkchop/pepsimod/command/api/Command.java
deleted file mode 100644
index 884e17d..0000000
--- a/src/main/java/net/daporkchop/pepsimod/command/api/Command.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.command.api;
-
-import net.daporkchop.pepsimod.Pepsimod;
-import net.daporkchop.pepsimod.util.PepsiConstants;
-import net.minecraft.util.text.TextComponentString;
-
-public abstract class Command extends PepsiConstants {
- public static void clientMessage(String toSend) {
- mc.player.sendMessage(new TextComponentString(Pepsimod.CHAT_PREFIX + toSend));
- }
- public String name;
-
- public Command(String name) {
- this.name = name;
- }
-
- public abstract void execute(String cmd, String[] args);
-
- public abstract String getSuggestion(String cmd, String[] args);
-
- public String[] aliases() {
- return new String[]{this.name};
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/command/impl/GoToCommand.java b/src/main/java/net/daporkchop/pepsimod/command/impl/GoToCommand.java
deleted file mode 100644
index 4f53459..0000000
--- a/src/main/java/net/daporkchop/pepsimod/command/impl/GoToCommand.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.command.impl;
-
-import net.daporkchop.pepsimod.command.api.Command;
-import net.minecraft.util.math.BlockPos;
-
-public class GoToCommand extends Command {
- public static GoToCommand INSTANCE;
-
- public GoToCommand() {
- super("goto");
- INSTANCE = this;
- }
-
- @Override
- public void execute(String cmd, String[] args) {
- clientMessage("§cThe pathfinder is currently disabled.");
- }
-
- @Override
- public String getSuggestion(String cmd, String[] args) {
- return ".goto";
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/command/impl/HelpCommand.java b/src/main/java/net/daporkchop/pepsimod/command/impl/HelpCommand.java
deleted file mode 100644
index 7b28ed1..0000000
--- a/src/main/java/net/daporkchop/pepsimod/command/impl/HelpCommand.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.command.impl;
-
-import net.daporkchop.pepsimod.command.CommandRegistry;
-import net.daporkchop.pepsimod.command.api.Command;
-
-public class HelpCommand extends Command {
- public HelpCommand() {
- super("help");
- }
-
- @Override
- public void execute(String cmd, String[] args) {
- String toSend = "";
- for (String command : CommandRegistry.commandNames.keySet()) {
- toSend += command + ", ";
- }
- toSend = toSend.substring(0, toSend.length() - 2);
- clientMessage(toSend);
- }
-
- @Override
- public String getSuggestion(String cmd, String[] args) {
- return ".help";
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/command/impl/InvSeeCommand.java b/src/main/java/net/daporkchop/pepsimod/command/impl/InvSeeCommand.java
deleted file mode 100644
index a1a3848..0000000
--- a/src/main/java/net/daporkchop/pepsimod/command/impl/InvSeeCommand.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.command.impl;
-
-import net.daporkchop.pepsimod.command.api.Command;
-import net.minecraft.client.entity.EntityOtherPlayerMP;
-import net.minecraft.client.gui.inventory.GuiInventory;
-import net.minecraft.entity.Entity;
-
-public class InvSeeCommand extends Command {
- public InvSeeCommand() {
- super("invsee");
- }
-
- @Override
- public void execute(String cmd, String[] args) {
- if (args.length < 2) {
- clientMessage("Usage: .invsee ");
- return;
- }
-
- for (Entity entity : mc.world.getLoadedEntityList()) {
- if (entity instanceof EntityOtherPlayerMP) {
- EntityOtherPlayerMP player = (EntityOtherPlayerMP) entity;
- if (player.getName().equals(args[1])) {
- clientMessage("Showing inventory of " + player.getName());
- mc.displayGuiScreen(new GuiInventory(player));
- return;
- }
- }
- }
-
- clientMessage("Such player in range!");
- }
-
- @Override
- public String getSuggestion(String cmd, String[] args) {
- switch (args.length) {
- case 1:
- String aName = this.getPlayerName("");
- if (aName == null) {
- break;
- } else {
- return ".invsee " + aName;
- }
- case 2:
- String bName = this.getPlayerName(args[1]);
- if (bName == null) {
- break;
- } else {
- return ".invsee " + bName;
- }
- }
-
- return ".invsee";
- }
-
- public String getPlayerName(String in) {
- for (Entity e : mc.world.loadedEntityList) {
- if (e instanceof EntityOtherPlayerMP) {
- EntityOtherPlayerMP player = (EntityOtherPlayerMP) e;
- if (player.getName().startsWith(in)) {
- return player.getName();
- }
- }
- }
-
- return null;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/command/impl/ListCommand.java b/src/main/java/net/daporkchop/pepsimod/command/impl/ListCommand.java
deleted file mode 100644
index 88f8d87..0000000
--- a/src/main/java/net/daporkchop/pepsimod/command/impl/ListCommand.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.command.impl;
-
-import net.daporkchop.pepsimod.command.api.Command;
-import net.daporkchop.pepsimod.module.ModuleManager;
-import net.daporkchop.pepsimod.util.PepsiUtils;
-
-public class ListCommand extends Command {
- public ListCommand() {
- super("list");
- }
-
- @Override
- public void execute(String cmd, String[] args) {
- String s = "";
- for (int i = 0; i < ModuleManager.AVALIBLE_MODULES.size(); i++) {
- s += ModuleManager.AVALIBLE_MODULES.get(i).name + (i + 1 == ModuleManager.AVALIBLE_MODULES.size() ? "" : ", ");
- }
- clientMessage("Available modules: " + PepsiUtils.COLOR_ESCAPE + "o" + s);
- }
-
- @Override
- public String getSuggestion(String cmd, String[] args) {
- return ".list";
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/command/impl/PeekCommand.java b/src/main/java/net/daporkchop/pepsimod/command/impl/PeekCommand.java
deleted file mode 100644
index 7db40e0..0000000
--- a/src/main/java/net/daporkchop/pepsimod/command/impl/PeekCommand.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.command.impl;
-
-import net.daporkchop.pepsimod.command.api.Command;
-import net.minecraft.block.Block;
-import net.minecraft.client.gui.inventory.GuiChest;
-import net.minecraft.init.Blocks;
-import net.minecraft.inventory.InventoryBasic;
-import net.minecraft.inventory.ItemStackHelper;
-import net.minecraft.item.ItemBlock;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.util.NonNullList;
-
-public class PeekCommand extends Command {
- public static Block[] SHULKERS;
-
- public static boolean isShulkerBox(Block block) {
- for (Block b : SHULKERS) {
- if (b == block) {
- return true;
- }
- }
-
- return false;
- }
-
- public static InventoryBasic getFromItemNBT(NBTTagCompound tag) {
- NonNullList items = NonNullList.withSize(27, ItemStack.EMPTY);
- String customName = "Shulker Box";
-
- if (tag.hasKey("Items", 9)) {
- ItemStackHelper.loadAllItems(tag, items);
- }
-
- if (tag.hasKey("CustomName", 8)) {
- customName = tag.getString("CustomName");
- }
-
- InventoryBasic inventoryBasic = new InventoryBasic(customName, true, items.size());
- for (int i = 0; i < items.size(); i++) {
- inventoryBasic.setInventorySlotContents(i, items.get(i));
- }
- return inventoryBasic;
- }
-
- {
- SHULKERS = new Block[]{
- Blocks.BLACK_SHULKER_BOX,
- Blocks.BLUE_SHULKER_BOX,
- Blocks.BROWN_SHULKER_BOX,
- Blocks.CYAN_SHULKER_BOX,
- Blocks.GRAY_SHULKER_BOX,
- Blocks.GREEN_SHULKER_BOX,
- Blocks.LIGHT_BLUE_SHULKER_BOX,
- Blocks.LIME_SHULKER_BOX,
- Blocks.MAGENTA_SHULKER_BOX,
- Blocks.ORANGE_SHULKER_BOX,
- Blocks.PINK_SHULKER_BOX,
- Blocks.PURPLE_SHULKER_BOX,
- Blocks.RED_SHULKER_BOX,
- Blocks.SILVER_SHULKER_BOX,
- Blocks.WHITE_SHULKER_BOX,
- Blocks.YELLOW_SHULKER_BOX
- };
- }
-
- public PeekCommand() {
- super("peek");
- }
-
- @Override
- public void execute(String cmd, String[] args) {
- ItemStack stack = null;
- if (!mc.player.getHeldItemOffhand().isEmpty()) {
- stack = mc.player.getHeldItemOffhand();
- }
- if (!mc.player.getHeldItemMainhand().isEmpty()) {
- stack = mc.player.getHeldItemMainhand();
- }
- if (stack != null && !stack.isEmpty()) {
- if (stack.getItem() instanceof ItemBlock) {
- Block block = ((ItemBlock) stack.getItem()).getBlock();
- if (isShulkerBox(block)) {
- if (stack.hasTagCompound()) {
- ItemStack wtf_java = stack;
-
- mc.displayGuiScreen(new GuiChest(mc.player.inventory, getFromItemNBT(wtf_java.getTagCompound().getCompoundTag("BlockEntityTag"))));
- } else {
- mc.displayGuiScreen(new GuiChest(new InventoryBasic("Shulker Box", true, 27), mc.player.inventory));
- }
- return;
- }
- }
- }
-
- clientMessage("Not holding a shulker box!");
- }
-
- @Override
- public String getSuggestion(String cmd, String[] args) {
- return ".peek";
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/command/impl/ReloadCommand.java b/src/main/java/net/daporkchop/pepsimod/command/impl/ReloadCommand.java
deleted file mode 100644
index c008efa..0000000
--- a/src/main/java/net/daporkchop/pepsimod/command/impl/ReloadCommand.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.command.impl;
-
-import net.daporkchop.pepsimod.command.api.Command;
-
-public class ReloadCommand extends Command {
- public ReloadCommand() {
- super("reload");
- }
-
- @Override
- public void execute(String cmd, String[] args) {
- clientMessage("Reloading resources...");
- new Thread(() -> {
- try {
- pepsimod.data.load();
- } catch (Exception e) {
- clientMessage("Error loading resources! See log for more info.");
- e.printStackTrace();
- throw new RuntimeException(e);
- }
- clientMessage("Resources reloaded!");
- }).start();
- }
-
- @Override
- public String getSuggestion(String cmd, String[] args) {
- return ".reload";
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/command/impl/SetRotCommand.java b/src/main/java/net/daporkchop/pepsimod/command/impl/SetRotCommand.java
deleted file mode 100644
index c5bb44f..0000000
--- a/src/main/java/net/daporkchop/pepsimod/command/impl/SetRotCommand.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.command.impl;
-
-import net.daporkchop.pepsimod.command.api.Command;
-
-public class SetRotCommand extends Command {
- public SetRotCommand() {
- super("setrot");
- }
-
- @Override
- public void execute(String cmd, String[] args) {
- if (args.length < 3) {
- clientMessage("Usage: .setrot ");
- return;
- }
-
- try {
- float yaw = Float.parseFloat(args[1]);
- float pitch = Float.parseFloat(args[2]);
- mc.player.setPositionAndRotation(mc.player.posX, mc.player.posY, mc.player.posZ, yaw, pitch);
- clientMessage("Set rotation to yaw: " + yaw + " pitch: " + pitch);
- } catch (NumberFormatException e) {
- clientMessage("Invalid arguemnts!");
- }
- }
-
- @Override
- public String getSuggestion(String cmd, String[] args) {
- switch (args.length) {
- case 1:
- return ".setrot 0 0";
- case 2:
- return ".setrot " + args[1] + (args[1].length() == 0 ? "0 0" : " 0");
- }
- return ".setrot";
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/command/impl/SortModulesCommand.java b/src/main/java/net/daporkchop/pepsimod/command/impl/SortModulesCommand.java
deleted file mode 100644
index c990879..0000000
--- a/src/main/java/net/daporkchop/pepsimod/command/impl/SortModulesCommand.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.command.impl;
-
-import net.daporkchop.pepsimod.command.api.Command;
-import net.daporkchop.pepsimod.module.ModuleManager;
-import net.daporkchop.pepsimod.module.api.ModuleSortType;
-
-public class SortModulesCommand extends Command {
- public static final String[] MODES = new String[]{"alphabetical", "default", "size", "random"};
-
- public SortModulesCommand() {
- super("sortmodules");
- }
-
- @Override
- public void execute(String cmd, String[] args) {
- String resulttype = null;
- for (int i = 0; i < MODES.length; i++) {
- String toanalyze = MODES[i];
- if (toanalyze.startsWith(args[1])) {
- resulttype = toanalyze;
- break;
- }
- }
- if (resulttype == null) {
- clientMessage("Invalid type: " + args[1]);
- clientMessage("Valid types are: alphabetical, default, size, random");
- } else {
- switch (resulttype) {
- case "alphabetical":
- ModuleManager.sortModules(ModuleSortType.ALPHABETICAL);
- break;
- case "default":
- ModuleManager.sortModules(ModuleSortType.DEFAULT);
- break;
- case "size":
- ModuleManager.sortModules(ModuleSortType.SIZE);
- break;
- case "random":
- ModuleManager.sortModules(ModuleSortType.RANDOM);
- break;
- }
- clientMessage("Sorted modules according to: \u00A7l" + resulttype);
- }
- }
-
- @Override
- public String getSuggestion(String cmd, String[] args) {
- switch (args.length) {
- case 1:
- return ".sortmodules " + MODES[0];
- case 2:
- if (args[1].isEmpty()) {
- return ".sortmodules " + MODES[0];
- }
- for (String mode : MODES) {
- if (mode.startsWith(args[1])) {
- return ".sortmodules " + mode;
- }
- }
- }
-
- return ".sortmodules";
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/command/impl/ToggleCommand.java b/src/main/java/net/daporkchop/pepsimod/command/impl/ToggleCommand.java
deleted file mode 100644
index 1c30267..0000000
--- a/src/main/java/net/daporkchop/pepsimod/command/impl/ToggleCommand.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.command.impl;
-
-import net.daporkchop.pepsimod.command.api.Command;
-import net.daporkchop.pepsimod.module.ModuleManager;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.util.PepsiUtils;
-
-public class ToggleCommand extends Command {
- public ToggleCommand() {
- super("toggle");
- }
-
- @Override
- public void execute(String cmd, String[] args) {
- if (args.length < 2) {
- String s = "";
- for (int i = 0; i < ModuleManager.AVALIBLE_MODULES.size(); i++) {
- s += ModuleManager.AVALIBLE_MODULES.get(i).name + (i + 1 == ModuleManager.AVALIBLE_MODULES.size() ? "" : ", ");
- }
- clientMessage("Available modules: " + PepsiUtils.COLOR_ESCAPE + "o" + s);
- return;
- }
- Module module = ModuleManager.getModuleByName(args[1]);
- if (module == null) {
- clientMessage("No module was found by the name: " + PepsiUtils.COLOR_ESCAPE + "o" + args[1]);
- } else {
- ModuleManager.toggleModule(module);
- clientMessage("Toggled module: " + PepsiUtils.COLOR_ESCAPE + "o" + module.name);
- }
- }
-
- @Override
- public String getSuggestion(String cmd, String[] args) {
- switch (args.length) {
- case 1:
- return ".toggle " + ModuleManager.AVALIBLE_MODULES.get(0).name;
- case 2:
- if (args[1].isEmpty()) {
- return ".toggle " + ModuleManager.AVALIBLE_MODULES.get(0).name;
- }
- for (Module module : ModuleManager.AVALIBLE_MODULES) {
- if (module.name.startsWith(args[1])) {
- return ".toggle " + module.name;
- }
- }
- return "";
- }
-
- return ".toggle";
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/event/GuiRenderHandler.java b/src/main/java/net/daporkchop/pepsimod/event/GuiRenderHandler.java
deleted file mode 100644
index bbb8356..0000000
--- a/src/main/java/net/daporkchop/pepsimod/event/GuiRenderHandler.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.event;
-
-import net.daporkchop.pepsimod.module.ModuleManager;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.util.BetterScaledResolution;
-import net.daporkchop.pepsimod.util.PepsiConstants;
-import net.minecraft.client.gui.GuiIngame;
-import net.minecraftforge.client.event.RenderGameOverlayEvent;
-import net.minecraftforge.client.event.RenderWorldLastEvent;
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
-
-public class GuiRenderHandler extends PepsiConstants {
- public static GuiRenderHandler INSTANCE;
-
- {
- INSTANCE = this;
- new BetterScaledResolution();
- }
-
- @SubscribeEvent
- public void onRenderGui(RenderGameOverlayEvent.Post event) {
- if (event.getType() != RenderGameOverlayEvent.ElementType.HOTBAR) {
- return;
- }
-
- GuiIngame gui = mc.ingameGUI;
-
- BetterScaledResolution.INSTANCE.update();
- int width = BetterScaledResolution.INSTANCE.scaledWidth;
- int height = BetterScaledResolution.INSTANCE.scaledHeight;
-
- for (Module module : ModuleManager.ENABLED_MODULES) {
- module.onRenderGUI(event.getPartialTicks(), width, height, gui);
- }
- }
-
- @SubscribeEvent
- public void onRenderWorld(RenderWorldLastEvent event) {
- for (Module module : ModuleManager.ENABLED_MODULES) {
- module.onRender(event.getPartialTicks());
- }
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/event/MiscEventHandler.java b/src/main/java/net/daporkchop/pepsimod/event/MiscEventHandler.java
deleted file mode 100644
index 27ea86d..0000000
--- a/src/main/java/net/daporkchop/pepsimod/event/MiscEventHandler.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.event;
-
-import net.daporkchop.pepsimod.module.impl.misc.HUDMod;
-import net.daporkchop.pepsimod.module.impl.misc.NotificationsMod;
-import net.daporkchop.pepsimod.util.PepsiConstants;
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
-import net.minecraftforge.fml.common.network.FMLNetworkEvent;
-
-import java.awt.TrayIcon;
-
-public class MiscEventHandler extends PepsiConstants {
- public static MiscEventHandler INSTANCE;
-
- @SubscribeEvent
- public void onDisconnect(FMLNetworkEvent.ClientDisconnectionFromServerEvent event) {
- HUDMod.INSTANCE.serverBrand = "";
- System.out.println("[PEPSIMOD] Saving config...");
- pepsimod.saveConfig();
- System.out.println("[PEPSIMOD] Saved.");
- NotificationsMod.sendNotification("Disconnected from server", TrayIcon.MessageType.WARNING);
- NotificationsMod.INSTANCE.inQueue = false;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/gui/clickgui/ClickGUI.java b/src/main/java/net/daporkchop/pepsimod/gui/clickgui/ClickGUI.java
deleted file mode 100644
index 3174caa..0000000
--- a/src/main/java/net/daporkchop/pepsimod/gui/clickgui/ClickGUI.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.gui.clickgui;
-
-import net.daporkchop.pepsimod.module.ModuleManager;
-import net.daporkchop.pepsimod.module.impl.misc.ClickGuiMod;
-import net.minecraft.client.gui.GuiScreen;
-import net.minecraft.util.math.MathHelper;
-import org.lwjgl.input.Mouse;
-
-import java.io.IOException;
-
-public class ClickGUI extends GuiScreen {
- public static ClickGUI INSTANCE;
- public Window[] windows;
-
- {
- INSTANCE = this;
- }
-
- public void setWindows(Window... windows) {
- this.windows = windows;
- }
-
- public void initWindows() {
- for (Window window : this.windows) {
- window.init(window.category);
- }
- }
-
- protected void keyTyped(char eventChar, int eventKey) {
- if (eventKey == 1 || eventKey == ClickGuiMod.INSTANCE.keybind.getKeyCode()) {
- ModuleManager.disableModule(ClickGuiMod.INSTANCE);
-
- this.mc.displayGuiScreen(null);
-
- if (this.mc.currentScreen == null) {
- this.mc.setIngameFocus();
- }
- }
- }
-
- public synchronized void sendToFront(Window window) {
- if (this.containsWindow(window)) {
- int panelIndex = 0;
- for (int i = 0; i < this.windows.length; i++) {
- if (this.windows[i] == window) {
- panelIndex = i;
- break;
- }
- }
- Window t = this.windows[0];
- this.windows[0] = this.windows[panelIndex];
- this.windows[panelIndex] = t;
- }
- }
-
- public void mouseClicked(int x, int y, int b) throws IOException {
- for (Window window : this.windows) {
- window.processMouseClick(x, y, b);
- }
-
- super.mouseClicked(x, y, b);
- }
-
- public void mouseReleased(int x, int y, int state) {
- for (Window window : this.windows) {
- window.processMouseRelease(x, y, state);
- }
-
- super.mouseReleased(x, y, state);
- }
-
- public void drawScreen(int x, int y, float ticks) {
- for (Window window : this.windows) {
- window.draw(x, y);
- }
-
- super.drawScreen(x, y, ticks);
- }
-
- @Override
- public boolean doesGuiPauseGame() {
- return false;
- }
-
- public boolean containsWindow(Window window) {
- for (Window window1 : this.windows) {
- if (window == window1) {
- return true;
- }
- }
-
- return false;
- }
-
- @Override
- public void handleMouseInput() throws IOException {
- super.handleMouseInput();
- int dWheel = MathHelper.clamp(Mouse.getEventDWheel(), -1, 1);
- if (dWheel != 0) {
- dWheel *= -1;
- int x = Mouse.getEventX() * this.width / this.mc.displayWidth;
- int y = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1;
- for (Window window : this.windows) {
- window.handleScroll(dWheel, x, y);
- }
- }
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/gui/clickgui/Window.java b/src/main/java/net/daporkchop/pepsimod/gui/clickgui/Window.java
deleted file mode 100644
index e61a281..0000000
--- a/src/main/java/net/daporkchop/pepsimod/gui/clickgui/Window.java
+++ /dev/null
@@ -1,328 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.gui.clickgui;
-
-import net.daporkchop.pepsimod.gui.clickgui.api.EntryImplBase;
-import net.daporkchop.pepsimod.gui.clickgui.api.IEntry;
-import net.daporkchop.pepsimod.gui.clickgui.entry.Button;
-import net.daporkchop.pepsimod.gui.clickgui.entry.SubButton;
-import net.daporkchop.pepsimod.gui.clickgui.entry.SubSlider;
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.ModuleManager;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-import net.daporkchop.pepsimod.module.api.option.ExtensionType;
-import net.daporkchop.pepsimod.util.BetterScaledResolution;
-import net.daporkchop.pepsimod.util.PepsiUtils;
-import net.daporkchop.pepsimod.util.colors.ColorUtils;
-import net.daporkchop.pepsimod.util.config.impl.HUDTranslator;
-import org.lwjgl.opengl.GL11;
-
-import java.awt.Color;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-public class Window extends EntryImplBase {
- public final String text;
- public List entries = Collections.synchronizedList(new ArrayList());
- public boolean isOpen = false;
- public int modulesCounted = 0;
- public int scroll = 0;
- public ModuleCategory category;
- private int renderYButton = 0;
- private boolean isDragging = false;
- private int dragX = 0, dragY = 0;
-
- public Window(int x, int y, String name, ModuleCategory category) {
- super(x, y, 100, 12);
- this.text = name;
- this.category = category;
- }
-
- public void processMouseClick(int mouseX, int mouseY, int button) {
- this.updateIsMouseHovered(mouseX, mouseY);
- if (this.isMouseHovered()) {
- ClickGUI.INSTANCE.sendToFront(this);
- if (button == 0) {
- //drag
- this.isDragging = true;
- this.dragX = mouseX - this.getX();
- this.dragY = mouseY - this.getY();
- } else if (button == 1) {
- this.isOpen = !this.isOpen;
- } else if (button == 2) {
- //anything with a middle mouse button (unimplemented)
- }
- }
-
- for (IEntry entry : this.entries) {
- if (entry.shouldRender()) {
- entry.processMouseClick(mouseX, mouseY, button);
- }
- }
- }
-
- public void processMouseRelease(int mouseX, int mouseY, int button) {
- this.updateIsMouseHovered(mouseX, mouseY);
- if (this.isDragging) {
- this.isDragging = false;
- }
-
- for (IEntry entry : this.entries) {
- if (entry.shouldRender()) {
- entry.processMouseRelease(mouseX, mouseY, button);
- }
- }
- }
-
- public void draw(int mouseX, int mouseY) {
- if (this.isDragging) {
- this.setX(mouseX - this.dragX);
- this.setY(mouseY - this.dragY);
- }
- GL11.glPushMatrix();
- GL11.glPushAttrib(8256);
-
- this.scroll = Math.max(0, this.scroll);
- this.scroll = Math.min(this.getDisplayableCount() - this.getModulesToDisplay(), this.scroll);
-
- this.updateIsMouseHovered(mouseX, mouseY);
- this.renderYButton = this.getY();
- PepsiUtils.drawRect(this.getX(), this.getY(), this.getX() + this.getWidth(), this.getY() + this.getDisplayedHeight(), this.getColor());
- GL11.glColor3f(0f, 0f, 0f);
- drawString(this.getX() + 2, this.getY() + 2, this.text, Color.BLACK.getRGB());
- if (this.isOpen) {
- if (this.shouldScroll()) {
- int barHeight = this.getScrollbarHeight();
- int barY = this.getScrollbarY();
- barY = Math.min(barY, this.getScrollingModuleCount() * 13 - 1 - barHeight);
- PepsiUtils.drawRect(this.getX() + 97, this.getY() + 13 + barY, this.getX() + 99, Math.min(this.getY() + 13 + barY + barHeight, this.getY() + this.getDisplayedHeight() - 1), HUDTranslator.INSTANCE.getColor());
- } else {
- PepsiUtils.drawRect(this.getX() + 97, this.getY() + 13, this.getX() + 99, this.getDisplayedHeight() - 1, HUDTranslator.INSTANCE.getColor());
- }
- this.modulesCounted = 0;
- for (int i = this.getScroll(); i < this.getModulesToDisplay() + this.getScroll(); i++) {
- IEntry entry = this.getNextEntry();
- this.modulesCounted++;
- entry.draw(mouseX, mouseY);
- }
- }
-
- GL11.glPopMatrix();
- GL11.glPopAttrib();
- }
-
- public int getScrollbarHeight() {
- double maxHeight = this.maxDisplayHeight();
- double maxAllowedModules = this.getScrollingModuleCount();
- double displayable = this.getDisplayableCount();
- int result = (int) Math.floor(maxHeight * (maxAllowedModules / displayable));
- return result;
- }
-
- public int getScrollbarY() {
- int displayable = this.getDisplayableCount();
- int rest = displayable - this.scroll;
- int resultRaw = displayable - rest;
- return resultRaw * 13;
- }
-
- 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 getHeight() {
- int i = this.height + 1; //+
- for (IEntry entry : this.entries) {
- if (entry.shouldRender()) {
- i += 13;
- }
- }
- return i;
- }
-
- public int getDisplayableCount() {
- int i = 0;
- for (IEntry entry : this.entries) {
- if (entry.shouldRender()) {
- i++;
- }
- }
- return i;
- }
-
- public int getWidth() {
- return this.width;
- }
-
- public int getColor() {
- return ColorUtils.getColorForGuiEntry(ColorUtils.TYPE_WINDOW, this.isMouseHovered(), false);
- }
-
- public Button addButton(Button b) {
- this.entries.add(b);
- return b;
- }
-
- public SubButton addSubButton(SubButton b) {
- this.entries.add(this.entries.indexOf(b.parent) + 1, b);
- b.parent.subEntries.add(b);
- return b;
- }
-
- public SubSlider addSubSlider(SubSlider slider) {
- this.entries.add(this.entries.indexOf(slider.parent) + 1, slider);
- slider.parent.subEntries.add(slider);
- return slider;
- }
-
- public int getRenderYButton() {
- return this.renderYButton += 13;
- }
-
- public boolean shouldRender() {
- return true;
- }
-
- public void openGui() {
- for (IEntry entry : this.entries) {
- entry.openGui();
- }
- }
-
- public int getScroll() {
- if (this.shouldScroll()) {
- return this.scroll;
- } else {
- return 0;
- }
- }
-
- public void init(ModuleCategory category) {
- for (Module module : ModuleManager.AVALIBLE_MODULES) {
- if (module.getCategory() != category) {
- continue;
- }
- Button b = this.addButton(new Button(this, module));
- for (ModuleOption option : module.options) {
- if (option.makeButton) {
- if (option.extended == null) {
- this.addSubButton(new SubButton(b, option));
- } else if (option.extended.getType() == ExtensionType.TYPE_SLIDER) {
- this.addSubSlider(new SubSlider(b, option));
- } else {
- throw new IllegalStateException("Option " + option.getName() + " uses an unsupported extension type!");
- }
- }
- }
- }
- }
-
- public String getName() {
- return this.text;
- }
-
- public boolean isOpen() {
- return this.isOpen;
- }
-
- public void setOpen(boolean val) {
- this.isOpen = val;
- }
-
- public int maxDisplayHeight() {
- int height = BetterScaledResolution.INSTANCE.scaledHeight;
- height = Math.floorDiv(height, 13);
- height -= 1;
- height *= 13;
- return height;
- }
-
- public int getScrollingModuleCount() {
- int height = BetterScaledResolution.INSTANCE.scaledHeight;
- height = Math.floorDiv(height, 13);
- height -= 2;
- return height;
- }
-
- public int getModulesToDisplay() {
- if (this.shouldScroll()) {
- return this.getScrollingModuleCount();
- } else {
- return this.getDisplayableCount();
- }
- }
-
- public boolean shouldScroll() {
- boolean val = this.getScrollingModuleCount() < this.getDisplayableCount();
- return val;
- }
-
- public int getDisplayedHeight() {
- int max = this.maxDisplayHeight();
- int normal = this.getHeight();
- int toReturn = Math.min(max, normal);
- return toReturn;
- }
-
- public IEntry getNextEntry() {
- int a = 0;
- int i = this.scroll;
- for (; ; i++) {
- IEntry entry = this.entries.get(i);
- if (entry.shouldRender()) {
- if (this.modulesCounted != 0) {
- if (a < this.modulesCounted) {
- a++;
- continue;
- }
- }
- return entry;
- }
- }
- }
-
- public void handleScroll(int dWheel, int x, int y) {
- this.updateIsMouseHoveredFull(x, y);
- if (this.isMouseHovered() && this.shouldScroll()) {
- this.scroll += dWheel;
- }
- }
-
- protected void updateIsMouseHoveredFull(int mouseX, int mouseY) {
- int x = this.getX(), y = this.getY();
- int maxX = x + this.width, maxY = y + this.getDisplayedHeight();
- this.isHoveredCached = (x <= mouseX && mouseX <= maxX && y <= mouseY && mouseY <= maxY);
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/gui/clickgui/api/EntryImplBase.java b/src/main/java/net/daporkchop/pepsimod/gui/clickgui/api/EntryImplBase.java
deleted file mode 100644
index c1a486e..0000000
--- a/src/main/java/net/daporkchop/pepsimod/gui/clickgui/api/EntryImplBase.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.gui.clickgui.api;
-
-import net.daporkchop.pepsimod.util.PepsiConstants;
-
-public abstract class EntryImplBase extends PepsiConstants implements IEntry {
- public static void drawString(int x, int y, String text, int color) {
- mc.fontRenderer.drawString(text, x, y, color, false);
- }
- public final int width;
- public final int height;
- public int x;
- public int y;
- protected boolean isHoveredCached = false;
-
- public EntryImplBase(int x, int y, int width, int height) {
- this.x = x;
- this.y = y;
- this.width = width;
- this.height = height;
- }
-
- public boolean isMouseHovered() {
- return this.isHoveredCached;
- }
-
- protected void updateIsMouseHovered(int mouseX, int mouseY) {
- int x = this.getX(), y = this.getY();
- int maxX = x + this.width, maxY = y + this.height;
- this.isHoveredCached = (x <= mouseX && mouseX <= maxX && y <= mouseY && mouseY <= maxY);
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/gui/clickgui/api/IEntry.java b/src/main/java/net/daporkchop/pepsimod/gui/clickgui/api/IEntry.java
deleted file mode 100644
index ebb9e1d..0000000
--- a/src/main/java/net/daporkchop/pepsimod/gui/clickgui/api/IEntry.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.gui.clickgui.api;
-
-public interface IEntry {
- boolean isMouseHovered();
-
- void draw(int mouseX, int mouseY);
-
- void processMouseClick(int x, int y, int button);
-
- void processMouseRelease(int x, int y, int button);
-
- int getX();
-
- void setX(int x);
-
- int getY();
-
- void setY(int y);
-
- int getWidth();
-
- int getHeight();
-
- int getColor();
-
- boolean shouldRender();
-
- void openGui();
-
- String getName();
-
- boolean isOpen();
-
- void setOpen(boolean val);
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/gui/clickgui/entry/Button.java b/src/main/java/net/daporkchop/pepsimod/gui/clickgui/entry/Button.java
deleted file mode 100644
index fc061ed..0000000
--- a/src/main/java/net/daporkchop/pepsimod/gui/clickgui/entry/Button.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.gui.clickgui.entry;
-
-import net.daporkchop.pepsimod.gui.clickgui.Window;
-import net.daporkchop.pepsimod.gui.clickgui.api.EntryImplBase;
-import net.daporkchop.pepsimod.gui.clickgui.api.IEntry;
-import net.daporkchop.pepsimod.module.ModuleManager;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.util.PepsiUtils;
-import net.daporkchop.pepsimod.util.colors.ColorUtils;
-import org.lwjgl.opengl.GL11;
-
-import java.awt.Color;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-public class Button extends EntryImplBase {
- public List subEntries = Collections.synchronizedList(new ArrayList());
- public boolean isOpen = false;
- public Window window;
- public Module module;
-
- public Button(Window window, Module module) {
- super(window.getX() + 2, window.getY() + 2, window.getWidth() - 6, 12);
- this.window = window;
- this.module = module;
- }
-
- public void processMouseClick(int mouseX, int mouseY, int button) {
- this.updateIsMouseHovered(mouseX, mouseY);
- if (this.isMouseHovered()) {
- if (button == 0) {
- ModuleManager.toggleModule(this.module);
- } else if (button == 1) {
- this.isOpen = !this.isOpen;
- }
- }
- }
-
- public void processMouseRelease(int mouseX, int mouseY, int button) {
- this.updateIsMouseHovered(mouseX, mouseY);
- }
-
- public void draw(int mouseX, int mouseY) {
- this.y = this.window.getRenderYButton();
- this.x = this.window.getX() + 2;
- this.updateIsMouseHovered(mouseX, mouseY);
- PepsiUtils.drawRect(this.getX(), this.getY(), this.getX() + this.getWidth(), this.getY() + this.height, this.getColor());
- GL11.glColor3f(0f, 0f, 0f);
- drawString(this.getX() + 2, this.getY() + 2, this.module.nameFull, Color.BLACK.getRGB());
- }
-
- 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 getHeight() {
- int i = this.height;
- if (this.isOpen) {
- i += 13 * this.subEntries.size(); //13 px for padding
- }
- return i;
- }
-
- public int getWidth() {
- return this.width;
- }
-
- public int getColor() {
- return ColorUtils.getColorForGuiEntry(ColorUtils.TYPE_BUTTON, this.isMouseHovered(), this.module.state.enabled);
- }
-
- public boolean shouldRender() {
- return this.window.isOpen;
- }
-
- public void openGui() {
-
- }
-
- public String getName() {
- return this.module.name;
- }
-
- public boolean isOpen() {
- return this.isOpen;
- }
-
- public void setOpen(boolean val) {
- this.isOpen = val;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/gui/clickgui/entry/SubButton.java b/src/main/java/net/daporkchop/pepsimod/gui/clickgui/entry/SubButton.java
deleted file mode 100644
index 04b0f15..0000000
--- a/src/main/java/net/daporkchop/pepsimod/gui/clickgui/entry/SubButton.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.gui.clickgui.entry;
-
-import net.daporkchop.pepsimod.gui.clickgui.Window;
-import net.daporkchop.pepsimod.gui.clickgui.api.EntryImplBase;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-import net.daporkchop.pepsimod.util.PepsiUtils;
-import net.daporkchop.pepsimod.util.colors.ColorUtils;
-import org.lwjgl.opengl.GL11;
-
-import java.awt.Color;
-
-public class SubButton extends EntryImplBase {
- public final Button parent;
- public Window window;
- public ModuleOption option;
-
- public SubButton(Button parent, ModuleOption option) {
- super(parent.window.getX() + 4, parent.getY() + 4, parent.window.getWidth() - 8, 12);
- this.parent = parent;
- this.window = parent.window;
- this.option = option;
- }
-
- public void processMouseClick(int mouseX, int mouseY, int button) {
- this.updateIsMouseHovered(mouseX, mouseY);
- if (this.isMouseHovered()) {
- if (button == 0) {
- this.option.setValue(!((boolean) this.option.getValue()));
- }
- }
- }
-
- public void processMouseRelease(int mouseX, int mouseY, int button) {
- this.updateIsMouseHovered(mouseX, mouseY);
- }
-
- public void draw(int mouseX, int mouseY) {
- this.y = this.window.getRenderYButton();
- this.x = this.window.getX() + 4;
- this.updateIsMouseHovered(mouseX, mouseY);
- PepsiUtils.drawRect(this.getX(), this.getY(), this.getX() + this.getWidth(), this.getY() + this.height, this.getColor());
- GL11.glColor3f(0f, 0f, 0f);
- mc.fontRenderer.drawString(this.option.displayName, this.getX() + 2, this.getY() + 2, Color.BLACK.getRGB());
- }
-
- 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 getHeight() {
- return this.height;
- }
-
- public int getWidth() {
- return this.width;
- }
-
- public int getColor() {
- return ColorUtils.getColorForGuiEntry(ColorUtils.TYPE_BUTTON, this.isMouseHovered(), (boolean) this.option.getValue());
- }
-
- public boolean shouldRender() {
- return this.parent.isOpen && this.parent.shouldRender();
- }
-
- public void openGui() {
-
- }
-
- public String getName() {
- return this.option.getName();
- }
-
- public boolean isOpen() {
- return false;
- }
-
- public void setOpen(boolean val) {
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/gui/clickgui/entry/SubSlider.java b/src/main/java/net/daporkchop/pepsimod/gui/clickgui/entry/SubSlider.java
deleted file mode 100644
index e0f60f0..0000000
--- a/src/main/java/net/daporkchop/pepsimod/gui/clickgui/entry/SubSlider.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.gui.clickgui.entry;
-
-import net.daporkchop.pepsimod.gui.clickgui.Window;
-import net.daporkchop.pepsimod.gui.clickgui.api.EntryImplBase;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-import net.daporkchop.pepsimod.module.api.option.ExtensionSlider;
-import net.daporkchop.pepsimod.module.api.option.ExtensionType;
-import net.daporkchop.pepsimod.util.PepsiUtils;
-import net.daporkchop.pepsimod.util.colors.ColorUtils;
-import org.lwjgl.opengl.GL11;
-
-import java.awt.Color;
-
-public class SubSlider extends EntryImplBase {
- public final Button parent;
- public Window window;
- public ModuleOption option;
- public ExtensionSlider slider;
- public int intValue;
- public float floatValue;
- public int currentWidth;
- public boolean isFloat;
- public boolean dragging = false;
-
- public SubSlider(Button parent, ModuleOption option) {
- super(parent.window.getX() + 4, parent.getY() + 4, parent.window.getWidth() - 8, 12);
- this.parent = parent;
- this.window = parent.window;
- this.slider = (ExtensionSlider) option.extended;
- if (this.isFloat = this.slider.dataType == ExtensionType.VALUE_FLOAT) {
- this.floatValue = (float) option.getValue();
- } else {
- this.intValue = (int) (Object) option.getValue();
- }
- this.option = option;
- }
-
- public void processMouseClick(int mouseX, int mouseY, int button) {
- this.updateIsMouseHovered(mouseX, mouseY);
- if (this.isMouseHovered()) {
- if (button == 0) {
- this.dragging = true;
- }
- }
- }
-
- public void processMouseRelease(int mouseX, int mouseY, int button) {
- this.updateIsMouseHovered(mouseX, mouseY);
- if (this.dragging && button == 0) {
- this.dragging = false;
- this.getWidthFromValue();
- }
- }
-
- public void draw(int mouseX, int mouseY) {
- if (this.dragging) {
- this.currentWidth = mouseX - this.getX();
- if (this.currentWidth < 0) {
- this.currentWidth = 0;
- } else if (this.currentWidth > 92) {
- this.currentWidth = 92;
- }
- this.updateValueFromWidth();
- }
- this.y = this.window.getRenderYButton();
- this.x = this.window.getX() + 4;
- this.updateIsMouseHovered(mouseX, mouseY);
- PepsiUtils.drawRect(this.getX(), this.getY(), this.getX() + this.getWidth(), this.getY() + this.height, ColorUtils.BACKGROUND);
- PepsiUtils.drawRect(this.getX(), this.getY(), this.getX() + this.currentWidth, this.getY() + this.height, this.getColor());
- GL11.glColor3f(0f, 0f, 0f);
- mc.fontRenderer.drawString(this.option.displayName + ": " + (this.isFloat ? PepsiUtils.roundFloatForSlider(this.floatValue) : this.intValue), this.getX() + 2, this.getY() + 2, Color.BLACK.getRGB());
- }
-
- public void updateValueFromWidth() {
- float val = (this.currentWidth / 92f);
- val *= (this.getMax() - this.getMin());
- val += this.getMin();
- val = PepsiUtils.round(val, this.getStep());
- val = PepsiUtils.ensureRange(val, this.getMin(), this.getMax());
- if (this.isFloat) {
- this.floatValue = val;
- this.option.setValue(val);
- } else {
- this.intValue = (int) val;
- this.option.setValue((int) val);
- }
- }
-
- public float getMax() {
- float val = this.isFloat ? (float) this.slider.max : ((int) this.slider.max) + 0.0f;
- return val;
- }
-
- public float getMin() {
- float val = this.isFloat ? (float) this.slider.min : ((int) this.slider.min) + 0.0f;
- return val;
- }
-
- public float getStep() {
- float val = this.isFloat ? (float) this.slider.step : ((int) this.slider.step) + 0.0f;
- return val;
- }
-
- public int getWidthFromValue() {
- float val = this.isFloat ? this.floatValue : this.intValue + 0.0f;
- val -= this.getMin();
- val /= (this.getMax() - this.getMin());
- val *= 92;
- return this.currentWidth = PepsiUtils.ensureRange((int) val, 0, 92);
- }
-
- 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 getHeight() {
- return this.height;
- }
-
- public int getWidth() {
- return this.width;
- }
-
- public int getColor() {
- return ColorUtils.getColorForGuiEntry(ColorUtils.TYPE_SLIDER, this.isMouseHovered(), false);
- }
-
- public boolean shouldRender() {
- return this.parent.isOpen && this.parent.shouldRender();
- }
-
- public void openGui() {
- if (this.isFloat) {
- this.floatValue = (float) this.option.getValue();
- } else {
- this.intValue = (int) (Object) this.option.getValue();
- }
- this.getWidthFromValue();
- }
-
- public String getName() {
- return this.option.getName();
- }
-
- public boolean isOpen() {
- return false;
- }
-
- public void setOpen(boolean val) {
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/gui/clickgui/window/WindowCombat.java b/src/main/java/net/daporkchop/pepsimod/gui/clickgui/window/WindowCombat.java
deleted file mode 100644
index 0a8bf7d..0000000
--- a/src/main/java/net/daporkchop/pepsimod/gui/clickgui/window/WindowCombat.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.gui.clickgui.window;
-
-import net.daporkchop.pepsimod.gui.clickgui.Window;
-import net.daporkchop.pepsimod.module.ModuleCategory;
-
-public class WindowCombat extends Window {
-
- public WindowCombat() {
- super(104, 2, "Combat", ModuleCategory.COMBAT);
- }
-}
\ No newline at end of file
diff --git a/src/main/java/net/daporkchop/pepsimod/gui/clickgui/window/WindowMisc.java b/src/main/java/net/daporkchop/pepsimod/gui/clickgui/window/WindowMisc.java
deleted file mode 100644
index 4f27e7f..0000000
--- a/src/main/java/net/daporkchop/pepsimod/gui/clickgui/window/WindowMisc.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.gui.clickgui.window;
-
-import net.daporkchop.pepsimod.gui.clickgui.Window;
-import net.daporkchop.pepsimod.module.ModuleCategory;
-
-public class WindowMisc extends Window {
-
- public WindowMisc() {
- super(206, 2, "Misc", ModuleCategory.MISC);
- }
-}
\ No newline at end of file
diff --git a/src/main/java/net/daporkchop/pepsimod/gui/clickgui/window/WindowPlayer.java b/src/main/java/net/daporkchop/pepsimod/gui/clickgui/window/WindowPlayer.java
deleted file mode 100644
index e46ec90..0000000
--- a/src/main/java/net/daporkchop/pepsimod/gui/clickgui/window/WindowPlayer.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.gui.clickgui.window;
-
-import net.daporkchop.pepsimod.gui.clickgui.Window;
-import net.daporkchop.pepsimod.module.ModuleCategory;
-
-public class WindowPlayer extends Window {
-
- public WindowPlayer() {
- super(410, 2, "Player", ModuleCategory.PLAYER);
- }
-}
\ No newline at end of file
diff --git a/src/main/java/net/daporkchop/pepsimod/gui/clickgui/window/WindowRender.java b/src/main/java/net/daporkchop/pepsimod/gui/clickgui/window/WindowRender.java
deleted file mode 100644
index 4edbddc..0000000
--- a/src/main/java/net/daporkchop/pepsimod/gui/clickgui/window/WindowRender.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.gui.clickgui.window;
-
-import net.daporkchop.pepsimod.gui.clickgui.Window;
-import net.daporkchop.pepsimod.module.ModuleCategory;
-
-public class WindowRender extends Window {
-
- public WindowRender() {
- super(2, 2, "Render", ModuleCategory.RENDER);
- }
-}
\ No newline at end of file
diff --git a/src/main/java/net/daporkchop/pepsimod/gui/mcleaks/GuiButtonMCLeaks.java b/src/main/java/net/daporkchop/pepsimod/gui/mcleaks/GuiButtonMCLeaks.java
deleted file mode 100644
index 5b47dda..0000000
--- a/src/main/java/net/daporkchop/pepsimod/gui/mcleaks/GuiButtonMCLeaks.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.gui.mcleaks;
-
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.GuiButton;
-import net.minecraft.client.renderer.GlStateManager;
-import net.minecraft.util.ResourceLocation;
-
-public class GuiButtonMCLeaks extends GuiButton {
- private ResourceLocation location;
-
- public GuiButtonMCLeaks(int buttonId, int x, int y, int widthIn, int heightIn) {
- super(buttonId, x, y, widthIn, heightIn, "");
- this.width = 20;
- this.height = 20;
- this.enabled = true;
- this.visible = true;
- this.id = buttonId;
- this.x = x;
- this.y = y;
- this.width = widthIn;
- this.height = heightIn;
- this.location = null;
- }
-
- @Override
- public void drawButton(Minecraft mc, int mouseX, int mouseY, float partialTicks) {
- if (this.location == null) {
- this.location = new ResourceLocation("pepsimod", "textures/gui/pepsibuttons.png");
- }
- if (this.visible) {
- mc.getTextureManager().bindTexture(this.location);
- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
- this.hovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height;
- int k = this.getHoverState(this.hovered);
- GlStateManager.enableBlend();
- GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
- GlStateManager.blendFunc(770, 771);
- this.drawTexturedModalRect(this.x, this.y, 0, (this.hovered ? 20 : 0), this.width, this.height);
- this.drawTexturedModalRect(this.x + this.width, this.y, 200 - this.width, k * 20, this.width, this.height);
- this.mouseDragged(mc, mouseX, mouseY);
- }
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/gui/mcleaks/GuiScreenMCLeaks.java b/src/main/java/net/daporkchop/pepsimod/gui/mcleaks/GuiScreenMCLeaks.java
deleted file mode 100644
index 552449a..0000000
--- a/src/main/java/net/daporkchop/pepsimod/gui/mcleaks/GuiScreenMCLeaks.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.gui.mcleaks;
-
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
-import net.daporkchop.pepsimod.util.AccountManager;
-import net.daporkchop.pepsimod.util.HTTPUtils;
-import net.daporkchop.pepsimod.util.MCLeaks;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.GuiButton;
-import net.minecraft.client.gui.GuiScreen;
-import net.minecraft.client.gui.GuiTextField;
-import net.minecraft.util.Session;
-import org.lwjgl.input.Keyboard;
-
-import java.io.IOException;
-
-import static net.daporkchop.pepsimod.util.PepsiConstants.pepsimod;
-
-public class GuiScreenMCLeaks extends GuiScreen {
- public Minecraft mc;
- public GuiScreen prevScreen;
- private GuiTextField tokenField;
-
- public GuiScreenMCLeaks(GuiScreen screen, Minecraft minecraft) {
- this.mc = minecraft;
- this.prevScreen = screen;
- }
-
- public void updateScreen() {
- this.tokenField.updateCursorCounter();
- }
-
- /**
- * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
- * window resizes, the buttonList is cleared beforehand.
- */
- public void initGui() {
- Keyboard.enableRepeatEvents(true);
- this.buttonList.clear();
- this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 96 + 18, "Log in"));
- this.buttonList.add(new GuiButton(1, this.width / 2 + 2, this.height / 4 + 120 + 18, 98, 20, "Back"));
- this.buttonList.add(new GuiButton(2, this.width / 2 - 100, this.height / 4 + 120 + 18, 98, 20, "Original"));
- this.tokenField = new GuiTextField(1, this.fontRenderer, this.width / 2 - 100, 106, 200, 20);
- this.tokenField.setMaxStringLength(128);
- this.tokenField.setText("");
- this.buttonList.get(0).enabled = !this.tokenField.getText().isEmpty();
- }
-
- /**
- * Called when the screen is unloaded. Used to disable keyboard repeat events
- */
- public void onGuiClosed() {
- Keyboard.enableRepeatEvents(false);
- }
-
- /**
- * Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
- */
- protected void actionPerformed(GuiButton button) throws IOException {
- if (button.enabled) {
- if (button.id == 1) {
- this.mc.displayGuiScreen(this.prevScreen);
- } else if (button.id == 0) {
- MCLeaks.RedeemResponse response = MCLeaks.redeemToken(this.tokenField.getText());
- if (response.success) {
- String idJson = HTTPUtils.performGetRequest(HTTPUtils.constantURL("https://api.mojang.com/users/profiles/minecraft/" + response.getName()));
- JsonObject json = (new JsonParser()).parse(idJson).getAsJsonObject();
- String UUID = json.get("id").getAsString();
-
- Session session = new Session(response.getName(), UUID, response.getSession(), "mojang");
-
- try {
- new AccountManager().setSession(session);
- } catch (Exception e) {
- e.printStackTrace();
- }
- this.tokenField.setText("");
- }
-
- pepsimod.isMcLeaksAccount = true;
- } else if (button.id == 2) {
- if (pepsimod.originalSession != null) {
- try {
- new AccountManager().setSession(pepsimod.originalSession);
- pepsimod.isMcLeaksAccount = false;
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
- }
- }
-
- /**
- * Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of
- * KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code)
- */
- protected void keyTyped(char typedChar, int keyCode) throws IOException //TODO: obfuscate password
- {
- this.tokenField.textboxKeyTyped(typedChar, keyCode);
-
- if (keyCode == 15) {
- this.tokenField.setFocused(!this.tokenField.isFocused());
- }
-
- if (keyCode == 28 || keyCode == 156) {
- this.actionPerformed(this.buttonList.get(0));
- }
- }
-
- /**
- * Called when the mouse is clicked. Args : mouseX, mouseY, clickedButton
- */
- protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
- super.mouseClicked(mouseX, mouseY, mouseButton);
- this.tokenField.mouseClicked(mouseX, mouseY, mouseButton);
- }
-
- /**
- * Draws the screen and all the components in it.
- */
- public void drawScreen(int mouseX, int mouseY, float partialTicks) {
- this.buttonList.get(0).enabled = !this.tokenField.getText().isEmpty();
- this.drawDefaultBackground();
- this.drawCenteredString(this.fontRenderer, "\u00A79\u00A7lMCLeaks login", this.width / 2, 17, 16777215);
- this.drawCenteredString(this.fontRenderer, "Username: " + this.mc.getSession().getUsername(), this.width / 2, 27, 10526880);
- this.drawCenteredString(this.fontRenderer, "UUID: " + this.mc.getSession().getPlayerID(), this.width / 2, 37, 10526880);
- this.tokenField.drawTextBox();
- super.drawScreen(mouseX, mouseY, partialTicks);
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/gui/misc/GuiButtonTooBeeTooTee.java b/src/main/java/net/daporkchop/pepsimod/gui/misc/GuiButtonTooBeeTooTee.java
deleted file mode 100644
index 7dbf7f3..0000000
--- a/src/main/java/net/daporkchop/pepsimod/gui/misc/GuiButtonTooBeeTooTee.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.gui.misc;
-
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.GuiButton;
-import net.minecraft.client.renderer.GlStateManager;
-import net.minecraft.util.ResourceLocation;
-
-public class GuiButtonTooBeeTooTee extends GuiButton {
- private ResourceLocation location;
-
- public GuiButtonTooBeeTooTee(int buttonId, int x, int y, int widthIn, int heightIn) {
- super(buttonId, x, y, widthIn, heightIn, "");
- this.width = 20;
- this.height = 20;
- this.enabled = true;
- this.visible = true;
- this.id = buttonId;
- this.x = x;
- this.y = y;
- this.width = widthIn;
- this.height = heightIn;
- this.location = null;
- }
-
- @Override
- public void drawButton(Minecraft mc, int mouseX, int mouseY, float partialTicks) {
- if (this.location == null) {
- this.location = new ResourceLocation("pepsimod", "textures/gui/pepsibuttons.png");
- }
- if (this.visible) {
- mc.getTextureManager().bindTexture(this.location);
- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
- this.hovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height;
- int k = this.getHoverState(this.hovered);
- GlStateManager.enableBlend();
- GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
- GlStateManager.blendFunc(770, 771);
- this.drawTexturedModalRect(this.x, this.y, 20, (this.hovered ? 20 : 0), this.width, this.height);
- this.drawTexturedModalRect(this.x + this.width, this.y, 200 - this.width, k * 20, this.width, this.height);
- this.mouseDragged(mc, mouseX, mouseY);
- }
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/key/KeyRegistry.java b/src/main/java/net/daporkchop/pepsimod/key/KeyRegistry.java
deleted file mode 100644
index b357306..0000000
--- a/src/main/java/net/daporkchop/pepsimod/key/KeyRegistry.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.key;
-
-import net.daporkchop.pepsimod.module.ModuleManager;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
-import net.minecraftforge.fml.common.gameevent.InputEvent;
-
-public class KeyRegistry {
- @SubscribeEvent
- public void onKeyPress(InputEvent.KeyInputEvent event) {
- for (Module module : ModuleManager.AVALIBLE_MODULES) {
- if (module.keybind != null && module.keybind.isPressed()) {
- ModuleManager.toggleModule(module);
- }
- }
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/misc/TickRate.java b/src/main/java/net/daporkchop/pepsimod/misc/TickRate.java
deleted file mode 100644
index 0c4a703..0000000
--- a/src/main/java/net/daporkchop/pepsimod/misc/TickRate.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.misc;
-
-import net.minecraft.network.Packet;
-import net.minecraft.network.play.server.SPacketTimeUpdate;
-
-import java.text.DecimalFormat;
-
-public class TickRate {
- public static float TPS = 20.0f;
-
- public static long lastUpdate = -1;
-
- public static float[] tpsCounts = new float[10];
-
- public static DecimalFormat format = new DecimalFormat("##.0#");
-
- public static void update(Packet packet) {
- if (!(packet instanceof SPacketTimeUpdate)) {
- return;
- }
-
- long currentTime = System.currentTimeMillis();
-
- if (lastUpdate == -1) {
- lastUpdate = currentTime;
- return;
- }
- long timeDiff = currentTime - lastUpdate;
- float tickTime = timeDiff / 20;
- if (tickTime == 0) {
- tickTime = 50;
- }
- float tps = 1000 / tickTime;
- if (tps > 20.0f) {
- tps = 20.0f;
- }
- System.arraycopy(tpsCounts, 0, tpsCounts, 1, tpsCounts.length - 1);
- tpsCounts[0] = tps;
-
- double total = 0.0;
- for (float f : tpsCounts) {
- total += f;
- }
- total /= tpsCounts.length;
-
- if (total > 20.0) {
- total = 20.0;
- }
-
- TPS = Float.parseFloat(format.format(total));
- lastUpdate = currentTime;
- }
-
- public static void reset() {
- for (int i = 0; i < tpsCounts.length; i++) {
- tpsCounts[i] = 20.0f;
- }
- TPS = 20.0f;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/misc/data/DataLoader.java b/src/main/java/net/daporkchop/pepsimod/misc/data/DataLoader.java
deleted file mode 100644
index 223a52e..0000000
--- a/src/main/java/net/daporkchop/pepsimod/misc/data/DataLoader.java
+++ /dev/null
@@ -1,259 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.misc.data;
-
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
-import com.mojang.authlib.GameProfile;
-import net.daporkchop.lib.common.function.io.IOConsumer;
-import net.daporkchop.lib.common.function.io.IOFunction;
-import net.daporkchop.lib.common.function.io.IOSupplier;
-import net.daporkchop.pepsimod.PepsimodMixinLoader;
-import net.daporkchop.pepsimod.util.PepsiConstants;
-import net.daporkchop.pepsimod.util.PepsiUtils;
-import net.daporkchop.pepsimod.util.ReflectionStuff;
-import net.daporkchop.pepsimod.util.render.Texture;
-import net.minecraft.client.network.NetworkPlayerInfo;
-import net.minecraft.entity.player.EntityPlayer;
-import org.lwjgl.opengl.GLContext;
-
-import javax.swing.ImageIcon;
-import javax.swing.JOptionPane;
-import java.io.BufferedInputStream;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Objects;
-import java.util.UUID;
-import java.util.stream.Collectors;
-import java.util.stream.StreamSupport;
-
-/**
- * @author DaPorkchop_
- */
-public class DataLoader extends PepsiConstants {
- protected final String resourcesUrl;
- protected final File cache;
- protected final JsonObject root;
- protected IOFunction readerFunction;
-
- public Groups groups = new Groups();
- public final Map localeKeys = new HashMap<>();
- public MainMenu mainMenu = new MainMenu();
-
- public DataLoader(String resourcesUrl, File cache) {
- this.resourcesUrl = Objects.requireNonNull(resourcesUrl, "resourcesUrl");
- this.cache = cache;
-
- if (!cache.exists() && !cache.mkdirs()) {
- throw new IllegalStateException(String.format("Unable to create directory: %s", cache.getAbsolutePath()));
- }
-
- this.root = this.getResourcesRoot();
- {
- String baseurl = this.root.get("baseurl").getAsString();
- this.readerFunction = PepsimodMixinLoader.isObfuscatedEnvironment ?
- s -> new URL(String.format("%s%s", baseurl, s)).openStream() :
- s -> new BufferedInputStream(new FileInputStream(new File(String.format("../resources/%s", s))));
- }
- }
-
- public void load() {
- JsonObject data = this.root.get("data").getAsJsonObject();
- if (data.has("groups")) {
- JsonObject json = this.readJson(data.get("groups").getAsString());
-
- Groups groups = new Groups();
- StreamSupport.stream(json.getAsJsonArray("groups").spliterator(), false)
- .map(JsonElement::getAsString)
- .map((IOFunction) this::readJson)
- .forEach((IOConsumer) object -> {
- int color = 0x000000;
- if (object.has("color")) {
- JsonObject colorJson = object.getAsJsonObject("color");
- color = (colorJson.get("r").getAsInt() << 16) |
- (colorJson.get("g").getAsInt() << 8) |
- (colorJson.get("b").getAsInt());
- }
- groups.addGroup(new Group(
- object.get("id").getAsString(),
- object.has("name") ? object.get("name").getAsString() : null,
- StreamSupport.stream(object.getAsJsonArray("members").spliterator(), false)
- .map(JsonElement::getAsString)
- .map(UUID::fromString)
- .collect(Collectors.toSet()),
- color,
- object.has("cape") ? this.readTexture(object.get("cape").getAsString()) : null,
- object.has("icon") ? this.readTexture(object.get("icon").getAsString()) : null
- ));
- });
-
- Groups oldGroups = this.groups;
- this.groups = groups;
- oldGroups.close();
- }
-
- if (data.has("lang")) {
- JsonObject json = this.readJson(data.get("lang").getAsString());
- Map internalMap = ReflectionStuff.getLanguageMapMap();
- Map ourMap = new HashMap<>();
- for (Map.Entry entry : json.getAsJsonObject("translations").entrySet()) {
- ourMap.put(entry.getKey(), entry.getValue().getAsString());
- }
- this.localeKeys.forEach(internalMap::remove);
- internalMap.putAll(ourMap);
- this.localeKeys.clear();
- this.localeKeys.putAll(ourMap);
- }
-
- if (data.has("mainmenu")) {
- JsonObject json = this.readJson(data.get("mainmenu").getAsString());
- this.mainMenu.setup(
- StreamSupport.stream(json.getAsJsonArray("splashes").spliterator(), false)
- .map(JsonElement::getAsString)
- .toArray(String[]::new),
- this.readTexture(json.get("banner").getAsString())
- );
- }
- }
-
- public Group getGroup(EntityPlayer entity) {
- return this.getGroup(entity.getGameProfile());
- }
-
- public Group getGroup(NetworkPlayerInfo info) {
- return this.getGroup(info.getGameProfile());
- }
-
- public Group getGroup(GameProfile profile) {
- return this.getGroup(profile.getId());
- }
-
- public Group getGroup(UUID uuid) {
- return this.groups.playerToGroup.get(uuid);
- }
-
- protected JsonObject getResourcesRoot() {
- if (PepsimodMixinLoader.isObfuscatedEnvironment) {
- return this.readJson(this.read(
- "/resources.json",
- () -> new URL(this.resourcesUrl).openStream(),
- new File(this.cache, "resources.json")
- ));
- } else {
- return this.readJson(this.read(
- "/resources.json",
- () -> new BufferedInputStream(new FileInputStream(new File("../resources/resources.json"))),
- new File(this.cache, "resources.json")
- ));
- }
- }
-
- protected byte[] read(String path) {
- return this.read(path, () -> this.readerFunction.apply(path), new File(this.cache, path.replace('/', File.separatorChar)));
- }
-
- protected byte[] read(String path, IOSupplier inSupplier, File cached) {
- try {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- try (InputStream in = inSupplier.get()) {
- int i;
- while ((i = in.read()) != -1) {
- baos.write(i);
- }
- } catch (IOException e) {
- if (cached.exists()) {
- //attempt to load from cache if error occurred while loading
- baos.reset();
- try (InputStream in = new BufferedInputStream(new FileInputStream(cached))) {
- int i;
- while ((i = in.read()) != -1) {
- baos.write(i);
- }
- } catch (IOException e1) {
- throw new RuntimeException(e1);
- }
- } else {
- throw new RuntimeException(e);
- }
- }
- byte[] b = baos.toByteArray();
- try {
- //write to cache
- if (!cached.exists()) {
- File parent = cached.getParentFile();
- if (!parent.exists() && !parent.mkdirs()) {
- throw new IllegalStateException(String.format("Unable to create directory: %s", parent.getAbsolutePath()));
- } else if (!cached.createNewFile()) {
- throw new IllegalStateException(String.format("Unable to create file: %s", cached.getAbsolutePath()));
- }
- }
- try (OutputStream out = new FileOutputStream(cached)) {
- out.write(b);
- }
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- return b;
- } catch (RuntimeException e) {
- e.printStackTrace();
- JOptionPane.showMessageDialog(
- null,
- String.format("Unable to load resource: \"%s\"", path),
- "pepsimod load error",
- JOptionPane.ERROR_MESSAGE,
- new ImageIcon(PepsiUtils.PEPSI_LOGO)
- );
- throw e;
- }
- }
-
- protected JsonObject readJson(byte[] in) {
- try {
- return new JsonParser().parse(new InputStreamReader(new ByteArrayInputStream(in), "UTF-8")).getAsJsonObject();
- } catch (UnsupportedEncodingException e) {
- throw new RuntimeException("go buy a computer that isn't shit", e);
- }
- }
-
- protected JsonObject readJson(String path) {
- return this.readJson(this.read(path));
- }
-
- protected Texture readTexture(String path) {
- try {
- return new Texture(this.read(path));
- } catch (IOException e) {
- throw new RuntimeException(String.format("Unable to parse texture: %s", path), e);
- }
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/misc/data/Group.java b/src/main/java/net/daporkchop/pepsimod/misc/data/Group.java
deleted file mode 100644
index 4090a81..0000000
--- a/src/main/java/net/daporkchop/pepsimod/misc/data/Group.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.misc.data;
-
-import net.daporkchop.pepsimod.util.PepsiConstants;
-import net.daporkchop.pepsimod.util.render.Texture;
-
-import java.util.Collections;
-import java.util.Objects;
-import java.util.Set;
-import java.util.UUID;
-import java.util.concurrent.atomic.AtomicReference;
-import java.util.function.Consumer;
-
-/**
- * A single group of players. A group may set some additional attributes about a player, such as their background color in the tab list, an icon
- * next to their player name, or their cape/elytra texture.
- *
- * @author DaPorkchop_
- */
-public class Group extends PepsiConstants implements AutoCloseable {
- public final String id;
- public final String name;
- public final Set members;
- public final int color;
- public final AtomicReference cape = new AtomicReference<>(null);
- public final AtomicReference icon = new AtomicReference<>(null);
-
- public Group(String id, String name, Set members, int color, Texture cape, Texture icon) {
- this.id = Objects.requireNonNull(id, "id");
- this.name = name == null ? id : name;
- this.members = Collections.unmodifiableSet(Objects.requireNonNull(members, "members"));
- this.color = color & 0xFFFFFF;
- this.cape.set(cape);
- this.icon.set(icon);
- }
-
- public void doWithCapeIfPresent(Consumer callback) {
- Texture cape = this.cape.get();
- if (cape != null) {
- callback.accept(cape);
- }
- }
-
- public void doWithIconIfPresent(Consumer callback) {
- Texture icon = this.icon.get();
- if (icon != null) {
- callback.accept(icon);
- }
- }
-
- @Override
- public void close() {
- this.cape.updateAndGet(loc -> {
- if (loc != null) {
- loc.close();
- }
- return null;
- });
- this.icon.updateAndGet(loc -> {
- if (loc != null) {
- loc.close();
- }
- return null;
- });
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/mixin/block/MixinBlock.java b/src/main/java/net/daporkchop/pepsimod/mixin/block/MixinBlock.java
deleted file mode 100644
index f8e8c2d..0000000
--- a/src/main/java/net/daporkchop/pepsimod/mixin/block/MixinBlock.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.mixin.block;
-
-import net.daporkchop.pepsimod.module.impl.misc.AnnouncerMod;
-import net.daporkchop.pepsimod.module.impl.misc.FreecamMod;
-import net.daporkchop.pepsimod.module.impl.movement.NoClipMod;
-import net.daporkchop.pepsimod.module.impl.render.XrayMod;
-import net.daporkchop.pepsimod.optimization.BlockID;
-import net.daporkchop.pepsimod.util.config.impl.XrayTranslator;
-import net.minecraft.block.Block;
-import net.minecraft.block.state.IBlockState;
-import net.minecraft.util.EnumFacing;
-import net.minecraft.util.math.BlockPos;
-import net.minecraft.world.IBlockAccess;
-import net.minecraft.world.World;
-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;
-
-import static net.daporkchop.pepsimod.util.PepsiConstants.pepsimod;
-
-@Mixin(Block.class)
-public abstract class MixinBlock extends net.minecraftforge.registries.IForgeRegistryEntry.Impl implements BlockID {
- public int pepsimod_id = 0;
-
- @Override
- public int getBlockId() {
- return this.pepsimod_id;
- }
-
- @Override
- public void internal_setBlockId(int id) {
- this.pepsimod_id = id;
- }
-
- @Inject(
- method = "Lnet/minecraft/block/Block;isFullCube(Lnet/minecraft/block/state/IBlockState;)Z",
- at = @At("HEAD"),
- cancellable = true
- )
- public void preIsFullCube(IBlockState state, CallbackInfoReturnable callbackInfoReturnable) {
- if (pepsimod.hasInitializedModules) {
- if (XrayMod.INSTANCE.state.enabled) {
- callbackInfoReturnable.setReturnValue(XrayTranslator.INSTANCE.isTargeted(this));
- } else if (FreecamMod.INSTANCE.state.enabled || NoClipMod.INSTANCE.state.enabled) {
- callbackInfoReturnable.setReturnValue(false);
- }
- }
- }
-
- @Inject(
- method = "Lnet/minecraft/block/Block;shouldSideBeRendered(Lnet/minecraft/block/state/IBlockState;Lnet/minecraft/world/IBlockAccess;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/EnumFacing;)Z",
- at = @At("HEAD"),
- cancellable = true
- )
- public void preShouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side, CallbackInfoReturnable callbackInfo) {
- if (pepsimod.hasInitializedModules) {
- if (XrayMod.INSTANCE.state.enabled) {
- callbackInfo.setReturnValue(true);
- callbackInfo.cancel();
- }
- }
- //vanilla code follows
- }
-
- @Inject(
- method = "Lnet/minecraft/block/Block;onPlayerDestroy(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/state/IBlockState;)V",
- at = @At("HEAD")
- )
- public void preOnPlayerDestroy(World worldIn, BlockPos pos, IBlockState state, CallbackInfo callbackInfo) {
- if (worldIn.isRemote) {
- AnnouncerMod.INSTANCE.onBreakBlock(state);
- }
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/mixin/block/MixinBlockLiquid.java b/src/main/java/net/daporkchop/pepsimod/mixin/block/MixinBlockLiquid.java
deleted file mode 100644
index 724a20a..0000000
--- a/src/main/java/net/daporkchop/pepsimod/mixin/block/MixinBlockLiquid.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.mixin.block;
-
-import net.daporkchop.pepsimod.module.impl.movement.JesusMod;
-import net.daporkchop.pepsimod.module.impl.render.XrayMod;
-import net.minecraft.block.Block;
-import net.minecraft.block.BlockLiquid;
-import net.minecraft.block.state.IBlockState;
-import net.minecraft.util.math.AxisAlignedBB;
-import net.minecraft.util.math.BlockPos;
-import net.minecraft.world.IBlockAccess;
-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;
-
-import static net.daporkchop.pepsimod.util.PepsiConstants.pepsimod;
-
-@Mixin(BlockLiquid.class)
-public abstract class MixinBlockLiquid extends Block {
- protected MixinBlockLiquid() {
- super(null);
- }
-
- @Inject(
- method = "Lnet/minecraft/block/BlockLiquid;isPassable(Lnet/minecraft/world/IBlockAccess;Lnet/minecraft/util/math/BlockPos;)Z",
- at = @At("HEAD"),
- cancellable = true
- )
- public void preIsPassable(IBlockAccess worldIn, BlockPos pos, CallbackInfoReturnable callbackInfoReturnable) {
- if (pepsimod.hasInitializedModules) {
- if (XrayMod.INSTANCE.state.enabled) {
- callbackInfoReturnable.setReturnValue(true);
- }
- }
- }
-
- @Inject(
- method = "Lnet/minecraft/block/BlockLiquid;getCollisionBoundingBox(Lnet/minecraft/block/state/IBlockState;Lnet/minecraft/world/IBlockAccess;Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/util/math/AxisAlignedBB;",
- at = @At("HEAD"),
- cancellable = true
- )
- public void preGetCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos, CallbackInfoReturnable callbackInfoReturnable) {
- if (pepsimod.hasInitializedModules) {
- if (JesusMod.INSTANCE.shouldBeSolid()) {
- callbackInfoReturnable.setReturnValue(FULL_BLOCK_AABB);
- }
- }
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/mixin/block/MixinBlockSoulSand.java b/src/main/java/net/daporkchop/pepsimod/mixin/block/MixinBlockSoulSand.java
deleted file mode 100644
index 35fc1e2..0000000
--- a/src/main/java/net/daporkchop/pepsimod/mixin/block/MixinBlockSoulSand.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.mixin.block;
-
-import net.daporkchop.pepsimod.module.impl.movement.NoSlowdownMod;
-import net.minecraft.block.BlockSoulSand;
-import net.minecraft.block.state.IBlockState;
-import net.minecraft.entity.Entity;
-import net.minecraft.util.math.BlockPos;
-import net.minecraft.world.World;
-import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.injection.At;
-import org.spongepowered.asm.mixin.injection.Constant;
-import org.spongepowered.asm.mixin.injection.Inject;
-import org.spongepowered.asm.mixin.injection.ModifyConstant;
-import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-
-@Mixin(BlockSoulSand.class)
-public abstract class MixinBlockSoulSand {
- @ModifyConstant(
- method = "Lnet/minecraft/block/BlockSoulSand;onEntityCollision(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/state/IBlockState;Lnet/minecraft/entity/Entity;)V",
- constant = @Constant(
- doubleValue = 0.4d
- ))
- public double changeSpeed(double oldMultiplier) {
- return NoSlowdownMod.INSTANCE.state.enabled ? 1.0d : oldMultiplier;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/mixin/client/MixinMinecraft.java b/src/main/java/net/daporkchop/pepsimod/mixin/client/MixinMinecraft.java
deleted file mode 100644
index a0a951e..0000000
--- a/src/main/java/net/daporkchop/pepsimod/mixin/client/MixinMinecraft.java
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.mixin.client;
-
-import net.daporkchop.pepsimod.Pepsimod;
-import net.daporkchop.pepsimod.PepsimodMixinLoader;
-import net.daporkchop.pepsimod.module.ModuleManager;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.impl.render.UnfocusedCPUMod;
-import net.daporkchop.pepsimod.module.impl.render.ZoomMod;
-import net.daporkchop.pepsimod.util.config.impl.CpuLimitTranslator;
-import net.daporkchop.pepsimod.util.config.impl.FriendsTranslator;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.entity.EntityPlayerSP;
-import net.minecraft.client.gui.GuiChat;
-import net.minecraft.client.gui.GuiScreen;
-import net.minecraft.client.multiplayer.PlayerControllerMP;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.util.math.RayTraceResult;
-import net.minecraft.util.text.TextComponentString;
-import net.minecraftforge.fml.common.FMLLog;
-import org.lwjgl.input.Keyboard;
-import org.lwjgl.input.Mouse;
-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 org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
-
-import javax.imageio.ImageIO;
-import java.awt.Graphics2D;
-import java.awt.image.BufferedImage;
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.List;
-
-import static net.daporkchop.pepsimod.util.PepsiConstants.mc;
-import static net.daporkchop.pepsimod.util.PepsiConstants.mcStartedSuccessfully;
-import static net.daporkchop.pepsimod.util.PepsiConstants.pepsimod;
-
-@Mixin(Minecraft.class)
-public abstract class MixinMinecraft {
- @Shadow
- public EntityPlayerSP player;
-
- @Shadow
- private ByteBuffer readImageToBuffer(InputStream imageStream) throws IOException {
- return null;
- }
-
- @Inject(
- method = "Lnet/minecraft/client/Minecraft;shutdown()V",
- at = @At("HEAD")
- )
- public void saveSettingsOnShutdown(CallbackInfo ci) {
- if (mcStartedSuccessfully) {
- System.out.println("[PEPSIMOD] Saving config...");
- pepsimod.saveConfig();
- System.out.println("[PEPSIMOD] Saved.");
-
- if (ZoomMod.INSTANCE.state.enabled) {
- ModuleManager.disableModule(ZoomMod.INSTANCE);
- mc.gameSettings.fovSetting = ZoomMod.INSTANCE.fov;
- }
- }
- }
-
- @Inject(
- method = "Lnet/minecraft/client/Minecraft;runGameLoop()V",
- at = @At("RETURN")
- )
- public void postOnClientPreTick(CallbackInfo callbackInfo) {
- if (mcStartedSuccessfully && mc.player != null && mc.player.movementInput != null) { // is ingame
- for (Module module : ModuleManager.AVALIBLE_MODULES) {
- if (module.shouldTick()) {
- module.tick();
- }
- }
- }
- }
-
- @Inject(
- method = "Lnet/minecraft/client/Minecraft;runTickMouse()V",
- at = @At(
- value = "INVOKE_ASSIGN",
- target = "Lorg/lwjgl/input/Mouse;getEventButton()I"
- ))
- public void onMouseClick(CallbackInfo ci) {
- try {
- if (Mouse.getEventButtonState()) {
- int buttonID = Mouse.getEventButton();
- switch (buttonID) {
- case 2:
- if (Minecraft.getMinecraft().objectMouseOver != null) {
- RayTraceResult result = Minecraft.getMinecraft().objectMouseOver;
- if (result.typeOfHit == RayTraceResult.Type.ENTITY && result.entityHit instanceof EntityPlayer) {
- if (FriendsTranslator.INSTANCE.isFriend(result.entityHit)) {
- this.player.sendMessage(new TextComponentString(Pepsimod.CHAT_PREFIX + "Removed \u00A7c" + result.entityHit.getName() + "\u00A7r as a friend"));
- FriendsTranslator.INSTANCE.friends.remove(result.entityHit.getUniqueID());
- } else {
- this.player.sendMessage(new TextComponentString(Pepsimod.CHAT_PREFIX + "Added \u00A79" + result.entityHit.getName() + "\u00A7r as a friend"));
- FriendsTranslator.INSTANCE.friends.add(result.entityHit.getUniqueID());
- }
- }
- FMLLog.log.info(result.entityHit.getClass().getCanonicalName());
- }
- break;
- }
- }
- } catch (NullPointerException e) {
- //wtf who cares
- }
- }
-
- @Redirect(
- method = "Lnet/minecraft/client/Minecraft;createDisplay()V",
- at = @At(
- value = "INVOKE",
- target = "Lorg/lwjgl/opengl/Display;setTitle(Ljava/lang/String;)V"
- ))
- public void changeWindowTitle(String title) {
- Display.setTitle(Pepsimod.NAME_VERSION + (PepsimodMixinLoader.isObfuscatedEnvironment ? "" : " (dev environment)"));
- }
-
- @Inject(
- method = "Lnet/minecraft/client/Minecraft;setWindowIcon()V",
- at = @At("HEAD"),
- cancellable = true
- )
- public void preSetWindowIcon(CallbackInfo callbackInfo) {
- try {
- BufferedImage img = ImageIO.read(Pepsimod.class.getResourceAsStream("/pepsilogo.png"));
- List sizes = new ArrayList<>();
- int w = img.getWidth();
- do {
- BufferedImage tmp = new BufferedImage(w, w, img.getType());
- tmp.createGraphics().drawImage(img, 0, 0, w, w, null);
- sizes.add(this.convertImageToBuffer(tmp));
- w >>= 1;
- } while (w >= 8);
- Display.setIcon(sizes.toArray(new ByteBuffer[sizes.size()]));
- callbackInfo.cancel();
- } catch (IOException e) {
- e.printStackTrace();
- //thonk
- }
-
- //in case of exception vanilla code will run
- }
-
- @Inject(method = "displayGuiScreen", at = @At("HEAD"))
- public void preDisplayGuiScreen(GuiScreen guiScreen, CallbackInfo callbackInfo) {
- if (mcStartedSuccessfully && ZoomMod.INSTANCE.state.enabled) {
- ModuleManager.disableModule(ZoomMod.INSTANCE);
- mc.gameSettings.fovSetting = ZoomMod.INSTANCE.fov;
- }
- }
-
- @Inject(
- method = "Lnet/minecraft/client/Minecraft;getLimitFramerate()I",
- at = @At("HEAD"),
- cancellable = true
- )
- public void preGetLimitFramerate(CallbackInfoReturnable callbackInfoReturnable) {
- try {
- if (UnfocusedCPUMod.INSTANCE.state.enabled && !Display.isActive()) {
- callbackInfoReturnable.setReturnValue(CpuLimitTranslator.INSTANCE.limit);
- }
- } catch (NullPointerException e) {
- }
- }
-
- @Inject(
- method = "Lnet/minecraft/client/Minecraft;processKeyBinds()V",
- at = @At("HEAD")
- )
- public void preProcessKeyBinds(CallbackInfo ci) {
- // If . is typed open GuiChat
- // Bypass the keybind system because the command prefix is not configurable
- if (mcStartedSuccessfully && mc.currentScreen == null && Keyboard.getEventCharacter() == '.') {
- mc.displayGuiScreen(new GuiChat("."));
- }
- }
-
- @Redirect(
- method = "Lnet/minecraft/client/Minecraft;clickMouse()V",
- at = @At(
- value = "INVOKE",
- target = "Lnet/minecraft/client/multiplayer/PlayerControllerMP;attackEntity(Lnet/minecraft/entity/player/EntityPlayer;Lnet/minecraft/entity/Entity;)V"
- ))
- public void preventAttackingRiddenEntity(PlayerControllerMP controller, EntityPlayer attacker, Entity attacked) {
- if (!attacked.isPassenger(attacker)) {
- controller.attackEntity(attacker, attacked);
- }
- }
-
-
- private ByteBuffer convertImageToBuffer(BufferedImage bufferedimage) throws IOException {
- int[] aint = bufferedimage.getRGB(0, 0, bufferedimage.getWidth(), bufferedimage.getHeight(), null, 0, bufferedimage.getWidth());
- ByteBuffer bytebuffer = ByteBuffer.allocate(4 * aint.length);
-
- for (int i : aint) {
- bytebuffer.putInt(i << 8 | i >> 24 & 255);
- }
-
- bytebuffer.flip();
- return bytebuffer;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/mixin/client/entity/MixinAbstractClientPlayer.java b/src/main/java/net/daporkchop/pepsimod/mixin/client/entity/MixinAbstractClientPlayer.java
deleted file mode 100644
index a74054b..0000000
--- a/src/main/java/net/daporkchop/pepsimod/mixin/client/entity/MixinAbstractClientPlayer.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.mixin.client.entity;
-
-import net.daporkchop.pepsimod.misc.data.Group;
-import net.minecraft.client.entity.AbstractClientPlayer;
-import net.minecraft.client.network.NetworkPlayerInfo;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.util.ResourceLocation;
-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 static net.daporkchop.pepsimod.util.PepsiConstants.pepsimod;
-
-@Mixin(AbstractClientPlayer.class)
-public abstract class MixinAbstractClientPlayer extends EntityPlayer {
- public MixinAbstractClientPlayer() {
- super(null, null);
- }
-
- @Shadow
- protected abstract NetworkPlayerInfo getPlayerInfo();
-
- @Inject(
- method = "Lnet/minecraft/client/entity/AbstractClientPlayer;getLocationCape()Lnet/minecraft/util/ResourceLocation;",
- at = @At("HEAD"),
- cancellable = true
- )
- public void preGetLocationCape(CallbackInfoReturnable callbackInfo) {
- if (this.getPlayerInfo() != null) {
- Group group = pepsimod.data.getGroup(this.getPlayerInfo());
- if (group != null) {
- group.doWithCapeIfPresent(tex -> callbackInfo.setReturnValue(tex.texture));
- }
- }
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/mixin/client/entity/MixinEntityPlayerSP.java b/src/main/java/net/daporkchop/pepsimod/mixin/client/entity/MixinEntityPlayerSP.java
deleted file mode 100644
index fbe3442..0000000
--- a/src/main/java/net/daporkchop/pepsimod/mixin/client/entity/MixinEntityPlayerSP.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.mixin.client.entity;
-
-import net.daporkchop.pepsimod.module.ModuleManager;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.impl.misc.FreecamMod;
-import net.daporkchop.pepsimod.module.impl.misc.HUDMod;
-import net.daporkchop.pepsimod.module.impl.movement.FlightMod;
-import net.daporkchop.pepsimod.module.impl.movement.NoSlowdownMod;
-import net.daporkchop.pepsimod.module.impl.movement.StepMod;
-import net.daporkchop.pepsimod.the.wurst.pkg.name.RotationUtils;
-import net.daporkchop.pepsimod.util.event.MoveEvent;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.entity.AbstractClientPlayer;
-import net.minecraft.client.entity.EntityPlayerSP;
-import net.minecraft.client.gui.GuiScreen;
-import net.minecraft.client.network.NetHandlerPlayClient;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.MoverType;
-import net.minecraft.network.play.client.CPacketEntityAction;
-import net.minecraft.network.play.client.CPacketPlayer;
-import net.minecraft.util.math.AxisAlignedBB;
-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 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 org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
-
-@Mixin(EntityPlayerSP.class)
-public abstract class MixinEntityPlayerSP extends AbstractClientPlayer {
- @Shadow
- @Final
- public NetHandlerPlayClient connection;
- @Shadow
- protected Minecraft mc;
-
- public MoveEvent event = new MoveEvent();
-
- public MixinEntityPlayerSP() {
- super(null, null);
- }
-
- @Overwrite
- public void move(MoverType type, double x, double y, double z) {
- this.event.x = x;
- this.event.y = y;
- this.event.z = z;
- for (Module module : ModuleManager.ENABLED_MODULES) {
- module.onPlayerMove(this.event);
- }
- super.move(type, this.event.x, this.event.y, this.event.z);
- }
-
- @Redirect(
- method = "Lnet/minecraft/client/entity/EntityPlayerSP;onLivingUpdate()V",
- at = @At(
- value = "INVOKE",
- target = "Lnet/minecraft/entity/Entity;isRiding()Z"
- ))
- public boolean fixNoSlowdown(Entity entity) {
- return entity.isRiding() && NoSlowdownMod.INSTANCE.state.enabled;
- }
-
- @Shadow
- protected boolean isCurrentViewEntity() {
- return false;
- }
-
- @Inject(
- method = "Lnet/minecraft/client/entity/EntityPlayerSP;isAutoJumpEnabled()Z",
- at = @At("HEAD"),
- cancellable = true
- )
- public void preisAutoJumpEnabled(CallbackInfoReturnable callbackInfoReturnable) {
- if (StepMod.INSTANCE.state.enabled) {
- callbackInfoReturnable.setReturnValue(false);
- }
- }
-
- @Inject(
- method = "Lnet/minecraft/client/entity/EntityPlayerSP;setServerBrand(Ljava/lang/String;)V",
- at = @At("HEAD")
- )
- public void setHUDBrand(String brand, CallbackInfo callbackInfo) {
- HUDMod.INSTANCE.serverBrand = brand;
- }
-
- //pepsimod: prevent guis from being impossible to open while in a portal
- @Redirect(
- method = "Lnet/minecraft/client/entity/EntityPlayerSP;onLivingUpdate()V",
- at = @At(
- value = "INVOKE",
- target = "Lnet/minecraft/client/entity/EntityPlayerSP;closeScreen()V",
- ordinal = 0
- ))
- public void fixPortalGUIs_1(EntityPlayerSP player) {
- }
-
- @Redirect(
- method = "Lnet/minecraft/client/entity/EntityPlayerSP;onLivingUpdate()V",
- at = @At(
- value = "INVOKE",
- target = "Lnet/minecraft/client/Minecraft;displayGuiScreen(Lnet/minecraft/client/gui/GuiScreen;)V",
- ordinal = 0
- ))
- public void fixPortalGUIs_2(Minecraft mc, GuiScreen screen) {
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/mixin/client/gui/MixinGuiBossOverlay.java b/src/main/java/net/daporkchop/pepsimod/mixin/client/gui/MixinGuiBossOverlay.java
deleted file mode 100644
index dc6b999..0000000
--- a/src/main/java/net/daporkchop/pepsimod/mixin/client/gui/MixinGuiBossOverlay.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.mixin.client.gui;
-
-import net.daporkchop.pepsimod.util.BossinfoCounted;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.BossInfoClient;
-import net.minecraft.client.gui.Gui;
-import net.minecraft.client.gui.GuiBossOverlay;
-import net.minecraft.client.gui.ScaledResolution;
-import net.minecraft.client.renderer.GlStateManager;
-import net.minecraft.network.play.server.SPacketUpdateBossInfo;
-import net.minecraft.util.ResourceLocation;
-import net.minecraft.world.BossInfo;
-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.callback.CallbackInfo;
-
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.UUID;
-
-/**
- * I made this for Future!
- * of course i added it here :P
- */
-@Mixin(GuiBossOverlay.class)
-public abstract class MixinGuiBossOverlay extends Gui {
- private final ArrayList counted_cache = new ArrayList<>();
- public ResourceLocation GUI_BARS_TEXTURES_ALT = new ResourceLocation("textures/gui/bars.png");
- @Shadow
- @Final
- private Map mapBossInfos;
- @Shadow
- @Final
- private Minecraft client;
-
- @Inject(
- method = "Lnet/minecraft/client/gui/GuiBossOverlay;renderBossHealth()V",
- at = @At("HEAD"),
- cancellable = true
- )
- public void preRenderBossHealth(CallbackInfo callbackInfo) {
- if (!this.mapBossInfos.isEmpty()) {
- ScaledResolution scaledresolution = new ScaledResolution(this.client);
- int i = scaledresolution.getScaledWidth();
- int j = 12;
- for (BossinfoCounted counted : this.counted_cache) {
- int k = i / 2 - 91;
- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
- this.client.getTextureManager().bindTexture(this.GUI_BARS_TEXTURES_ALT);
- this.render(k, j, counted.info);
- String s = counted.info.getName().getFormattedText() + (counted.count > 1 ? " (x" + counted.count + ')' : "");
- this.client.fontRenderer.drawStringWithShadow(s, (float) (i / 2 - this.client.fontRenderer.getStringWidth(s) / 2), (float) (j - 9), 16777215);
- j += 10 + this.client.fontRenderer.FONT_HEIGHT;
-
- if (j >= scaledresolution.getScaledHeight() / 3) {
- break;
- }
- }
- }
- callbackInfo.cancel();
- }
-
- @Shadow
- private void render(int x, int y, BossInfo info) {
- }
-
- @Inject(
- method = "Lnet/minecraft/client/gui/GuiBossOverlay;read(Lnet/minecraft/network/play/server/SPacketUpdateBossInfo;)V",
- at = @At("HEAD")
- )
- public void read(SPacketUpdateBossInfo packetIn, CallbackInfo callbackInfo) {
- this.counted_cache.clear();
- ArrayList known = new ArrayList<>();
- for (BossInfoClient infoLerping : this.mapBossInfos.values()) {
- if (known.contains(infoLerping.getName().getFormattedText())) {
- continue;
- }
- String formattedText = infoLerping.getName().getFormattedText();
- BossinfoCounted counted = new BossinfoCounted();
- counted.info = infoLerping;
- for (BossInfoClient infoLerping2 : this.mapBossInfos.values()) {
- if (infoLerping2.getName().getFormattedText().equals(formattedText)) {
- counted.count++;
- }
- }
- known.add(formattedText);
- this.counted_cache.add(counted);
- }
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/mixin/client/gui/MixinGuiChat.java b/src/main/java/net/daporkchop/pepsimod/mixin/client/gui/MixinGuiChat.java
deleted file mode 100644
index af9befd..0000000
--- a/src/main/java/net/daporkchop/pepsimod/mixin/client/gui/MixinGuiChat.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.mixin.client.gui;
-
-import net.daporkchop.pepsimod.command.CommandRegistry;
-import net.minecraft.client.gui.GuiChat;
-import net.minecraft.client.gui.GuiScreen;
-import net.minecraft.client.gui.GuiTextField;
-import org.lwjgl.opengl.GL11;
-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;
-
-@Mixin(GuiChat.class)
-public abstract class MixinGuiChat extends GuiScreen {
-
- public String prevText = "";
- public String prevSuggestion = "";
-
- @Shadow
- protected GuiTextField inputField;
-
- @Inject(
- method = "Lnet/minecraft/client/gui/GuiChat;drawScreen(IIF)V",
- at = @At(
- value = "INVOKE",
- target = "Lnet/minecraft/client/gui/GuiTextField;drawTextBox()V"
- ))
- public void drawSemiTransparentText(CallbackInfo ci) {
- if (this.inputField.getText().startsWith(".")) {
- GL11.glPushMatrix();
- GL11.glEnable(GL11.GL_BLEND);
- int x = this.inputField.x;
- int y = this.inputField.y;
- if (!this.prevText.equals(this.inputField.getText())) {
- this.prevText = this.inputField.getText();
- this.prevSuggestion = CommandRegistry.getSuggestionFor(this.prevText);
- }
- this.fontRenderer.drawString(this.prevSuggestion, x, y, 0x5FFFFFFF, false);
- GL11.glDisable(GL11.GL_BLEND);
- GL11.glPopMatrix();
- }
- }
-
- @Inject(
- method = "Lnet/minecraft/client/gui/GuiChat;keyTyped(CI)V",
- at = @At("HEAD"),
- cancellable = true
- )
- public void checkIfIsCommandAndProcess(char typedChar, int keyCode, CallbackInfo ci) {
- if (keyCode == 28 || keyCode == 156) {
- if (this.inputField.getText().startsWith(".")) {
- this.mc.ingameGUI.getChatGUI().addToSentMessages(this.inputField.getText());
- this.mc.displayGuiScreen(null);
- CommandRegistry.runCommand(this.inputField.getText());
- ci.cancel();
- }
- }
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/mixin/client/gui/MixinGuiConnecting.java b/src/main/java/net/daporkchop/pepsimod/mixin/client/gui/MixinGuiConnecting.java
deleted file mode 100644
index a4a162d..0000000
--- a/src/main/java/net/daporkchop/pepsimod/mixin/client/gui/MixinGuiConnecting.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.mixin.client.gui;
-
-import net.daporkchop.pepsimod.util.PepsiUtils;
-import net.minecraft.client.multiplayer.GuiConnecting;
-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(GuiConnecting.class)
-public abstract class MixinGuiConnecting {
- @Inject(
- method = "Lnet/minecraft/client/multiplayer/GuiConnecting;connect(Ljava/lang/String;I)V",
- at = @At("HEAD")
- )
- public void preConnect(String ip, int port, CallbackInfo callbackInfo) {
- PepsiUtils.lastIp = ip;
- PepsiUtils.lastPort = port;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/mixin/client/gui/MixinGuiDisconnected.java b/src/main/java/net/daporkchop/pepsimod/mixin/client/gui/MixinGuiDisconnected.java
deleted file mode 100644
index b4b6c43..0000000
--- a/src/main/java/net/daporkchop/pepsimod/mixin/client/gui/MixinGuiDisconnected.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.mixin.client.gui;
-
-import net.daporkchop.pepsimod.module.ModuleManager;
-import net.daporkchop.pepsimod.module.impl.render.ZoomMod;
-import net.daporkchop.pepsimod.util.PepsiUtils;
-import net.daporkchop.pepsimod.util.config.impl.GeneralTranslator;
-import net.minecraft.client.gui.GuiButton;
-import net.minecraft.client.gui.GuiDisconnected;
-import net.minecraft.client.gui.GuiScreen;
-import net.minecraft.client.multiplayer.ServerData;
-import net.minecraft.util.text.ITextComponent;
-import net.minecraftforge.fml.client.FMLClientHandler;
-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.callback.CallbackInfo;
-
-@Mixin(GuiDisconnected.class)
-public abstract class MixinGuiDisconnected extends GuiScreen {
-
- @Shadow
- private int textHeight;
-
- @Inject(
- method = "Lnet/minecraft/client/gui/GuiDisconnected;drawScreen(IIF)V",
- at = @At("HEAD")
- )
- public void preDrawScreen(int mouseX, int mouseY, float partialTicks, CallbackInfo callbackInfo) {
- if (ZoomMod.INSTANCE.state.enabled) {
- ModuleManager.disableModule(ZoomMod.INSTANCE);
- this.mc.gameSettings.fovSetting = ZoomMod.INSTANCE.fov;
- }
- }
-
- @Inject(
- method = "Lnet/minecraft/client/gui/GuiDisconnected;initGui()V",
- at = @At("RETURN")
- )
- public void postInitGui(CallbackInfo callbackInfo) {
- PepsiUtils.autoReconnectWaitTime = 5;
- this.buttonList.add(PepsiUtils.reconnectButton = new GuiButton(1, this.width / 2 - 100, Math.min(this.height / 2 + this.textHeight / 2 + this.fontRenderer.FONT_HEIGHT + 22, this.height - 30 + 22), "Reconnect"));
- this.buttonList.add(PepsiUtils.autoReconnectButton = new GuiButton(2, this.width / 2 - 100, Math.min(this.height / 2 + this.textHeight / 2 + this.fontRenderer.FONT_HEIGHT + 44, this.height - 30 + 44), "AutoReconnect"));
- if (!GeneralTranslator.INSTANCE.autoReconnect) {
- PepsiUtils.autoReconnectButton.displayString = "AutoReconnect (\u00A7cDisabled\u00A7r)";
- }
- }
-
- @Inject(
- method = "Lnet/minecraft/client/gui/GuiDisconnected;actionPerformed(Lnet/minecraft/client/gui/GuiButton;)V",
- at = @At("HEAD"),
- cancellable = true
- )
- public void preActionPerformed(GuiButton button, CallbackInfo callbackInfo) {
- if (button.id == 1) {
- ServerData data = new ServerData("", PepsiUtils.lastIp + ':' + PepsiUtils.lastPort, false);
- data.setResourceMode(ServerData.ServerResourceMode.PROMPT);
- FMLClientHandler.instance().connectToServer(this.mc.currentScreen, data);
- callbackInfo.cancel();
- } else if (button.id == 2) {
- GeneralTranslator.INSTANCE.autoReconnect = !GeneralTranslator.INSTANCE.autoReconnect;
- if (GeneralTranslator.INSTANCE.autoReconnect) {
- PepsiUtils.autoReconnectWaitTime = 5;
- PepsiUtils.autoReconnectButton.displayString = "AutoReconnect (\u00A7a" + PepsiUtils.autoReconnectWaitTime + "\u00A7r)";
- } else {
- PepsiUtils.autoReconnectButton.displayString = "AutoReconnect (\u00A7cDisabled\u00A7r)";
- }
- callbackInfo.cancel();
- }
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/mixin/client/gui/MixinGuiIngame.java b/src/main/java/net/daporkchop/pepsimod/mixin/client/gui/MixinGuiIngame.java
deleted file mode 100644
index 6f62707..0000000
--- a/src/main/java/net/daporkchop/pepsimod/mixin/client/gui/MixinGuiIngame.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.mixin.client.gui;
-
-import net.daporkchop.pepsimod.module.impl.render.NoOverlayMod;
-import net.daporkchop.pepsimod.util.config.impl.HUDTranslator;
-import net.minecraft.client.gui.Gui;
-import net.minecraft.client.gui.GuiIngame;
-import net.minecraft.client.gui.ScaledResolution;
-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(GuiIngame.class)
-public abstract class MixinGuiIngame extends Gui {
- @Inject(
- method = "Lnet/minecraft/client/gui/GuiIngame;renderPumpkinOverlay(Lnet/minecraft/client/gui/ScaledResolution;)V",
- at = @At("HEAD"),
- cancellable = true
- )
- protected void preRenderPumpkinOverlay(ScaledResolution scaledRes, CallbackInfo callbackInfo) {
- if (NoOverlayMod.INSTANCE.state.enabled) {
- callbackInfo.cancel();
- }
- }
-
- @Inject(
- method = "Lnet/minecraft/client/gui/GuiIngame;renderPotionEffects(Lnet/minecraft/client/gui/ScaledResolution;)V",
- at = @At("HEAD"),
- cancellable = true
- )
- public void prerenderPotionEffects(ScaledResolution resolution, CallbackInfo callbackInfo) {
- if (!HUDTranslator.INSTANCE.effects) {
- callbackInfo.cancel();
- }
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/mixin/client/gui/MixinGuiIngameMenu.java b/src/main/java/net/daporkchop/pepsimod/mixin/client/gui/MixinGuiIngameMenu.java
deleted file mode 100644
index c041c43..0000000
--- a/src/main/java/net/daporkchop/pepsimod/mixin/client/gui/MixinGuiIngameMenu.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.mixin.client.gui;
-
-import net.daporkchop.pepsimod.module.ModuleManager;
-import net.daporkchop.pepsimod.module.impl.render.ZoomMod;
-import net.minecraft.client.gui.GuiButton;
-import net.minecraft.client.gui.GuiIngameMenu;
-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 static net.daporkchop.pepsimod.util.PepsiConstants.mc;
-
-@Mixin(GuiIngameMenu.class)
-public abstract class MixinGuiIngameMenu {
- @Inject(
- method = "Lnet/minecraft/client/gui/GuiIngameMenu;actionPerformed(Lnet/minecraft/client/gui/GuiButton;)V",
- at = @At("HEAD")
- )
- public void preActionPerformed(GuiButton button, CallbackInfo callbackInfo) {
- if (ZoomMod.INSTANCE.state.enabled) {
- ModuleManager.disableModule(ZoomMod.INSTANCE);
- mc.gameSettings.fovSetting = ZoomMod.INSTANCE.fov;
- }
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/mixin/client/gui/MixinGuiMainMenu.java b/src/main/java/net/daporkchop/pepsimod/mixin/client/gui/MixinGuiMainMenu.java
deleted file mode 100644
index a76d258..0000000
--- a/src/main/java/net/daporkchop/pepsimod/mixin/client/gui/MixinGuiMainMenu.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.mixin.client.gui;
-
-import net.daporkchop.pepsimod.Pepsimod;
-import net.daporkchop.pepsimod.module.ModuleManager;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.util.PepsiUtils;
-import net.daporkchop.pepsimod.util.colors.ColorizedText;
-import net.daporkchop.pepsimod.util.colors.rainbow.RainbowText;
-import net.daporkchop.pepsimod.util.config.impl.GeneralTranslator;
-import net.minecraft.client.gui.FontRenderer;
-import net.minecraft.client.gui.GuiMainMenu;
-import net.minecraft.client.gui.GuiScreen;
-import net.minecraft.client.renderer.GlStateManager;
-import net.minecraft.client.renderer.texture.TextureManager;
-import net.minecraft.util.ResourceLocation;
-import net.minecraftforge.common.MinecraftForge;
-import org.spongepowered.asm.lib.Opcodes;
-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 java.awt.*;
-
-import static net.daporkchop.pepsimod.util.PepsiConstants.mcStartedSuccessfully;
-import static net.daporkchop.pepsimod.util.PepsiConstants.pepsimod;
-
-@Mixin(GuiMainMenu.class)
-public abstract class MixinGuiMainMenu extends GuiScreen {
- public ColorizedText PEPSIMOD_TEXT_GRADIENT;
- public ColorizedText PEPSIMOD_AUTHOR_GRADIENT;
- @Shadow
- private String splashText;
-
- @Inject(
- method = "Lnet/minecraft/client/gui/GuiMainMenu;()V",
- at = @At("RETURN")
- )
- public void postConstructor(CallbackInfo callbackInfo) {
- if (mcStartedSuccessfully) {
- this.PEPSIMOD_TEXT_GRADIENT = PepsiUtils.getGradientFromStringThroughColor(Pepsimod.NAME_VERSION + " for Minecraft " + MinecraftForge.MC_VERSION, new Color(255, 0, 0), new Color(0, 0, 255), new Color(255, 255, 255));
- this.PEPSIMOD_AUTHOR_GRADIENT = new RainbowText("Made by DaPorkchop_");
-
- this.splashText = pepsimod.data.mainMenu.getRandomSplash();
- }
- }
-
- @Inject(
- method = "Lnet/minecraft/client/gui/GuiMainMenu;initGui()V",
- at = @At("RETURN")
- )
- public void addPepsiIconAndChangeSplash(CallbackInfo ci) {
- if (mcStartedSuccessfully) {
- pepsimod.isInitialized = true;
- if (!pepsimod.hasInitializedModules) {
- for (Module module : ModuleManager.AVALIBLE_MODULES) {
- module.doInit();
- }
- PepsiUtils.setBlockIdFields();
- pepsimod.hasInitializedModules = true;
- }
- ModuleManager.sortModules(GeneralTranslator.INSTANCE.sortType);
- }
- }
-
- @Redirect(
- method = "Lnet/minecraft/client/gui/GuiMainMenu;initGui()V",
- at = @At(
- value = "FIELD",
- target = "Lnet/minecraft/client/gui/GuiMainMenu;splashText:Ljava/lang/String;",
- opcode = Opcodes.PUTFIELD
- ))
- public void preventSettingSplashInInitGui(GuiMainMenu menu, String val) {
- }
-
- @Redirect(
- method = "Lnet/minecraft/client/gui/GuiMainMenu;drawScreen(IIF)V",
- at = @At(
- value = "FIELD",
- target = "Lnet/minecraft/client/gui/GuiMainMenu;splashText:Ljava/lang/String;",
- opcode = Opcodes.PUTFIELD
- ))
- public void preventSettingSplashInDrawScreen(GuiMainMenu menu, String val) {
- }
-
- @Redirect(
- method = "Lnet/minecraft/client/gui/GuiMainMenu;drawScreen(IIF)V",
- at = @At(
- value = "INVOKE",
- target = "Lnet/minecraft/client/renderer/texture/TextureManager;bindTexture(Lnet/minecraft/util/ResourceLocation;)V",
- ordinal = 0
- ))
- public void removeMenuLogoInit(TextureManager textureManager, ResourceLocation resource) {
- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
- pepsimod.data.mainMenu.banner.render(this.width / 2 - 150, 10, 300, 100);
- }
-
- @Redirect(
- method = "Lnet/minecraft/client/gui/GuiMainMenu;drawScreen(IIF)V",
- at = @At(
- value = "INVOKE",
- target = "Lnet/minecraft/client/gui/GuiMainMenu;drawTexturedModalRect(IIIIII)V"
- ))
- public void removeMenuLogoRendering(GuiMainMenu guiMainMenu, int x, int y, int textureX, int textureY, int width, int height) {
- }
-
- @Redirect(
- method = "Lnet/minecraft/client/gui/GuiMainMenu;drawScreen(IIF)V",
- at = @At(
- value = "INVOKE",
- target = "Lnet/minecraft/client/gui/GuiMainMenu;drawModalRectWithCustomSizedTexture(IIFFIIFF)V"
- ))
- public void removeSubLogoRendering(int x, int y, float a, float b, int c, int d, float e, float f) {
- }
-
- @Redirect(
- method = "Lnet/minecraft/client/gui/GuiMainMenu;drawScreen(IIF)V",
- at = @At(
- value = "INVOKE",
- target = "Lnet/minecraft/client/gui/GuiMainMenu;drawString(Lnet/minecraft/client/gui/FontRenderer;Ljava/lang/String;III)V"
- ))
- public void removeAllDrawStrings(GuiMainMenu guiMainMenu, FontRenderer fontRenderer1, String string, int i1, int i2, int i3) {
- }
-
- @Inject(
- method = "Lnet/minecraft/client/gui/GuiMainMenu;drawScreen(IIF)V",
- at = @At("RETURN")
- )
- public void addDrawPepsiStuff(int mouseX, int mouseY, float partialTicks, CallbackInfo ci) {
- this.drawString(this.fontRenderer, PepsiUtils.COLOR_ESCAPE + "cCopyright Mojang AB. Do not distribute!", this.width - this.fontRenderer.getStringWidth("Copyright Mojang AB. Do not distribute!") - 2, this.height - 10, -1);
- if (this.PEPSIMOD_TEXT_GRADIENT != null && this.PEPSIMOD_AUTHOR_GRADIENT != null) {
- this.PEPSIMOD_TEXT_GRADIENT.drawAtPos(this, 2, this.height - 20);
- this.PEPSIMOD_AUTHOR_GRADIENT.drawAtPos(this, 2, this.height - 10);
- }
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/mixin/client/gui/MixinGuiMultiplayer.java b/src/main/java/net/daporkchop/pepsimod/mixin/client/gui/MixinGuiMultiplayer.java
deleted file mode 100644
index 76867b9..0000000
--- a/src/main/java/net/daporkchop/pepsimod/mixin/client/gui/MixinGuiMultiplayer.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.mixin.client.gui;
-
-import net.daporkchop.pepsimod.gui.mcleaks.GuiButtonMCLeaks;
-import net.daporkchop.pepsimod.gui.mcleaks.GuiScreenMCLeaks;
-import net.daporkchop.pepsimod.gui.misc.GuiButtonTooBeeTooTee;
-import net.daporkchop.pepsimod.util.PepsiUtils;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.GuiButton;
-import net.minecraft.client.gui.GuiMainMenu;
-import net.minecraft.client.gui.GuiMultiplayer;
-import net.minecraft.client.gui.GuiScreen;
-import net.minecraftforge.fml.client.FMLClientHandler;
-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(GuiMultiplayer.class)
-public abstract class MixinGuiMultiplayer extends GuiScreen {
-
- @Inject(
- method = "Lnet/minecraft/client/gui/GuiMultiplayer;createButtons()V",
- at = @At("RETURN")
- )
- public void createButtons(CallbackInfo ci) {
- this.buttonList.add(new GuiButtonMCLeaks(9, 6, 6, 20, 20));
- this.buttonList.add(new GuiButtonTooBeeTooTee(10, this.width - 26, 6, 20, 20));
- }
-
- @Inject(
- method = "Lnet/minecraft/client/gui/GuiMultiplayer;actionPerformed(Lnet/minecraft/client/gui/GuiButton;)V",
- at = @At("HEAD"),
- cancellable = true
- )
- public void actionPerformed(GuiButton button, CallbackInfo ci) {
- if (button.id == 9) {
- GuiScreenMCLeaks mcLeaks = new GuiScreenMCLeaks(this, Minecraft.getMinecraft());
- Minecraft.getMinecraft().displayGuiScreen(mcLeaks);
- ci.cancel();
- } else if (button.id == 10) {
- FMLClientHandler.instance().connectToServer(new GuiMainMenu(), PepsiUtils.TOOBEETOOTEE_DATA);
- ci.cancel();
- }
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/mixin/client/gui/MixinGuiPlayerTabOverlay.java b/src/main/java/net/daporkchop/pepsimod/mixin/client/gui/MixinGuiPlayerTabOverlay.java
deleted file mode 100644
index 00aa369..0000000
--- a/src/main/java/net/daporkchop/pepsimod/mixin/client/gui/MixinGuiPlayerTabOverlay.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.mixin.client.gui;
-
-import net.daporkchop.pepsimod.misc.data.Group;
-import net.daporkchop.pepsimod.util.config.impl.HUDTranslator;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.Gui;
-import net.minecraft.client.gui.GuiPlayerTabOverlay;
-import net.minecraft.client.network.NetHandlerPlayClient;
-import net.minecraft.client.network.NetworkPlayerInfo;
-import net.minecraft.client.renderer.texture.TextureManager;
-import net.minecraft.scoreboard.ScoreObjective;
-import net.minecraft.scoreboard.Scoreboard;
-import net.minecraft.util.ResourceLocation;
-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.Constant;
-import org.spongepowered.asm.mixin.injection.Inject;
-import org.spongepowered.asm.mixin.injection.ModifyConstant;
-import org.spongepowered.asm.mixin.injection.Redirect;
-import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
-
-import java.util.List;
-
-import static net.daporkchop.pepsimod.util.PepsiConstants.pepsimod;
-
-/**
- * @author DaPorkchop_
- */
-@Mixin(GuiPlayerTabOverlay.class)
-public abstract class MixinGuiPlayerTabOverlay extends Gui {
- @Shadow
- @Final
- private Minecraft mc;
-
- @Redirect(
- method = "Lnet/minecraft/client/gui/GuiPlayerTabOverlay;renderPlayerlist(ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V",
- at = @At(
- value = "INVOKE",
- target = "Ljava/lang/Math;min(II)I",
- ordinal = 0
- ))
- public int preventTabClamping(int listSize, int theNumber_80) {
- return HUDTranslator.INSTANCE.clampTabList ? Math.min(listSize, theNumber_80) : listSize;
- }
-
- @ModifyConstant(
- method = "Lnet/minecraft/client/gui/GuiPlayerTabOverlay;renderPlayerlist(ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V",
- constant = @Constant(
- intValue = 20,
- ordinal = 0
- ))
- public int modifyMaxRows(int old) {
- int maxRows = HUDTranslator.INSTANCE.maxTabRows;
- return maxRows > 0 ? maxRows : old;
- }
-
- @Redirect(
- method = "Lnet/minecraft/client/gui/GuiPlayerTabOverlay;renderPlayerlist(ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V",
- at = @At(
- value = "INVOKE",
- target = "Lnet/minecraft/client/Minecraft;isIntegratedServerRunning()Z"
- ))
- public boolean alwaysRenderPlayerIcons(Minecraft mc) {
- return true;
- }
-
- @ModifyConstant(
- method = "Lnet/minecraft/client/gui/GuiPlayerTabOverlay;renderPlayerlist(ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V",
- constant = @Constant(
- intValue = 9,
- ordinal = 0
- ))
- public int changePlayerBoxWidthIncrease(int old) {
- return old + 9;
- }
-
- @Inject(
- method = "Lnet/minecraft/client/gui/GuiPlayerTabOverlay;renderPlayerlist(ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V",
- at = @At(
- value = "INVOKE",
- target = "Lnet/minecraft/client/gui/GuiPlayerTabOverlay;drawRect(IIIII)V",
- ordinal = 2
- ),
- locals = LocalCapture.CAPTURE_FAILHARD
- )
- public void drawPlayerBoxBackgroundCustom(int width, Scoreboard scoreboardIn, ScoreObjective scoreObjectiveIn,
- CallbackInfo ci,
- NetHandlerPlayClient nethandlerplayclient, List list, int i, int j, int l3, int i4, int j4, boolean flag, int l, int i1, int j1, int k1, int l1, List list1, List list2, int k4, int l4, int i5, int j2, int k2) {
- int color = 553648126;
- if (k4 < list.size()) {
- Group group = pepsimod.data.getGroup(list.get(k4));
- if (group != null && group.color != 0) {
- color = group.color | 0x80000000;
- }
- }
- drawRect(j2, k2, j2 + i1, k2 + 8, color);
- }
-
- @ModifyConstant(
- method = "Lnet/minecraft/client/gui/GuiPlayerTabOverlay;renderPlayerlist(ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V",
- constant = @Constant(
- intValue = 553648127
- ))
- public int changePlayerBoxBackgroundColor(int old) {
- return 0;
- }
-
- @Redirect(
- method = "Lnet/minecraft/client/gui/GuiPlayerTabOverlay;drawPing(IIILnet/minecraft/client/network/NetworkPlayerInfo;)V",
- at = @At(
- value = "INVOKE",
- target = "Lnet/minecraft/client/renderer/texture/TextureManager;bindTexture(Lnet/minecraft/util/ResourceLocation;)V"
- ))
- public void preventExtraPingTextureBind(TextureManager manager, ResourceLocation location) {
- }
-
- @Inject(
- method = "Lnet/minecraft/client/gui/GuiPlayerTabOverlay;drawPing(IIILnet/minecraft/client/network/NetworkPlayerInfo;)V",
- at = @At(
- value = "INVOKE",
- target = "Lnet/minecraft/client/gui/GuiPlayerTabOverlay;drawTexturedModalRect(IIIIII)V"
- ))
- public void drawIconIfPossible(int p_175245_1_, int p_175245_2_, int p_175245_3_, NetworkPlayerInfo info, CallbackInfo callbackInfo) {
- Group group = pepsimod.data.getGroup(info);
- if (group != null) {
- group.doWithIconIfPresent(tex -> tex.render(p_175245_2_ + p_175245_1_ - 11 - 9, p_175245_3_, 8, 8));
- }
- this.mc.getTextureManager().bindTexture(ICONS);
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/mixin/client/multiplayer/MixinWorldClient.java b/src/main/java/net/daporkchop/pepsimod/mixin/client/multiplayer/MixinWorldClient.java
deleted file mode 100644
index 0307dc8..0000000
--- a/src/main/java/net/daporkchop/pepsimod/mixin/client/multiplayer/MixinWorldClient.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.mixin.client.multiplayer;
-
-import net.daporkchop.pepsimod.module.impl.misc.FreecamMod;
-import net.minecraft.client.multiplayer.WorldClient;
-import net.minecraft.world.World;
-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(WorldClient.class)
-public abstract class MixinWorldClient extends World {
- public MixinWorldClient() {
- super(null, null, null, null, false);
- }
-
- @Inject(
- method = "Lnet/minecraft/client/multiplayer/WorldClient;doVoidFogParticles(III)V",
- at = @At("HEAD"),
- cancellable = true
- )
- public void preDoVoidFogParticles(int posX, int posY, int posZ, CallbackInfo callbackInfo) {
- if (FreecamMod.INSTANCE.state.enabled) {
- callbackInfo.cancel();
- }
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/mixin/client/network/MixinNetHandlerLoginClient.java b/src/main/java/net/daporkchop/pepsimod/mixin/client/network/MixinNetHandlerLoginClient.java
deleted file mode 100644
index 944a499..0000000
--- a/src/main/java/net/daporkchop/pepsimod/mixin/client/network/MixinNetHandlerLoginClient.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.mixin.client.network;
-
-import net.daporkchop.pepsimod.util.MCLeaks;
-import net.minecraft.client.network.NetHandlerLoginClient;
-import net.minecraft.network.NetworkManager;
-import net.minecraft.network.login.INetHandlerLoginClient;
-import net.minecraft.network.login.server.SPacketEncryptionRequest;
-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.callback.CallbackInfo;
-
-import static net.daporkchop.pepsimod.util.PepsiConstants.pepsimod;
-
-@Mixin(NetHandlerLoginClient.class)
-public abstract class MixinNetHandlerLoginClient implements INetHandlerLoginClient {
- @Shadow
- @Final
- private NetworkManager networkManager;
-
- @Inject(
- method = "Lnet/minecraft/client/network/NetHandlerLoginClient;handleEncryptionRequest(Lnet/minecraft/network/login/server/SPacketEncryptionRequest;)V",
- at = @At("HEAD"),
- cancellable = true
- )
- public void handleEncryptionRequest(SPacketEncryptionRequest packetIn, CallbackInfo ci) {
- if (pepsimod.isMcLeaksAccount) {
- MCLeaks.joinServerStuff(packetIn, this.networkManager);
- ci.cancel();
- }
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/mixin/client/network/MixinNetHandlerPlayClient.java b/src/main/java/net/daporkchop/pepsimod/mixin/client/network/MixinNetHandlerPlayClient.java
deleted file mode 100644
index 7c6d33c..0000000
--- a/src/main/java/net/daporkchop/pepsimod/mixin/client/network/MixinNetHandlerPlayClient.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.mixin.client.network;
-
-import com.google.common.collect.Maps;
-import net.daporkchop.pepsimod.module.impl.misc.AnnouncerMod;
-import net.daporkchop.pepsimod.module.impl.misc.FreecamMod;
-import net.minecraft.client.network.NetHandlerPlayClient;
-import net.minecraft.client.network.NetworkPlayerInfo;
-import net.minecraft.network.Packet;
-import net.minecraft.network.play.client.CPacketPlayer;
-import net.minecraft.network.play.server.SPacketPlayerListItem;
-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.Map;
-import java.util.UUID;
-
-import static net.daporkchop.pepsimod.util.PepsiConstants.mc;
-
-@Mixin(NetHandlerPlayClient.class)
-public abstract class MixinNetHandlerPlayClient {
- @Shadow
- private final Map playerInfoMap = Maps.newHashMap();
-
- @Inject(
- method = "Lnet/minecraft/client/network/NetHandlerPlayClient;handlePlayerListItem(Lnet/minecraft/network/play/server/SPacketPlayerListItem;)V",
- at = @At("HEAD")
- )
- public void preHandlePlayerListItem(SPacketPlayerListItem listItem, CallbackInfo callbackInfo) {
- try {
- if (listItem.getEntries().size() == 1) {
- if (listItem.getAction() == SPacketPlayerListItem.Action.ADD_PLAYER) {
- for (SPacketPlayerListItem.AddPlayerData data : listItem.getEntries()) {
- if (!data.getProfile().getId().equals(mc.player.getGameProfile().getId())) {
- AnnouncerMod.INSTANCE.onPlayerJoin(data.getProfile().getName());
- }
- }
- } else if (listItem.getAction() == SPacketPlayerListItem.Action.REMOVE_PLAYER) {
- for (SPacketPlayerListItem.AddPlayerData data : listItem.getEntries()) {
- if (!data.getProfile().getId().equals(mc.player.getGameProfile().getId())) {
- AnnouncerMod.INSTANCE.onPlayerLeave(this.playerInfoMap.get(data.getProfile().getId()).getGameProfile().getName());
- }
- }
-
- }
- }
- } catch (NullPointerException e) {
- }
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/mixin/client/renderer/MixinBlockFluidRenderer.java b/src/main/java/net/daporkchop/pepsimod/mixin/client/renderer/MixinBlockFluidRenderer.java
deleted file mode 100644
index b3fd494..0000000
--- a/src/main/java/net/daporkchop/pepsimod/mixin/client/renderer/MixinBlockFluidRenderer.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.mixin.client.renderer;
-
-import net.daporkchop.pepsimod.module.impl.render.XrayMod;
-import net.daporkchop.pepsimod.util.config.impl.XrayTranslator;
-import net.minecraft.block.state.IBlockState;
-import net.minecraft.client.renderer.BlockFluidRenderer;
-import net.minecraft.client.renderer.BufferBuilder;
-import net.minecraft.util.math.BlockPos;
-import net.minecraft.world.IBlockAccess;
-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(BlockFluidRenderer.class)
-public abstract class MixinBlockFluidRenderer {
- @Inject(
- method = "Lnet/minecraft/client/renderer/BlockFluidRenderer;renderFluid(Lnet/minecraft/world/IBlockAccess;Lnet/minecraft/block/state/IBlockState;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/client/renderer/BufferBuilder;)Z",
- at = @At("HEAD"),
- cancellable = true
- )
- public void preRenderFluid(IBlockAccess blockAccess, IBlockState blockStateIn, BlockPos blockPosIn, BufferBuilder worldRendererIn, CallbackInfoReturnable callbackInfoReturnable) {
- if (XrayMod.INSTANCE.state.enabled) {
- if (!XrayTranslator.INSTANCE.isTargeted(blockStateIn.getBlock())) {
- callbackInfoReturnable.setReturnValue(false);
- callbackInfoReturnable.cancel();
- }
- }
- //vanilla code follows
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/mixin/client/renderer/MixinBlockModelRenderer.java b/src/main/java/net/daporkchop/pepsimod/mixin/client/renderer/MixinBlockModelRenderer.java
deleted file mode 100644
index 3e7aaf8..0000000
--- a/src/main/java/net/daporkchop/pepsimod/mixin/client/renderer/MixinBlockModelRenderer.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.mixin.client.renderer;
-
-import net.daporkchop.pepsimod.module.impl.render.XrayMod;
-import net.daporkchop.pepsimod.util.config.impl.XrayTranslator;
-import net.minecraft.block.state.IBlockState;
-import net.minecraft.client.renderer.BlockModelRenderer;
-import net.minecraft.client.renderer.BufferBuilder;
-import net.minecraft.client.renderer.block.model.IBakedModel;
-import net.minecraft.util.math.BlockPos;
-import net.minecraft.world.IBlockAccess;
-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(BlockModelRenderer.class)
-public abstract class MixinBlockModelRenderer {
- @Inject(
- method = "Lnet/minecraft/client/renderer/BlockModelRenderer;renderModel(Lnet/minecraft/world/IBlockAccess;Lnet/minecraft/client/renderer/block/model/IBakedModel;Lnet/minecraft/block/state/IBlockState;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/client/renderer/BufferBuilder;Z)Z",
- at = @At("HEAD"),
- cancellable = true
- )
- public void preRenderModel(IBlockAccess blockAccessIn, IBakedModel modelIn, IBlockState blockStateIn, BlockPos blockPosIn, BufferBuilder buffer, boolean checkSides, CallbackInfoReturnable callbackInfoReturnable) {
- if (XrayMod.INSTANCE.state.enabled) {
- if (!XrayTranslator.INSTANCE.isTargeted(blockStateIn.getBlock())) {
- callbackInfoReturnable.setReturnValue(false);
- callbackInfoReturnable.cancel();
- }
- }
- //vanilla code follows
- }
-
- @Inject(
- method = "Lnet/minecraft/client/renderer/BlockModelRenderer;renderModelSmooth(Lnet/minecraft/world/IBlockAccess;Lnet/minecraft/client/renderer/block/model/IBakedModel;Lnet/minecraft/block/state/IBlockState;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/client/renderer/BufferBuilder;ZJ)Z",
- at = @At("HEAD"),
- cancellable = true
- )
- public void preRenderQuadsSmooth(IBlockAccess access, IBakedModel model, IBlockState stateIn, BlockPos pos, BufferBuilder bufferBuilder, boolean idk, long ok, CallbackInfoReturnable returnable) {
- if (XrayMod.INSTANCE.state.enabled) {
- if (!XrayTranslator.INSTANCE.isTargeted(stateIn.getBlock())) {
- returnable.setReturnValue(false);
- returnable.cancel();
- }
- }
- //vanilla code follows
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/mixin/client/renderer/MixinEntityRenderer.java b/src/main/java/net/daporkchop/pepsimod/mixin/client/renderer/MixinEntityRenderer.java
deleted file mode 100644
index 5e9d190..0000000
--- a/src/main/java/net/daporkchop/pepsimod/mixin/client/renderer/MixinEntityRenderer.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.mixin.client.renderer;
-
-import net.daporkchop.pepsimod.module.ModuleManager;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.impl.render.AntiBlindMod;
-import net.daporkchop.pepsimod.module.impl.render.AntiTotemAnimationMod;
-import net.daporkchop.pepsimod.module.impl.render.FullbrightMod;
-import net.daporkchop.pepsimod.module.impl.render.NoHurtCamMod;
-import net.daporkchop.pepsimod.module.impl.render.NoOverlayMod;
-import net.daporkchop.pepsimod.the.wurst.pkg.name.RotationUtils;
-import net.daporkchop.pepsimod.util.PepsiUtils;
-import net.daporkchop.pepsimod.util.render.WorldRenderer;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.renderer.EntityRenderer;
-import net.minecraft.client.renderer.GlStateManager;
-import net.minecraft.client.settings.GameSettings;
-import net.minecraft.entity.Entity;
-import net.minecraft.init.MobEffects;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.math.AxisAlignedBB;
-import net.minecraft.util.math.MathHelper;
-import org.lwjgl.util.glu.Project;
-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 org.spongepowered.asm.mixin.injection.At;
-import org.spongepowered.asm.mixin.injection.Constant;
-import org.spongepowered.asm.mixin.injection.Inject;
-import org.spongepowered.asm.mixin.injection.ModifyConstant;
-import org.spongepowered.asm.mixin.injection.Redirect;
-import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-
-import static org.lwjgl.opengl.GL11.glPopMatrix;
-import static org.lwjgl.opengl.GL11.glPushMatrix;
-
-@Mixin(EntityRenderer.class)
-public abstract class MixinEntityRenderer {
- @Shadow
- protected abstract void setupCameraTransform(float partialTicks, int pass);
-
- @Shadow
- @Final
- private Minecraft mc;
-
- @Inject(
- method = "Lnet/minecraft/client/renderer/EntityRenderer;renderWorldPass(IFJ)V",
- at = @At(
- value = "INVOKE_ASSIGN",
- target = "Lnet/minecraft/profiler/Profiler;endStartSection(Ljava/lang/String;)V",
- ordinal = 19
- ))
- public void preRenderHand(CallbackInfo ci, int pass, float partialTicks, long finishTimeNano) {
- PepsiUtils.toRemoveWurstRenderListeners.forEach(PepsiUtils.wurstRenderListeners::remove);
- PepsiUtils.toRemoveWurstRenderListeners.clear();
- PepsiUtils.wurstRenderListeners.forEach(listener -> listener.render(partialTicks));
- }
-
- @Inject(
- method = "Lnet/minecraft/client/renderer/EntityRenderer;renderWorldPass(IFJ)V",
- at = @At(
- value = "FIELD",
- target = "Lnet/minecraft/client/renderer/EntityRenderer;renderHand:Z",
- shift = At.Shift.BEFORE
- ))
- public void renderLines(int pass, float partialTicks, long finishTimeNano, CallbackInfo ci) {
- if (this.mc.gameSettings.viewBobbing) {
- this.mc.gameSettings.viewBobbing = false;
-
- glPushMatrix();
- this.setupCameraTransform(partialTicks, pass);
- try (WorldRenderer renderer = new WorldRenderer(RotationUtils.getClientLookVec(), PepsiUtils.getPlayerPos(partialTicks), partialTicks)) {
- for (Module module : ModuleManager.ENABLED_MODULES) {
- module.renderOverlay(renderer);
- }
- }
- glPopMatrix();
-
- this.mc.gameSettings.viewBobbing = true;
-
- glPushMatrix();
- this.setupCameraTransform(partialTicks, pass);
- try (WorldRenderer renderer = new WorldRenderer(RotationUtils.getClientLookVec(), PepsiUtils.getPlayerPos(partialTicks), partialTicks)) {
- for (Module module : ModuleManager.ENABLED_MODULES) {
- module.renderWorld(renderer);
- }
- }
- glPopMatrix();
- } else {
- try (WorldRenderer renderer = new WorldRenderer(RotationUtils.getClientLookVec(), PepsiUtils.getPlayerPos(partialTicks), partialTicks)) {
- for (Module module : ModuleManager.ENABLED_MODULES) {
- module.renderOverlay(renderer);
- module.renderWorld(renderer);
- }
- }
- }
- }
-
- @ModifyConstant(
- method = "Lnet/minecraft/client/renderer/EntityRenderer;setupCameraTransform(FI)V",
- constant = {
- @Constant(intValue = 20),
- @Constant(intValue = 7)
- })
- public int preventNauseaEffect(int orig) {
- return AntiBlindMod.INSTANCE.state.enabled ? 0 : orig;
- }
-
- @Inject(
- method = "Lnet/minecraft/client/renderer/EntityRenderer;hurtCameraEffect(F)V",
- at = @At("HEAD"),
- cancellable = true
- )
- public void preHurtCameraEffect(float partialTicks, CallbackInfo callbackInfo) {
- if (NoHurtCamMod.INSTANCE.state.enabled) {
- callbackInfo.cancel();
- }
- }
-
- @Redirect(
- method = "Lnet/minecraft/client/renderer/EntityRenderer;setupFog(IF)V",
- at = @At(
- value = "INVOKE",
- target = "Lnet/minecraft/client/renderer/GlStateManager;setFogDensity(F)V"
- ))
- public void changeFog(float density) {
- if (NoOverlayMod.INSTANCE.state.enabled) {
- GlStateManager.setFogDensity(0.01f);
- } else {
- GlStateManager.setFogDensity(density);
- }
- }
-
- @Inject(
- method = "Lnet/minecraft/client/renderer/EntityRenderer;displayItemActivation(Lnet/minecraft/item/ItemStack;)V",
- at = @At("HEAD"),
- cancellable = true
- )
- public void preDisplayItemActivation(ItemStack stack, CallbackInfo callbackInfo) {
- if (AntiTotemAnimationMod.INSTANCE.state.enabled) {
- callbackInfo.cancel();
- }
- }
-
- @Inject(
- method = "Lnet/minecraft/client/renderer/EntityRenderer;renderItemActivation(IIF)V",
- at = @At("HEAD"),
- cancellable = true
- )
- public void preRenderItemActivation(int a, int b, float c, CallbackInfo callbackInfo) {
- if (AntiTotemAnimationMod.INSTANCE.state.enabled) {
- callbackInfo.cancel();
- }
- }
-
- @Redirect(
- method = "Lnet/minecraft/client/renderer/EntityRenderer;updateLightmap(F)V",
- at = @At(
- value = "FIELD",
- target = "Lnet/minecraft/client/settings/GameSettings;gammaSetting:F"
- ))
- public float redirectGammaSetting(GameSettings settings) {
- return Math.max(FullbrightMod.INSTANCE.level * 0.5f, settings.gammaSetting);
- }
-
- @Redirect(
- method = "Lnet/minecraft/client/renderer/EntityRenderer;getMouseOver(F)V",
- at = @At(
- value = "INVOKE",
- target = "Lnet/minecraft/entity/Entity;getEntityBoundingBox()Lnet/minecraft/util/math/AxisAlignedBB;",
- ordinal = 1
- ))
- public AxisAlignedBB preventMousingOverRiddenEntity(Entity possiblyRidden) {
- if (possiblyRidden.isPassenger(this.mc.getRenderViewEntity())) {
- return new AxisAlignedBB(0, 0, 0, 0, 0, 0);
- } else {
- return possiblyRidden.getEntityBoundingBox();
- }
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/mixin/client/renderer/MixinItemRenderer.java b/src/main/java/net/daporkchop/pepsimod/mixin/client/renderer/MixinItemRenderer.java
deleted file mode 100644
index 5ce7568..0000000
--- a/src/main/java/net/daporkchop/pepsimod/mixin/client/renderer/MixinItemRenderer.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.mixin.client.renderer;
-
-import net.daporkchop.pepsimod.module.impl.render.NoOverlayMod;
-import net.minecraft.client.renderer.ItemRenderer;
-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(ItemRenderer.class)
-public abstract class MixinItemRenderer {
- @Inject(
- method = "Lnet/minecraft/client/renderer/ItemRenderer;renderWaterOverlayTexture(F)V",
- at = @At("HEAD"),
- cancellable = true
- )
- public void preRenderWaterOverlayTexture(float partialTicks, CallbackInfo callbackInfo) {
- if (NoOverlayMod.INSTANCE.state.enabled) {
- callbackInfo.cancel();
- }
- }
-
- @Inject(
- method = "Lnet/minecraft/client/renderer/ItemRenderer;renderFireInFirstPerson()V",
- at = @At("HEAD"),
- cancellable = true
- )
- public void preRenderFireInFirstPerson(CallbackInfo callbackInfo) {
- if (NoOverlayMod.INSTANCE.state.enabled) {
- callbackInfo.cancel();
- }
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/mixin/client/renderer/chunk/MixinVisGraph.java b/src/main/java/net/daporkchop/pepsimod/mixin/client/renderer/chunk/MixinVisGraph.java
deleted file mode 100644
index 2fb3e30..0000000
--- a/src/main/java/net/daporkchop/pepsimod/mixin/client/renderer/chunk/MixinVisGraph.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.mixin.client.renderer.chunk;
-
-import net.daporkchop.pepsimod.module.impl.misc.FreecamMod;
-import net.daporkchop.pepsimod.module.impl.render.XrayMod;
-import net.minecraft.client.renderer.chunk.VisGraph;
-import net.minecraft.util.math.BlockPos;
-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(VisGraph.class)
-public abstract class MixinVisGraph {
- @Inject(
- method = "Lnet/minecraft/client/renderer/chunk/VisGraph;setOpaqueCube(Lnet/minecraft/util/math/BlockPos;)V",
- at = @At("HEAD"),
- cancellable = true
- )
- public void preSetOpaqueCube(BlockPos pos, CallbackInfo callbackInfo) {
- if (XrayMod.INSTANCE.state.enabled || FreecamMod.INSTANCE.state.enabled) {
- callbackInfo.cancel();
- }
- //vanilla code follows
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/mixin/client/renderer/entity/MixinRender.java b/src/main/java/net/daporkchop/pepsimod/mixin/client/renderer/entity/MixinRender.java
deleted file mode 100644
index e7d6ccc..0000000
--- a/src/main/java/net/daporkchop/pepsimod/mixin/client/renderer/entity/MixinRender.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.mixin.client.renderer.entity;
-
-import net.daporkchop.pepsimod.misc.data.DataLoader;
-import net.daporkchop.pepsimod.misc.data.Group;
-import net.daporkchop.pepsimod.module.impl.render.ESPMod;
-import net.daporkchop.pepsimod.module.impl.render.HealthTagsMod;
-import net.daporkchop.pepsimod.module.impl.render.NameTagsMod;
-import net.daporkchop.pepsimod.util.PepsiUtils;
-import net.daporkchop.pepsimod.util.RenderColor;
-import net.daporkchop.pepsimod.util.config.impl.ESPTranslator;
-import net.daporkchop.pepsimod.util.config.impl.FriendsTranslator;
-import net.daporkchop.pepsimod.util.config.impl.NameTagsTranslator;
-import net.minecraft.client.entity.EntityPlayerSP;
-import net.minecraft.client.gui.FontRenderer;
-import net.minecraft.client.renderer.EntityRenderer;
-import net.minecraft.client.renderer.entity.Render;
-import net.minecraft.client.renderer.entity.RenderManager;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.EntityLivingBase;
-import net.minecraft.entity.player.EntityPlayer;
-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 org.spongepowered.asm.mixin.injection.Constant;
-import org.spongepowered.asm.mixin.injection.ModifyConstant;
-
-import static net.daporkchop.pepsimod.util.PepsiConstants.pepsimod;
-
-@Mixin(Render.class)
-public abstract class MixinRender {
- @Shadow
- @Final
- protected RenderManager renderManager;
-
- @Shadow
- public FontRenderer getFontRendererFromRenderManager() {
- return null;
- }
-
- @Overwrite
- protected void renderLivingLabel(T entityIn, String str, double x, double y, double z, int maxDistance) {
- double d0 = entityIn.getDistanceSq(this.renderManager.renderViewEntity);
-
- if (d0 <= (double) (maxDistance * maxDistance)) {
- boolean flag = entityIn.isSneaking();
- float f = this.renderManager.playerViewY;
- float f1 = this.renderManager.playerViewX;
- boolean flag1 = this.renderManager.options.thirdPersonView == 2;
- float f2 = entityIn.height + 0.5F - (flag ? 0.25F : 0.0F);
- int i = "deadmau5".equals(str) ? -10 : 0;
-
- if (entityIn instanceof EntityLivingBase) {
- if (entityIn instanceof EntityPlayer && FriendsTranslator.INSTANCE.isFriend(entityIn)) {
- str = PepsiUtils.COLOR_ESCAPE + "b" + str;
- }
-
- if (HealthTagsMod.INSTANCE.state.enabled) {
- str += " ";
- int health = (int) ((EntityLivingBase) entityIn).getHealth();
- if (health <= 5) {
- str += "\u00A74";
- } else if (health <= 10) {
- str += "\u00A76";
- } else if (health <= 15) {
- str += "\u00A7e";
- } else {
- str += "\u00A7a";
- }
- str += health;
- }
- }
-
- if (NameTagsMod.INSTANCE.state.enabled) {
- PepsiUtils.drawNameplateNoScale(this.getFontRendererFromRenderManager(), str, (float) x, (float) y, (float) z, i, f, f1, flag1, f2, NameTagsTranslator.INSTANCE.scale);
- } else {
- EntityRenderer.drawNameplate(this.getFontRendererFromRenderManager(), str, (float) x, (float) y + f2, (float) z, i, f, f1, flag1, flag);
- }
- }
- }
-
- @ModifyConstant(
- method = "Lnet/minecraft/client/renderer/entity/Render;getTeamColor(Lnet/minecraft/entity/Entity;)I",
- constant = @Constant(
- intValue = 16777215 // 0xFFFFFF
- ))
- public int changeDefaultTeamColor(int old, Entity entity) {
- if (entity instanceof EntityPlayer) {
- Group group = pepsimod.data.getGroup((EntityPlayer) entity);
- if (group != null && group.color != 0) {
- return group.color;
- }
- }
- if (ESPMod.INSTANCE.state.enabled && !ESPTranslator.INSTANCE.box) {
- RenderColor color = ESPMod.INSTANCE.chooseColor(entity);
- if (color != null) {
- return color.getIntColor();
- }
- }
- return old;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/mixin/client/settings/MixinGameSettings.java b/src/main/java/net/daporkchop/pepsimod/mixin/client/settings/MixinGameSettings.java
deleted file mode 100644
index 3d7122a..0000000
--- a/src/main/java/net/daporkchop/pepsimod/mixin/client/settings/MixinGameSettings.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.mixin.client.settings;
-
-import net.daporkchop.pepsimod.module.impl.render.ZoomMod;
-import net.minecraft.client.settings.GameSettings;
-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(GameSettings.class)
-public abstract class MixinGameSettings {
- @Inject(
- method = "Lnet/minecraft/client/settings/GameSettings;setOptionFloatValue(Lnet/minecraft/client/settings/GameSettings$Options;F)V",
- at = @At("HEAD")
- )
- public void preSetOptionFloatValue(GameSettings.Options settingsOption, float value, CallbackInfo callbackInfo) {
- if (settingsOption == GameSettings.Options.FOV) {
- ZoomMod.INSTANCE.fov = value;
- }
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/mixin/entity/MixinEntity.java b/src/main/java/net/daporkchop/pepsimod/mixin/entity/MixinEntity.java
deleted file mode 100644
index 6123ff9..0000000
--- a/src/main/java/net/daporkchop/pepsimod/mixin/entity/MixinEntity.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.mixin.entity;
-
-import net.daporkchop.pepsimod.module.impl.misc.FreecamMod;
-import net.daporkchop.pepsimod.module.impl.movement.NoClipMod;
-import net.daporkchop.pepsimod.module.impl.movement.VelocityMod;
-import net.daporkchop.pepsimod.module.impl.render.AntiInvisibleMod;
-import net.daporkchop.pepsimod.module.impl.render.ESPMod;
-import net.daporkchop.pepsimod.util.config.impl.ESPTranslator;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.MoverType;
-import net.minecraft.entity.monster.EntityGolem;
-import net.minecraft.entity.monster.EntityMob;
-import net.minecraft.entity.passive.EntityAnimal;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.util.math.AxisAlignedBB;
-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 org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
-
-import static net.daporkchop.pepsimod.util.PepsiConstants.mc;
-
-@Mixin(Entity.class)
-public abstract class MixinEntity {
- @Shadow
- public double motionX;
- @Shadow
- public double motionY;
- @Shadow
- public double motionZ;
- @Shadow
- private AxisAlignedBB boundingBox;
-
- @Shadow
- public abstract void resetPositionToBB();
-
- @Inject(
- method = "Lnet/minecraft/entity/Entity;setVelocity(DDD)V",
- at = @At("HEAD"),
- cancellable = true
- )
- public void preSetVelocity(double x, double y, double z, CallbackInfo callbackInfo) {
- float strength = 1.0f;
- if (Entity.class.cast(this) == mc.player) {
- strength = VelocityMod.INSTANCE.getVelocity();
- }
- this.motionX = x * strength;
- this.motionY = y * strength;
- this.motionZ = z * strength;
- callbackInfo.cancel();
- }
-
- @Inject(
- method = "Lnet/minecraft/entity/Entity;move(Lnet/minecraft/entity/MoverType;DDD)V",
- at = @At("HEAD"),
- cancellable = true
- )
- public void preMove(MoverType type, double x, double y, double z, CallbackInfo callbackInfo) {
- Entity thisAsEntity = Entity.class.cast(this);
- if ((FreecamMod.INSTANCE.state.enabled || NoClipMod.INSTANCE.state.enabled) && thisAsEntity instanceof EntityPlayer) {
- this.boundingBox = this.boundingBox.offset(x, y, z);
- this.resetPositionToBB();
- callbackInfo.cancel();
- }
- }
-
- @Inject(
- method = "Lnet/minecraft/entity/Entity;isInvisibleToPlayer(Lnet/minecraft/entity/player/EntityPlayer;)Z",
- at = @At("HEAD"),
- cancellable = true
- )
- public void preIsInvisibleToPlayer(EntityPlayer player, CallbackInfoReturnable callbackInfoReturnable) {
- if (AntiInvisibleMod.INSTANCE.state.enabled) {
- callbackInfoReturnable.setReturnValue(false);
- callbackInfoReturnable.cancel();
- }
- }
-
- @Inject(
- method = "Lnet/minecraft/entity/Entity;isGlowing()Z",
- at = @At("HEAD"),
- cancellable = true
- )
- public void preisGlowing(CallbackInfoReturnable callbackInfoReturnable) {
- if (ESPMod.INSTANCE.state.enabled && !ESPTranslator.INSTANCE.box) {
- Entity this_ = Entity.class.cast(this);
- if (this_.isInvisible()) {
- if (!ESPTranslator.INSTANCE.invisible) {
- return;
- }
- }
- if (ESPTranslator.INSTANCE.animals && this_ instanceof EntityAnimal) {
- callbackInfoReturnable.setReturnValue(true);
- } else if (ESPTranslator.INSTANCE.monsters && this_ instanceof EntityMob) {
- callbackInfoReturnable.setReturnValue(true);
- } else if (ESPTranslator.INSTANCE.players && this_ instanceof EntityPlayer) {
- callbackInfoReturnable.setReturnValue(true);
- } else if (ESPTranslator.INSTANCE.golems && this_ instanceof EntityGolem) {
- callbackInfoReturnable.setReturnValue(true);
- }
- }
- }
-
- @Inject(
- method = "Lnet/minecraft/entity/Entity;isInWater()Z",
- at = @At("HEAD"),
- cancellable = true
- )
- public void preIsInWater(CallbackInfoReturnable callbackInfoReturnable) {
- if (FreecamMod.INSTANCE.state.enabled) {
- callbackInfoReturnable.setReturnValue(false);
- }
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/mixin/entity/MixinEntityLivingBase.java b/src/main/java/net/daporkchop/pepsimod/mixin/entity/MixinEntityLivingBase.java
deleted file mode 100644
index 46055a9..0000000
--- a/src/main/java/net/daporkchop/pepsimod/mixin/entity/MixinEntityLivingBase.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.mixin.entity;
-
-import net.daporkchop.pepsimod.module.impl.misc.FreecamMod;
-import net.daporkchop.pepsimod.module.impl.movement.ElytraFlyMod;
-import net.daporkchop.pepsimod.module.impl.render.AntiBlindMod;
-import net.daporkchop.pepsimod.util.config.impl.ElytraFlyTranslator;
-import net.daporkchop.pepsimod.util.config.impl.FreecamTranslator;
-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.util.SoundEvent;
-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 org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
-
-import static net.daporkchop.pepsimod.util.PepsiConstants.mc;
-
-@Mixin(EntityLivingBase.class)
-public abstract class MixinEntityLivingBase extends Entity {
- @Shadow
- public float jumpMovementFactor;
- @Shadow
- public float prevLimbSwingAmount;
- @Shadow
- public float limbSwingAmount;
- @Shadow
- public float limbSwing;
-
- public MixinEntityLivingBase() {
- super(null);
- }
-
- @Inject(
- method = "Lnet/minecraft/entity/EntityLivingBase;isPotionActive(Lnet/minecraft/potion/Potion;)Z",
- at = @At("HEAD"),
- cancellable = true
- )
- public void preIsPotionActive(Potion potionIn, CallbackInfoReturnable callbackInfoReturnable) {
- if (potionIn == MobEffects.BLINDNESS && AntiBlindMod.INSTANCE.state.enabled) {
- callbackInfoReturnable.setReturnValue(false);
- callbackInfoReturnable.cancel();
- }
- }
-
- @Inject(
- method = "Lnet/minecraft/entity/EntityLivingBase;onLivingUpdate()V",
- at = @At("HEAD")
- )
- public void preOnLivingUpdate(CallbackInfo callbackInfo) {
- EntityLivingBase thisAsEntity = EntityLivingBase.class.cast(this);
- if (thisAsEntity == mc.player && ElytraFlyMod.INSTANCE.state.enabled && ElytraFlyTranslator.INSTANCE.mode == ElytraFlyTranslator.ElytraFlyMode.PACKET) {
- this.motionY = 0;
- }
- }
-
- @Inject(
- method = "Lnet/minecraft/entity/EntityLivingBase;travel(FFF)V",
- at = @At("HEAD")
- )
- public void preTravel(float x, float y, float z, CallbackInfo callbackInfo) {
- EntityLivingBase thisAsEntity = EntityLivingBase.class.cast(this);
- if (thisAsEntity == mc.player && ElytraFlyMod.INSTANCE.state.enabled && ElytraFlyTranslator.INSTANCE.mode == ElytraFlyTranslator.ElytraFlyMode.PACKET) {
- this.motionY = 0;
- }
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/mixin/entity/passive/MixinAbstractHorse.java b/src/main/java/net/daporkchop/pepsimod/mixin/entity/passive/MixinAbstractHorse.java
deleted file mode 100644
index d655a63..0000000
--- a/src/main/java/net/daporkchop/pepsimod/mixin/entity/passive/MixinAbstractHorse.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.mixin.entity.passive;
-
-import net.daporkchop.pepsimod.module.impl.movement.EntitySpeedMod;
-import net.minecraft.entity.passive.AbstractHorse;
-import net.minecraft.entity.passive.EntityAnimal;
-import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.Overwrite;
-import org.spongepowered.asm.mixin.Shadow;
-
-@Mixin(AbstractHorse.class)
-public abstract class MixinAbstractHorse extends EntityAnimal {
- public MixinAbstractHorse() {
- super(null);
- }
-
- @Shadow
- protected abstract boolean getHorseWatchableBoolean(int p_110233_1_);
-
- @Shadow
- public abstract boolean isTame();
-
- @Overwrite
- public boolean isHorseSaddled() {
- if (this.world.isRemote) {
- return this.getHorseWatchableBoolean(4) || (this.isTame() && EntitySpeedMod.INSTANCE.state.enabled); //make the horse be controllable even without a saddle
- } else {
- return this.getHorseWatchableBoolean(4);
- }
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/mixin/entity/passive/MixinEntityPig.java b/src/main/java/net/daporkchop/pepsimod/mixin/entity/passive/MixinEntityPig.java
deleted file mode 100644
index a8573cb..0000000
--- a/src/main/java/net/daporkchop/pepsimod/mixin/entity/passive/MixinEntityPig.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.mixin.entity.passive;
-
-import net.daporkchop.pepsimod.module.impl.movement.EntitySpeedMod;
-import net.daporkchop.pepsimod.optimization.SizeSettable;
-import net.daporkchop.pepsimod.util.config.impl.EntitySpeedTranslator;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.passive.EntityAnimal;
-import net.minecraft.entity.passive.EntityPig;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.init.Items;
-import net.minecraft.util.math.AxisAlignedBB;
-import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.Overwrite;
-import org.spongepowered.asm.mixin.Shadow;
-import org.spongepowered.asm.mixin.injection.Constant;
-import org.spongepowered.asm.mixin.injection.ModifyConstant;
-
-import javax.annotation.Nullable;
-
-@Mixin(EntityPig.class)
-public abstract class MixinEntityPig extends EntityAnimal implements SizeSettable {
- public int riddenTicks = 0;
-
- public MixinEntityPig() {
- super(null);
- }
-
- @Shadow
- @Nullable
- public abstract Entity getControllingPassenger();
-
- @Overwrite
- public boolean canBeSteered() {
- Entity entity = this.getControllingPassenger();
-
- if (!(entity instanceof EntityPlayer)) {
- return false;
- } else {
- EntityPlayer entityplayer = (EntityPlayer) entity;
- return (this.world.isRemote && EntitySpeedMod.INSTANCE.state.enabled) || entityplayer.getHeldItemMainhand().getItem() == Items.CARROT_ON_A_STICK || entityplayer.getHeldItemOffhand().getItem() == Items.CARROT_ON_A_STICK;
- }
- }
-
- @Override
- public void onLivingUpdate() {
- this.forceSetSize(0.9f, 0.9f);
- if (this.world.isRemote && this.isBeingRidden()) {
- if (this.riddenTicks++ >= 2) {
- if (this.riddenTicks > 1000) {
- this.riddenTicks = 1000;
- }
- AxisAlignedBB bb = EntitySpeedMod.getMergedBBs(this, this.getEntityBoundingBox());
- this.forceSetSize((float) Math.max(bb.maxX - bb.minX, bb.maxZ - bb.minZ), (float) (bb.maxY - bb.minY));
- }
- } else {
- this.riddenTicks = 0;
- }
- super.onLivingUpdate();
- }
-
- @Override
- public double getMountedYOffset() {
- return 0.9d * 0.75d;
- }
-
- @ModifyConstant(
- method = "Lnet/minecraft/entity/passive/EntityPig;travel(FFF)V",
- constant = @Constant(
- floatValue = 1.0f,
- ordinal = 0
- ))
- public float modifyStepHeight(float orig) {
- return this.world.isRemote && EntitySpeedMod.INSTANCE.state.enabled ? EntitySpeedMod.INSTANCE.fakedStepHeight : orig;
- }
-
- @ModifyConstant(
- method = "Lnet/minecraft/entity/passive/EntityPig;travel(FFF)V",
- constant = @Constant(
- floatValue = 1.0f,
- ordinal = 1
- ))
- public float modifyIdleSpeed(float orig) {
- return this.world.isRemote && EntitySpeedMod.INSTANCE.state.enabled ? EntitySpeedTranslator.INSTANCE.idleSpeed : orig;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/mixin/item/MixinItemStack.java b/src/main/java/net/daporkchop/pepsimod/mixin/item/MixinItemStack.java
deleted file mode 100644
index 082b5ac..0000000
--- a/src/main/java/net/daporkchop/pepsimod/mixin/item/MixinItemStack.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.mixin.item;
-
-import net.daporkchop.pepsimod.module.impl.combat.BedBomberMod;
-import net.daporkchop.pepsimod.module.impl.misc.AnnouncerMod;
-import net.minecraft.block.Block;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.ItemBed;
-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.BlockPos;
-import net.minecraft.world.World;
-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(ItemStack.class)
-public abstract class MixinItemStack {
- @Inject(
- method = "Lnet/minecraft/item/ItemStack;onItemUse(Lnet/minecraft/entity/player/EntityPlayer;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/EnumHand;Lnet/minecraft/util/EnumFacing;FFF)Lnet/minecraft/util/EnumActionResult;",
- at = @At("HEAD")
- )
- public void preOnItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ, CallbackInfoReturnable callbackInfo) {
- if (worldIn.isRemote) {
- ItemStack this_ = ItemStack.class.cast(this);
- if (this_.getItem() instanceof ItemBlock) {
- Block block = ((ItemBlock) this_.getItem()).getBlock();
- AnnouncerMod.INSTANCE.onPlaceBlock(block);
- } else if (this_.getItem() instanceof ItemBed) {
- BedBomberMod.INSTANCE.onPlaceBed();
- }
- }
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/mixin/network/MixinNetworkManager.java b/src/main/java/net/daporkchop/pepsimod/mixin/network/MixinNetworkManager.java
deleted file mode 100644
index 2950477..0000000
--- a/src/main/java/net/daporkchop/pepsimod/mixin/network/MixinNetworkManager.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.mixin.network;
-
-import io.netty.channel.ChannelHandlerContext;
-import io.netty.util.concurrent.Future;
-import io.netty.util.concurrent.GenericFutureListener;
-import net.daporkchop.pepsimod.misc.TickRate;
-import net.daporkchop.pepsimod.module.ModuleManager;
-import net.daporkchop.pepsimod.module.impl.misc.FreecamMod;
-import net.minecraft.network.NetworkManager;
-import net.minecraft.network.Packet;
-import net.minecraft.util.text.ITextComponent;
-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 javax.annotation.Nullable;
-
-/**
- * inspired by fr1kin's PacketListener
- */
-@Mixin(NetworkManager.class)
-public abstract class MixinNetworkManager {
- @Inject(
- method = "Lnet/minecraft/network/NetworkManager;dispatchPacket(Lnet/minecraft/network/Packet;[Lio/netty/util/concurrent/GenericFutureListener;)V",
- at = @At("HEAD"),
- cancellable = true
- )
- public void preSend(final Packet> inPacket, @Nullable final GenericFutureListener extends Future super Void>>[] futureListeners, CallbackInfo callbackInfo) {
- if (ModuleManager.preSendPacket(inPacket)) {
- callbackInfo.cancel();
- }
- }
-
- @Inject(
- method = "Lnet/minecraft/network/NetworkManager;dispatchPacket(Lnet/minecraft/network/Packet;[Lio/netty/util/concurrent/GenericFutureListener;)V",
- at = @At("RETURN")
- )
- public void postSend(final Packet> inPacket, @Nullable final GenericFutureListener extends Future super Void>>[] futureListeners, CallbackInfo callbackInfo) {
- ModuleManager.postSendPacket(inPacket);
- }
-
- @Inject(
- method = "Lnet/minecraft/network/NetworkManager;channelRead0(Lio/netty/channel/ChannelHandlerContext;Lnet/minecraft/network/Packet;)V",
- at = @At("HEAD"),
- cancellable = true
- )
- public void preProcess(ChannelHandlerContext p_channelRead0_1_, Packet> p_channelRead0_2_, CallbackInfo callbackInfo) {
- TickRate.update(p_channelRead0_2_);
- if (ModuleManager.preRecievePacket(p_channelRead0_2_)) {
- callbackInfo.cancel();
- }
- }
-
- @Inject(
- method = "Lnet/minecraft/network/NetworkManager;channelRead0(Lio/netty/channel/ChannelHandlerContext;Lnet/minecraft/network/Packet;)V",
- at = @At("RETURN")
- )
- public void postProcess(ChannelHandlerContext p_channelRead0_1_, Packet> p_channelRead0_2_, CallbackInfo callbackInfo) {
- ModuleManager.postRecievePacket(p_channelRead0_2_);
- }
-
- @Inject(
- method = "Lnet/minecraft/network/NetworkManager;closeChannel(Lnet/minecraft/util/text/ITextComponent;)V",
- at = @At("HEAD")
- )
- public void preCloseChannel(ITextComponent message, CallbackInfo callbackInfo) {
- TickRate.reset();
- if (FreecamMod.INSTANCE.state.enabled) {
- ModuleManager.disableModule(FreecamMod.INSTANCE);
- }
- }
-
- @Inject(
- method = "Lnet/minecraft/network/NetworkManager;exceptionCaught(Lio/netty/channel/ChannelHandlerContext;Ljava/lang/Throwable;)V",
- at = @At("RETURN")
- )
- public void postExceptionCaught(ChannelHandlerContext p_exceptionCaught_1_, Throwable p_exceptionCaught_2_, CallbackInfo callbackInfo) {
- p_exceptionCaught_2_.printStackTrace(System.out);
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/mixin/network/play/client/MixinCPacketPlayer.java b/src/main/java/net/daporkchop/pepsimod/mixin/network/play/client/MixinCPacketPlayer.java
deleted file mode 100644
index aab4b53..0000000
--- a/src/main/java/net/daporkchop/pepsimod/mixin/network/play/client/MixinCPacketPlayer.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.mixin.network.play.client;
-
-import net.daporkchop.pepsimod.module.impl.misc.AntiHungerMod;
-import net.daporkchop.pepsimod.module.impl.misc.NoFallMod;
-import net.minecraft.network.PacketBuffer;
-import net.minecraft.network.play.client.CPacketPlayer;
-import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.Overwrite;
-import org.spongepowered.asm.mixin.Shadow;
-
-import java.io.IOException;
-
-@Mixin(CPacketPlayer.class)
-public abstract class MixinCPacketPlayer {
- @Shadow
- protected boolean onGround;
-
- @Overwrite
- public void writePacketData(PacketBuffer buf) throws IOException {
- if (NoFallMod.NO_FALL && AntiHungerMod.ANTI_HUNGER) {
- buf.writeByte(this.onGround ? 0 : 1);
- /*
- * This inverts the value sent to the server
- * If the player is falling, it says that it's on the ground
- * And antihunger will run while the player's on the ground (it says it's not on the ground)
- */
- } else if (NoFallMod.NO_FALL) {
- buf.writeByte(1); //on ground
- } else if (AntiHungerMod.ANTI_HUNGER) {
- buf.writeByte(0); //on ground
- } else {
- buf.writeByte(this.onGround ? 1 : 0);
- }
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/mixin/scoreboard/MixinScoreboard.java b/src/main/java/net/daporkchop/pepsimod/mixin/scoreboard/MixinScoreboard.java
deleted file mode 100644
index 3b7b679..0000000
--- a/src/main/java/net/daporkchop/pepsimod/mixin/scoreboard/MixinScoreboard.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.mixin.scoreboard;
-
-import com.google.common.collect.Maps;
-import net.minecraft.scoreboard.ScorePlayerTeam;
-import net.minecraft.scoreboard.Scoreboard;
-import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.Overwrite;
-import org.spongepowered.asm.mixin.Shadow;
-
-import java.util.Map;
-
-@Mixin(Scoreboard.class)
-public abstract class MixinScoreboard {
- @Shadow
- private final Map teamMemberships = Maps.newHashMap();
-
- @Overwrite
- public void removePlayerFromTeam(String username, ScorePlayerTeam playerTeam) {
- try {
- if (this.getPlayersTeam(username) != playerTeam) {
- throw new IllegalStateException("Player is either on another team or not on any team. Cannot remove from team '" + playerTeam.getName() + "'.");
- } else {
- this.teamMemberships.remove(username);
- playerTeam.getMembershipCollection().remove(username);
- }
- } catch (NullPointerException e) {
- }
- }
-
- @Shadow
- public ScorePlayerTeam getPlayersTeam(String username) {
- return null;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/mixin/util/MixinMovementInputFromOptions.java b/src/main/java/net/daporkchop/pepsimod/mixin/util/MixinMovementInputFromOptions.java
deleted file mode 100644
index fef1392..0000000
--- a/src/main/java/net/daporkchop/pepsimod/mixin/util/MixinMovementInputFromOptions.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.mixin.util;
-
-import net.daporkchop.pepsimod.gui.clickgui.ClickGUI;
-import net.daporkchop.pepsimod.module.impl.movement.InventoryMoveMod;
-import net.daporkchop.pepsimod.optimization.OverrideCounter;
-import net.daporkchop.pepsimod.util.ReflectionStuff;
-import net.minecraft.client.gui.GuiChat;
-import net.minecraft.client.gui.GuiIngameMenu;
-import net.minecraft.client.renderer.InventoryEffectRenderer;
-import net.minecraft.client.settings.KeyBinding;
-import net.minecraft.util.MovementInput;
-import net.minecraft.util.MovementInputFromOptions;
-import org.lwjgl.input.Keyboard;
-import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.injection.At;
-import org.spongepowered.asm.mixin.injection.Redirect;
-
-import static net.daporkchop.pepsimod.util.PepsiConstants.mc;
-
-@Mixin(MovementInputFromOptions.class)
-public abstract class MixinMovementInputFromOptions extends MovementInput {
- @Redirect(
- method = "Lnet/minecraft/util/MovementInputFromOptions;updatePlayerMoveState()V",
- at = @At(
- value = "INVOKE",
- target = "Lnet/minecraft/client/settings/KeyBinding;isKeyDown()Z"
- ))
- public boolean redirectIsKeyDown(KeyBinding binding) {
- if (((OverrideCounter) binding).isOverriden()) {
- return true;
- }
- if (InventoryMoveMod.INSTANCE.state.enabled && mc.currentScreen != null) {
- if (mc.currentScreen instanceof InventoryEffectRenderer) {
- return Keyboard.isKeyDown(binding.getKeyCode()) || ReflectionStuff.getPressed(binding);
- } else if (mc.world.isRemote && mc.currentScreen instanceof GuiIngameMenu) {
- return Keyboard.isKeyDown(binding.getKeyCode()) || ReflectionStuff.getPressed(binding);
- } else if (mc.currentScreen instanceof ClickGUI) {
- return Keyboard.isKeyDown(binding.getKeyCode()) || ReflectionStuff.getPressed(binding);
- } else if (mc.currentScreen instanceof GuiChat) {
- return ReflectionStuff.getPressed(binding);
- }
- }
- return binding.isKeyDown();
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/mixin/util/MixinTabCompleter.java b/src/main/java/net/daporkchop/pepsimod/mixin/util/MixinTabCompleter.java
deleted file mode 100644
index 7dbeda9..0000000
--- a/src/main/java/net/daporkchop/pepsimod/mixin/util/MixinTabCompleter.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.mixin.util;
-
-import net.daporkchop.pepsimod.command.CommandRegistry;
-import net.minecraft.client.gui.GuiTextField;
-import net.minecraft.util.TabCompleter;
-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.callback.CallbackInfo;
-
-@Mixin(TabCompleter.class)
-public abstract class MixinTabCompleter {
- @Shadow
- @Final
- protected GuiTextField textField;
-
- @Inject(
- method = "Lnet/minecraft/util/TabCompleter;complete()V",
- at = @At("HEAD"),
- cancellable = true
- )
- public void preComplete(CallbackInfo callbackInfo) {
- if (this.textField.getText().startsWith(".")) {
- String completed = CommandRegistry.getSuggestionFor(this.textField.getText());
- if (completed == null || completed.isEmpty() || completed.length() <= this.textField.getText().length()) {
- return;
- //run vanilla code
- }
- this.textField.setText(completed);
- callbackInfo.cancel();
- }
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/mixin/util/MixinTimer.java b/src/main/java/net/daporkchop/pepsimod/mixin/util/MixinTimer.java
deleted file mode 100644
index 6bb7bb8..0000000
--- a/src/main/java/net/daporkchop/pepsimod/mixin/util/MixinTimer.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.mixin.util;
-
-import net.daporkchop.pepsimod.module.impl.misc.TimerMod;
-import net.minecraft.client.Minecraft;
-import net.minecraft.util.Timer;
-import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.Overwrite;
-import org.spongepowered.asm.mixin.Shadow;
-
-@Mixin(Timer.class)
-public abstract class MixinTimer {
- @Shadow
- public int elapsedTicks;
-
- @Shadow
- public float renderPartialTicks;
-
- @Shadow
- public float elapsedPartialTicks;
-
- @Shadow
- private long lastSyncSysClock;
-
- @Shadow
- private float tickLength;
-
- @Overwrite
- public void updateTimer() {
- float timerSpeed = (TimerMod.INSTANCE == null ?
- 1.0f :
- TimerMod.INSTANCE.getMultiplier());
-
- long i = Minecraft.getSystemTime();
- this.elapsedPartialTicks = (float) (i - this.lastSyncSysClock) / this.tickLength * timerSpeed;
- this.lastSyncSysClock = i;
- this.renderPartialTicks += this.elapsedPartialTicks;
- this.elapsedTicks = (int) this.renderPartialTicks;
- this.renderPartialTicks -= this.elapsedTicks;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/mixin/world/MixinWorld.java b/src/main/java/net/daporkchop/pepsimod/mixin/world/MixinWorld.java
deleted file mode 100644
index c93e65e..0000000
--- a/src/main/java/net/daporkchop/pepsimod/mixin/world/MixinWorld.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.mixin.world;
-
-import net.daporkchop.pepsimod.module.impl.render.NoWeatherMod;
-import net.daporkchop.pepsimod.util.config.impl.NoWeatherTranslator;
-import net.minecraft.world.World;
-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(World.class)
-public abstract class MixinWorld {
- @Inject(
- method = "Lnet/minecraft/world/World;getCelestialAngle(F)F",
- at = @At("HEAD"),
- cancellable = true
- )
- public void preGetCelestialAngle(float partialTicks, CallbackInfoReturnable callbackInfoReturnable) {
- if (NoWeatherMod.INSTANCE.state.enabled && NoWeatherTranslator.INSTANCE.changeTime) {
- callbackInfoReturnable.setReturnValue(NoWeatherTranslator.INSTANCE.time + 0.0f);
- callbackInfoReturnable.cancel();
- }
- }
-
- @Inject(
- method = "Lnet/minecraft/world/World;getRainStrength(F)F",
- at = @At("HEAD"),
- cancellable = true
- )
- public void preGetRainStrength(float partialTicks, CallbackInfoReturnable callbackInfoReturnable) {
- if (NoWeatherMod.INSTANCE.state.enabled && NoWeatherTranslator.INSTANCE.disableRain) {
- callbackInfoReturnable.setReturnValue(0.0f);
- callbackInfoReturnable.cancel();
- }
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/mixin/world/storage/MixinWorldInfo.java b/src/main/java/net/daporkchop/pepsimod/mixin/world/storage/MixinWorldInfo.java
deleted file mode 100644
index 4e04fb0..0000000
--- a/src/main/java/net/daporkchop/pepsimod/mixin/world/storage/MixinWorldInfo.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.mixin.world.storage;
-
-import net.daporkchop.pepsimod.module.impl.render.NoWeatherMod;
-import net.daporkchop.pepsimod.util.config.impl.NoWeatherTranslator;
-import net.minecraft.world.storage.WorldInfo;
-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(WorldInfo.class)
-public abstract class MixinWorldInfo {
- @Inject(
- method = "Lnet/minecraft/world/storage/WorldInfo;getWorldTime()J",
- at = @At("HEAD"),
- cancellable = true
- )
- public void preGetWorldTime(CallbackInfoReturnable callbackInfoReturnable) {
- if (NoWeatherMod.INSTANCE.state.enabled && NoWeatherTranslator.INSTANCE.changeTime) {
- callbackInfoReturnable.setReturnValue((long) NoWeatherTranslator.INSTANCE.time);
- }
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/Mods.java b/src/main/java/net/daporkchop/pepsimod/module/Mods.java
new file mode 100644
index 0000000..1f243b8
--- /dev/null
+++ b/src/main/java/net/daporkchop/pepsimod/module/Mods.java
@@ -0,0 +1,35 @@
+/*
+ * Adapted from The MIT License (MIT)
+ *
+ * Copyright (c) 2016-2020 DaPorkchop_
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions:
+ *
+ * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
+ * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+package net.daporkchop.pepsimod.module;
+
+import net.daporkchop.pepsimod.module.impl.NoWeather;
+import net.daporkchop.pepsimod.module.util.Mod;
+
+/**
+ * An interface containing all mods in pepsimod.
+ *
+ * Entries are sorted alphabetically.
+ *
+ * @author DaPorkchop_
+ */
+public interface Mods {
+ Mod NO_WEATHER = new Mod<>(NoWeather.class, NoWeather::new);
+}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/Module.java b/src/main/java/net/daporkchop/pepsimod/module/Module.java
new file mode 100644
index 0000000..45917d9
--- /dev/null
+++ b/src/main/java/net/daporkchop/pepsimod/module/Module.java
@@ -0,0 +1,107 @@
+/*
+ * Adapted from The MIT License (MIT)
+ *
+ * Copyright (c) 2016-2020 DaPorkchop_
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions:
+ *
+ * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
+ * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+package net.daporkchop.pepsimod.module;
+
+import net.daporkchop.pepsimod.util.event.impl.Event;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * The root of most pepsimod utilities are modules. These are individual, toggleable utilities with a distinct function that
+ *
+ * i need to come up with a definition for this
+ * although in all likelihood i'll forget and this useless javadoc will still be sitting here in three years
+ *
+ * @author DaPorkchop_
+ */
+public interface Module extends Event, AutoCloseable {
+ /**
+ * Initializes a newly created instance of this module.
+ *
+ * This is guaranteed to be the first method that is called after the instance is created.
+ */
+ default void init() {
+ }
+
+ /**
+ * Called before this module instance is discarded to release any additional resources.
+ *
+ * This method will be called every time the module manager is reset, which will happen every time we disconnect from a server (dedicated or internal)
+ * or change dimensions.
+ *
+ * No guarantees are made as to what state the module will be in when this is called, as the player can disconnect, get kicked or be teleported to
+ * another dimension at any moment.
+ */
+ @Override
+ default void close() {
+ }
+
+ /**
+ * Called when this module is enabled.
+ *
+ * Any events registered by this module will be registered automatically before this method is called.
+ *
+ * {@link #init()} is guaranteed to be called before this method.
+ */
+ default void enabled() {
+ }
+
+ /**
+ * Called when this module is disabled.
+ *
+ * Any events registered by this module will be deregistered automatically before this method is called.
+ */
+ default void disabled() {
+ }
+
+ /**
+ * Required annotation for all implementations of {@link Module}. Provides additional static information about the module.
+ *
+ * @author DaPorkchop_
+ */
+ @Target(ElementType.TYPE)
+ @Retention(RetentionPolicy.RUNTIME)
+ @interface Info {
+ /**
+ * The unique ID of the module.
+ *
+ * This is never displayed directly to the user, but rather is used internally for things such as serialization.
+ */
+ String id();
+
+ /**
+ * An array of module classes that this module requires to be enabled before it may be enabled itself.
+ *
+ * Currently unused.
+ */
+ Class extends Module>[] requires() default {};
+
+ /**
+ * An array of module classes that this module is incompatible with.
+ *
+ * Currently unused.
+ */
+ Class extends Module>[] incompatible() default {};
+ }
+}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/ModuleManager.java b/src/main/java/net/daporkchop/pepsimod/module/ModuleManager.java
deleted file mode 100644
index 7d7c0a7..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/ModuleManager.java
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module;
-
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleSortType;
-import net.daporkchop.pepsimod.util.PepsiUtils;
-import net.daporkchop.pepsimod.util.config.impl.GeneralTranslator;
-import net.minecraft.network.Packet;
-
-import java.util.ArrayList;
-import java.util.concurrent.ThreadLocalRandom;
-
-public class ModuleManager {
-
- /**
- * All modules that are registered
- */
- public static ArrayList AVALIBLE_MODULES = new ArrayList<>();
-
- /**
- * All modules that are currently enabled
- */
- public static ArrayList ENABLED_MODULES = new ArrayList<>();
-
- /**
- * Adds a module to the registry
- *
- * @param toRegister the Module to register
- * @return the Module passed to the function
- */
- public static Module registerModule(Module toRegister) {
- if (toRegister.shouldRegister()) {
- AVALIBLE_MODULES.add(toRegister);
- if (toRegister.state.enabled) {
- enableModule(toRegister);
- } else {
- disableModule(toRegister);
- }
- }
- return toRegister;
- }
-
- public static void registerModules(Module... toRegister) {
- for (Module module : toRegister) {
- registerModule(module);
- }
- }
-
- public static void unRegister(Module module) {
- if (AVALIBLE_MODULES.contains(module)) {
- AVALIBLE_MODULES.remove(module);
- ENABLED_MODULES.remove(module);
- }
- }
-
- /**
- * Enables a module
- *
- * @param toEnable the module to enable
- * @return the enabled module
- */
- public static Module enableModule(Module toEnable) {
- if (!ENABLED_MODULES.contains(toEnable)) {
- if (AVALIBLE_MODULES.contains(toEnable)) {
- ENABLED_MODULES.add(toEnable);
- toEnable.setEnabled(true);
- } else {
- throw new IllegalStateException("Attempted to enable an unregistered Module!");
- }
- }
- return toEnable;
- }
-
- /**
- * Disables a module
- *
- * @param toDisable the module to disable
- * @return the disabled module
- */
- public static Module disableModule(Module toDisable) {
- if (toDisable.state.enabled && ENABLED_MODULES.contains(toDisable)) {
- if (AVALIBLE_MODULES.contains(toDisable)) {
- ENABLED_MODULES.remove(toDisable);
- toDisable.setEnabled(false);
- } else {
- throw new IllegalStateException("Attempted to disable an unregistered Module!");
- }
- }
- return toDisable;
- }
-
- /**
- * Toggles a module
- *
- * @param toToggle the module to toggle
- * @return the toggled module
- */
- public static Module toggleModule(Module toToggle) {
- if (toToggle.state.enabled) {
- disableModule(toToggle);
- } else {
- enableModule(toToggle);
- }
- return toToggle;
- }
-
- /**
- * Gets a module by it's name
- *
- * @param name the module's name
- * @return a module, or null if nothing was found
- */
- public static Module getModuleByName(String name) {
- for (Module module : AVALIBLE_MODULES) {
- if (module.name.equals(name)) {
- return module;
- }
- }
-
- return null;
- }
-
- @SuppressWarnings("unchecked")
- public static void sortModules(ModuleSortType type) {
- GeneralTranslator.INSTANCE.sortType = type;
- switch (type) {
- case ALPHABETICAL:
- ArrayList tempArrayList = (ArrayList) ENABLED_MODULES.clone();
- ArrayList newArrayList = new ArrayList<>();
- ESCAPE:
- for (Module module : tempArrayList) {
- for (int i = 0; i < newArrayList.size(); i++) {
- if (module.name.compareTo(newArrayList.get(i).name) < 0) {
- newArrayList.add(i, module);
- continue ESCAPE;
- }
- }
- newArrayList.add(module);
- }
- ENABLED_MODULES = newArrayList;
- break;
- case DEFAULT: //hehe do nothing lol
- break;
- case SIZE:
- ArrayList tempArrayList1 = (ArrayList) ENABLED_MODULES.clone();
- ArrayList newArrayList1 = new ArrayList<>();
- ESCAPE:
- for (Module module : tempArrayList1) {
- if (module.text == null) {
- return;
- }
- for (int i = 0; i < newArrayList1.size(); i++) {
- Module existingModule = newArrayList1.get(i);
- if (module.text.width() > existingModule.text.width()) {
- newArrayList1.add(i, module);
- continue ESCAPE;
- } else if (module.text.width() == existingModule.text.width()) {
- if (module.name.compareTo(existingModule.name) < 0) {
- newArrayList1.add(i, module);
- continue ESCAPE;
- }
- }
- }
- newArrayList1.add(module);
- }
- ENABLED_MODULES = newArrayList1;
- break;
- case RANDOM:
- ArrayList tempArrayList2 = (ArrayList) ENABLED_MODULES.clone();
- ArrayList newArrayList2 = new ArrayList<>();
- for (Module module : tempArrayList2) {
- newArrayList2.add(ThreadLocalRandom.current().nextInt(newArrayList2.size()), module);
- }
- ENABLED_MODULES = newArrayList2;
- }
- }
-
- public static boolean preRecievePacket(Packet> packetIn) {
- boolean cancel = false;
- for (Module module : ENABLED_MODULES) {
- if (module.preRecievePacket(packetIn)) {
- cancel = true;
- }
- }
- return cancel;
- }
-
- public static void postRecievePacket(Packet> packetIn) {
- for (Module module : ENABLED_MODULES) {
- module.postRecievePacket(packetIn);
- }
- }
-
- public static boolean preSendPacket(Packet> packetIn) {
- boolean cancel = false;
- for (Module module : ENABLED_MODULES) {
- if (module.preSendPacket(packetIn)) {
- cancel = true;
- }
- }
- return cancel;
- }
-
- public static void postSendPacket(Packet> packetIn) {
- for (Module module : ENABLED_MODULES) {
- module.postSendPacket(packetIn);
- }
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/api/Module.java b/src/main/java/net/daporkchop/pepsimod/module/api/Module.java
deleted file mode 100644
index 09e94bc..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/api/Module.java
+++ /dev/null
@@ -1,407 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.api;
-
-import net.daporkchop.pepsimod.command.CommandRegistry;
-import net.daporkchop.pepsimod.command.api.Command;
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.ModuleManager;
-import net.daporkchop.pepsimod.util.PepsiUtils;
-import net.daporkchop.pepsimod.util.colors.ColorizedText;
-import net.daporkchop.pepsimod.util.colors.rainbow.RainbowText;
-import net.daporkchop.pepsimod.util.config.impl.GeneralTranslator;
-import net.daporkchop.pepsimod.util.config.impl.HUDTranslator;
-import net.daporkchop.pepsimod.util.event.MoveEvent;
-import net.daporkchop.pepsimod.util.misc.ITickListener;
-import net.daporkchop.pepsimod.util.render.WorldRenderer;
-import net.minecraft.client.gui.GuiIngame;
-import net.minecraft.client.settings.KeyBinding;
-import net.minecraft.network.Packet;
-import net.minecraftforge.fml.client.registry.ClientRegistry;
-import org.lwjgl.input.Keyboard;
-
-import java.util.ArrayList;
-
-/**
- * hehe this is actually a command
- * but it's a module
- * gl understanding my overly complicated class heirachy
- */
-public abstract class Module extends Command implements ITickListener {
- public static boolean shouldBeEnabled(boolean in, ModuleLaunchState state) {
- if (state == ModuleLaunchState.ENABLED) {
- return true;
- } else if (state == ModuleLaunchState.DISABLED) {
- return false;
- } else {
- return in;
- }
- }
- public KeyBinding keybind;
- public ColorizedText text;
- public ModuleOption[] options;
- public String nameFull;
- public String[] completionOptions;
- public GeneralTranslator.ModuleState state;
-
- public Module(String name) {
- this(false, name, -1, false);
- }
-
- public Module(boolean def, String name, int keybind, boolean hide) {
- super(name.toLowerCase());
- this.nameFull = name;
- this.options = this.getDefaultOptions();
- this.registerKeybind(name, keybind);
- this.state = GeneralTranslator.INSTANCE.getState(name, new GeneralTranslator.ModuleState(def, hide));
- if (this.state == null) {
- GeneralTranslator.INSTANCE.states.put(name, this.state = new GeneralTranslator.ModuleState(def, hide));
- }
- }
-
- /**
- * Toggles a Module
- *
- * @return the new status
- */
- public boolean toggle() {
- this.state.enabled = !this.state.enabled;
- if (this.state.enabled) {
- this.onEnable();
- } else {
- this.onDisable();
- }
- return this.state.enabled;
- }
-
- /**
- * Enables or disables a Module
- *
- * @return the given argument
- */
- public boolean setEnabled(boolean enabled) {
- this.state.enabled = enabled;
- if (this.state.enabled) {
- this.onEnable();
- } else {
- this.onDisable();
- }
- return this.state.enabled;
- }
-
- /**
- * Handles base initialization logic after minecraft is started
- */
- public final void doInit() {
- this.init();
- if (this.hasModeInName()) {
- this.updateName();
- } else {
- this.text = new RainbowText(this.nameFull);
- }
- CommandRegistry.registerCommand(this);
- ArrayList temp = new ArrayList<>();
- for (ModuleOption option : this.options) {
- temp.add(option.getName());
- }
- //temp.add("list"); is this really needed? get opinions
- this.completionOptions = temp.toArray(new String[temp.size()]);
- }
-
- /**
- * Gets a ModuleOption by name
- *
- * @param name the name to search for
- * @return a ModuleOption by the given name, null if there was nothing with the name
- */
- public ModuleOption getOptionByName(String name) {
- for (ModuleOption moduleOption : this.options) {
- if (moduleOption.getName().equals(name)) {
- return moduleOption;
- }
- }
-
- return null;
- }
-
- public boolean shouldTick() {
- return this.state.enabled;
- }
-
- /**
- * Called when the Module is enabled
- */
- public abstract void onEnable();
-
- /**
- * Called when the Module is disabled
- */
- public abstract void onDisable();
-
- /**
- * Called when minecraft is started
- */
- public abstract void init();
-
- /**
- * Module specific module settings
- */
- protected abstract ModuleOption[] getDefaultOptions();
-
- /**
- * Called directly after a packet is recieved, before it's processed
- *
- * @return if true, the packet will be ignored by vanilla
- */
- public boolean preRecievePacket(Packet> packetIn) {
- return false;
- }
-
- /**
- * Called after a packet is recieved, after it's been processed
- */
- public void postRecievePacket(Packet> packetIn) {
- }
-
- /**
- * Called right before a packet is sent
- *
- * @return if true, the packet will not be sent
- */
- public boolean preSendPacket(Packet> packetIn) {
- return false;
- }
-
- /**
- * Called after a packet is sent
- */
- public void postSendPacket(Packet> packetIn) {
- }
-
- /**
- * Whether or not extra info should show in the name
- * e.g.
- * Criticals [Packet]
- */
- public boolean hasModeInName() {
- return false;
- }
-
- /**
- * Whether or not extra info should show in the name
- * e.g.
- * Criticals [Packet]
- *
- * This method returned "Packet"
- */
- public String getModeForName() {
- return "";
- }
-
- /**
- * Updates the module's name
- * Does nothing if the module has no custom name
- */
- public void updateName() {
- if (pepsimod.isInitialized && this.hasModeInName()) {
- if (HUDTranslator.INSTANCE.rainbow) {
- this.text = new RainbowText(this.nameFull + PepsiUtils.COLOR_ESCAPE + "customa8a8a8 [" + this.getModeForName() + "]");
- } else {
- this.text = new RainbowText(this.nameFull + PepsiUtils.COLOR_ESCAPE + "7 [" + this.getModeForName() + "]");
- }
- }
- }
-
- public String getSuggestion(String cmd, String[] args) {
- switch (args.length) {
- case 1:
- return "." + this.name + " " + (this.completionOptions.length == 0 ? "" : this.completionOptions[0]);
- case 2:
- if (args[1].isEmpty()) {
- return "." + this.name + " " + (this.completionOptions.length == 0 ? "" : this.completionOptions[0]);
- }
- for (String mode : this.completionOptions) {
- if (mode.equals(args[1])) {
- ModuleOption option = this.getOptionByName(args[1]);
- if (option == null) {
- return "";
- } else {
- return args[0] + " " + args[1] + " " + option.getDefaultValue();
- }
- } else if (mode.startsWith(args[1])) {
- return "." + this.name + " " + mode;
- }
- }
- return "";
- case 3:
- if (args[2].isEmpty()) {
- ModuleOption option = this.getOptionByName(args[1].trim());
- if (option == null) {
- return "";
- } else {
- return args[0] + " " + args[1] + " " + option.getDefaultValue();
- }
- }
- ModuleOption option = this.getOptionByName(args[1]);
- if (option == null) {
- return "";
- } else {
- if (option.getDefaultValue().toString().startsWith(args[2])) {
- return args[0] + " " + args[1] + " " + option.getDefaultValue();
- } else {
- for (String s : option.defaultCompletions()) {
- if (s.startsWith(args[2])) {
- return args[0] + " " + args[1] + " " + s;
- }
- }
- return "";
- }
- }
- }
-
- return "." + this.name;
- }
-
- public void execute(String cmd, String[] args) {
- switch (args.length) {
- case 1:
- String commands = "";
- for (int i = 0; i < this.completionOptions.length; i++) {
- commands += PepsiUtils.COLOR_ESCAPE + "o" + this.completionOptions[i] + PepsiUtils.COLOR_ESCAPE + "r" + (i + 1 == this.completionOptions.length ? "" : ", ");
- }
- clientMessage(commands);
- break;
- case 2:
- if (args[1].isEmpty()) {
- String cmds = "";
- for (int i = 0; i < this.completionOptions.length; i++) {
- cmds += PepsiUtils.COLOR_ESCAPE + "o" + this.completionOptions[i] + PepsiUtils.COLOR_ESCAPE + "r" + (i + 1 == this.completionOptions.length ? "" : ", ");
- }
- clientMessage(cmds);
- break;
- }
- ModuleOption option = this.getOptionByName(args[1]);
- if (option == null) {
- clientMessage("Unknown option: " + PepsiUtils.COLOR_ESCAPE + "o" + args[1]);
- break;
- } else {
- clientMessage(args[1] + ": " + option.getValue());
- break;
- }
- case 3:
- if (args[2].isEmpty()) {
- ModuleOption opt = this.getOptionByName(args[1]);
- if (opt == null) {
- clientMessage("Unknown option: " + PepsiUtils.COLOR_ESCAPE + "o" + args[1]);
- break;
- } else {
- clientMessage(args[1] + ": " + opt.getValue());
- break;
- }
- }
- ModuleOption opt = this.getOptionByName(args[1]);
- if (opt == null) {
- clientMessage("Unknown option: " + PepsiUtils.COLOR_ESCAPE + "o" + args[1]);
- break;
- } else {
- try {
- switch (opt.getValue().getClass().getCanonicalName()) {
- case "java.lang.String":
- opt.setValue(args[2]);
- break;
- case "java.lang.Boolean":
- opt.setValue(Boolean.parseBoolean(args[2]));
- break;
- case "java.lang.Byte":
- opt.setValue(Byte.parseByte(args[2]));
- break;
- case "java.lang.Double":
- opt.setValue(Double.parseDouble(args[2]));
- break;
- case "java.lang.Float":
- opt.setValue(Float.parseFloat(args[2]));
- break;
- case "java.lang.Integer":
- opt.setValue(Integer.parseInt(args[2]));
- break;
- case "java.lang.Short":
- opt.setValue(Short.parseShort(args[2]));
- break;
- default:
- clientMessage("Unknown value type: " + PepsiUtils.COLOR_ESCAPE + "o" + opt.getValue().getClass().getCanonicalName() + PepsiUtils.COLOR_ESCAPE + "r. Please report to devs!");
- return;
- }
-
- switch (args[1]) {
- case "hidden":
- this.state.hidden = (boolean) opt.getValue();
- break;
- case "enabled":
- if ((boolean) opt.getValue()) {
- ModuleManager.enableModule(this);
- } else {
- ModuleManager.disableModule(this);
- }
- break;
- }
- clientMessage("Set " + PepsiUtils.COLOR_ESCAPE + "o" + args[1] + PepsiUtils.COLOR_ESCAPE + "r to " + PepsiUtils.COLOR_ESCAPE + "o" + opt.getValue());
- } catch (NumberFormatException e) {
- clientMessage("Invalid number: " + PepsiUtils.COLOR_ESCAPE + "o" + args[2]);
- }
- }
- }
- }
-
- /**
- * called every frame
- */
- public void onRender(float partialTicks) {
- }
-
- public void onRenderGUI(float partialTicks, int width, int height, GuiIngame gui) {
- }
-
- public void renderOverlay(WorldRenderer renderer) {
- }
-
- public void renderWorld(WorldRenderer renderer) {
- }
-
- @Deprecated
- public ModuleLaunchState getLaunchState() {
- return ModuleLaunchState.AUTO;
- }
-
- public void registerKeybind(String name, int key) {
- this.keybind = new KeyBinding(name, key == -1 ? Keyboard.KEY_NONE : key, "key.categories.pepsimod");
- ClientRegistry.registerKeyBinding(this.keybind);
- }
-
- public abstract ModuleCategory getCategory();
-
- public void onPlayerMove(MoveEvent e) {
-
- }
-
- public boolean shouldRegister() {
- return true;
- }
-}
\ No newline at end of file
diff --git a/src/main/java/net/daporkchop/pepsimod/module/api/ModuleOption.java b/src/main/java/net/daporkchop/pepsimod/module/api/ModuleOption.java
deleted file mode 100644
index d180bbd..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/api/ModuleOption.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.api;
-
-import net.daporkchop.pepsimod.module.api.option.OptionExtended;
-
-import java.util.function.Function;
-import java.util.function.Supplier;
-
-public class ModuleOption {
- public final Function SET;
- public final Supplier GET;
- private final String[] DEFAULT_COMPLETIONS;
- private final T DEFAULT_VALUE;
- public String displayName;
- public boolean makeButton = true;
- public OptionExtended extended = null;
- private T value;
- private String name;
-
- public ModuleOption(T defaultValue, String name, String[] defaultCompletions, Function set, Supplier get, String displayName, OptionExtended extended, boolean makeWindow) {
- this(defaultValue, name, defaultCompletions, set, get, displayName, makeWindow);
- this.extended = extended;
- }
-
- public ModuleOption(T defaultValue, String name, String[] defaultCompletions, Function set, Supplier get, String displayName, OptionExtended extended) {
- this(defaultValue, name, defaultCompletions, set, get, displayName);
- this.extended = extended;
- }
-
- public ModuleOption(T defaultValue, String name, String[] defaultCompletions, Function set, Supplier get, String displayName, boolean makeButton) {
- this(defaultValue, name, defaultCompletions, set, get, displayName);
- this.makeButton = makeButton;
- }
-
- public ModuleOption(T defaultValue, String name, String[] defaultCompletions, Function set, Supplier get, String displayName) {
- this.DEFAULT_COMPLETIONS = defaultCompletions;
- this.DEFAULT_VALUE = defaultValue;
- this.SET = set;
- this.GET = get;
- this.value = defaultValue;
- this.name = name;
- this.displayName = displayName;
- }
-
- public String getName() {
- return this.name == null ? this.displayName.toLowerCase() : this.name;
- }
-
- public boolean setValue(T value) {
- return this.SET.apply(value);
- }
-
- public T getValue() {
- T toReturn = this.GET.get();
- return toReturn == null ? this.getDefaultValue() : toReturn;
- }
-
- public T getDefaultValue() {
- return this.DEFAULT_VALUE;
- }
-
- public String[] defaultCompletions() {
- return this.DEFAULT_COMPLETIONS;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/api/ModuleSortType.java b/src/main/java/net/daporkchop/pepsimod/module/api/ModuleSortType.java
deleted file mode 100644
index 68fe975..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/api/ModuleSortType.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.api;
-
-public enum ModuleSortType {
- ALPHABETICAL,
- SIZE,
- RANDOM,
- DEFAULT;
-
- public static ModuleSortType fromOrdinal(int ordinal) {
- return values()[ordinal];
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/api/OptionCompletions.java b/src/main/java/net/daporkchop/pepsimod/module/api/OptionCompletions.java
deleted file mode 100644
index 52a47b4..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/api/OptionCompletions.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.api;
-
-public class OptionCompletions {
- public static final String[] BOOLEAN = new String[]{"true", "false"};
- public static final String[] BYTE = new String[]{"0"};
- public static final String[] DOUBLE = new String[]{"0.0"};
- public static final String[] FLOAT = new String[]{"0.0"};
- public static final String[] INTEGER = new String[]{"0"};
- public static final String[] SHORT = new String[]{"0"};
- public static final String[] STRING = new String[]{""};
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/api/TimeModule.java b/src/main/java/net/daporkchop/pepsimod/module/api/TimeModule.java
deleted file mode 100644
index 9ffbeb2..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/api/TimeModule.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.api;
-
-public abstract class TimeModule extends Module {
- public long currentMS = 0L;
- public long lastMS = -1L;
-
- public TimeModule(String name) {
- super(name);
- }
-
- public final void updateMS() {
- this.currentMS = System.currentTimeMillis();
- }
-
- public final void updateLastMS() {
- this.lastMS = System.currentTimeMillis();
- }
-
- public final boolean hasTimePassedM(long MS) {
- return this.currentMS >= this.lastMS + MS;
- }
-
- public final boolean hasTimePassedS(float speed) {
- return this.currentMS >= this.lastMS + (long) (1000 / speed);
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/api/option/ExtensionMulti.java b/src/main/java/net/daporkchop/pepsimod/module/api/option/ExtensionMulti.java
deleted file mode 100644
index c2f644c..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/api/option/ExtensionMulti.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.api.option;
-
-public class ExtensionMulti extends OptionExtended {
- //TODO
-
- @Override
- public ExtensionType getType() {
- return ExtensionType.TYPE_MULTI;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/api/option/ExtensionSlider.java b/src/main/java/net/daporkchop/pepsimod/module/api/option/ExtensionSlider.java
deleted file mode 100644
index 251f61e..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/api/option/ExtensionSlider.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.api.option;
-
-public class ExtensionSlider extends OptionExtended {
- public final ExtensionType dataType;
- public final Object min, max, step;
-
- public ExtensionSlider(ExtensionType dataType, Object min, Object max, Object step) {
- this.dataType = dataType;
- this.min = min;
- this.max = max;
- this.step = step;
- }
-
- @Override
- public ExtensionType getType() {
- return ExtensionType.TYPE_SLIDER;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/api/option/ExtensionType.java b/src/main/java/net/daporkchop/pepsimod/module/api/option/ExtensionType.java
deleted file mode 100644
index d4f2e0d..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/api/option/ExtensionType.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.api.option;
-
-public enum ExtensionType {
- TYPE_BOOLEAN,
- TYPE_SLIDER,
- TYPE_MULTI,
- VALUE_INT,
- VALUE_FLOAT
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/api/option/OptionExtended.java b/src/main/java/net/daporkchop/pepsimod/module/api/option/OptionExtended.java
deleted file mode 100644
index fe1d622..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/api/option/OptionExtended.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.api.option;
-
-public abstract class OptionExtended {
- public abstract ExtensionType getType();
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/BasicMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/BasicMod.java
deleted file mode 100644
index 522d6d9..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/BasicMod.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl;
-
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-
-public class BasicMod extends Module {
- public static BasicMod INSTANCE;
-
- {
- INSTANCE = this;
- }
-
- public BasicMod() {
- super("delet_this");
- }
-
- @Override
- public void onEnable() {
-
- }
-
- @Override
- public void onDisable() {
-
- }
-
- @Override
- public void tick() {
-
- }
-
- @Override
- public void init() {
- INSTANCE = this;
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[]{
- };
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.PLACEHOLDER;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/ModuleCategory.java b/src/main/java/net/daporkchop/pepsimod/module/impl/NoWeather.java
similarity index 86%
rename from src/main/java/net/daporkchop/pepsimod/module/ModuleCategory.java
rename to src/main/java/net/daporkchop/pepsimod/module/impl/NoWeather.java
index 030f309..92bda2c 100644
--- a/src/main/java/net/daporkchop/pepsimod/module/ModuleCategory.java
+++ b/src/main/java/net/daporkchop/pepsimod/module/impl/NoWeather.java
@@ -18,14 +18,13 @@
*
*/
-package net.daporkchop.pepsimod.module;
+package net.daporkchop.pepsimod.module.impl;
-public enum ModuleCategory {
- RENDER,
- COMBAT,
- MISC,
- MOVEMENT,
- PLAYER,
+import net.daporkchop.pepsimod.module.Module;
- PLACEHOLDER
+/**
+ * @author DaPorkchop_
+ */
+@Module.Info(id = "noweather")
+public final class NoWeather implements Module {
}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/combat/AuraMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/combat/AuraMod.java
deleted file mode 100644
index 133def5..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/combat/AuraMod.java
+++ /dev/null
@@ -1,320 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.combat;
-
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-import net.daporkchop.pepsimod.module.api.OptionCompletions;
-import net.daporkchop.pepsimod.module.api.option.ExtensionSlider;
-import net.daporkchop.pepsimod.module.api.option.ExtensionType;
-import net.daporkchop.pepsimod.module.impl.player.AutoEatMod;
-import net.daporkchop.pepsimod.the.wurst.pkg.name.EntityUtils;
-import net.daporkchop.pepsimod.the.wurst.pkg.name.RotationUtils;
-import net.daporkchop.pepsimod.util.PepsiUtils;
-import net.daporkchop.pepsimod.util.config.impl.TargettingTranslator;
-import net.minecraft.entity.Entity;
-import net.minecraft.util.EnumHand;
-
-public class AuraMod extends Module {
- public static final String[] targetBoneStrings = new String[]{"head", "feet", "middle"};
- public static AuraMod INSTANCE;
- public int lastTick = 0;
-
- {
- INSTANCE = this;
- }
-
- public AuraMod() {
- super("Aura");
- }
-
- @Override
- public void onEnable() {
- if (mc.player == null) {
- }
- }
-
- @Override
- public void onDisable() {
- if (mc.player == null) {
- }
- }
-
- @Override
- public void tick() {
- if (AutoEatMod.INSTANCE.state.enabled && !AutoEatMod.INSTANCE.doneEating) {
- return;
- }
-
- if (TargettingTranslator.INSTANCE.use_cooldown) {
- if (mc.player.getCooledAttackStrength(0) == 1) {
- Entity entity = EntityUtils.getBestEntityToAttack(EntityUtils.DEFAULT_SETTINGS);
- if (entity == null) {
- return;
- }
-
- if (TargettingTranslator.INSTANCE.rotate) {
- if (!RotationUtils.faceEntityPacket(entity)) {
- return;
- }
- if (!TargettingTranslator.INSTANCE.silent) {
- RotationUtils.faceEntityClient(entity);
- }
- }
-
- mc.playerController.attackEntity(mc.player, entity);
- if (!TargettingTranslator.INSTANCE.silent) {
- mc.player.swingArm(EnumHand.MAIN_HAND);
- }
- }
- } else {
- this.lastTick++;
-
- if (this.lastTick >= TargettingTranslator.INSTANCE.delay) {
- this.lastTick = 0;
-
- Entity entity = EntityUtils.getBestEntityToAttack(EntityUtils.DEFAULT_SETTINGS);
- if (entity == null) {
- return;
- }
-
- if (TargettingTranslator.INSTANCE.rotate) {
- if (!RotationUtils.faceEntityPacket(entity)) {
- return;
- }
- if (!TargettingTranslator.INSTANCE.silent) {
- RotationUtils.faceEntityClient(entity);
- }
- }
-
- mc.playerController.attackEntity(mc.player, entity);
- if (!TargettingTranslator.INSTANCE.silent) {
- mc.player.swingArm(EnumHand.MAIN_HAND);
- }
- }
- }
- }
-
- @Override
- public void init() {
-
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[]{ //wtf why is this throwing an NPE
- new ModuleOption<>(TargettingTranslator.INSTANCE.players, "players", OptionCompletions.BOOLEAN,
- (value) -> {
- TargettingTranslator.INSTANCE.players = value;
- return true;
- },
- () -> {
- return TargettingTranslator.INSTANCE.players;
- }, "Players"),
- new ModuleOption<>(TargettingTranslator.INSTANCE.animals, "animals", OptionCompletions.BOOLEAN,
- (value) -> {
- TargettingTranslator.INSTANCE.animals = value;
- return true;
- },
- () -> {
- return TargettingTranslator.INSTANCE.animals;
- }, "Animals"),
- new ModuleOption<>(TargettingTranslator.INSTANCE.monsters, "monsters", OptionCompletions.BOOLEAN,
- (value) -> {
- TargettingTranslator.INSTANCE.monsters = value;
- return true;
- },
- () -> {
- return TargettingTranslator.INSTANCE.monsters;
- }, "Monsters"),
- new ModuleOption<>(TargettingTranslator.INSTANCE.golems, "golems", OptionCompletions.BOOLEAN,
- (value) -> {
- TargettingTranslator.INSTANCE.golems = value;
- return true;
- },
- () -> {
- return TargettingTranslator.INSTANCE.golems;
- }, "Golems"),
- new ModuleOption<>(TargettingTranslator.INSTANCE.sleeping, "sleeping", OptionCompletions.BOOLEAN,
- (value) -> {
- TargettingTranslator.INSTANCE.sleeping = value;
- return true;
- },
- () -> {
- return TargettingTranslator.INSTANCE.sleeping;
- }, "Sleeping"),
- new ModuleOption<>(TargettingTranslator.INSTANCE.invisible, "invisible", OptionCompletions.BOOLEAN,
- (value) -> {
- TargettingTranslator.INSTANCE.invisible = value;
- return true;
- },
- () -> {
- return TargettingTranslator.INSTANCE.invisible;
- }, "Invisible"),
- new ModuleOption<>(TargettingTranslator.INSTANCE.teams, "teams", OptionCompletions.BOOLEAN,
- (value) -> {
- TargettingTranslator.INSTANCE.teams = value;
- return true;
- },
- () -> {
- return TargettingTranslator.INSTANCE.teams;
- }, "Teams"),
- new ModuleOption<>(TargettingTranslator.INSTANCE.friends, "friends", OptionCompletions.BOOLEAN,
- (value) -> {
- TargettingTranslator.INSTANCE.friends = value;
- return true;
- },
- () -> {
- return TargettingTranslator.INSTANCE.friends;
- }, "Friends"),
- new ModuleOption<>(TargettingTranslator.INSTANCE.through_walls, "through_walls", OptionCompletions.BOOLEAN,
- (value) -> {
- TargettingTranslator.INSTANCE.through_walls = value;
- return true;
- },
- () -> {
- return TargettingTranslator.INSTANCE.through_walls;
- }, "Through Walls"),
- new ModuleOption<>(TargettingTranslator.INSTANCE.fov, "fov", OptionCompletions.FLOAT,
- (value) -> {
- TargettingTranslator.INSTANCE.fov = value;
- return true;
- },
- () -> {
- return TargettingTranslator.INSTANCE.fov;
- }, "FOV", new ExtensionSlider(ExtensionType.VALUE_FLOAT, 0.0f, 360.0f, 0.5f)),
- new ModuleOption<>(TargettingTranslator.INSTANCE.reach, "reach", OptionCompletions.FLOAT,
- (value) -> {
- TargettingTranslator.INSTANCE.reach = value;
- return true;
- },
- () -> {
- return TargettingTranslator.INSTANCE.reach;
- }, "Reach", new ExtensionSlider(ExtensionType.VALUE_FLOAT, 0.0f, 10.0f, 0.1f)),
- new ModuleOption<>(TargettingTranslator.INSTANCE.delay, "delay", OptionCompletions.INTEGER,
- (value) -> {
- TargettingTranslator.INSTANCE.delay = value;
- return true;
- },
- () -> {
- return TargettingTranslator.INSTANCE.delay;
- }, "Delay", new ExtensionSlider(ExtensionType.VALUE_INT, 0, 50, 1)),
- new ModuleOption<>(TargettingTranslator.INSTANCE.use_cooldown, "use_cooldown", OptionCompletions.BOOLEAN,
- (value) -> {
- TargettingTranslator.INSTANCE.use_cooldown = value;
- return true;
- },
- () -> {
- return TargettingTranslator.INSTANCE.use_cooldown;
- }, "Use Cooldown"),
- new ModuleOption<>(TargettingTranslator.INSTANCE.silent, "silent", OptionCompletions.BOOLEAN,
- (value) -> {
- TargettingTranslator.INSTANCE.silent = value;
- return true;
- },
- () -> {
- return TargettingTranslator.INSTANCE.silent;
- }, "Silent"),
- new ModuleOption<>(TargettingTranslator.INSTANCE.rotate, "rotate", OptionCompletions.BOOLEAN,
- (value) -> {
- TargettingTranslator.INSTANCE.rotate = value;
- return true;
- },
- () -> {
- return TargettingTranslator.INSTANCE.rotate;
- }, "Rotate"),
- new ModuleOption<>(TargettingTranslator.INSTANCE.targetBone, "bone", targetBoneStrings,
- (value) -> {
- TargettingTranslator.INSTANCE.targetBone = value;
- return true;
- },
- () -> {
- return TargettingTranslator.INSTANCE.targetBone;
- }, "Bone", false)
- };
- }
-
- @Override
- public boolean hasModeInName() {
- return true;
- }
-
- @Override
- public String getModeForName() {
- String mode = "";
- if (TargettingTranslator.INSTANCE.silent) {
- mode += "Silent:";
- }
- if (TargettingTranslator.INSTANCE.rotate) {
- mode += "Rotate";
- } else {
- mode += "NoRotate";
- }
- return mode;
- }
-
- @Override
- public String getSuggestion(String cmd, String[] args) {
- if (args.length == 2 && args[1].equals("bone")) {
- return cmd + " " + targetBoneStrings[0];
- } else if (args.length == 3 && args[1].equals("bone")) {
- if (args[2].isEmpty()) {
- return cmd + targetBoneStrings[0];
- } else {
- for (String s : targetBoneStrings) {
- if (s.startsWith(args[2])) {
- return args[0] + " " + args[1] + " " + s;
- }
- }
-
- return "";
- }
- }
-
- return super.getSuggestion(cmd, args);
- }
-
- @Override
- public void execute(String cmd, String[] args) {
- if (args.length == 3 && !args[2].isEmpty() && cmd.startsWith(".aura bone ")) {
- String s = args[2].toUpperCase();
- try {
- TargettingTranslator.TargetBone bone = TargettingTranslator.TargetBone.valueOf(s);
- if (bone == null) {
- clientMessage("Not a valid bone: " + args[2]);
- } else {
- this.getOptionByName("bone").setValue(bone);
- clientMessage("Set " + PepsiUtils.COLOR_ESCAPE + "o" + args[1] + PepsiUtils.COLOR_ESCAPE + "r to " + PepsiUtils.COLOR_ESCAPE + "o" + s);
- }
- } catch (Exception e) {
- clientMessage("Not a valid bone: " + args[2]);
- }
- return;
- }
-
- super.execute(cmd, args);
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.COMBAT;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/combat/AutoArmorMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/combat/AutoArmorMod.java
deleted file mode 100644
index 452ae02..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/combat/AutoArmorMod.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.combat;
-
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-import net.daporkchop.pepsimod.module.api.TimeModule;
-import net.daporkchop.pepsimod.the.wurst.pkg.name.WPlayerController;
-import net.daporkchop.pepsimod.util.PepsiUtils;
-import net.minecraft.item.ItemArmor;
-import net.minecraft.item.ItemStack;
-
-public class AutoArmorMod extends TimeModule {
- public static AutoArmorMod INSTANCE;
-
- {
- INSTANCE = this;
- }
-
- public AutoArmorMod() {
- super("AutoArmor");
- }
-
- @Override
- public void onEnable() {
-
- }
-
- @Override
- public void onDisable() {
-
- }
-
- @Override
- public void tick() {
- if (mc.player.capabilities.isCreativeMode) {
- return;
- }
-
- this.updateMS();
- if (this.hasTimePassedM(500)) {
- this.updateLastMS();
- int[] bestArmorValues = new int[4];
- for (int type = 0; type < 4; type++) {
- ItemStack oldArmor = mc.player.inventory.armorItemInSlot(type);
- if (oldArmor.getItem() instanceof ItemArmor) {
- bestArmorValues[type] = ((ItemArmor) oldArmor.getItem()).damageReduceAmount;
- }
- }
- int[] bestArmorSlots = {-1, -1, -1, -1};
- for (int slot = 0; slot < 36; slot++) {
- ItemStack stack = mc.player.inventory.getStackInSlot(slot);
- if (stack.getItem() instanceof ItemArmor) {
- ItemArmor armor = (ItemArmor) stack.getItem();
- int type = PepsiUtils.getArmorType(armor);
- if (armor.damageReduceAmount > bestArmorValues[type]) {
- bestArmorValues[type] = armor.damageReduceAmount;
- bestArmorSlots[type] = slot;
- }
- }
- }
- for (int type = 0; type < 4; type++) {
- int slot = bestArmorSlots[type];
- if (slot != -1) {
- WPlayerController.windowClick_PICKUP(slot < 9 ? 36 + slot : slot);
- WPlayerController.windowClick_PICKUP(8 - type);
- WPlayerController.windowClick_PICKUP(slot < 9 ? 36 + slot : slot);
- }
- }
- }
- }
-
- @Override
- public void init() {
- INSTANCE = this;
- this.updateLastMS();
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[0];
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.COMBAT;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/combat/AutoTotemMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/combat/AutoTotemMod.java
deleted file mode 100644
index 7addaf8..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/combat/AutoTotemMod.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.combat;
-
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-import net.minecraft.client.entity.EntityPlayerSP;
-import net.minecraft.init.Items;
-import net.minecraft.inventory.ClickType;
-import net.minecraft.inventory.ContainerPlayer;
-import net.minecraft.inventory.EntityEquipmentSlot;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.NonNullList;
-
-/**
- * #totallyNotSkidded
- */
-public class AutoTotemMod extends Module {
- public static AutoTotemMod INSTANCE;
- private int timer;
-
- {
- INSTANCE = this;
- }
-
- public AutoTotemMod() {
- super("AutoTotem");
- }
-
- @Override
- public void onEnable() {
- this.timer = 0;
- }
-
- @Override
- public void onDisable() {
-
- }
-
- @Override
- public void tick() {
- EntityPlayerSP player = mc.player;
-
- if (this.timer > 0) {
- this.timer--;
- return;
- }
-
- NonNullList inv;
- ItemStack offhand = player.getItemStackFromSlot(EntityEquipmentSlot.OFFHAND);
-
- int inventoryIndex;
-
- inv = player.inventory.mainInventory;
-
- if ((offhand == null) || (offhand.getItem() != Items.TOTEM_OF_UNDYING)) {
- for (inventoryIndex = 0; inventoryIndex < inv.size(); inventoryIndex++) {
- if (inv.get(inventoryIndex) != ItemStack.EMPTY) {
- if (inv.get(inventoryIndex).getItem() == Items.TOTEM_OF_UNDYING) {
- this.replaceTotem(inventoryIndex);
- break;
- }
- }
- }
- this.timer = 3;
- }
- }
-
- @Override
- public void init() {
- INSTANCE = this;
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[0];
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.COMBAT;
- }
-
- public void replaceTotem(int inventoryIndex) {
- if (mc.player.openContainer instanceof ContainerPlayer) {
- mc.playerController.windowClick(0, inventoryIndex < 9 ? inventoryIndex + 36 : inventoryIndex, 0, ClickType.PICKUP, mc.player);
- mc.playerController.windowClick(0, 45, 0, ClickType.PICKUP, mc.player);
- mc.playerController.windowClick(0, inventoryIndex < 9 ? inventoryIndex + 36 : inventoryIndex, 0, ClickType.PICKUP, mc.player);
- }
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/combat/BedBomberMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/combat/BedBomberMod.java
deleted file mode 100644
index 8e1c371..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/combat/BedBomberMod.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.combat;
-
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-import net.daporkchop.pepsimod.module.api.OptionCompletions;
-import net.daporkchop.pepsimod.module.api.TimeModule;
-import net.daporkchop.pepsimod.module.api.option.ExtensionSlider;
-import net.daporkchop.pepsimod.module.api.option.ExtensionType;
-import net.daporkchop.pepsimod.the.wurst.pkg.name.BlockUtils;
-import net.daporkchop.pepsimod.util.config.impl.BedBomberTranslator;
-import net.minecraft.block.BlockBed;
-import net.minecraft.block.state.IBlockState;
-import net.minecraft.inventory.ClickType;
-import net.minecraft.item.ItemBed;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.EnumHand;
-import net.minecraft.util.NonNullList;
-import net.minecraft.util.math.BlockPos;
-
-public class BedBomberMod extends TimeModule {
- public static BedBomberMod INSTANCE;
- private static BlockUtils.BlockValidator validator =
- (pos) -> {
- IBlockState state = mc.world.getBlockState(pos);
- return state.getBlock() instanceof BlockBed;
- };
- public int itemMoveTick = 3, bedSlot = -1;
- private int itemTimer;
- private boolean shouldRestock = false;
-
- {
- INSTANCE = this;
- }
-
- public BedBomberMod() {
- super("BedBomber");
- }
-
- @Override
- public void onEnable() {
-
- }
-
- @Override
- public void onDisable() {
-
- }
-
- @Override
- public void tick() {
- this.updateMS();
-
- if (this.hasTimePassedM(BedBomberTranslator.INSTANCE.delay) && (mc.player.dimension == -1 || mc.player.dimension == 1)) {
- Iterable validBlocks = BlockUtils.getValidBlocksByDistance(BedBomberTranslator.INSTANCE.range, false, validator);
-
- for (BlockPos pos : validBlocks) {
- if (BlockUtils.rightClickBlockLegit(pos)) {
- return;
- }
- }
- }
-
- this.replaceBed(-1);
-
- if (this.shouldRestock && BedBomberTranslator.INSTANCE.resupply && this.itemMoveTick == 3) {
- if (this.itemTimer > 0) {
- this.itemTimer--;
- return;
- }
-
- ItemStack hand = mc.player.getHeldItem(EnumHand.MAIN_HAND);
- NonNullList inv = mc.player.inventory.mainInventory;
-
- if (hand == null || hand.isEmpty()) {
- for (int inventoryIndex = 0; inventoryIndex < inv.size(); inventoryIndex++) {
- if (inventoryIndex != mc.player.inventory.currentItem) {
- ItemStack stack = inv.get(inventoryIndex);
- if (!stack.isEmpty() && stack.getItem() instanceof ItemBed) {
- this.replaceBed(inventoryIndex);
- break;
- }
- }
- }
- this.shouldRestock = false;
- }
- }
- }
-
- @Override
- public void init() {
- INSTANCE = this;
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[]{
- new ModuleOption<>(BedBomberTranslator.INSTANCE.range, "range", OptionCompletions.FLOAT,
- (value) -> {
- BedBomberTranslator.INSTANCE.range = Math.max(value, 0);
- return true;
- },
- () -> {
- return BedBomberTranslator.INSTANCE.range;
- }, "Range", new ExtensionSlider(ExtensionType.VALUE_FLOAT, 0.0f, 10.0f, 0.5f)),
- new ModuleOption<>(BedBomberTranslator.INSTANCE.delay, "delay", OptionCompletions.FLOAT,
- (value) -> {
- BedBomberTranslator.INSTANCE.delay = Math.max(value, 0);
- return true;
- },
- () -> {
- return BedBomberTranslator.INSTANCE.delay;
- }, "Delay", new ExtensionSlider(ExtensionType.VALUE_INT, 0, 5000, 50)),
- new ModuleOption<>(BedBomberTranslator.INSTANCE.resupply, "resupply", OptionCompletions.BOOLEAN,
- (value) -> {
- BedBomberTranslator.INSTANCE.resupply = value;
- return true;
- },
- () -> {
- return BedBomberTranslator.INSTANCE.resupply;
- }, "Resupply")
- };
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.COMBAT;
- }
-
- public void replaceBed(int inventoryIndex) {
- if (inventoryIndex == -1) {
- inventoryIndex = this.bedSlot;
- } else {
- this.itemMoveTick = 0;
- this.bedSlot = inventoryIndex;
- }
- if (inventoryIndex == -1) {
- return;
- }
- switch (this.itemMoveTick) {
- case 0:
- mc.playerController.windowClick(0, inventoryIndex < 9 ? inventoryIndex + 36 : inventoryIndex, 0, ClickType.PICKUP, mc.player);
- break;
- case 1:
- mc.playerController.windowClick(0, 36 + mc.player.inventory.currentItem, 0, ClickType.PICKUP, mc.player);
- break;
- case 2:
- mc.playerController.windowClick(0, inventoryIndex < 9 ? inventoryIndex + 36 : inventoryIndex, 0, ClickType.PICKUP, mc.player);
- this.bedSlot = -1;
- break;
- }
- this.itemMoveTick++;
- }
-
- public void onPlaceBed() {
- if (this.state.enabled && BedBomberTranslator.INSTANCE.resupply) {
- this.shouldRestock = true;
- this.itemTimer = 3;
- }
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/combat/BowAimBotMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/combat/BowAimBotMod.java
deleted file mode 100644
index 0d40da0..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/combat/BowAimBotMod.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.combat;
-
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-import net.daporkchop.pepsimod.the.wurst.pkg.name.RenderUtils;
-import net.daporkchop.pepsimod.the.wurst.pkg.name.RotationUtils;
-import net.daporkchop.pepsimod.util.PepsiUtils;
-import net.daporkchop.pepsimod.util.ReflectionStuff;
-import net.minecraft.client.gui.GuiIngame;
-import net.minecraft.entity.EntityLivingBase;
-import net.minecraft.item.ItemBow;
-import net.minecraft.util.math.AxisAlignedBB;
-import org.lwjgl.opengl.GL11;
-
-import java.awt.Color;
-
-public class BowAimBotMod extends Module {
- public static BowAimBotMod INSTANCE;
- public EntityLivingBase target;
- public float velocity;
-
- {
- INSTANCE = this;
- }
-
- public BowAimBotMod() {
- super("BowAimBot");
- }
-
- @Override
- public void onEnable() {
-
- }
-
- @Override
- public void onDisable() {
-
- }
-
- @Override
- public void tick() {
-
- }
-
- @Override
- public void onRenderGUI(float partialTicks, int width, int height, GuiIngame gui) {
- if (this.velocity != -1.0f) {
- if (this.velocity > 0.0f) {
- gui.drawCenteredString(mc.fontRenderer, "Ready!", width / 2, height / 2 - 20, 16777215);
- } else {
- gui.drawCenteredString(mc.fontRenderer, "Charging...", width / 2, height / 2 - 20, 16740352);
- }
- }
- }
-
- @Override
- public void onRender(float partialTicks) {
- if (this.target != null) {
- double[] pos = PepsiUtils.interpolate(this.target);
- double x = pos[0] - ReflectionStuff.getRenderPosX();
- double y = pos[1] - ReflectionStuff.getRenderPosY();
- double z = pos[2] - ReflectionStuff.getRenderPosZ();
-
- GL11.glPushMatrix();
- GL11.glTranslated(x, y, z);
- GL11.glRotatef(-this.target.rotationYaw, 0.0F, 1.0F, 0.0F);
- PepsiUtils.glColor(Color.RED);
- RenderUtils.drawOutlinedBox(new AxisAlignedBB(this.target.width / 2.0D, 0.0D, -(this.target.width / 2.0D), -this.target.width / 2.0D, this.target.height + 0.1D, this.target.width / 2.0D));
- GL11.glPopMatrix();
- }
-
- this.target = null;
- if (mc.player.inventory.getCurrentItem() != null) {
- if (mc.player.inventory.getCurrentItem().getItem() instanceof ItemBow &&
- mc.gameSettings.keyBindUseItem.isKeyDown()) {
- this.target = PepsiUtils.getClosestEntityWithoutReachFactor();
- this.aimAtTarget();
- return;
- }
- }
- this.velocity = -1.0F;
- }
-
- private void aimAtTarget() {
- if (this.target == null) {
- return;
- }
- this.velocity = ((72000 - mc.player.getItemInUseCount()) / 20.0F);
- this.velocity = ((this.velocity * this.velocity + this.velocity * 2.0F) / 3.0F);
- if (this.velocity > 1.0F) {
- this.velocity = 1.0F;
- }
- if (this.velocity < 0.1D) {
- if ((this.target instanceof EntityLivingBase)) {
- RotationUtils.faceEntityClient(this.target);
- RotationUtils.faceEntityPacket(this.target);
- }
- return;
- }
- if (this.velocity > 1.0F) {
- this.velocity = 1.0F;
- }
- double posX = this.target.posX - mc.player.posX;
- double posY = this.target.posY + this.target.getEyeHeight() - 0.15D -
- mc.player.posY -
- mc.player.getEyeHeight();
- double posZ = this.target.posZ - mc.player.posZ;
-
- float yaw = (float) (Math.atan2(posZ, posX) * 180.0D / 3.141592653589793D) - 90.0F;
- double y2 = Math.sqrt(posX * posX + posZ * posZ);
- float g = 0.006F;
- float tmp = (float) (this.velocity * this.velocity * this.velocity * this.velocity -
- g * (g * (y2 * y2) + 2.0D * posY * (this.velocity * this.velocity)));
- float pitch = (float) -Math.toDegrees(
- Math.atan((this.velocity * this.velocity - Math.sqrt(tmp)) / (g * y2)));
- mc.player.rotationYaw = yaw;
- mc.player.rotationPitch = pitch;
- }
-
- @Override
- public void init() {
- INSTANCE = this;
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[0];
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.COMBAT;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/combat/CriticalsMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/combat/CriticalsMod.java
deleted file mode 100644
index 217dcd1..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/combat/CriticalsMod.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.combat;
-
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-import net.daporkchop.pepsimod.module.api.OptionCompletions;
-import net.daporkchop.pepsimod.util.config.impl.CriticalsTranslator;
-import net.minecraft.client.Minecraft;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.network.NetworkManager;
-import net.minecraft.network.Packet;
-import net.minecraft.network.play.client.CPacketPlayer;
-import net.minecraft.network.play.client.CPacketUseEntity;
-
-public class CriticalsMod extends Module {
- public static CriticalsMod INSTANCE;
-
- {
- INSTANCE = this;
- }
-
- public CriticalsMod() {
- super("Criticals");
- }
-
- @Override
- public void onEnable() {
- }
-
- @Override
- public void onDisable() {
- }
-
- @Override
- public void tick() {
- }
-
- @Override
- public void init() {
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[]{new ModuleOption<>(true, "packet", OptionCompletions.BOOLEAN,
- (value) -> {
- CriticalsTranslator.INSTANCE.packet = value;
- return true;
- },
- () -> {
- return CriticalsTranslator.INSTANCE.packet;
- }, "Packet")};
- }
-
- @Override
- public boolean preSendPacket(Packet> packetIn) {
- if (packetIn instanceof CPacketUseEntity) {
- if (((CPacketUseEntity) packetIn).getAction() == CPacketUseEntity.Action.ATTACK) {
- this.doCrit();
- }
- }
- return false;
- }
-
- public void doCrit() {
- EntityPlayer player = Minecraft.getMinecraft().player;
-
- if (!player.onGround) {
- return;
- }
-
- if (player.isInWater() || player.isInLava()) {
- return;
- }
-
- if ((boolean) this.getOptionByName("packet").getValue()) {
- double x = player.posX;
- double y = player.posY;
- double z = player.posZ;
- NetworkManager manager = Minecraft.getMinecraft().getConnection().getNetworkManager();
- manager.sendPacket(new CPacketPlayer.Position(x, y + 0.0625D, z, true));
- manager.sendPacket(new CPacketPlayer.Position(x, y, z, false));
- manager.sendPacket(new CPacketPlayer.Position(x, y + 1.1E-5D, z, false));
- manager.sendPacket(new CPacketPlayer.Position(x, y, z, false));
- } else {
- player.motionY = 0.1F;
- player.fallDistance = 0.1F;
- player.onGround = false;
- }
- }
-
- @Override
- public boolean hasModeInName() {
- return true;
- }
-
- @Override
- public String getModeForName() {
- if ((boolean) this.getOptionByName("packet").getValue()) {
- return "Packet";
- } else {
- return "Jump";
- }
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.COMBAT;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/combat/CrystalAuraMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/combat/CrystalAuraMod.java
deleted file mode 100644
index 322e9fa..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/combat/CrystalAuraMod.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.combat;
-
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-import net.daporkchop.pepsimod.module.api.OptionCompletions;
-import net.daporkchop.pepsimod.module.api.option.ExtensionSlider;
-import net.daporkchop.pepsimod.module.api.option.ExtensionType;
-import net.daporkchop.pepsimod.util.config.impl.CrystalAuraTranslator;
-import net.minecraft.client.entity.EntityPlayerSP;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.item.EntityEnderCrystal;
-import net.minecraft.util.EnumHand;
-
-/**
- * #totallyNotSkidded
- */
-public class CrystalAuraMod extends Module {
- public static CrystalAuraMod INSTANCE;
- private long currentMS = 0L;
- private long lastMS = -1L;
-
- {
- INSTANCE = this;
- }
-
- public CrystalAuraMod() {
- super("CrystalAura");
- }
-
- @Override
- public void onEnable() {
-
- }
-
- @Override
- public void onDisable() {
-
- }
-
- @Override
- public void tick() {
- EntityPlayerSP player = mc.player;
-
- this.currentMS = System.nanoTime() / 1000000;
- if (this.hasDelayRun((long) (1000 / CrystalAuraTranslator.INSTANCE.speed))) {
- for (Entity e : mc.world.loadedEntityList) {
- if (player.getDistance(e) < CrystalAuraTranslator.INSTANCE.range) {
- if (e instanceof EntityEnderCrystal) {
- mc.playerController.attackEntity(player, e);
- player.swingArm(EnumHand.MAIN_HAND);
- this.lastMS = System.nanoTime() / 1000000;
- break;
- }
- }
- }
- }
- }
-
- @Override
- public void init() {
- INSTANCE = this;
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[]{
- new ModuleOption<>(CrystalAuraTranslator.INSTANCE.speed, "speed", OptionCompletions.FLOAT,
- (value) -> {
- CrystalAuraTranslator.INSTANCE.speed = Math.max(value, 0);
- return true;
- },
- () -> {
- return CrystalAuraTranslator.INSTANCE.speed;
- }, "Speed", new ExtensionSlider(ExtensionType.VALUE_FLOAT, 0f, 20f, 0.5f)),
- new ModuleOption<>(CrystalAuraTranslator.INSTANCE.range, "range", OptionCompletions.FLOAT,
- (value) -> {
- CrystalAuraTranslator.INSTANCE.range = Math.max(value, 0);
- return true;
- },
- () -> {
- return CrystalAuraTranslator.INSTANCE.range;
- }, "Range", new ExtensionSlider(ExtensionType.VALUE_FLOAT, 3f, 10f, 0.05f))
- };
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.COMBAT;
- }
-
- public boolean hasDelayRun(long time) {
- return (this.currentMS - this.lastMS) >= time;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/misc/AnnouncerMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/misc/AnnouncerMod.java
deleted file mode 100644
index c570f33..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/misc/AnnouncerMod.java
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.misc;
-
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-import net.daporkchop.pepsimod.module.api.OptionCompletions;
-import net.daporkchop.pepsimod.module.api.TimeModule;
-import net.daporkchop.pepsimod.module.api.option.ExtensionSlider;
-import net.daporkchop.pepsimod.module.api.option.ExtensionType;
-import net.daporkchop.pepsimod.util.PepsiUtils;
-import net.daporkchop.pepsimod.util.config.impl.AnnouncerTranslator;
-import net.daporkchop.pepsimod.util.misc.announcer.MessagePrefixes;
-import net.daporkchop.pepsimod.util.misc.announcer.QueuedTask;
-import net.daporkchop.pepsimod.util.misc.announcer.TaskType;
-import net.daporkchop.pepsimod.util.misc.announcer.impl.TaskBasic;
-import net.daporkchop.pepsimod.util.misc.announcer.impl.TaskBlock;
-import net.daporkchop.pepsimod.util.misc.announcer.impl.TaskMove;
-import net.minecraft.block.Block;
-import net.minecraft.block.state.IBlockState;
-import net.minecraft.util.text.TextComponentString;
-import net.minecraftforge.common.MinecraftForge;
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
-import net.minecraftforge.fml.common.network.FMLNetworkEvent;
-
-import java.util.Iterator;
-import java.util.Queue;
-import java.util.concurrent.ConcurrentLinkedQueue;
-
-public class AnnouncerMod extends TimeModule {
- public static AnnouncerMod INSTANCE;
- public Queue toSend = new ConcurrentLinkedQueue<>();
-
- {
- INSTANCE = this;
- }
-
- public AnnouncerMod() {
- super("Announcer");
- }
-
- @Override
- public void onEnable() {
- }
-
- @Override
- public void onDisable() {
- }
-
- @Override
- public void tick() {
- if (mc.world != null && mc.world.isRemote) {
- this.updateMS();
- if (this.hasTimePassedM(AnnouncerTranslator.INSTANCE.delay)) {
- this.updateLastMS();
- MAINLOOP:
- while (this.toSend.size() > 0) {
- QueuedTask task = this.toSend.poll();
- if (task != null) {
- String msg = task.getMessage();
- if (msg != null) {
- if (AnnouncerTranslator.INSTANCE.clientSide) {
- mc.player.sendMessage(new TextComponentString(PepsiUtils.COLOR_ESCAPE + "a" + msg));
- } else {
- mc.player.sendChatMessage(msg);
- }
- break MAINLOOP;
- } else {
- continue MAINLOOP;
- }
- }
- }
- }
-
- if (AnnouncerTranslator.INSTANCE.walk && !FreecamMod.INSTANCE.state.enabled) {
- Iterator iterator = this.toSend.iterator();
- TaskMove task = null;
- while (iterator.hasNext()) {
- QueuedTask curr = iterator.next();
- if (curr instanceof TaskMove) {
- task = (TaskMove) curr;
- }
- }
- if (task == null) {
- this.toSend.add(new TaskMove(TaskType.WALK));
- } else {
- task.update(mc.player.getPositionVector());
- }
- }
- }
- }
-
- @Override
- public void init() {
- INSTANCE = this;
- MinecraftForge.EVENT_BUS.register(this);
- this.updateLastMS();
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[]{
- new ModuleOption<>(AnnouncerTranslator.INSTANCE.clientSide, "client", OptionCompletions.BOOLEAN,
- (value) -> {
- AnnouncerTranslator.INSTANCE.clientSide = value;
- return true;
- },
- () -> {
- return AnnouncerTranslator.INSTANCE.clientSide;
- }, "Client Sided"),
- new ModuleOption<>(AnnouncerTranslator.INSTANCE.join, "join", OptionCompletions.BOOLEAN,
- (value) -> {
- AnnouncerTranslator.INSTANCE.join = value;
- return true;
- },
- () -> {
- return AnnouncerTranslator.INSTANCE.join;
- }, "Join"),
- new ModuleOption<>(AnnouncerTranslator.INSTANCE.leave, "leave", OptionCompletions.BOOLEAN,
- (value) -> {
- AnnouncerTranslator.INSTANCE.leave = value;
- return true;
- },
- () -> {
- return AnnouncerTranslator.INSTANCE.leave;
- }, "Leave"),
- new ModuleOption<>(AnnouncerTranslator.INSTANCE.eat, "eat", OptionCompletions.BOOLEAN,
- (value) -> {
- AnnouncerTranslator.INSTANCE.eat = value;
- return true;
- },
- () -> {
- return AnnouncerTranslator.INSTANCE.eat;
- }, "Food"),
- new ModuleOption<>(AnnouncerTranslator.INSTANCE.walk, "walk", OptionCompletions.BOOLEAN,
- (value) -> {
- AnnouncerTranslator.INSTANCE.walk = value;
- return true;
- },
- () -> {
- return AnnouncerTranslator.INSTANCE.walk;
- }, "Walk"),
- new ModuleOption<>(AnnouncerTranslator.INSTANCE.mine, "mine", OptionCompletions.BOOLEAN,
- (value) -> {
- AnnouncerTranslator.INSTANCE.mine = value;
- return true;
- },
- () -> {
- return AnnouncerTranslator.INSTANCE.mine;
- }, "Mined"),
- new ModuleOption<>(AnnouncerTranslator.INSTANCE.place, "place", OptionCompletions.BOOLEAN,
- (value) -> {
- AnnouncerTranslator.INSTANCE.place = value;
- return true;
- },
- () -> {
- return AnnouncerTranslator.INSTANCE.place;
- }, "Place"),
- new ModuleOption<>(AnnouncerTranslator.INSTANCE.delay, "delay", OptionCompletions.INTEGER,
- (value) -> {
- AnnouncerTranslator.INSTANCE.delay = Math.max(value, 0);
- return true;
- },
- () -> {
- return AnnouncerTranslator.INSTANCE.delay;
- }, "Delay", new ExtensionSlider(ExtensionType.VALUE_INT, 0, 10000, 500))
- };
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.MISC;
- }
-
- public void onBreakBlock(IBlockState state) {
- if (this.state.enabled && AnnouncerTranslator.INSTANCE.mine) {
- Iterator iterator = this.toSend.iterator();
- while (iterator.hasNext()) {
- QueuedTask task = iterator.next();
- if (task.type == TaskType.BREAK) {
- TaskBlock taskBlock = (TaskBlock) task;
- if (taskBlock.block == state.getBlock()) {
- taskBlock.count++;
- return;
- }
- }
- }
- this.toSend.add(new TaskBlock(TaskType.BREAK, state.getBlock()));
- this.tick();
- }
- }
-
- public void onPlaceBlock(Block block) {
- if (this.state.enabled && AnnouncerTranslator.INSTANCE.place) {
- Iterator iterator = this.toSend.iterator();
- while (iterator.hasNext()) {
- QueuedTask task = iterator.next();
- if (task.type == TaskType.PLACE) {
- TaskBlock taskBlock = (TaskBlock) task;
- if (taskBlock.block == block) {
- taskBlock.count++;
- return;
- }
- }
- }
- this.toSend.add(new TaskBlock(TaskType.PLACE, block));
- this.tick();
- }
- }
-
- public void onPlayerJoin(String name) {
- if (this.state.enabled && AnnouncerTranslator.INSTANCE.join) {
- QueuedTask task = new TaskBasic(TaskType.JOIN, MessagePrefixes.getMessage(TaskType.JOIN, name));
- if (this.hasTimePassedM(2000)) {
- this.updateLastMS();
- String msg = task.getMessage();
- if (msg != null) {
- if (AnnouncerTranslator.INSTANCE.clientSide) {
- mc.player.sendMessage(new TextComponentString(PepsiUtils.COLOR_ESCAPE + "a" + msg));
- } else {
- mc.player.sendChatMessage(msg);
- }
- }
- }
- }
- }
-
- public void onPlayerLeave(String name) {
- if (this.state.enabled && AnnouncerTranslator.INSTANCE.leave) {
- QueuedTask task = new TaskBasic(TaskType.LEAVE, MessagePrefixes.getMessage(TaskType.LEAVE, name));
- if (this.hasTimePassedM(2000)) {
- this.updateLastMS();
- String msg = task.getMessage();
- if (msg != null) {
- if (AnnouncerTranslator.INSTANCE.clientSide) {
- mc.player.sendMessage(new TextComponentString(PepsiUtils.COLOR_ESCAPE + "a" + msg));
- } else {
- mc.player.sendChatMessage(msg);
- }
- }
- }
- }
- }
-
- @SubscribeEvent
- public void onDisconnect(FMLNetworkEvent.ClientDisconnectionFromServerEvent event) {
- this.toSend.clear();
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/misc/AntiHungerMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/misc/AntiHungerMod.java
deleted file mode 100644
index 8840d67..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/misc/AntiHungerMod.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.misc;
-
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-
-public class AntiHungerMod extends Module {
- public static AntiHungerMod INSTANCE;
- public static boolean ANTI_HUNGER = false;
-
- {
- INSTANCE = this;
- }
-
- public AntiHungerMod() {
- super("AntiHunger");
- }
-
- @Override
- public void onEnable() {
- ANTI_HUNGER = true;
- }
-
- @Override
- public void onDisable() {
- ANTI_HUNGER = false;
- }
-
- @Override
- public void tick() {
-
- }
-
- @Override
- public void init() {
-
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[0];
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.MISC;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/misc/AutoFishMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/misc/AutoFishMod.java
deleted file mode 100644
index 2ccf838..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/misc/AutoFishMod.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.misc;
-
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-import net.daporkchop.pepsimod.the.wurst.pkg.name.WPlayerController;
-import net.daporkchop.pepsimod.util.ReflectionStuff;
-import net.minecraft.init.SoundEvents;
-import net.minecraft.item.ItemFishingRod;
-import net.minecraft.item.ItemStack;
-import net.minecraft.network.Packet;
-import net.minecraft.network.play.server.SPacketSoundEffect;
-
-public class AutoFishMod extends Module {
- public static AutoFishMod INSTANCE;
-
- public static boolean isBobberSplash(SPacketSoundEffect soundEffect) {
- return SoundEvents.ENTITY_BOBBER_SPLASH.equals(soundEffect.getSound());
- }
-
- public int timer;
-
- {
- INSTANCE = this;
- }
-
- public AutoFishMod() {
- super("AutoFish");
- }
-
- @Override
- public void onEnable() {
- // reset timer
- this.timer = 0;
- }
-
- @Override
- public void onDisable() {
- // reset timer
- this.timer = 0;
- }
-
- @Override
- public void tick() {
- // search fishing rod in hotbar
- int rodInHotbar = -1;
- for (int i = 0; i < 9; i++) {
- // skip non-rod items
- ItemStack stack = mc.player.inventory.getStackInSlot(i);
- if (stack.isEmpty() || !(stack.getItem() instanceof ItemFishingRod)) {
- continue;
- }
-
- rodInHotbar = i;
- break;
- }
-
- // check if any rod was found
- if (rodInHotbar != -1) {
- // select fishing rod
- if (mc.player.inventory.currentItem != rodInHotbar) {
- mc.player.inventory.currentItem = rodInHotbar;
- return;
- }
-
- // wait for timer
- if (this.timer > 0) {
- this.timer--;
- return;
- }
-
- // check bobber
- if (mc.player.fishEntity != null) {
- return;
- }
-
- // cast rod
- this.rightClick();
- return;
- }
-
- // search fishing rod in inventory
- int rodInInventory = -1;
- for (int i = 9; i < 36; i++) {
- // skip non-rod items
- ItemStack stack = mc.player.inventory.getStackInSlot(i);
- if (stack.isEmpty() || !(stack.getItem() instanceof ItemFishingRod)) {
- continue;
- }
-
- rodInInventory = i;
- break;
- }
-
- // check if completely out of rods
- if (rodInInventory == -1) {
- return;
- }
-
- // find empty hotbar slot
- int hotbarSlot = -1;
- for (int i = 0; i < 9; i++) {
- // skip non-empty slots
- if (!mc.player.inventory.getStackInSlot(i).isEmpty()) {
- continue;
- }
-
- hotbarSlot = i;
- break;
- }
-
- // check if hotbar is full
- boolean swap = false;
- if (hotbarSlot == -1) {
- hotbarSlot = mc.player.inventory.currentItem;
- swap = true;
- }
-
- // place rod in hotbar slot
- WPlayerController.windowClick_PICKUP(rodInInventory);
- WPlayerController.windowClick_PICKUP(36 + hotbarSlot);
-
- // swap old hotbar item with rod
- if (swap) {
- WPlayerController.windowClick_PICKUP(rodInInventory);
- }
- }
-
- @Override
- public void init() {
- INSTANCE = this;
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[0];
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.MISC;
- }
-
- private void rightClick() {
- // check held item
- ItemStack stack = mc.player.inventory.getCurrentItem();
- if (stack.isEmpty() || !(stack.getItem() instanceof ItemFishingRod)) {
- return;
- }
-
- // right click
- ReflectionStuff.rightClickMouse();
-
- // reset timer
- this.timer = 15;
- }
-
- @Override
- public void postRecievePacket(Packet> packetIn) {
- if (packetIn instanceof SPacketSoundEffect && isBobberSplash((SPacketSoundEffect) packetIn) && mc.player.fishEntity != null) {
- this.rightClick();
- }
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/misc/AutoToolMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/misc/AutoToolMod.java
deleted file mode 100644
index 1116145..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/misc/AutoToolMod.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.misc;
-
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-import net.daporkchop.pepsimod.module.impl.player.AutoEatMod;
-import net.daporkchop.pepsimod.util.PepsiUtils;
-import net.daporkchop.pepsimod.util.ReflectionStuff;
-import net.minecraft.network.Packet;
-import net.minecraft.network.play.client.CPacketHeldItemChange;
-import net.minecraft.network.play.client.CPacketPlayerDigging;
-import net.minecraft.world.GameType;
-
-public class AutoToolMod extends Module {
- public static AutoToolMod INSTANCE;
- public boolean digging = false;
- public int slot = -1;
-
- {
- INSTANCE = this;
- }
-
- public AutoToolMod() {
- super("AutoTool");
- }
-
- @Override
- public void onEnable() {
- }
-
- @Override
- public void onDisable() {
- }
-
- @Override
- public void tick() {
- synchronized (this) {
- if (!mc.gameSettings.keyBindAttack.isKeyDown() && this.digging) {
- this.digging = false;
- if (this.slot != -1) {
- ReflectionStuff.setCurrentPlayerItem(mc.player.inventory.currentItem = this.slot);
- mc.getConnection().sendPacket(new CPacketHeldItemChange(this.slot));
- this.slot = -1;
- }
- }
- }
- }
-
- public boolean preSendPacket(Packet> packetIn) {
- if (!this.digging && AutoEatMod.INSTANCE.doneEating && packetIn instanceof CPacketPlayerDigging) {
- synchronized (this) {
- CPacketPlayerDigging pck = (CPacketPlayerDigging) packetIn;
- if (!this.digging && mc.playerController.getCurrentGameType() != GameType.CREATIVE && pck.getAction() == CPacketPlayerDigging.Action.START_DESTROY_BLOCK) {
- this.digging = true;
- int bestIndex = PepsiUtils.getBestTool(mc.world.getBlockState(pck.getPosition()).getBlock());
- if (bestIndex != -1 && bestIndex != mc.player.inventory.currentItem) {
- if (this.slot == -1) {
- this.slot = mc.player.inventory.currentItem;
- }
- ReflectionStuff.setCurrentPlayerItem(mc.player.inventory.currentItem = bestIndex);
- mc.getConnection().sendPacket(new CPacketHeldItemChange(bestIndex));
- mc.getConnection().sendPacket(packetIn);
- return true;
- }
- }
- }
- }
- return false;
- }
-
- @Override
- public void init() {
- INSTANCE = this;
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[0];
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.MISC;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/misc/ClickGuiMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/misc/ClickGuiMod.java
deleted file mode 100644
index f70a059..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/misc/ClickGuiMod.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.misc;
-
-import net.daporkchop.pepsimod.gui.clickgui.ClickGUI;
-import net.daporkchop.pepsimod.gui.clickgui.Window;
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-import net.minecraft.client.settings.KeyBinding;
-import net.minecraftforge.fml.client.registry.ClientRegistry;
-import org.lwjgl.input.Keyboard;
-
-public class ClickGuiMod extends Module {
- public static ClickGuiMod INSTANCE;
-
- {
- INSTANCE = this;
- }
-
- public ClickGuiMod(boolean isEnabled, int key) {
- super(isEnabled, "ClickGUI", key, true);
- }
-
- @Override
- public void onEnable() {
- if (pepsimod.isInitialized) {
- for (Window window : ClickGUI.INSTANCE.windows) {
- window.openGui();
- }
-
- mc.displayGuiScreen(ClickGUI.INSTANCE);
- }
- }
-
- @Override
- public void onDisable() {
- if (mc.currentScreen instanceof ClickGUI) {
- mc.displayGuiScreen(null);
- }
- }
-
- @Override
- public void tick() {
-
- }
-
- @Override
- public void init() {
- INSTANCE = this;
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[0];
- }
-
- @Override
- public void registerKeybind(String name, int key) {
- this.keybind = new KeyBinding("\u00A7cOpen ClickGUI", Keyboard.KEY_RSHIFT, "key.categories.pepsimod");
- ClientRegistry.registerKeyBinding(this.keybind);
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.MISC;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/misc/FreecamMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/misc/FreecamMod.java
deleted file mode 100644
index 502a84e..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/misc/FreecamMod.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.misc;
-
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleLaunchState;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-import net.daporkchop.pepsimod.module.api.option.ExtensionSlider;
-import net.daporkchop.pepsimod.module.api.option.ExtensionType;
-import net.daporkchop.pepsimod.util.EntityFakePlayer;
-import net.daporkchop.pepsimod.util.config.impl.FreecamTranslator;
-import net.minecraft.network.Packet;
-import net.minecraft.network.play.client.CPacketPlayer;
-import org.lwjgl.opengl.Display;
-
-public class FreecamMod extends Module {
- public static FreecamMod INSTANCE;
-
- public static void doMove(float speed) {
- mc.player.motionX = 0.0d;
- mc.player.motionY = 0.0d;
- mc.player.motionZ = 0.0d;
-
- if (Display.isActive()) {
- if (mc.gameSettings.keyBindJump.isKeyDown()) {
- mc.player.motionY += speed;
- }
- if (mc.gameSettings.keyBindSneak.isKeyDown()) {
- mc.player.motionY -= speed;
- }
-
- float forward = 0.0f;
- if (mc.gameSettings.keyBindForward.isKeyDown()) {
- forward += speed;
- }
- if (mc.gameSettings.keyBindBack.isKeyDown()) {
- forward -= speed;
- }
-
- float strafe = 0.0f;
- if (mc.gameSettings.keyBindLeft.isKeyDown()) {
- strafe += speed;
- }
- if (mc.gameSettings.keyBindRight.isKeyDown()) {
- strafe -= speed;
- }
-
- float yaw = mc.player.rotationYaw;
- mc.player.motionX = (forward * Math.cos(Math.toRadians(yaw + 90.0F)) + strafe * Math.sin(Math.toRadians(yaw + 90.0F)));
- mc.player.motionZ = (forward * Math.sin(Math.toRadians(yaw + 90.0F)) - strafe * Math.cos(Math.toRadians(yaw + 90.0F)));
- }
- }
-
- public EntityFakePlayer fakePlayer;
-
- {
- INSTANCE = this;
- }
-
- public FreecamMod() {
- super("Freecam");
- }
-
- @Override
- public void onEnable() {
- INSTANCE = this;//adding this a bunch because it always seems to be null idk y
- if (pepsimod.hasInitializedModules) {
- this.fakePlayer = new EntityFakePlayer();
- }
- }
-
- @Override
- public void onDisable() {
- INSTANCE = this; //adding this a bunch because it always seems to be null idk y
- if (pepsimod.hasInitializedModules) {
- this.fakePlayer.resetPlayerPosition();
- this.fakePlayer.despawn();
- }
- }
-
- @Override
- public void tick() {
- doMove(FreecamTranslator.INSTANCE.speed);
- }
-
- @Override
- public void init() {
- INSTANCE = this; //adding this a bunch because it always seems to be null idk y
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[]{
- new ModuleOption<>(1.0f, "speed", new String[]{"1.0", "0.0"},
- (value) -> {
- if (value <= 0.0f) {
- clientMessage("Speed cannot be negative or 0!");
- return false;
- }
- FreecamTranslator.INSTANCE.speed = value;
- return true;
- },
- () -> {
- return FreecamTranslator.INSTANCE.speed;
- }, "Speed", new ExtensionSlider(ExtensionType.VALUE_FLOAT, 0.0f, 1.0f, 0.1f))
- };
- }
-
- @Override
- public boolean preSendPacket(Packet> packetIn) {
- return packetIn instanceof CPacketPlayer;
- }
-
- @Override
- public ModuleLaunchState getLaunchState() {
- return ModuleLaunchState.DISABLED;
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.MISC;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/misc/HUDMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/misc/HUDMod.java
deleted file mode 100644
index 1035e87..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/misc/HUDMod.java
+++ /dev/null
@@ -1,374 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.misc;
-
-import net.daporkchop.pepsimod.Pepsimod;
-import net.daporkchop.pepsimod.misc.TickRate;
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.ModuleManager;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-import net.daporkchop.pepsimod.module.api.OptionCompletions;
-import net.daporkchop.pepsimod.module.api.option.ExtensionSlider;
-import net.daporkchop.pepsimod.module.api.option.ExtensionType;
-import net.daporkchop.pepsimod.util.PepsiUtils;
-import net.daporkchop.pepsimod.util.ReflectionStuff;
-import net.daporkchop.pepsimod.util.colors.rainbow.RainbowText;
-import net.daporkchop.pepsimod.util.config.impl.GeneralTranslator;
-import net.daporkchop.pepsimod.util.config.impl.HUDTranslator;
-import net.minecraft.client.gui.GuiChat;
-import net.minecraft.client.gui.GuiIngame;
-import net.minecraft.item.ItemStack;
-
-import java.awt.Color;
-
-public class HUDMod extends Module {
- public static HUDMod INSTANCE;
- public String serverBrand = "";
-
- {
- INSTANCE = this;
- }
-
- public HUDMod(boolean isEnabled, int key) {
- super(isEnabled, "HUD", key, true);
- }
-
- @Override
- public void onEnable() {
-
- }
-
- @Override
- public void onDisable() {
-
- }
-
- @Override
- public boolean shouldTick() {
- return true;
- }
-
- @Override
- public void tick() {
- for (Module module : ModuleManager.ENABLED_MODULES) {
- module.updateName();
- }
-
- ModuleManager.sortModules(GeneralTranslator.INSTANCE.sortType);
- }
-
- @Override
- public void init() {
- INSTANCE = this;
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[]{
- new ModuleOption<>(HUDTranslator.INSTANCE.drawLogo, "draw_logo", OptionCompletions.BOOLEAN,
- (value) -> {
- HUDTranslator.INSTANCE.drawLogo = value;
- return true;
- },
- () -> {
- return HUDTranslator.INSTANCE.drawLogo;
- }, "Watermark"),
- new ModuleOption<>(HUDTranslator.INSTANCE.arrayList, "arraylist", OptionCompletions.BOOLEAN,
- (value) -> {
- HUDTranslator.INSTANCE.arrayList = value;
- return true;
- },
- () -> {
- return HUDTranslator.INSTANCE.arrayList;
- }, "ArrayList"),
- new ModuleOption<>(HUDTranslator.INSTANCE.TPS, "tps", OptionCompletions.BOOLEAN,
- (value) -> {
- HUDTranslator.INSTANCE.TPS = value;
- return true;
- },
- () -> {
- return HUDTranslator.INSTANCE.TPS;
- }, "TPS"),
- new ModuleOption<>(HUDTranslator.INSTANCE.coords, "coords", OptionCompletions.BOOLEAN,
- (value) -> {
- HUDTranslator.INSTANCE.coords = value;
- return true;
- },
- () -> {
- return HUDTranslator.INSTANCE.coords;
- }, "Coords"),
- new ModuleOption<>(HUDTranslator.INSTANCE.netherCoords, "nether_coords", OptionCompletions.BOOLEAN,
- (value) -> {
- HUDTranslator.INSTANCE.netherCoords = value;
- return true;
- },
- () -> {
- return HUDTranslator.INSTANCE.netherCoords;
- }, "NetherCoords"),
- new ModuleOption<>(HUDTranslator.INSTANCE.arrayListTop, "arraylist_top", OptionCompletions.BOOLEAN,
- (value) -> {
- HUDTranslator.INSTANCE.arrayListTop = value;
- return true;
- },
- () -> {
- return HUDTranslator.INSTANCE.arrayListTop;
- }, "ArrayListOnTop"),
- new ModuleOption<>(HUDTranslator.INSTANCE.serverBrand, "server_brand", OptionCompletions.BOOLEAN,
- (value) -> {
- HUDTranslator.INSTANCE.serverBrand = value;
- return true;
- },
- () -> {
- return HUDTranslator.INSTANCE.serverBrand;
- }, "ServerBrand"),
- new ModuleOption<>(HUDTranslator.INSTANCE.rainbow, "rainbow", OptionCompletions.BOOLEAN,
- (value) -> {
- HUDTranslator.INSTANCE.rainbow = value;
- for (Module module : ModuleManager.AVALIBLE_MODULES) {
- module.updateName();
- }
- return true;
- },
- () -> {
- return HUDTranslator.INSTANCE.rainbow;
- }, "Rainbow"),
- new ModuleOption<>(HUDTranslator.INSTANCE.direction, "direction", OptionCompletions.BOOLEAN,
- (value) -> {
- HUDTranslator.INSTANCE.direction = value;
- return true;
- },
- () -> {
- return HUDTranslator.INSTANCE.direction;
- }, "Direction"),
- new ModuleOption<>(HUDTranslator.INSTANCE.armor, "armor", OptionCompletions.BOOLEAN,
- (value) -> {
- HUDTranslator.INSTANCE.armor = value;
- return true;
- },
- () -> {
- return HUDTranslator.INSTANCE.armor;
- }, "Armor"),
- new ModuleOption<>(HUDTranslator.INSTANCE.effects, "effects", OptionCompletions.BOOLEAN,
- (value) -> {
- HUDTranslator.INSTANCE.effects = value;
- return true;
- },
- () -> {
- return HUDTranslator.INSTANCE.effects;
- }, "Effects"),
- new ModuleOption<>(HUDTranslator.INSTANCE.fps, "fps", OptionCompletions.BOOLEAN,
- (value) -> {
- HUDTranslator.INSTANCE.fps = value;
- return true;
- },
- () -> {
- return HUDTranslator.INSTANCE.fps;
- }, "FPS"),
- new ModuleOption<>(HUDTranslator.INSTANCE.ping, "ping", OptionCompletions.BOOLEAN,
- (value) -> {
- HUDTranslator.INSTANCE.ping = value;
- return true;
- },
- () -> {
- return HUDTranslator.INSTANCE.ping;
- }, "Ping"),
- new ModuleOption<>(HUDTranslator.INSTANCE.clampTabList, "clampTabList", OptionCompletions.BOOLEAN,
- (value) -> {
- HUDTranslator.INSTANCE.clampTabList = value;
- return true;
- },
- () -> {
- return HUDTranslator.INSTANCE.clampTabList;
- }, "Clamp Tab List"),
- new ModuleOption<>(HUDTranslator.INSTANCE.maxTabRows, "maxTabRows", OptionCompletions.INTEGER,
- (value) -> {
- HUDTranslator.INSTANCE.maxTabRows = value;
- return true;
- },
- () -> {
- return HUDTranslator.INSTANCE.maxTabRows;
- }, "Max Tab Rows", new ExtensionSlider(ExtensionType.VALUE_INT, 1, 80, 1)),
- /*new ModuleOption<>(HUDTranslator.INSTANCE.maxTabCols, "maxTabCols", OptionCompletions.INTEGER,
- (value) -> {
- HUDTranslator.INSTANCE.maxTabCols = value;
- return true;
- },
- () -> {
- return HUDTranslator.INSTANCE.maxTabCols;
- }, "Max Tab Cols", new ExtensionSlider(ExtensionType.VALUE_INT, 0, 15, 1)),*/
- new ModuleOption<>(HUDTranslator.INSTANCE.r, "r", new String[]{"0", "128", "255"},
- (value) -> {
- HUDTranslator.INSTANCE.r = value;
- return true;
- },
- () -> {
- return HUDTranslator.INSTANCE.r;
- }, "Red", new ExtensionSlider(ExtensionType.VALUE_INT, 0, 255, 1)),
- new ModuleOption<>(HUDTranslator.INSTANCE.g, "g", new String[]{"0", "128", "255"},
- (value) -> {
- HUDTranslator.INSTANCE.g = value;
- return true;
- },
- () -> {
- return HUDTranslator.INSTANCE.g;
- }, "Green", new ExtensionSlider(ExtensionType.VALUE_INT, 0, 255, 1)),
- new ModuleOption<>(HUDTranslator.INSTANCE.b, "b", new String[]{"0", "128", "255"},
- (value) -> {
- HUDTranslator.INSTANCE.b = value;
- return true;
- },
- () -> {
- return HUDTranslator.INSTANCE.b;
- }, "Blue", new ExtensionSlider(ExtensionType.VALUE_INT, 0, 255, 1))
- };
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.MISC;
- }
-
- public void registerKeybind(String name, int key) {
- }
-
- @Override
- public void onRenderGUI(float partialTicks, int width, int height, GuiIngame gui) {
- if (HUDTranslator.INSTANCE.drawLogo) {
- if (HUDTranslator.INSTANCE.rainbow) {
- PepsiUtils.PEPSI_NAME.drawAtPos(gui, 2, 2, 0);
- } else {
- HUDTranslator.INSTANCE.bindColor();
- mc.fontRenderer.drawString(Pepsimod.NAME_VERSION, 2, 2, HUDTranslator.INSTANCE.getColor(), true);
- }
- }
-
- if (HUDTranslator.INSTANCE.arrayList) {
- if (HUDTranslator.INSTANCE.arrayListTop) {
- for (int i = 0, j = 0; i < ModuleManager.ENABLED_MODULES.size(); i++) {
- Module module = ModuleManager.ENABLED_MODULES.get(i);
- if (module.state.hidden) {
- continue;
- }
-
- if (HUDTranslator.INSTANCE.rainbow) {
- if (module.text instanceof RainbowText) {
- ((RainbowText) module.text).drawAtPos(gui, width - 2 - module.text.width(), 2 + j * 10, ++j * 10);
- } else {
- module.text.drawAtPos(gui, width - 2 - module.text.width(), 2 + ++j * 10);
- }
- } else {
- HUDTranslator.INSTANCE.bindColor();
- mc.fontRenderer.drawString(module.text.getRawText(), width - 2 - module.text.width(), 2 + j * 10, HUDTranslator.INSTANCE.getColor());
- j++;
- }
- }
- } else {
- int j = mc.currentScreen instanceof GuiChat ? 14 : 0;
- for (int i = 0; i < ModuleManager.ENABLED_MODULES.size(); i++) {
- Module module = ModuleManager.ENABLED_MODULES.get(i);
- if (module.state.hidden) {
- continue;
- }
-
- if (HUDTranslator.INSTANCE.rainbow) {
- if (module.text instanceof RainbowText) {
- ((RainbowText) module.text).drawAtPos(gui, width - 2 - module.text.width(), height - (j += 10), j / 10 * 8);
- } else {
- module.text.drawAtPos(gui, width - 2 - module.text.width(), height - (j += 10));
- }
- } else {
- HUDTranslator.INSTANCE.bindColor();
- mc.fontRenderer.drawString(module.text.getRawText(), width - 2 - module.text.width(), height - (j += 10), HUDTranslator.INSTANCE.getColor());
- }
- }
- }
- }
-
- int i = 0;
- if (HUDTranslator.INSTANCE.arrayListTop) {
- i = mc.currentScreen instanceof GuiChat ? 14 : 0;
- if (HUDTranslator.INSTANCE.serverBrand) {
- String text = PepsiUtils.COLOR_ESCAPE + "7Server brand: " + PepsiUtils.COLOR_ESCAPE + "r" + HUDMod.INSTANCE.serverBrand;
- gui.drawString(mc.fontRenderer, text, width - (mc.fontRenderer.getStringWidth("Server brand: " + HUDMod.INSTANCE.serverBrand) + 2), height - 2 - (i += 10), Color.white.getRGB());
- }
- if (HUDTranslator.INSTANCE.ping) {
- try {
- int ping = mc.getConnection().getPlayerInfo(mc.getConnection().getGameProfile().getId()).getResponseTime();
- String text = PepsiUtils.COLOR_ESCAPE + "7Ping: " + PepsiUtils.COLOR_ESCAPE + "r" + ping;
- gui.drawString(mc.fontRenderer, text, width - (mc.fontRenderer.getStringWidth("Ping: " + ping) + 2), height - 2 - (i += 10), Color.white.getRGB());
- } catch (NullPointerException e) {
- }
- }
- if (HUDTranslator.INSTANCE.TPS) {
- String text = PepsiUtils.COLOR_ESCAPE + "7TPS: " + PepsiUtils.COLOR_ESCAPE + "r" + TickRate.TPS;
- gui.drawString(mc.fontRenderer, text, width - (mc.fontRenderer.getStringWidth("TPS: " + TickRate.TPS) + 2), height - 2 - (i += 10), Color.white.getRGB());
- }
- if (HUDTranslator.INSTANCE.fps) {
- String text = PepsiUtils.COLOR_ESCAPE + "7FPS: " + PepsiUtils.COLOR_ESCAPE + "r" + ReflectionStuff.getDebugFps();
- gui.drawString(mc.fontRenderer, text, width - (mc.fontRenderer.getStringWidth("FPS: " + ReflectionStuff.getDebugFps()) + 2), height - 2 - (i += 10), Color.white.getRGB());
- }
- } else {
- if (HUDTranslator.INSTANCE.serverBrand) {
- String text = PepsiUtils.COLOR_ESCAPE + "7Server brand: " + PepsiUtils.COLOR_ESCAPE + "r" + HUDMod.INSTANCE.serverBrand;
- gui.drawString(mc.fontRenderer, text, width - (mc.fontRenderer.getStringWidth("Server brand: " + HUDMod.INSTANCE.serverBrand) + 2), 2 + i++ * 10, Color.white.getRGB());
- }
- if (HUDTranslator.INSTANCE.ping) {
- try {
- int ping = mc.getConnection().getPlayerInfo(mc.getConnection().getGameProfile().getId()).getResponseTime();
- String text = PepsiUtils.COLOR_ESCAPE + "7Ping: " + PepsiUtils.COLOR_ESCAPE + "r" + ping;
- gui.drawString(mc.fontRenderer, text, width - (mc.fontRenderer.getStringWidth("Ping: " + ping) + 2), 2 + i++ * 10, Color.white.getRGB());
- } catch (NullPointerException e) {
- }
- }
- if (HUDTranslator.INSTANCE.TPS) {
- String text = PepsiUtils.COLOR_ESCAPE + "7TPS: " + PepsiUtils.COLOR_ESCAPE + "r" + TickRate.TPS;
- gui.drawString(mc.fontRenderer, text, width - (mc.fontRenderer.getStringWidth("TPS: " + TickRate.TPS) + 2), 2 + i++ * 10, Color.white.getRGB());
- }
- if (HUDTranslator.INSTANCE.fps) {
- String text = PepsiUtils.COLOR_ESCAPE + "7FPS: " + PepsiUtils.COLOR_ESCAPE + "r" + ReflectionStuff.getDebugFps();
- gui.drawString(mc.fontRenderer, text, width - (mc.fontRenderer.getStringWidth("FPS: " + ReflectionStuff.getDebugFps()) + 2), 2 + i++ * 10, Color.white.getRGB());
- }
- }
-
- i = mc.currentScreen instanceof GuiChat ? 14 : 0;
- if (HUDTranslator.INSTANCE.coords) {
- String toRender = PepsiUtils.COLOR_ESCAPE + "7XYZ" + PepsiUtils.COLOR_ESCAPE + "f: " + PepsiUtils.COLOR_ESCAPE + "7" + PepsiUtils.roundCoords(mc.player.posX) + "" + PepsiUtils.COLOR_ESCAPE + "f, " + PepsiUtils.COLOR_ESCAPE + "7" + PepsiUtils.roundCoords(mc.player.posY) + "" + PepsiUtils.COLOR_ESCAPE + "f, " + PepsiUtils.COLOR_ESCAPE + "7" + PepsiUtils.roundCoords(mc.player.posZ);
- if (HUDTranslator.INSTANCE.netherCoords && mc.player.dimension != 1) {
- toRender += " " + PepsiUtils.COLOR_ESCAPE + "f(" + PepsiUtils.COLOR_ESCAPE + "7" + PepsiUtils.roundCoords(PepsiUtils.getDimensionCoord(mc.player.posX)) + "" + PepsiUtils.COLOR_ESCAPE + "f, " + PepsiUtils.COLOR_ESCAPE + "7" + PepsiUtils.roundCoords(mc.player.posY) + "" + PepsiUtils.COLOR_ESCAPE + "f, " + PepsiUtils.COLOR_ESCAPE + "7" + PepsiUtils.roundCoords(PepsiUtils.getDimensionCoord(mc.player.posZ)) + "" + PepsiUtils.COLOR_ESCAPE + "f)";
- }
- mc.fontRenderer.drawString(toRender, 2, height - (i += 10), Color.white.getRGB(), true);
- }
- if (HUDTranslator.INSTANCE.direction) {
- mc.fontRenderer.drawString(PepsiUtils.COLOR_ESCAPE + "7[" + PepsiUtils.COLOR_ESCAPE + "f" + PepsiUtils.getFacing() + PepsiUtils.COLOR_ESCAPE + "7]", 2, height - (i += 10), Color.white.getRGB(), true);
- }
-
-
- if (HUDTranslator.INSTANCE.armor) {
- i = 0;
- int xPos = width / 2;
- xPos -= 90;
- for (int j = 0; j < 4; j++) {
- ItemStack stack = PepsiUtils.getWearingArmor(j);
- PepsiUtils.renderItem(xPos + 20 * i++, height - 70, partialTicks, mc.player, stack);
- }
- }
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/misc/NoFallMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/misc/NoFallMod.java
deleted file mode 100644
index 0bcf7d7..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/misc/NoFallMod.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.misc;
-
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-
-public class NoFallMod extends Module {
- public static boolean NO_FALL = false;
- public static NoFallMod INSTANCE;
-
-
- {
- INSTANCE = this;
- }
-
- public NoFallMod() {
- super("NoFall");
- }
-
- @Override
- public void onEnable() {
- NO_FALL = true;
- }
-
- @Override
- public void onDisable() {
- NO_FALL = false;
- }
-
- @Override
- public void tick() {
-
- }
-
- @Override
- public void init() {
- INSTANCE = this;
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[0];
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.MISC;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/misc/NotificationsMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/misc/NotificationsMod.java
deleted file mode 100644
index bad1edd..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/misc/NotificationsMod.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.misc;
-
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.ModuleManager;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-import net.daporkchop.pepsimod.module.api.OptionCompletions;
-import net.daporkchop.pepsimod.util.config.impl.NotificationsTranslator;
-import net.minecraft.network.Packet;
-import net.minecraft.network.play.server.SPacketChat;
-import net.minecraft.network.play.server.SPacketSpawnPlayer;
-import org.lwjgl.opengl.Display;
-
-import javax.imageio.ImageIO;
-import java.awt.AWTException;
-import java.awt.PopupMenu;
-import java.awt.SystemTray;
-import java.awt.TrayIcon;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.util.Base64;
-
-public class NotificationsMod extends Module {
- public static NotificationsMod INSTANCE;
-
- public static void sendNotification(String message, TrayIcon.MessageType type) {
- if (!Display.isActive() && ModuleManager.ENABLED_MODULES.contains(INSTANCE)) {
- INSTANCE.trayIcon.displayMessage("pepsimod", message, type);
- }
- }
- public TrayIcon trayIcon;
- public SystemTray tray;
- public PopupMenu menu;
- public boolean inQueue = false;
-
- {
- INSTANCE = this;
- }
-
- public NotificationsMod() {
- super("Notifications");
- }
-
- @Override
- public void onEnable() {
-
- }
-
- @Override
- public void onDisable() {
-
- }
-
- @Override
- public void tick() {
- if (NotificationsTranslator.INSTANCE.death && mc.player.getHealth() <= 0) {
- sendNotification("You died!", TrayIcon.MessageType.WARNING);
- }
- }
-
- @Override
- public void init() {
- try {
- INSTANCE = this;
- this.tray = SystemTray.getSystemTray();
- this.trayIcon = new TrayIcon(ImageIO.read(new ByteArrayInputStream(Base64.getDecoder()
- .decode("iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAACDVBMVEUAAAD////++fneAAD1j5z0+fz0+Pru9PgAWJH//////Pz82+D5uMH3pK/3oa34r7n7ztT+8vT////////84uX2nKjwWW3vSF/0g5L70Nb////////819zzd4f3q7X////////96Orze4v////8/f7////3p7LY5e7k7vP96ezyaXujwte60eH6zNLuQ1uTt9D5u8N9qcf5u8SAq8j6ztTvRVyYu9L96+7ybX8rc6PA1eP////4rLZwocHx9vn/7e7WuMZGha/H2uf////Z6fFuocFLiLG60eH////////l7vObvtRRjLM9f6t/q8jO3+r////////9/v7g6/K70uGjwtegwNawy93T4uz2+fsAWJHtNE3sJ0LsJkHsLkjsKkTrGjfrHDjrGjbsJD/rIj3rHTnrGzftOlL71drtL0nrGzjzfY3/+vv7/f7uPVX709j////9/v7sJUD2nqr//f76/P1yosLtNU7rHzvze4v+8vTf6vE2eqftNU/rIDzzcoP96uz3+vt9qscKXZTsKUT1g5L+7O7n7/WCrckQYpcMX5XtITzyTmP6r7j68/bs9PjL3emQts8/gawHXJQAVY/uP1bqS2Lbh5q+ucuWutJonb8+gKsaaJwEWpIAVpAAV5AFWpJqia0vd6USZZoAWJEAV5EBV5EUZJkAVo8IXJQjbqASY5gQYpgbaZwAAAAprTAwAAAAW3RSTlMAAAAAAAAAAAACKHrA4ufPlUIICWDO+f3jiRsHdu/7qRxW7PyRC8HoT13y/qqZ/ua4/Lf8lf3jWPD+pBm65UhO5/qHBWrp+Z4XBlPD9frbexUBH2mt0te9gjUElCjBbQAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAAEDSURBVBjTY2BgYOTk4ubh5eMXEBRiZAACRmERUbHomNg4cQlJKSZGBkZpGdn4hEQgSEqWk1dgZGBWVEpJTAWBtPQMZRVVBgW1zCwwPzUxOydXXYNBUysNwk/Lyy8o1NZh0NWDCCQWFZcUlJbpMxiUg01IrKisKiiorjFkMKoFCSTW1TcUFDQ2NRszmJgCtSS0tLYVFLR3dHaZMZhbpKV19/T29U+YOGnyFEsrBmubqdOmz5g5a/acufPmL7C1Y2Cxd1i4aPHcefPmL1m6zNFJiIHR2cV1+Yp585fOn7fSzd2DFeg5Ty9vn1Wr16z19fMPYAP5lzEwKDgkNCw8ItKZnSMKAAihVlWjuDlCAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE3LTA5LTA5VDE3OjE3OjAyKzAyOjAw4iAIuQAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxNy0wOS0wOVQxNzoxNzowMiswMjowMJN9sAUAAAAASUVORK5CYII="))),
- "pepsimod", this.menu = new PopupMenu());
- this.tray.add(this.trayIcon);
- } catch (IOException | AWTException e) {
- e.printStackTrace();
- ModuleManager.unRegister(this);
- }
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[]{
- new ModuleOption<>(NotificationsTranslator.INSTANCE.chat, "chat", OptionCompletions.BOOLEAN,
- (value) -> {
- NotificationsTranslator.INSTANCE.chat = value;
- return true;
- },
- () -> {
- return NotificationsTranslator.INSTANCE.chat;
- }, "Chat"),
- new ModuleOption<>(NotificationsTranslator.INSTANCE.queue, "queue", OptionCompletions.BOOLEAN,
- (value) -> {
- NotificationsTranslator.INSTANCE.queue = value;
- return true;
- },
- () -> {
- return NotificationsTranslator.INSTANCE.queue;
- }, "Queue"),
- new ModuleOption<>(NotificationsTranslator.INSTANCE.death, "death", OptionCompletions.BOOLEAN,
- (value) -> {
- NotificationsTranslator.INSTANCE.death = value;
- return true;
- },
- () -> {
- return NotificationsTranslator.INSTANCE.death;
- }, "Death"),
- new ModuleOption<>(NotificationsTranslator.INSTANCE.player, "visual_range", OptionCompletions.BOOLEAN,
- (value) -> {
- NotificationsTranslator.INSTANCE.player = value;
- return true;
- },
- () -> {
- return NotificationsTranslator.INSTANCE.player;
- }, "Visual Range")
- };
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.MISC;
- }
-
- @Override
- public boolean shouldRegister() {
- return SystemTray.isSupported();
- }
-
- @Override
- public void postRecievePacket(Packet> packet) {
- if (packet instanceof SPacketChat) {
- SPacketChat pck = (SPacketChat) packet;
- if (!pck.isSystem()) {
- String message = pck.getChatComponent().getUnformattedText().toLowerCase();
- if (NotificationsTranslator.INSTANCE.queue && message.startsWith("position in queue")) {
- this.inQueue = true;
- } else if (this.inQueue && message.startsWith("connecting to")) {
- sendNotification("Finished going through the queue!", TrayIcon.MessageType.INFO);
- this.inQueue = false;
- } else if (NotificationsTranslator.INSTANCE.chat && message.contains(mc.getSession().getUsername().toLowerCase())) {
- sendNotification("Your name was mentioned in chat!", TrayIcon.MessageType.INFO);
- }
- }
- } else if (NotificationsTranslator.INSTANCE.player && packet instanceof SPacketSpawnPlayer) {
- sendNotification(mc.getConnection().getPlayerInfo(((SPacketSpawnPlayer) packet).getUniqueId()).getGameProfile().getName() + " entered visual range!", TrayIcon.MessageType.INFO);
- }
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/misc/TimerMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/misc/TimerMod.java
deleted file mode 100644
index 2781d93..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/misc/TimerMod.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.misc;
-
-import net.daporkchop.pepsimod.misc.TickRate;
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-import net.daporkchop.pepsimod.module.api.OptionCompletions;
-import net.daporkchop.pepsimod.module.api.option.ExtensionSlider;
-import net.daporkchop.pepsimod.module.api.option.ExtensionType;
-import net.daporkchop.pepsimod.util.config.impl.TimerTranslator;
-
-public class TimerMod extends Module {
- public static TimerMod INSTANCE;
-
- {
- INSTANCE = this;
- }
-
- public TimerMod() {
- super("Timer");
- }
-
- @Override
- public void onEnable() {
- INSTANCE = this;//adding this a bunch because it always seems to be null idk y
- }
-
- @Override
- public void onDisable() {
- INSTANCE = this;//adding this a bunch because it always seems to be null idk y
- }
-
- @Override
- public void tick() {
-
- }
-
- @Override
- public void init() {
- INSTANCE = this; //adding this a bunch because it always seems to be null idk y
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[]{
- new ModuleOption<>(1.0f, "multiplier", new String[]{"1.0", "0.0"},
- (value) -> {
- if (value <= 0.0f) {
- clientMessage("Multiplier cannot be negative or 0!");
- return false;
- }
- TimerTranslator.INSTANCE.multiplier = value;
- return true;
- },
- () -> {
- return TimerTranslator.INSTANCE.multiplier;
- }, "Multiplier", new ExtensionSlider(ExtensionType.VALUE_FLOAT, 0.0f, 1.0f, 0.01f)),
- new ModuleOption<>(false, "tps_sync", OptionCompletions.BOOLEAN,
- (value) -> {
- TimerTranslator.INSTANCE.tpsSync = value;
- return true;
- },
- () -> {
- return TimerTranslator.INSTANCE.tpsSync;
- }, "TpsSync")
- };
- }
-
- @Override
- public boolean hasModeInName() {
- return true;
- }
-
- @Override
- public String getModeForName() {
- return TickRate.format.format(this.getMultiplier());
- }
-
- public float getMultiplier() {
- if (this.state.enabled) {
- if (TimerTranslator.INSTANCE.tpsSync) {
- return TickRate.TPS / 20 * TimerTranslator.INSTANCE.multiplier;
- } else {
- return TimerTranslator.INSTANCE.multiplier;
- }
- } else {
- return 1.0f;
- }
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.MISC;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/movement/AutoRespawnMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/movement/AutoRespawnMod.java
deleted file mode 100644
index f491d59..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/movement/AutoRespawnMod.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.movement;
-
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-
-public class AutoRespawnMod extends Module {
- public AutoRespawnMod INSTANCE;
-
- {
- this.INSTANCE = this;
- }
-
- public AutoRespawnMod() {
- super("AutoRespawn");
- }
-
- @Override
- public void onEnable() {
- }
-
- @Override
- public void onDisable() {
- }
-
- @Override
- public void tick() {
- if (mc.player != null && mc.player.getHealth() <= 0) {
- mc.player.respawnPlayer();
- }
- }
-
- @Override
- public void init() {
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[0];
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.MOVEMENT;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/movement/AutoWalkMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/movement/AutoWalkMod.java
deleted file mode 100644
index a08cfe9..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/movement/AutoWalkMod.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.movement;
-
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-import net.daporkchop.pepsimod.optimization.OverrideCounter;
-import net.daporkchop.pepsimod.util.ReflectionStuff;
-import org.lwjgl.input.Keyboard;
-
-import java.util.concurrent.atomic.AtomicBoolean;
-
-public class AutoWalkMod extends Module {
- public static AutoWalkMod INSTANCE;
-
- {
- INSTANCE = this;
- }
-
- protected final AtomicBoolean incremented = new AtomicBoolean(false);
-
- public AutoWalkMod() {
- super("AutoWalk");
- }
-
- @Override
- public void onEnable() {
- if (!this.incremented.getAndSet(true)) {
- ((OverrideCounter) mc.gameSettings.keyBindForward).incrementOverride();
- }
- }
-
- @Override
- public void onDisable() {
- if (this.incremented.getAndSet(false)) {
- ((OverrideCounter) mc.gameSettings.keyBindForward).decrementOverride();
- }
- }
-
- @Override
- public void tick() {
- }
-
- @Override
- public void init() {
- INSTANCE = this;
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[0];
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.MOVEMENT;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/movement/BoatFlyMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/movement/BoatFlyMod.java
deleted file mode 100644
index 5796c99..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/movement/BoatFlyMod.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.movement;
-
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-import net.daporkchop.pepsimod.util.ReflectionStuff;
-
-public class BoatFlyMod extends Module {
- public static BoatFlyMod INSTANCE;
-
- {
- INSTANCE = this;
- }
-
- public BoatFlyMod() {
- super("BoatFly");
- }
-
- @Override
- public void onEnable() {
-
- }
-
- @Override
- public void onDisable() {
-
- }
-
- @Override
- public void tick() {
- if (mc.player.isRiding()) {
- // fly
- mc.player.getRidingEntity().motionY = ReflectionStuff.getPressed(mc.gameSettings.keyBindJump) ? 0.3 : 0;
- }
- }
-
- @Override
- public void init() {
- INSTANCE = this;
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[0];
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.MOVEMENT;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/movement/ElytraFlyMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/movement/ElytraFlyMod.java
deleted file mode 100644
index 6c94181..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/movement/ElytraFlyMod.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.movement;
-
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.ModuleManager;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-import net.daporkchop.pepsimod.module.api.OptionCompletions;
-import net.daporkchop.pepsimod.module.api.TimeModule;
-import net.daporkchop.pepsimod.module.api.option.ExtensionSlider;
-import net.daporkchop.pepsimod.module.api.option.ExtensionType;
-import net.daporkchop.pepsimod.util.PepsiUtils;
-import net.daporkchop.pepsimod.util.ReflectionStuff;
-import net.daporkchop.pepsimod.util.config.impl.ElytraFlyTranslator;
-import net.minecraft.init.Items;
-import net.minecraft.item.ItemElytra;
-import net.minecraft.item.ItemStack;
-import net.minecraft.network.play.client.CPacketEntityAction;
-
-public class ElytraFlyMod extends TimeModule {
- public static final String[] modes = new String[]{"normal", "packet"};
-
- public static ElytraFlyMod INSTANCE;
-
- {
- INSTANCE = this;
- }
-
- public ElytraFlyMod() {
- super("Elytra+");
- }
-
- @Override
- public void onEnable() {
- if (ElytraFlyTranslator.INSTANCE.mode == ElytraFlyTranslator.ElytraFlyMode.PACKET) {
- if (mc.world == null) {
- ModuleManager.disableModule(this);
- }
- }
- }
-
- @Override
- public void onDisable() {
- }
-
- @Override
- public void tick() {
- this.updateMS();
-
- ItemStack chestplate = PepsiUtils.getWearingArmor(1);
- if (chestplate == null || chestplate.getItem() != Items.ELYTRA) {
- return;
- }
-
- if (mc.player.isElytraFlying()) {
- if (ElytraFlyTranslator.INSTANCE.stopInWater && mc.player.isInWater()) {
- mc.getConnection().sendPacket(new CPacketEntityAction(mc.player, CPacketEntityAction.Action.START_FALL_FLYING));
- return;
- }
-
- if (ElytraFlyTranslator.INSTANCE.fly && ElytraFlyTranslator.INSTANCE.mode == ElytraFlyTranslator.ElytraFlyMode.NORMAL) {
- if (ReflectionStuff.getPressed(mc.gameSettings.keyBindJump)) {
- mc.player.motionY += 0.08 * ElytraFlyTranslator.INSTANCE.speed;
- } else if (ReflectionStuff.getPressed(mc.gameSettings.keyBindSneak)) {
- mc.player.motionY -= 0.04 * ElytraFlyTranslator.INSTANCE.speed;
- }
-
- if (ReflectionStuff.getPressed(mc.gameSettings.keyBindForward)) {
- double yaw = Math.toRadians(mc.player.rotationYaw);
- mc.player.motionX -= Math.sin(yaw) * ElytraFlyTranslator.INSTANCE.speed;
- mc.player.motionZ += Math.cos(yaw) * ElytraFlyTranslator.INSTANCE.speed;
- } else if (ReflectionStuff.getPressed(mc.gameSettings.keyBindBack)) {
- double yaw = Math.toRadians(mc.player.rotationYaw);
- mc.player.motionX += Math.sin(yaw) * ElytraFlyTranslator.INSTANCE.speed;
- mc.player.motionZ -= Math.cos(yaw) * ElytraFlyTranslator.INSTANCE.speed;
- }
- }
- } else if (ElytraFlyTranslator.INSTANCE.easyStart && ElytraFlyTranslator.INSTANCE.mode != ElytraFlyTranslator.ElytraFlyMode.PACKET && ItemElytra.isUsable(chestplate) && mc.gameSettings.keyBindJump.isPressed()) {
- if (this.hasTimePassedM(1000)) {
- this.updateLastMS();
- mc.player.setJumping(false);
- mc.player.setSprinting(true);
- mc.player.jump();
- }
- mc.getConnection().sendPacket(new CPacketEntityAction(mc.player, CPacketEntityAction.Action.START_FALL_FLYING));
- }
- if (ElytraFlyTranslator.INSTANCE.fly && ElytraFlyTranslator.INSTANCE.mode == ElytraFlyTranslator.ElytraFlyMode.PACKET) {
- mc.player.motionX = mc.player.motionZ = 0;
- if (ReflectionStuff.getPressed(mc.gameSettings.keyBindForward)) {
- double yaw = Math.toRadians(mc.player.rotationYaw);
- mc.player.motionX -= Math.sin(yaw) * ElytraFlyTranslator.INSTANCE.speed;
- mc.player.motionZ += Math.cos(yaw) * ElytraFlyTranslator.INSTANCE.speed;
- } else if (ReflectionStuff.getPressed(mc.gameSettings.keyBindBack)) {
- double yaw = Math.toRadians(mc.player.rotationYaw);
- mc.player.motionX += Math.sin(yaw) * ElytraFlyTranslator.INSTANCE.speed;
- mc.player.motionZ -= Math.cos(yaw) * ElytraFlyTranslator.INSTANCE.speed;
- }
- mc.player.motionY = 0;
- mc.getConnection().sendPacket(new CPacketEntityAction(mc.player, CPacketEntityAction.Action.START_FALL_FLYING));
- mc.getConnection().sendPacket(new CPacketEntityAction(mc.player, CPacketEntityAction.Action.START_FALL_FLYING));
- }
- }
-
- @Override
- public void init() {
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[]{
- new ModuleOption<>(ElytraFlyTranslator.INSTANCE.easyStart, "easyStart", OptionCompletions.BOOLEAN,
- (value) -> {
- ElytraFlyTranslator.INSTANCE.easyStart = value;
- return true;
- },
- () -> {
- return ElytraFlyTranslator.INSTANCE.easyStart;
- }, "EasyStart"),
- new ModuleOption<>(ElytraFlyTranslator.INSTANCE.stopInWater, "stopInWater", OptionCompletions.BOOLEAN,
- (value) -> {
- ElytraFlyTranslator.INSTANCE.stopInWater = value;
- return true;
- },
- () -> {
- return ElytraFlyTranslator.INSTANCE.stopInWater;
- }, "StopInWater"),
- new ModuleOption<>(ElytraFlyTranslator.INSTANCE.fly, "fly", OptionCompletions.BOOLEAN,
- (value) -> {
- ElytraFlyTranslator.INSTANCE.fly = value;
- return true;
- },
- () -> {
- return ElytraFlyTranslator.INSTANCE.fly;
- }, "Fly"),
- new ModuleOption<>(ElytraFlyTranslator.INSTANCE.mode, "mode", modes,
- (value) -> {
- ElytraFlyTranslator.INSTANCE.mode = value;
- return true;
- },
- () -> {
- return ElytraFlyTranslator.INSTANCE.mode;
- }, "Mode", false),
- new ModuleOption<>(ElytraFlyTranslator.INSTANCE.speed, "speed", OptionCompletions.FLOAT,
- (value) -> {
- ElytraFlyTranslator.INSTANCE.speed = Math.max(value, 0);
- return true;
- },
- () -> {
- return ElytraFlyTranslator.INSTANCE.speed;
- }, "Speed", new ExtensionSlider(ExtensionType.VALUE_FLOAT, 0f, 0.5f, 0.005f))
- };
- }
-
- @Override
- public boolean hasModeInName() {
- return true;
- }
-
- @Override
- public String getModeForName() {
- return ElytraFlyTranslator.INSTANCE.mode.name();
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.MOVEMENT;
- }
-
- @Override
- public String getSuggestion(String cmd, String[] args) {
- if (args.length == 2 && args[1].equals("mode")) {
- return cmd + " " + modes[0];
- } else if (args.length == 3 && args[1].equals("mode")) {
- if (args[2].isEmpty()) {
- return cmd + modes[0];
- } else {
- for (String s : modes) {
- if (s.startsWith(args[2])) {
- return args[0] + " " + args[1] + " " + s;
- }
- }
-
- return "";
- }
- }
-
- return super.getSuggestion(cmd, args);
- }
-
- @Override
- public void execute(String cmd, String[] args) {
- if (args.length == 3 && !args[2].isEmpty() && cmd.startsWith(".elytra+ mode ")) {
- String s = args[2].toUpperCase();
- try {
- ElytraFlyTranslator.ElytraFlyMode mode = ElytraFlyTranslator.ElytraFlyMode.valueOf(s);
- if (mode == null) {
- clientMessage("Not a valid mode: " + args[2]);
- } else {
- this.getOptionByName("mode").setValue(mode);
- clientMessage("Set " + PepsiUtils.COLOR_ESCAPE + "o" + args[1] + PepsiUtils.COLOR_ESCAPE + "r to " + PepsiUtils.COLOR_ESCAPE + "o" + s);
- }
- } catch (Exception e) {
- clientMessage("Not a valid mode: " + args[2]);
- }
- return;
- }
-
- super.execute(cmd, args);
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/movement/EntitySpeedMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/movement/EntitySpeedMod.java
deleted file mode 100644
index 3b7f2b6..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/movement/EntitySpeedMod.java
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.movement;
-
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-import net.daporkchop.pepsimod.module.api.OptionCompletions;
-import net.daporkchop.pepsimod.module.api.option.ExtensionSlider;
-import net.daporkchop.pepsimod.module.api.option.ExtensionType;
-import net.daporkchop.pepsimod.util.ReflectionStuff;
-import net.daporkchop.pepsimod.util.config.impl.EntitySpeedTranslator;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.passive.EntityPig;
-import net.minecraft.network.Packet;
-import net.minecraft.network.play.client.CPacketPlayer;
-import net.minecraft.network.play.client.CPacketVehicleMove;
-import net.minecraft.network.play.server.SPacketMoveVehicle;
-import net.minecraft.util.MovementInput;
-import net.minecraft.util.math.AxisAlignedBB;
-import net.minecraft.util.math.Vec3d;
-
-import java.util.List;
-
-public class EntitySpeedMod extends Module {
- public static EntitySpeedMod INSTANCE;
-
- public static AxisAlignedBB getMergedBBs(Entity entity, AxisAlignedBB bb) {
- if (entity.world.isRemote) { //only run on client to fix stuff in single player
- for (Entity passenger : entity.getPassengers()) {
- AxisAlignedBB bb2 = passenger.getEntityBoundingBox();
- ReflectionStuff.setMaxY(bb2, passenger.getPositionEyes(0.0f).y);
- bb = bb.union(bb2);
- }
- }
- return bb;
- }
-
- {
- INSTANCE = this;
- }
-
- public float fakedStepHeight = 0.5f;
- protected int stepDelay = 0;
-
- public EntitySpeedMod() {
- super("EntitySpeed");
- }
-
- @Override
- public void onEnable() {
- }
-
- @Override
- public void onDisable() {
- this.fakedStepHeight = 0.5f;
- }
-
- @Override
- public void tick() {
- Entity ridingEntity = ReflectionStuff.getRidingEntity(mc.player);
- if (ridingEntity != null) {
- PIG_STEP:
- if (ridingEntity instanceof EntityPig) {
- if (this.stepDelay > 0) {
- this.stepDelay--;
- return;
- }
-
- EntityPig pig = (EntityPig) ridingEntity;
-
- if (mc.player.movementInput.moveForward == 0 && mc.player.movementInput.moveStrafe == 0) {
- pig.stepHeight = this.fakedStepHeight = 1.0f;
- break PIG_STEP;
- } else {
- pig.stepHeight = this.fakedStepHeight = 0.5f;
- }
-
- if (!pig.collidedHorizontally) {
- break PIG_STEP;
- }
-
- if (!pig.onGround || pig.isOnLadder() || pig.isInWater() || pig.isInLava()) {
- break PIG_STEP;
- }
-
- if (mc.player.movementInput.jump) {
- break PIG_STEP;
- }
-
- double stepHeight = -1;
- Vec3d stepDir = null;
- {
- boolean found = false;
- Vec3d[] dirs = {
- new Vec3d(1, 0, 0),
- new Vec3d(-1, 0, 0),
- new Vec3d(0, 0, 1),
- new Vec3d(0, 0, -1)
- };
- YLOOP:
- for (double d = 1.0d; d > 0.0d; d -= 0.0625d) {
- for (Vec3d dir : dirs) {
- AxisAlignedBB bb = pig.getEntityBoundingBox().offset(dir.scale(0.0625d));
- if (mc.world.getCollisionBoxes(pig, bb.offset(0, d, 0)).isEmpty()) {
- found = true;
- stepDir = dir;
- for (AxisAlignedBB box : mc.world.getCollisionBoxes(pig, bb)) {
- if (box.maxY > stepHeight) {
- stepHeight = box.maxY;
- }
- }
- break YLOOP;
- }
- }
- }
-
- if (!found) {
- break PIG_STEP;
- }
- }
-
- stepHeight -= pig.posY;
-
- if (stepHeight < 0 || stepHeight > 1) {
- break PIG_STEP;
- }
-
- double yOrig = pig.posY;
- mc.player.connection.sendPacket(new CPacketVehicleMove(pig));
- pig.posY = yOrig + 0.24d * stepHeight;
- mc.player.connection.sendPacket(new CPacketVehicleMove(pig));
- pig.posY = yOrig + 0.48d * stepHeight;
- mc.player.connection.sendPacket(new CPacketVehicleMove(pig));
- pig.posY = yOrig + 0.72d * stepHeight;
- mc.player.connection.sendPacket(new CPacketVehicleMove(pig));
- pig.posY = yOrig + 0.96d * stepHeight;
- mc.player.connection.sendPacket(new CPacketVehicleMove(pig));
- pig.posY = yOrig + stepHeight;
- mc.player.connection.sendPacket(new CPacketVehicleMove(pig));
-
- pig.setPosition(pig.posX + stepDir.x * 0.0625d, yOrig + stepHeight, pig.posZ + stepDir.z * 0.0625d);
- //System.out.println("Stepping at x=" + pig.getEntityBoundingBox().maxX);
- this.stepDelay = 5;
- return;
- }
-
- MovementInput movementInput = mc.player.movementInput;
- double forward = movementInput.moveForward;
- double strafe = movementInput.moveStrafe;
- float yaw = mc.player.rotationYaw;
- if ((forward == 0.0D) && (strafe == 0.0D)) {
- ridingEntity.motionX = 0.0D;
- ridingEntity.motionZ = 0.0D;
- } else {
- if (forward != 0.0D) {
- if (strafe > 0.0D) {
- yaw += (forward > 0.0D ? -45 : 45);
- } else if (strafe < 0.0D) {
- yaw += (forward > 0.0D ? 45 : -45);
- }
- strafe = 0.0D;
- if (forward > 0.0D) {
- forward = 1.0D;
- } else if (forward < 0.0D) {
- forward = -1.0D;
- }
- }
- ridingEntity.motionX = (forward * EntitySpeedTranslator.INSTANCE.speed * Math.cos(Math.toRadians(yaw + 90.0F)) + strafe * EntitySpeedTranslator.INSTANCE.speed * Math.sin(Math.toRadians(yaw + 90.0F)));
- ridingEntity.motionZ = (forward * EntitySpeedTranslator.INSTANCE.speed * Math.sin(Math.toRadians(yaw + 90.0F)) - strafe * EntitySpeedTranslator.INSTANCE.speed * Math.cos(Math.toRadians(yaw + 90.0F)));
- }
- }
- }
-
- @Override
- public void init() {
- INSTANCE = this;
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[]{
- new ModuleOption<>(EntitySpeedTranslator.INSTANCE.speed, "speed", OptionCompletions.FLOAT,
- (value) -> {
- EntitySpeedTranslator.INSTANCE.speed = Math.max(0, value);
- return true;
- },
- () -> {
- return EntitySpeedTranslator.INSTANCE.speed;
- }, "Speed", new ExtensionSlider(ExtensionType.VALUE_FLOAT, 0f, 4f, 0.1f)),
- new ModuleOption<>(EntitySpeedTranslator.INSTANCE.idleSpeed, "idleSpeed", OptionCompletions.FLOAT,
- (value) -> {
- EntitySpeedTranslator.INSTANCE.idleSpeed = Math.max(0, value);
- return true;
- },
- () -> {
- return EntitySpeedTranslator.INSTANCE.idleSpeed;
- }, "Idle Speed", new ExtensionSlider(ExtensionType.VALUE_FLOAT, 0f, 2f, 0.1f))
- };
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.MOVEMENT;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/movement/FlightMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/movement/FlightMod.java
deleted file mode 100644
index 1ac1fde..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/movement/FlightMod.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.movement;
-
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-import net.daporkchop.pepsimod.module.api.OptionCompletions;
-import net.daporkchop.pepsimod.module.api.option.ExtensionSlider;
-import net.daporkchop.pepsimod.module.api.option.ExtensionType;
-import net.daporkchop.pepsimod.module.impl.misc.FreecamMod;
-import net.daporkchop.pepsimod.util.config.impl.FlightTranslator;
-
-public class FlightMod extends Module {
- public static FlightMod INSTANCE;
-
- {
- INSTANCE = this;
- }
-
- public FlightMod() {
- super("Flight");
- }
-
- @Override
- public void onEnable() {
- }
-
- @Override
- public void onDisable() {
- }
-
- @Override
- public void tick() {
- FreecamMod.doMove(FlightTranslator.INSTANCE.speed);
- }
-
- @Override
- public void init() {
- INSTANCE = this;
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[]{
- new ModuleOption<>(FlightTranslator.INSTANCE.speed, "speed", OptionCompletions.FLOAT,
- (value) -> {
- FlightTranslator.INSTANCE.speed = Math.max(0, value);
- return true;
- },
- () -> {
- return FlightTranslator.INSTANCE.speed;
- }, "Speed", new ExtensionSlider(ExtensionType.VALUE_FLOAT, 0.1f, 10f, 0.1f))
- };
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.MOVEMENT;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/movement/HorseJumpPowerMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/movement/HorseJumpPowerMod.java
deleted file mode 100644
index 78ae885..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/movement/HorseJumpPowerMod.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.movement;
-
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-import net.daporkchop.pepsimod.util.ReflectionStuff;
-
-public class HorseJumpPowerMod extends Module {
- public static HorseJumpPowerMod INSTANCE;
-
- {
- INSTANCE = this;
- }
-
- public HorseJumpPowerMod() {
- super("HorseJumpPower");
- }
-
- @Override
- public void onEnable() {
-
- }
-
- @Override
- public void onDisable() {
-
- }
-
- @Override
- public void tick() {
- ReflectionStuff.setHorseJumpPower(1.0f);
- }
-
- @Override
- public void init() {
- INSTANCE = this;
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[0];
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.MOVEMENT;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/movement/InventoryMoveMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/movement/InventoryMoveMod.java
deleted file mode 100644
index d8e99bc..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/movement/InventoryMoveMod.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.movement;
-
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-
-public class InventoryMoveMod extends Module {
- public static InventoryMoveMod INSTANCE;
-
- {
- INSTANCE = this;
- }
-
- public InventoryMoveMod() {
- super("InventoryMove");
- INSTANCE = this;
- }
-
- @Override
- public void onEnable() {
-
- }
-
- @Override
- public void onDisable() {
-
- }
-
- @Override
- public void tick() {
-
- }
-
- @Override
- public void init() {
-
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[0];
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.MOVEMENT;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/movement/JesusMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/movement/JesusMod.java
deleted file mode 100644
index b6dba15..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/movement/JesusMod.java
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.movement;
-
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-import net.daporkchop.pepsimod.util.ReflectionStuff;
-import net.minecraft.block.material.Material;
-import net.minecraft.block.state.IBlockState;
-import net.minecraft.entity.Entity;
-import net.minecraft.network.Packet;
-import net.minecraft.network.play.client.CPacketPlayer;
-import net.minecraft.network.play.client.CPacketVehicleMove;
-import net.minecraft.util.math.AxisAlignedBB;
-import net.minecraft.util.math.BlockPos;
-
-public class JesusMod extends Module {
- public static JesusMod INSTANCE;
- private int tickTimer = 10;
- private int packetTimer = 0;
-
- {
- INSTANCE = this;
- }
-
- public JesusMod() {
- super("Jesus");
- }
-
- public boolean isOverLiquid() {
- if (mc.player == null) {
- return false;
- }
-
- Entity entity = mc.player.isRiding() ? mc.player.getRidingEntity() : mc.player;
-
- boolean foundLiquid = false;
- boolean foundSolid = false;
-
- // check collision boxes below player
- for (AxisAlignedBB bb : mc.world.getCollisionBoxes(entity, entity.getEntityBoundingBox().offset(0, -0.5, 0))) {
- BlockPos pos = new BlockPos(bb.getCenter());
- IBlockState state = mc.world.getBlockState(pos);
- Material material = state.getBlock().getMaterial(state);
-
- if (material == Material.WATER || material == Material.LAVA) {
- foundLiquid = true;
- } else if (material != Material.AIR) {
- foundSolid = true;
- }
- }
-
- return foundLiquid && !foundSolid;
- }
-
- public boolean shouldBeSolid() {
- if (mc.player == null) {
- return false;
- }
-
- Entity entity = mc.player.isRiding() ? mc.player.getRidingEntity() : mc.player;
-
- return this.state.enabled && entity.fallDistance <= 3 && !mc.gameSettings.keyBindSneak.isPressed() && !entity.isInWater();
- }
-
- @Override
- public void onEnable() {
-
- }
-
- @Override
- public void onDisable() {
-
- }
-
- @Override
- public void tick() {
- if (mc.player == null) {
- return;
- }
-
- Entity entity = mc.player.isRiding() ? mc.player.getRidingEntity() : mc.player;
-
- // check if sneaking
- if (mc.gameSettings.keyBindSneak.isPressed()) {
- return;
- }
-
- // move up in water
- if (entity.isInWater()) {
- entity.motionY = 0.11;
- this.tickTimer = 0;
- return;
- }
-
- // simulate jumping out of water
- if (this.tickTimer == 0) {
- entity.motionY = 0.30;
- } else if (this.tickTimer == 1) {
- entity.motionY = 0;
- }
-
- // update timer
- this.tickTimer++;
- }
-
- @Override
- public boolean preSendPacket(Packet> packet) {
- if (mc.player == null) {
- return false;
- }
-
- Entity entity = mc.player.isRiding() ? mc.player.getRidingEntity() : mc.player;
-
- RETURN:
- if (!mc.player.isRiding() && packet instanceof CPacketPlayer) {
- // check if packet contains a position
- if (!(packet instanceof CPacketPlayer.Position || packet instanceof CPacketPlayer.PositionRotation)) {
- break RETURN;
- }
-
- // check inWater
- if (entity.isInWater()) {
- break RETURN;
- }
-
- // check fall distance
- if (entity.fallDistance > 3F) {
- break RETURN;
- }
-
- if (!this.isOverLiquid()) {
- break RETURN;
- }
-
- // if not actually moving, cancel packet
- if (mc.player.movementInput == null) {
- return true;
- }
-
- // wait for timer
- this.packetTimer++;
- if (this.packetTimer < 4) {
- break RETURN;
- }
-
- CPacketPlayer pck = (CPacketPlayer) packet;
-
- // get position
- double y = pck.getY(0);
-
- // offset y
- if (entity.ticksExisted % 2 == 0) {
- y -= 0.05;
- } else {
- y += 0.05;
- }
-
- ReflectionStuff.setCPacketPlayer_y(pck, y);
- ReflectionStuff.setcPacketPlayer_onGround(pck, true);
- } else if (mc.player.isRiding() && packet instanceof CPacketVehicleMove) {
- // check inWater
- if (entity.isInWater()) {
- break RETURN;
- }
-
- // check fall distance
- if (entity.fallDistance > 3F) {
- break RETURN;
- }
-
- if (!this.isOverLiquid()) {
- break RETURN;
- }
-
- // if not actually moving, cancel packet
- if (mc.player.movementInput == null) {
- return true;
- }
-
- // wait for timer
- this.packetTimer++;
- if (this.packetTimer < 4) {
- break RETURN;
- }
-
- CPacketVehicleMove pck = (CPacketVehicleMove) packet;
-
- // get position
- double y = pck.getY();
-
- // offset y
- if (entity.ticksExisted % 2 == 0) {
- y -= 0.05;
- } else {
- y += 0.05;
- }
-
- ReflectionStuff.setcPacketVehicleMove_y(pck, y);
- }
-
- return false;
- }
-
- @Override
- public void init() {
- INSTANCE = this;
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[0];
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.MOVEMENT;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/movement/NoClipMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/movement/NoClipMod.java
deleted file mode 100644
index 0de1513..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/movement/NoClipMod.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.movement;
-
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-import net.daporkchop.pepsimod.util.ReflectionStuff;
-
-public class NoClipMod extends Module {
- public static NoClipMod INSTANCE;
-
- {
- INSTANCE = this;
- }
-
- public NoClipMod() {
- super("NoClip");
- }
-
- @Override
- public void onEnable() {
-
- }
-
- @Override
- public void onDisable() {
- if (pepsimod.isInitialized) {
- mc.player.noClip = false;
- }
- }
-
- @Override
- public void tick() {
- mc.player.noClip = true;
- mc.player.fallDistance = 0;
- mc.player.onGround = false;
-
- mc.player.capabilities.isFlying = false;
- mc.player.motionX = 0;
- mc.player.motionY = 0;
- mc.player.motionZ = 0;
-
- float speed = 0.2F;
- mc.player.jumpMovementFactor = speed;
- if (ReflectionStuff.getPressed(mc.gameSettings.keyBindJump)) {
- mc.player.motionY += speed;
- }
-
- if (ReflectionStuff.getPressed(mc.gameSettings.keyBindSneak)) {
- mc.player.motionY -= speed;
- }
- }
-
- @Override
- public void init() {
- INSTANCE = this;
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[0];
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.MOVEMENT;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/movement/NoSlowdownMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/movement/NoSlowdownMod.java
deleted file mode 100644
index ac56d5b..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/movement/NoSlowdownMod.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.movement;
-
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-import net.minecraft.init.Blocks;
-
-public class NoSlowdownMod extends Module {
- public static NoSlowdownMod INSTANCE;
-
- {
- INSTANCE = this;
- }
-
- public NoSlowdownMod() {
- super("NoSlowdown");
- }
-
- @Override
- public void onEnable() {
- this.fastIce();
- }
-
- @Override
- public void onDisable() {
- this.normalIce();
- }
-
- @Override
- public void tick() {
-
- }
-
- @Override
- public void init() {
- INSTANCE = this;
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[0];
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.MOVEMENT;
- }
-
- private void fastIce() {
- Blocks.ICE.slipperiness = 0.39F;
- Blocks.PACKED_ICE.slipperiness = 0.39F;
- }
-
- private void normalIce() {
- Blocks.ICE.slipperiness = 0.98F;
- Blocks.PACKED_ICE.slipperiness = 0.98F;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/movement/SafewalkMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/movement/SafewalkMod.java
deleted file mode 100644
index 9a9360a..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/movement/SafewalkMod.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.movement;
-
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-import net.daporkchop.pepsimod.util.event.MoveEvent;
-import net.minecraft.client.entity.EntityPlayerSP;
-import net.minecraft.client.renderer.Vector3d;
-
-public class SafewalkMod extends Module {
- public static SafewalkMod INSTANCE;
- private Vector3d vec = new Vector3d();
-
- {
- INSTANCE = this;
- }
-
- public SafewalkMod() {
- super("Safewalk");
- }
-
- @Override
- public void onEnable() {
-
- }
-
- @Override
- public void onDisable() {
-
- }
-
- @Override
- public void tick() {
-
- }
-
- @Override
- public void init() {
- INSTANCE = this;
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[0];
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.MOVEMENT;
- }
-
- @Override
- public void onPlayerMove(MoveEvent event) {
- double x = event.x;
- double y = event.y;
- double z = event.z;
-
- if (mc.player.onGround) {
- double increment;
- for (increment = 0.05D; x != 0.0D && this.isOffsetBBEmpty(x, -1.0D, 0.0D); ) {
- if (x < increment && x >= -increment) {
- x = 0.0D;
- } else if (x > 0.0D) {
- x -= increment;
- } else {
- x += increment;
- }
- }
- for (; z != 0.0D && this.isOffsetBBEmpty(0.0D, -1.0D, z); ) {
- if (z < increment && z >= -increment) {
- z = 0.0D;
- } else if (z > 0.0D) {
- z -= increment;
- } else {
- z += increment;
- }
- }
- for (; x != 0.0D && z != 0.0D && this.isOffsetBBEmpty(x, -1.0D, z); ) {
- if (x < increment && x >= -increment) {
- x = 0.0D;
- } else if (x > 0.0D) {
- x -= increment;
- } else {
- x += increment;
- }
- if (z < increment && z >= -increment) {
- z = 0.0D;
- } else if (z > 0.0D) {
- z -= increment;
- } else {
- z += increment;
- }
- }
- }
-
- event.x = x;
- event.y = y;
- event.z = z;
- }
-
- public boolean isOffsetBBEmpty(double offsetX, double offsetY, double offsetZ) {
- EntityPlayerSP playerSP = mc.player;
- this.vec.x = offsetX;
- this.vec.y = offsetY;
- this.vec.z = offsetZ;
- return mc.world.getCollisionBoxes(playerSP, playerSP.getEntityBoundingBox().offset(this.vec.x, this.vec.y, this.vec.z)).isEmpty();
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/movement/StepMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/movement/StepMod.java
deleted file mode 100644
index 6204675..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/movement/StepMod.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.movement;
-
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-import net.daporkchop.pepsimod.module.api.OptionCompletions;
-import net.daporkchop.pepsimod.module.api.option.ExtensionSlider;
-import net.daporkchop.pepsimod.module.api.option.ExtensionType;
-import net.daporkchop.pepsimod.util.config.impl.StepTranslator;
-import net.minecraft.client.entity.EntityPlayerSP;
-import net.minecraft.network.play.client.CPacketPlayer;
-import net.minecraft.util.math.AxisAlignedBB;
-
-import java.util.List;
-
-public class StepMod extends Module {
- public static StepMod INSTANCE;
-
- {
- INSTANCE = this;
- }
-
- public StepMod() {
- super("Step");
- }
-
- @Override
- public void onEnable() {
- }
-
- @Override
- public void onDisable() {
- if (pepsimod.hasInitializedModules) {
- mc.player.stepHeight = 0.5F;
- }
- }
-
- @Override
- public void tick() {
- if (StepTranslator.INSTANCE.legit) {
- EntityPlayerSP player = mc.player;
-
- player.stepHeight = 0.5f;
-
- if (!player.collidedHorizontally) {
- return;
- }
-
- if (!player.onGround || player.isOnLadder() || player.isInWater() || player.isInLava()) {
- return;
- }
-
- if (player.movementInput.moveForward == 0 && player.movementInput.moveStrafe == 0) {
- return;
- }
-
- if (player.movementInput.jump) {
- return;
- }
-
- AxisAlignedBB bb = player.getEntityBoundingBox().expand(0.0625, 0, 0.0625).expand(-0.0625, 0, -0.0625);
- boolean found = false;
- for (double d = 1.0d; d > 0.0d; d -= 1.0d / 16.0d) {
- if (mc.world.getCollisionBoxes(player, bb.offset(0, d, 0)).isEmpty()) {
- found = true;
- break;
- }
- }
-
- if (!found) {
- return;
- }
-
- double stepHeight = -1;
- List bbs = mc.world.getCollisionBoxes(player, bb);
- for (AxisAlignedBB box : bbs) {
- if (box.maxY > stepHeight) {
- stepHeight = box.maxY;
- }
- }
-
- stepHeight -= player.posY;
-
- if (stepHeight < 0 || stepHeight > 1) {
- return;
- }
-
- mc.player.connection.sendPacket(new CPacketPlayer.Position(player.posX, player.posY + 0.42 * stepHeight, player.posZ, player.onGround));
- mc.player.connection.sendPacket(new CPacketPlayer.Position(player.posX, player.posY + 0.753 * stepHeight, player.posZ, player.onGround));
- player.setPosition(player.posX, player.posY + 1 * stepHeight, player.posZ);
- } else {
- mc.player.stepHeight = StepTranslator.INSTANCE.height;
- }
- }
-
- @Override
- public void init() {
- INSTANCE = this;
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[]{
- new ModuleOption<>(StepTranslator.INSTANCE.height, "height", OptionCompletions.INTEGER,
- (value) -> {
- StepTranslator.INSTANCE.height = Math.max(0, value);
- return true;
- },
- () -> {
- return StepTranslator.INSTANCE.height;
- }, "Height", new ExtensionSlider(ExtensionType.VALUE_INT, 1, 64, 1)),
- new ModuleOption<>(StepTranslator.INSTANCE.legit, "legit", OptionCompletions.BOOLEAN,
- (value) -> {
- StepTranslator.INSTANCE.legit = value;
- return true;
- },
- () -> {
- return StepTranslator.INSTANCE.legit;
- }, "Legit")
- };
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.MOVEMENT;
- }
-
- @Override
- public boolean hasModeInName() {
- return true;
- }
-
- @Override
- public String getModeForName() {
- if (StepTranslator.INSTANCE.legit) {
- return "Legit";
- } else {
- return String.valueOf(StepTranslator.INSTANCE.height);
- }
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/movement/VelocityMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/movement/VelocityMod.java
deleted file mode 100644
index fc5a55f..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/movement/VelocityMod.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.movement;
-
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-import net.daporkchop.pepsimod.module.api.option.ExtensionSlider;
-import net.daporkchop.pepsimod.module.api.option.ExtensionType;
-import net.daporkchop.pepsimod.util.config.impl.VelocityTranslator;
-
-public class VelocityMod extends Module {
- public static VelocityMod INSTANCE;
-
- {
- INSTANCE = this;
- }
-
- public VelocityMod() {
- super("Velocity");
- }
-
- @Override
- public void onEnable() {
-
- }
-
- @Override
- public void onDisable() {
-
- }
-
- @Override
- public void tick() {
-
- }
-
- @Override
- public void init() {
-
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[]{
- new ModuleOption<>(1.0f, "strength", new String[]{"1.0", "0.0"},
- (value) -> {
- VelocityTranslator.INSTANCE.multiplier = value;
- return true;
- },
- () -> {
- return VelocityTranslator.INSTANCE.multiplier;
- }, "Strength", new ExtensionSlider(ExtensionType.VALUE_FLOAT, 0.0f, 1.0f, 0.1f))
- };
- }
-
- @Override
- public boolean hasModeInName() {
- return true;
- }
-
- @Override
- public String getModeForName() {
- return String.valueOf((float) this.getOptionByName("strength").getValue());
- }
-
- public float getVelocity() {
- if (this.state.enabled) {
- return VelocityTranslator.INSTANCE.multiplier;
- } else {
- return 1.0f;
- }
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.MOVEMENT;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/player/AntiAFKMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/player/AntiAFKMod.java
deleted file mode 100644
index 8d1f2b8..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/player/AntiAFKMod.java
+++ /dev/null
@@ -1,264 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.player;
-
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-import net.daporkchop.pepsimod.module.api.OptionCompletions;
-import net.daporkchop.pepsimod.module.api.option.ExtensionSlider;
-import net.daporkchop.pepsimod.module.api.option.ExtensionType;
-import net.daporkchop.pepsimod.optimization.OverrideCounter;
-import net.daporkchop.pepsimod.the.wurst.pkg.name.RotationUtils;
-import net.daporkchop.pepsimod.util.config.impl.AntiAFKTranslator;
-import net.minecraft.client.settings.KeyBinding;
-import net.minecraft.util.EnumHand;
-import net.minecraft.util.Tuple;
-import org.lwjgl.opengl.Display;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.ThreadLocalRandom;
-
-public class AntiAFKMod extends Module {
- public static AntiAFKMod INSTANCE;
- protected long lastRun = System.currentTimeMillis();
- protected Runnable cleaner = null;
-
- {
- INSTANCE = this;
- }
-
- public AntiAFKMod() {
- super("AntiAFK");
- }
-
- @Override
- public void onEnable() {
- this.lastRun = System.currentTimeMillis();
- }
-
- @Override
- public void onDisable() {
- this.clean();
- }
-
- @Override
- public void tick() {
- if (AntiAFKTranslator.INSTANCE.requireInactive && mc.inGameHasFocus) {
- this.lastRun = System.currentTimeMillis();
- } else if (this.isAnyKeyPressed()) {
- this.clean();
- this.lastRun = System.currentTimeMillis();
- } else if (this.lastRun + AntiAFKTranslator.INSTANCE.delay <= System.currentTimeMillis()) {
- this.clean();
- this.lastRun = System.currentTimeMillis();
- List> functions = new ArrayList<>();
-
- if (AntiAFKTranslator.INSTANCE.spin) {
- functions.add(new Tuple<>(
- () -> RotationUtils.faceVectorClient(mc.player.getPositionVector().add(
- ThreadLocalRandom.current().nextDouble(-5.0d, 5.0d),
- ThreadLocalRandom.current().nextDouble(-5.0d, 5.0d),
- ThreadLocalRandom.current().nextDouble(-5.0d, 5.0d)
- )),
- () -> {
- }
- ));
- }
- if (AntiAFKTranslator.INSTANCE.sneak) {
- functions.add(new Tuple<>(
- () -> ((OverrideCounter) mc.gameSettings.keyBindSneak).incrementOverride(),
- () -> ((OverrideCounter) mc.gameSettings.keyBindSneak).decrementOverride()
- ));
- }
- if (AntiAFKTranslator.INSTANCE.swingArm) {
- functions.add(new Tuple<>(
- () -> mc.player.swingArm(EnumHand.MAIN_HAND),
- () -> {
- }
- ));
- }
- if (AntiAFKTranslator.INSTANCE.strafe) {
- int flag = ThreadLocalRandom.current().nextInt(2);
- functions.add(new Tuple<>(
- () -> {
- switch (flag) {
- case 0:
- ((OverrideCounter) mc.gameSettings.keyBindLeft).incrementOverride();
- break;
- case 1:
- ((OverrideCounter) mc.gameSettings.keyBindRight).incrementOverride();
- break;
- }
- },
- () -> {
- switch (flag) {
- case 0:
- ((OverrideCounter) mc.gameSettings.keyBindLeft).decrementOverride();
- break;
- case 1:
- ((OverrideCounter) mc.gameSettings.keyBindRight).decrementOverride();
- break;
- }
- }
- ));
- } else if (AntiAFKTranslator.INSTANCE.move) {
- int flag = ThreadLocalRandom.current().nextInt(4);
- functions.add(new Tuple<>(
- () -> {
- switch (flag) {
- case 0:
- ((OverrideCounter) mc.gameSettings.keyBindForward).incrementOverride();
- break;
- case 1:
- ((OverrideCounter) mc.gameSettings.keyBindBack).incrementOverride();
- break;
- case 2:
- ((OverrideCounter) mc.gameSettings.keyBindLeft).incrementOverride();
- break;
- case 3:
- ((OverrideCounter) mc.gameSettings.keyBindRight).incrementOverride();
- break;
- }
- },
- () -> {
- switch (flag) {
- case 0:
- ((OverrideCounter) mc.gameSettings.keyBindForward).decrementOverride();
- break;
- case 1:
- ((OverrideCounter) mc.gameSettings.keyBindBack).decrementOverride();
- break;
- case 2:
- ((OverrideCounter) mc.gameSettings.keyBindLeft).decrementOverride();
- break;
- case 3:
- ((OverrideCounter) mc.gameSettings.keyBindRight).decrementOverride();
- break;
- }
- }
- ));
- }
-
- if (!functions.isEmpty()) {
- Tuple tuple = functions.get(ThreadLocalRandom.current().nextInt(functions.size()));
- tuple.getFirst().run();
- this.cleaner = tuple.getSecond();
- }
- }
- }
-
- protected void clean() {
- if (this.cleaner != null) {
- this.cleaner.run();
- this.cleaner = null;
- }
- }
-
- protected boolean isAnyKeyPressed() {
- if (!Display.isActive()) {
- return false;
- }
- for (KeyBinding keyBind : mc.gameSettings.keyBindings) {
- if (keyBind.isKeyDown()) {
- return true;
- }
- }
- return false;
- }
-
- @Override
- public void init() {
- INSTANCE = this;
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[]{
- new ModuleOption<>(AntiAFKTranslator.INSTANCE.delay, "delay", new String[]{"1000", "2000", "3000", "4000", "5000"},
- val -> {
- AntiAFKTranslator.INSTANCE.delay = val;
- return true;
- },
- () -> AntiAFKTranslator.INSTANCE.delay,
- "Delay", new ExtensionSlider(ExtensionType.VALUE_INT, 0, 10000, 500)
- ),
- new ModuleOption<>(AntiAFKTranslator.INSTANCE.spin, "spin", OptionCompletions.BOOLEAN,
- val -> {
- AntiAFKTranslator.INSTANCE.spin = val;
- this.clean();
- return true;
- },
- () -> AntiAFKTranslator.INSTANCE.spin,
- "Spin"
- ),
- new ModuleOption<>(AntiAFKTranslator.INSTANCE.sneak, "sneak", OptionCompletions.BOOLEAN,
- val -> {
- AntiAFKTranslator.INSTANCE.sneak = val;
- this.clean();
- return true;
- },
- () -> AntiAFKTranslator.INSTANCE.sneak,
- "Sneak"
- ),
- new ModuleOption<>(AntiAFKTranslator.INSTANCE.swingArm, "swingArm", OptionCompletions.BOOLEAN,
- val -> {
- AntiAFKTranslator.INSTANCE.swingArm = val;
- this.clean();
- return true;
- },
- () -> AntiAFKTranslator.INSTANCE.swingArm,
- "Swing arm"
- ),
- new ModuleOption<>(AntiAFKTranslator.INSTANCE.move, "move", OptionCompletions.BOOLEAN,
- val -> {
- AntiAFKTranslator.INSTANCE.move = val;
- this.clean();
- return true;
- },
- () -> AntiAFKTranslator.INSTANCE.move,
- "Move"
- ),
- new ModuleOption<>(AntiAFKTranslator.INSTANCE.strafe, "strafe", OptionCompletions.BOOLEAN,
- val -> {
- AntiAFKTranslator.INSTANCE.strafe = val;
- this.clean();
- return true;
- },
- () -> AntiAFKTranslator.INSTANCE.strafe,
- "Strafe"
- ),
- new ModuleOption<>(AntiAFKTranslator.INSTANCE.requireInactive, "requireInactive", OptionCompletions.BOOLEAN,
- val -> {
- AntiAFKTranslator.INSTANCE.requireInactive = val;
- return true;
- },
- () -> AntiAFKTranslator.INSTANCE.requireInactive,
- "Require inactive"
- )
- };
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.PLAYER;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/player/AutoEatMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/player/AutoEatMod.java
deleted file mode 100644
index fa6d557..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/player/AutoEatMod.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.player;
-
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-import net.daporkchop.pepsimod.module.api.OptionCompletions;
-import net.daporkchop.pepsimod.module.api.option.ExtensionSlider;
-import net.daporkchop.pepsimod.module.api.option.ExtensionType;
-import net.daporkchop.pepsimod.util.ReflectionStuff;
-import net.daporkchop.pepsimod.util.config.impl.AutoEatTranslator;
-import net.minecraft.block.BlockContainer;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.passive.EntityTameable;
-import net.minecraft.entity.passive.EntityVillager;
-import net.minecraft.inventory.ClickType;
-import net.minecraft.item.ItemAppleGold;
-import net.minecraft.item.ItemFood;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.FoodStats;
-
-public class AutoEatMod extends Module {
- public static AutoEatMod INSTANCE;
- public boolean doneEating = true;
-
- {
- INSTANCE = this;
- }
-
- public AutoEatMod() {
- super("AutoEat");
- }
-
- @Override
- public void onEnable() {
-
- }
-
- @Override
- public void onDisable() {
- if (mc.world != null) {
- ReflectionStuff.setPressed(mc.gameSettings.keyBindUseItem, false);
- }
- this.doneEating = true;
- }
-
- @Override
- public void tick() {
- if (!this.shouldEat()) {
- ReflectionStuff.setPressed(mc.gameSettings.keyBindUseItem, false);
- this.doneEating = true;
- return;
- }
-
- FoodStats foodStats = mc.player.getFoodStats();
- if (foodStats.getFoodLevel() <= AutoEatTranslator.INSTANCE.threshold && this.shouldEat()) {
- this.doneEating = false;
- this.eatFood();
- }
- }
-
- @Override
- public void init() {
- INSTANCE = this;
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[]{
- new ModuleOption<>(AutoEatTranslator.INSTANCE.threshold, "threshold", OptionCompletions.FLOAT,
- (value) -> {
- AutoEatTranslator.INSTANCE.threshold = Math.max(0, value);
- return true;
- },
- () -> {
- return AutoEatTranslator.INSTANCE.threshold;
- }, "Threshold", new ExtensionSlider(ExtensionType.VALUE_FLOAT, 0f, 19f, 1f))
- };
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.PLAYER;
- }
-
- private void eatFood() {
- for (int slot = 44; slot >= 9; slot--) {
- ItemStack stack = mc.player.inventoryContainer.getSlot(slot).getStack();
-
- if (stack != null) {
- if (slot >= 36 && slot <= 44) {
- if (stack.getItem() instanceof ItemFood
- && !(stack.getItem() instanceof ItemAppleGold)) {
- mc.player.inventory.currentItem = slot - 36;
- ReflectionStuff.setPressed(mc.gameSettings.keyBindUseItem, true);
- return;
- }
- } else if (stack.getItem() instanceof ItemFood
- && !(stack.getItem() instanceof ItemAppleGold)) {
- int itemSlot = slot;
- int currentSlot = mc.player.inventory.currentItem + 36;
- mc.playerController.windowClick(0, slot, 0, ClickType.PICKUP, mc.player);
- mc.playerController.windowClick(0, currentSlot, 0, ClickType.PICKUP, mc.player);
- mc.playerController.windowClick(0, slot, 0, ClickType.PICKUP, mc.player);
- return;
- }
- }
- }
- }
-
- private boolean shouldEat() {
- if (!mc.player.canEat(false)) {
- return false;
- }
-
- if (mc.currentScreen != null) {
- return false;
- }
-
- if (mc.currentScreen == null && mc.objectMouseOver != null) {
- Entity entity = mc.objectMouseOver.entityHit;
- if (entity instanceof EntityVillager || entity instanceof EntityTameable) {
- return false;
- }
-
- if (mc.objectMouseOver.getBlockPos() != null && mc.world.getBlockState(mc.objectMouseOver.getBlockPos()).getBlock() instanceof BlockContainer) {
- return false;
- }
- }
-
- return true;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/player/AutoMineMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/player/AutoMineMod.java
deleted file mode 100644
index d5faaa4..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/player/AutoMineMod.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.player;
-
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-import net.daporkchop.pepsimod.optimization.OverrideCounter;
-import net.minecraft.block.material.Material;
-import net.minecraft.block.state.IBlockState;
-import net.minecraft.util.math.RayTraceResult;
-
-import java.util.concurrent.atomic.AtomicBoolean;
-
-public class AutoMineMod extends Module {
- public static AutoMineMod INSTANCE;
- protected boolean started = false;
- protected final AtomicBoolean incremented = new AtomicBoolean(false);
-
- {
- INSTANCE = this;
- }
-
- public AutoMineMod() {
- super("AutoMine");
- }
-
- @Override
- public void onEnable() {
- }
-
- @Override
- public void onDisable() {
- if (this.incremented.getAndSet(false)) {
- ((OverrideCounter) mc.gameSettings.keyBindAttack).decrementOverride();
- }
- }
-
- @Override
- public void tick() {
- if (this.started && mc.gameSettings.keyBindUseItem.isKeyDown()) {
- this.started = false;
- }
- if (this.incremented.getAndSet(false)) {
- ((OverrideCounter) mc.gameSettings.keyBindAttack).decrementOverride();
- }
- if (mc.objectMouseOver == null || mc.objectMouseOver.typeOfHit != RayTraceResult.Type.BLOCK) {
- return;
- }
-
- if (this.started) {
- IBlockState state = mc.world.getBlockState(mc.objectMouseOver.getBlockPos());
- boolean flag = state.getBlock().getMaterial(state) != Material.AIR;
- if (flag && !this.incremented.getAndSet(true)) {
- ((OverrideCounter) mc.gameSettings.keyBindAttack).incrementOverride();
- }
- } else {
- if (mc.gameSettings.keyBindAttack.isKeyDown()) {
- this.started = true;
- }
- }
- }
-
- @Override
- public void init() {
- INSTANCE = this;
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[0];
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.PLAYER;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/player/FastPlaceMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/player/FastPlaceMod.java
deleted file mode 100644
index 4888bec..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/player/FastPlaceMod.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.player;
-
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-import net.daporkchop.pepsimod.util.ReflectionStuff;
-
-public class FastPlaceMod extends Module {
- public static FastPlaceMod INSTANCE;
-
- {
- INSTANCE = this;
- }
-
- public FastPlaceMod() {
- super("FastPlace");
- }
-
- @Override
- public void onEnable() {
-
- }
-
- @Override
- public void onDisable() {
-
- }
-
- @Override
- public void tick() {
- ReflectionStuff.setRightClickDelayTimer(0);
- }
-
- @Override
- public void init() {
- INSTANCE = this;
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[0];
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.PLAYER;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/player/ScaffoldMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/player/ScaffoldMod.java
deleted file mode 100644
index a936958..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/player/ScaffoldMod.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.player;
-
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-import net.daporkchop.pepsimod.the.wurst.pkg.name.BlockUtils;
-import net.minecraft.block.Block;
-import net.minecraft.block.BlockPistonBase;
-import net.minecraft.block.state.IBlockState;
-import net.minecraft.item.ItemBlock;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.math.BlockPos;
-
-public class ScaffoldMod extends Module {
- public static ScaffoldMod INSTANCE;
-
- {
- INSTANCE = this;
- }
-
- public ScaffoldMod() {
- super("Scaffold");
- }
-
- @Override
- public void onEnable() {
-
- }
-
- @Override
- public void onDisable() {
-
- }
-
- @Override
- public void tick() {
- BlockPos belowPlayer = new BlockPos(mc.player).down();
-
- // check if block is already placed
- IBlockState state = mc.world.getBlockState(belowPlayer);
- if (!state.getBlock().isReplaceable(mc.world, belowPlayer)) {
- return;
- }
-
- // search blocks in hotbar
- int newSlot = -1;
- for (int i = 0; i < 9; i++) {
- // filter out non-block items
- ItemStack stack = mc.player.inventory.getStackInSlot(i);
- if (stack == null || stack.isEmpty() || !(stack.getItem() instanceof ItemBlock)) {
- continue;
- }
-
- // filter out non-solid blocks
- Block block = Block.getBlockFromItem(stack.getItem());
- if (!block.getDefaultState().isFullBlock() && !(block instanceof BlockPistonBase)) {
- continue;
- }
-
- newSlot = i;
- break;
- }
-
- // check if any blocks were found
- if (newSlot == -1) {
- return;
- }
-
- // set slot
- int oldSlot = mc.player.inventory.currentItem;
- mc.player.inventory.currentItem = newSlot;
-
- // place block
- BlockUtils.placeBlockScaffold(belowPlayer);
-
- // reset slot
- mc.player.inventory.currentItem = oldSlot;
- }
-
- @Override
- public void init() {
- INSTANCE = this;
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[0];
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.PLAYER;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/player/SpeedmineMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/player/SpeedmineMod.java
deleted file mode 100644
index 7c81ed9..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/player/SpeedmineMod.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.player;
-
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-import net.daporkchop.pepsimod.module.api.OptionCompletions;
-import net.daporkchop.pepsimod.module.api.option.ExtensionSlider;
-import net.daporkchop.pepsimod.module.api.option.ExtensionType;
-import net.daporkchop.pepsimod.util.ReflectionStuff;
-import net.daporkchop.pepsimod.util.config.impl.SpeedmineTranslator;
-
-public class SpeedmineMod extends Module {
- public static SpeedmineMod INSTANCE;
-
- {
- INSTANCE = this;
- }
-
- public SpeedmineMod() {
- super("Speedmine");
- }
-
- @Override
- public void onEnable() {
-
- }
-
- @Override
- public void onDisable() {
-
- }
-
- @Override
- public void tick() {
- if (mc.world != null) {
- if (ReflectionStuff.getCurBlockDamageMP() < SpeedmineTranslator.INSTANCE.speed) {
- ReflectionStuff.setCurBlockDamageMP(SpeedmineTranslator.INSTANCE.speed);
- }
- if (ReflectionStuff.getBlockHitDelay() > 1) {
- ReflectionStuff.setBlockHitDelay(1);
- }
- }
- }
-
- @Override
- public void init() {
- INSTANCE = this;
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[]{
- new ModuleOption<>(SpeedmineTranslator.INSTANCE.speed, "speed", OptionCompletions.FLOAT,
- (value) -> {
- SpeedmineTranslator.INSTANCE.speed = Math.max(0, value);
- return true;
- },
- () -> {
- return SpeedmineTranslator.INSTANCE.speed;
- }, "Speed", new ExtensionSlider(ExtensionType.VALUE_FLOAT, 0.1f, 1f, 0.1f))
- };
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.PLAYER;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/player/SprintMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/player/SprintMod.java
deleted file mode 100644
index b3d793c..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/player/SprintMod.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.player;
-
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-
-public class SprintMod extends Module {
- public static SprintMod INSTANCE;
-
- {
- INSTANCE = this;
- }
-
- public SprintMod() {
- super("Sprint");
- }
-
- @Override
- public void onEnable() {
-
- }
-
- @Override
- public void onDisable() {
-
- }
-
- @Override
- public void tick() {
- boolean shouldSprint = mc.player.movementInput.moveForward > 0.0F && !mc.player.isSneaking();
- if (shouldSprint) {
- mc.player.setSprinting(true);
- }
- }
-
- @Override
- public void init() {
- INSTANCE = this;
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[0];
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.PLAYER;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/render/AntiBlindMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/render/AntiBlindMod.java
deleted file mode 100644
index bfcc170..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/render/AntiBlindMod.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.render;
-
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-
-public class AntiBlindMod extends Module {
- public static AntiBlindMod INSTANCE;
-
- {
- INSTANCE = this;
- }
-
- public AntiBlindMod() {
- super("AntiBlind");
- }
-
- @Override
- public void onEnable() {
-
- }
-
- @Override
- public void onDisable() {
-
- }
-
- @Override
- public void tick() {
-
- }
-
- @Override
- public void init() {
- INSTANCE = this;
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[0];
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.RENDER;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/render/AntiInvisibleMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/render/AntiInvisibleMod.java
deleted file mode 100644
index d1c1431..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/render/AntiInvisibleMod.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.render;
-
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-
-public class AntiInvisibleMod extends Module {
- public static AntiInvisibleMod INSTANCE;
-
- {
- INSTANCE = this;
- }
-
- public AntiInvisibleMod() {
- super("AntiInvisible");
- }
-
- @Override
- public void onEnable() {
-
- }
-
- @Override
- public void onDisable() {
-
- }
-
- @Override
- public void tick() {
-
- }
-
- @Override
- public void init() {
- INSTANCE = this;
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[0];
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.RENDER;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/render/AntiTotemAnimationMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/render/AntiTotemAnimationMod.java
deleted file mode 100644
index 3fbe8fc..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/render/AntiTotemAnimationMod.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.render;
-
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-
-public class AntiTotemAnimationMod extends Module {
- public static AntiTotemAnimationMod INSTANCE;
-
- {
- INSTANCE = this;
- }
-
- public AntiTotemAnimationMod() {
- super("AntiTotemAnimation");
- }
-
- @Override
- public void onEnable() {
-
- }
-
- @Override
- public void onDisable() {
-
- }
-
- @Override
- public void tick() {
-
- }
-
- @Override
- public void init() {
- INSTANCE = this;
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[0];
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.RENDER;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/render/ESPMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/render/ESPMod.java
deleted file mode 100644
index ff9f261..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/render/ESPMod.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.render;
-
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-import net.daporkchop.pepsimod.module.api.OptionCompletions;
-import net.daporkchop.pepsimod.util.RenderColor;
-import net.daporkchop.pepsimod.util.config.impl.ESPTranslator;
-import net.daporkchop.pepsimod.util.config.impl.FriendsTranslator;
-import net.daporkchop.pepsimod.util.render.WorldRenderer;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.monster.EntityGolem;
-import net.minecraft.entity.monster.EntityMob;
-import net.minecraft.entity.passive.EntityAnimal;
-import net.minecraft.entity.player.EntityPlayer;
-
-public class ESPMod extends Module {
- public static final RenderColor friendColor = new RenderColor(76, 144, 255, 255);
- public static final RenderColor monsterColor = new RenderColor(128, 0, 0, 255);
- public static final RenderColor animalColor = new RenderColor(0, 0, 204, 255);
- public static final RenderColor golemColor = new RenderColor(179, 179, 179, 255);
- public static final RenderColor playerColor = new RenderColor(255, 255, 0, 255);
-
- public static ESPMod INSTANCE;
-
- {
- INSTANCE = this;
- }
-
- public ESPMod() {
- super("ESP");
- }
-
- @Override
- public void onEnable() {
- }
-
- @Override
- public void onDisable() {
- }
-
- @Override
- public void tick() {
- }
-
- @Override
- public void init() {
- INSTANCE = this;
- }
-
- @Override
- public void renderWorld(WorldRenderer renderer) {
- if (!ESPTranslator.INSTANCE.box) {
- return;
- }
-
- for (Entity entity : mc.world.loadedEntityList) {
- if (entity == mc.player) {
- continue;
- }
- RenderColor color = this.chooseColor(entity);
- if (color != null) {
- renderer.color(color).outline(entity);
- }
- }
- }
-
- public RenderColor chooseColor(Entity entity) {
- if (!this.state.enabled) {
- return null;
- } else if (entity.isInvisible() && !ESPTranslator.INSTANCE.invisible) {
- return null;
- } else if (ESPTranslator.INSTANCE.animals && entity instanceof EntityAnimal) {
- return animalColor;
- } else if (ESPTranslator.INSTANCE.monsters && entity instanceof EntityMob) {
- return monsterColor;
- } else if (ESPTranslator.INSTANCE.players && entity instanceof EntityPlayer) {
- if (ESPTranslator.INSTANCE.friendColors && FriendsTranslator.INSTANCE.isFriend(entity)) {
- return friendColor;
- } else {
- return playerColor;
- }
- } else if (ESPTranslator.INSTANCE.golems && entity instanceof EntityGolem) {
- return golemColor;
- } else {
- return null;
- }
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[]{
- new ModuleOption<>(ESPTranslator.INSTANCE.monsters, "monsters", OptionCompletions.BOOLEAN,
- (value) -> {
- ESPTranslator.INSTANCE.monsters = value;
- return true;
- },
- () -> {
- return ESPTranslator.INSTANCE.monsters;
- }, "Monsters"),
- new ModuleOption<>(ESPTranslator.INSTANCE.animals, "animals", OptionCompletions.BOOLEAN,
- (value) -> {
- ESPTranslator.INSTANCE.animals = value;
- return true;
- },
- () -> {
- return ESPTranslator.INSTANCE.animals;
- }, "Animals"),
- new ModuleOption<>(ESPTranslator.INSTANCE.players, "players", OptionCompletions.BOOLEAN,
- (value) -> {
- ESPTranslator.INSTANCE.players = value;
- return true;
- },
- () -> {
- return ESPTranslator.INSTANCE.players;
- }, "Players"),
- new ModuleOption<>(ESPTranslator.INSTANCE.golems, "golems", OptionCompletions.BOOLEAN,
- (value) -> {
- ESPTranslator.INSTANCE.golems = value;
- return true;
- },
- () -> {
- return ESPTranslator.INSTANCE.golems;
- }, "Golems"),
- new ModuleOption<>(ESPTranslator.INSTANCE.invisible, "invisible", OptionCompletions.BOOLEAN,
- (value) -> {
- ESPTranslator.INSTANCE.invisible = value;
- return true;
- },
- () -> {
- return ESPTranslator.INSTANCE.invisible;
- }, "Invisible"),
- new ModuleOption<>(ESPTranslator.INSTANCE.friendColors, "friendColors", OptionCompletions.BOOLEAN,
- (value) -> {
- ESPTranslator.INSTANCE.friendColors = value;
- return true;
- },
- () -> {
- return ESPTranslator.INSTANCE.friendColors;
- }, "FriendColors"),
- new ModuleOption<>(ESPTranslator.INSTANCE.box, "box", OptionCompletions.BOOLEAN,
- (value) -> {
- ESPTranslator.INSTANCE.box = value;
- return true;
- },
- () -> {
- return ESPTranslator.INSTANCE.box;
- }, "Box")
- };
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.RENDER;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/render/FullbrightMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/render/FullbrightMod.java
deleted file mode 100644
index f986085..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/render/FullbrightMod.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.render;
-
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-
-public class FullbrightMod extends Module {
- public static FullbrightMod INSTANCE;
-
- public int level = 0;
-
- {
- INSTANCE = this;
- }
-
- public FullbrightMod() {
- super("Fullbright");
- }
-
- @Override
- public void onEnable() {
- }
-
- @Override
- public void onDisable() {
- }
-
- @Override
- public void tick() {
- if (this.state.enabled || XrayMod.INSTANCE.state.enabled) {
- final int max = 32;
- if (this.level < max) {
- this.level++;
- } else if (this.level > max) {
- this.level = max;
- }
- } else {
- final int min = 8;
- if (this.level > min) {
- this.level = min;
- } else if (this.level > 0) {
- this.level--;
- } else if (this.level < 0) {
- this.level = 0;
- }
- }
- }
-
- @Override
- public void init() {
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[0];
- }
-
- @Override
- public boolean shouldTick() {
- return true;
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.RENDER;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/render/HealthTagsMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/render/HealthTagsMod.java
deleted file mode 100644
index ff81b3f..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/render/HealthTagsMod.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.render;
-
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-
-public class HealthTagsMod extends Module {
- public static HealthTagsMod INSTANCE;
-
- {
- INSTANCE = this;
- }
-
- public HealthTagsMod() {
- super("HealthTags");
- }
-
- @Override
- public void onEnable() {
-
- }
-
- @Override
- public void onDisable() {
-
- }
-
- @Override
- public void tick() {
-
- }
-
- @Override
- public void init() {
- INSTANCE = this;
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[0];
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.RENDER;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/render/NameTagsMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/render/NameTagsMod.java
deleted file mode 100644
index cc1de5b..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/render/NameTagsMod.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.render;
-
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-import net.daporkchop.pepsimod.module.api.option.ExtensionSlider;
-import net.daporkchop.pepsimod.module.api.option.ExtensionType;
-import net.daporkchop.pepsimod.util.config.impl.NameTagsTranslator;
-
-public class NameTagsMod extends Module {
- public static NameTagsMod INSTANCE;
-
- {
- INSTANCE = this;
- }
-
- public NameTagsMod() {
- super("NameTags");
- }
-
- @Override
- public void onEnable() {
- }
-
- @Override
- public void onDisable() {
- }
-
- @Override
- public void tick() {
- }
-
- @Override
- public void init() {
- INSTANCE = this;
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[] {
- new ModuleOption<>(1.0f, "scale", new String[]{"0.5", "1.0", "1.5", "2.0"},
- val -> {
- NameTagsTranslator.INSTANCE.scale = val;
- return true;
- },
- () -> NameTagsTranslator.INSTANCE.scale,
- "Scale", new ExtensionSlider(ExtensionType.VALUE_FLOAT, 0.1f, 5.0f, 0.1f))
- };
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.RENDER;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/render/NoHurtCamMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/render/NoHurtCamMod.java
deleted file mode 100644
index d099a3c..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/render/NoHurtCamMod.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.render;
-
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-
-public class NoHurtCamMod extends Module {
- public static NoHurtCamMod INSTANCE;
-
- {
- INSTANCE = this;
- }
-
- public NoHurtCamMod() {
- super("NoHurtCam");
- }
-
- @Override
- public void onEnable() {
-
- }
-
- @Override
- public void onDisable() {
-
- }
-
- @Override
- public void tick() {
-
- }
-
- @Override
- public void init() {
- INSTANCE = this;
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[0];
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.RENDER;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/render/NoOverlayMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/render/NoOverlayMod.java
deleted file mode 100644
index 7854a0e..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/render/NoOverlayMod.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.render;
-
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-
-public class NoOverlayMod extends Module {
- public static NoOverlayMod INSTANCE;
-
- {
- INSTANCE = this;
- }
-
- public NoOverlayMod() {
- super("NoOverlay");
- }
-
- @Override
- public void onEnable() {
- INSTANCE = this;
- }
-
- @Override
- public void onDisable() {
- INSTANCE = this;
- }
-
- @Override
- public void tick() {
-
- }
-
- @Override
- public void init() {
- INSTANCE = this;
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[0];
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.RENDER;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/render/NoWeatherMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/render/NoWeatherMod.java
deleted file mode 100644
index fc1b04a..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/render/NoWeatherMod.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.render;
-
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-import net.daporkchop.pepsimod.module.api.OptionCompletions;
-import net.daporkchop.pepsimod.module.api.option.ExtensionSlider;
-import net.daporkchop.pepsimod.module.api.option.ExtensionType;
-import net.daporkchop.pepsimod.util.config.impl.NoWeatherTranslator;
-
-public class NoWeatherMod extends Module {
- public static NoWeatherMod INSTANCE;
-
- {
- INSTANCE = this;
- }
-
- public NoWeatherMod() {
- super("NoWeather");
- }
-
- @Override
- public void onEnable() {
-
- }
-
- @Override
- public void onDisable() {
-
- }
-
- @Override
- public void tick() {
-
- }
-
- @Override
- public void init() {
- INSTANCE = this;
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[]{
- new ModuleOption<>(false, "disableRain", OptionCompletions.BOOLEAN,
- (value) -> {
- NoWeatherTranslator.INSTANCE.disableRain = value;
- return true;
- },
- () -> {
- return NoWeatherTranslator.INSTANCE.disableRain;
- }, "Disable Rain"),
- new ModuleOption<>(false, "changeTime", OptionCompletions.BOOLEAN,
- (value) -> {
- NoWeatherTranslator.INSTANCE.changeTime = value;
- return true;
- },
- () -> {
- return NoWeatherTranslator.INSTANCE.changeTime;
- }, "Change Time"),
- new ModuleOption<>(NoWeatherTranslator.INSTANCE.time, "time", new String[]{"0", "6000", "12000", "18000", "24000"},
- (value) -> {
- if (value < 0 || value > 24000) {
- clientMessage("Time must be in range 0-24000!");
- return false;
- }
- NoWeatherTranslator.INSTANCE.time = value;
- return true;
- },
- () -> {
- return NoWeatherTranslator.INSTANCE.time;
- }, "Time", new ExtensionSlider(ExtensionType.VALUE_INT, 0, 24000, 500))
- };
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.RENDER;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/render/StorageESPMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/render/StorageESPMod.java
deleted file mode 100644
index 7312af9..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/render/StorageESPMod.java
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.render;
-
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-import net.daporkchop.pepsimod.module.api.OptionCompletions;
-import net.daporkchop.pepsimod.util.PepsiUtils;
-import net.daporkchop.pepsimod.util.ReflectionStuff;
-import net.daporkchop.pepsimod.util.RenderColor;
-import net.daporkchop.pepsimod.util.config.impl.ESPTranslator;
-import net.daporkchop.pepsimod.util.config.impl.TracersTranslator;
-import net.daporkchop.pepsimod.util.render.WorldRenderer;
-import net.minecraft.block.BlockChest;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraft.tileentity.TileEntityChest;
-import net.minecraft.tileentity.TileEntityEnderChest;
-import net.minecraft.tileentity.TileEntityFurnace;
-import net.minecraft.tileentity.TileEntityHopper;
-import net.minecraft.util.math.AxisAlignedBB;
-import net.minecraft.util.math.BlockPos;
-import net.minecraft.world.World;
-
-import java.util.ArrayList;
-
-public class StorageESPMod extends Module {
- public static final RenderColor chestColor = new RenderColor(196, 139, 53, 128);
- public static final RenderColor trappedColor = new RenderColor(81, 57, 22, 128);
- public static final RenderColor enderColor = new RenderColor(25, 35, 40, 128);
- public static final RenderColor hopperColor = new RenderColor(45, 45, 45, 128);
- public static final RenderColor furnaceColor = new RenderColor(151, 151, 151, 128);
- public static StorageESPMod INSTANCE;
-
- public static AxisAlignedBB getBoundingBox(World world, BlockPos pos) {
- return world.getBlockState(pos).getBoundingBox(world, pos);
- }
-
- public final ArrayList basic = new ArrayList<>();
- public final ArrayList trapped = new ArrayList<>();
- public final ArrayList ender = new ArrayList<>();
- public final ArrayList hopper = new ArrayList<>();
- public final ArrayList furnace = new ArrayList<>();
-
- {
- INSTANCE = this;
- }
-
- public StorageESPMod() {
- super("StorageESP");
- }
-
- @Override
- public void onEnable() {
- }
-
- @Override
- public void onDisable() {
- }
-
- @Override
- public void tick() {
- this.basic.clear();
- this.trapped.clear();
- this.ender.clear();
- this.hopper.clear();
- this.furnace.clear();
-
- for (TileEntity te : mc.world.loadedTileEntityList) {
- if ((ESPTranslator.INSTANCE.basic || ESPTranslator.INSTANCE.trapped) && te instanceof TileEntityChest) {
- TileEntityChest chestTe = (TileEntityChest) te;
-
- if (chestTe.adjacentChestXPos != null || chestTe.adjacentChestZPos != null) {
- continue;
- }
-
- AxisAlignedBB bb = PepsiUtils.offsetBB(PepsiUtils.cloneBB(getBoundingBox(mc.world, te.getPos())), te.getPos());
-
- if (chestTe.adjacentChestXNeg != null) {
- ReflectionStuff.setMinX(bb, bb.minX - 1);
- //PepsiUtils.unionBB(bb, PepsiUtils.offsetBB(PepsiUtils.cloneBB(getBoundingBox(mc.world, chestTe.adjacentChestXNeg.getPos())), chestTe.adjacentChestXNeg.getPos()));
- } else if (chestTe.adjacentChestZNeg != null) {
- ReflectionStuff.setMinZ(bb, bb.minZ - 1);
- //PepsiUtils.unionBB(bb, PepsiUtils.offsetBB(PepsiUtils.cloneBB(getBoundingBox(mc.world, chestTe.adjacentChestZNeg.getPos())), chestTe.adjacentChestZNeg.getPos()));
- }
-
- if (chestTe.getChestType() == BlockChest.Type.TRAP) {
- if (ESPTranslator.INSTANCE.trapped) {
- this.trapped.add(bb);
- }
- } else {
- if (ESPTranslator.INSTANCE.basic) {
- this.basic.add(bb);
- }
- }
- } else if (ESPTranslator.INSTANCE.ender && te instanceof TileEntityEnderChest) {
- this.ender.add(PepsiUtils.offsetBB(PepsiUtils.cloneBB(getBoundingBox(mc.world, te.getPos())), te.getPos()));
- } else if (ESPTranslator.INSTANCE.furnace && te instanceof TileEntityFurnace) {
- this.furnace.add(PepsiUtils.offsetBB(PepsiUtils.cloneBB(getBoundingBox(mc.world, te.getPos())), te.getPos()));
- } else if (ESPTranslator.INSTANCE.hopper && te instanceof TileEntityHopper) {
- this.hopper.add(PepsiUtils.offsetBB(PepsiUtils.cloneBB(getBoundingBox(mc.world, te.getPos())), te.getPos()));
- }
- }
- }
-
- @Override
- public void init() {
- INSTANCE = this;
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[]{
- new ModuleOption<>(ESPTranslator.INSTANCE.basic, "normal", OptionCompletions.BOOLEAN,
- (value) -> {
- ESPTranslator.INSTANCE.basic = value;
- return true;
- },
- () -> {
- return ESPTranslator.INSTANCE.basic;
- }, "Normal"),
- new ModuleOption<>(ESPTranslator.INSTANCE.trapped, "trapped", OptionCompletions.BOOLEAN,
- (value) -> {
- ESPTranslator.INSTANCE.trapped = value;
- return true;
- },
- () -> {
- return ESPTranslator.INSTANCE.trapped;
- }, "Trapped"),
- new ModuleOption<>(ESPTranslator.INSTANCE.ender, "ender", OptionCompletions.BOOLEAN,
- (value) -> {
- ESPTranslator.INSTANCE.ender = value;
- return true;
- },
- () -> {
- return ESPTranslator.INSTANCE.ender;
- }, "Ender"),
- new ModuleOption<>(ESPTranslator.INSTANCE.hopper, "hopper", OptionCompletions.BOOLEAN,
- (value) -> {
- ESPTranslator.INSTANCE.hopper = value;
- return true;
- },
- () -> {
- return ESPTranslator.INSTANCE.hopper;
- }, "Hopper"),
- new ModuleOption<>(ESPTranslator.INSTANCE.furnace, "furnace", OptionCompletions.BOOLEAN,
- (value) -> {
- ESPTranslator.INSTANCE.furnace = value;
- return true;
- },
- () -> {
- return ESPTranslator.INSTANCE.furnace;
- }, "Furnace")
- };
- }
-
- @Override
- public void renderWorld(WorldRenderer renderer) {
- renderer.width(TracersTranslator.INSTANCE.width);
-
- if (ESPTranslator.INSTANCE.basic) {
- renderer.color(chestColor);
- //this.basic.forEach(bb -> renderer.line(bb.minX, bb.minY, bb.minZ, bb.maxX, bb.maxY, bb.maxZ));
- this.basic.forEach(renderer::outline);
- }
-
- if (ESPTranslator.INSTANCE.trapped) {
- renderer.color(trappedColor);
- this.trapped.forEach(renderer::outline);
- }
-
- if (ESPTranslator.INSTANCE.ender) {
- renderer.color(enderColor);
- this.ender.forEach(renderer::outline);
- }
-
- if (ESPTranslator.INSTANCE.hopper) {
- renderer.color(hopperColor);
- this.hopper.forEach(renderer::outline);
- }
-
- if (ESPTranslator.INSTANCE.furnace) {
- renderer.color(furnaceColor);
- this.furnace.forEach(renderer::outline);
- }
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.RENDER;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/render/TracersMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/render/TracersMod.java
deleted file mode 100644
index fb97e8e..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/render/TracersMod.java
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.render;
-
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-import net.daporkchop.pepsimod.module.api.OptionCompletions;
-import net.daporkchop.pepsimod.module.api.option.ExtensionSlider;
-import net.daporkchop.pepsimod.module.api.option.ExtensionType;
-import net.daporkchop.pepsimod.util.EntityFakePlayer;
-import net.daporkchop.pepsimod.util.ReflectionStuff;
-import net.daporkchop.pepsimod.util.RenderColor;
-import net.daporkchop.pepsimod.util.config.impl.FriendsTranslator;
-import net.daporkchop.pepsimod.util.config.impl.TracersTranslator;
-import net.daporkchop.pepsimod.util.render.WorldRenderer;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.item.EntityItem;
-import net.minecraft.entity.monster.EntityMob;
-import net.minecraft.entity.passive.EntityAnimal;
-import net.minecraft.entity.player.EntityPlayer;
-
-public class TracersMod extends Module {
- public static final RenderColor friendColor = new RenderColor(76, 144, 255, 255);
- public static final RenderColor monsterColor = new RenderColor(128, 0, 0, 255);
- public static final RenderColor animalColor = new RenderColor(0, 0, 204, 255);
- public static final RenderColor itemColor = new RenderColor(179, 179, 179, 255);
-
- public static final RenderColor distSafe = new RenderColor(0, 255, 0, 255);
- public static final RenderColor dist20 = new RenderColor(128, 255, 0, 255);
- public static final RenderColor dist15 = new RenderColor(255, 255, 0, 255);
- public static final RenderColor dist10 = new RenderColor(255, 128, 0, 255);
- public static final RenderColor dist5 = new RenderColor(255, 0, 0, 255);
-
- public static TracersMod INSTANCE;
-
- {
- INSTANCE = this;
- }
-
- public TracersMod() {
- super("Tracers");
- }
-
- @Override
- public void onEnable() {
- }
-
- @Override
- public void onDisable() {
- }
-
- @Override
- public void tick() {
- }
-
- @Override
- public void init() {
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[]{
- new ModuleOption<>(false, "sleeping", OptionCompletions.BOOLEAN,
- (value) -> {
- TracersTranslator.INSTANCE.sleeping = value;
- return true;
- },
- () -> {
- return TracersTranslator.INSTANCE.sleeping;
- }, "Sleeping"),
- new ModuleOption<>(false, "invisible", OptionCompletions.BOOLEAN,
- (value) -> {
- TracersTranslator.INSTANCE.invisible = value;
- return true;
- },
- () -> {
- return TracersTranslator.INSTANCE.invisible;
- }, "Invisible"),
- new ModuleOption<>(true, "friendColors", OptionCompletions.BOOLEAN,
- (value) -> {
- TracersTranslator.INSTANCE.friendColors = value;
- return true;
- },
- () -> {
- return TracersTranslator.INSTANCE.friendColors;
- }, "FriendColors"),
- new ModuleOption<>(false, "animals", OptionCompletions.BOOLEAN,
- (value) -> {
- TracersTranslator.INSTANCE.animals = value;
- return true;
- },
- () -> {
- return TracersTranslator.INSTANCE.animals;
- }, "Animals"),
- new ModuleOption<>(false, "monsters", OptionCompletions.BOOLEAN,
- (value) -> {
- TracersTranslator.INSTANCE.monsters = value;
- return true;
- },
- () -> {
- return TracersTranslator.INSTANCE.monsters;
- }, "Monsters"),
- new ModuleOption<>(false, "players", OptionCompletions.BOOLEAN,
- (value) -> {
- TracersTranslator.INSTANCE.players = value;
- return true;
- },
- () -> {
- return TracersTranslator.INSTANCE.players;
- }, "Players"),
- new ModuleOption<>(false, "items", OptionCompletions.BOOLEAN,
- (value) -> {
- TracersTranslator.INSTANCE.items = value;
- return true;
- },
- () -> {
- return TracersTranslator.INSTANCE.items;
- }, "Items"),
- new ModuleOption<>(false, "everything", OptionCompletions.BOOLEAN,
- (value) -> {
- TracersTranslator.INSTANCE.everything = value;
- return true;
- },
- () -> {
- return TracersTranslator.INSTANCE.everything;
- }, "Everything"),
- new ModuleOption<>(true, "distanceColor", OptionCompletions.BOOLEAN,
- (value) -> {
- TracersTranslator.INSTANCE.distanceColor = value;
- return true;
- },
- () -> {
- return TracersTranslator.INSTANCE.distanceColor;
- }, "DistanceColor"),
- new ModuleOption<>(2.0f, "width", new String[]{"0.5", "1.0", "1.5", "2.0", "2.5"},
- val -> {
- TracersTranslator.INSTANCE.width = val;
- return true;
- },
- () -> {
- return TracersTranslator.INSTANCE.width;
- }, "Width", new ExtensionSlider(ExtensionType.VALUE_FLOAT, 0.0f, 10.0f, 0.1f))
- };
- }
-
-
- @Override
- public void renderOverlay(WorldRenderer renderer) {
- renderer.width(TracersTranslator.INSTANCE.width);
-
- RenderColor color = null;
- for (Entity entity : mc.world.getLoadedEntityList()) {
- if (Math.abs(entity.posY - mc.player.posY) > 1e6) {
- continue;
- }
-
- if (!TracersTranslator.INSTANCE.invisible && entity.isInvisible()) {
- continue;
- }
-
- if ((TracersTranslator.INSTANCE.players || TracersTranslator.INSTANCE.everything) && entity instanceof EntityPlayer) {
- if (entity == mc.player || entity instanceof EntityFakePlayer) {
- continue;
- }
-
- if (!TracersTranslator.INSTANCE.sleeping && ReflectionStuff.getSleeping((EntityPlayer) entity)) {
- continue;
- }
-
- if (TracersTranslator.INSTANCE.friendColors && FriendsTranslator.INSTANCE.isFriend(entity)) {
- color = friendColor;
- } else if (TracersTranslator.INSTANCE.distanceColor) {
- double dist = mc.player.getDistanceSq(entity);
- if (dist >= 625) {
- color = distSafe;
- } else if (dist >= 400) {
- color = dist20;
- } else if (dist >= 225) {
- color = dist15;
- } else if (dist >= 100) {
- color = dist10;
- } else {
- color = dist5;
- }
- }
- } else if ((TracersTranslator.INSTANCE.monsters || TracersTranslator.INSTANCE.everything) && entity instanceof EntityMob) {
- if (TracersTranslator.INSTANCE.distanceColor) {
- double dist = mc.player.getDistanceSq(entity);
- if (dist >= 625) {
- color = distSafe;
- } else if (dist >= 400) {
- color = dist20;
- } else if (dist >= 225) {
- color = dist15;
- } else if (dist >= 100) {
- color = dist10;
- } else {
- color = dist5;
- }
- } else {
- color = monsterColor;
- }
- } else if ((TracersTranslator.INSTANCE.animals || TracersTranslator.INSTANCE.everything) && entity instanceof EntityAnimal) {
- color = animalColor;
- } else if ((TracersTranslator.INSTANCE.items || TracersTranslator.INSTANCE.everything) && entity instanceof EntityItem) {
- color = itemColor;
- } else {
- continue;
- }
-
- renderer.color(color).lineFromEyes(entity);
- }
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.RENDER;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/render/TrajectoriesMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/render/TrajectoriesMod.java
deleted file mode 100644
index 8cb38e6..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/render/TrajectoriesMod.java
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.render;
-
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-import net.daporkchop.pepsimod.the.wurst.pkg.name.RenderUtils;
-import net.daporkchop.pepsimod.util.PepsiUtils;
-import net.daporkchop.pepsimod.util.ReflectionStuff;
-import net.daporkchop.pepsimod.util.RenderColor;
-import net.minecraft.client.entity.EntityPlayerSP;
-import net.minecraft.client.renderer.entity.RenderManager;
-import net.minecraft.item.ItemBow;
-import net.minecraft.item.ItemFishingRod;
-import net.minecraft.item.ItemPotion;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.math.AxisAlignedBB;
-import net.minecraft.util.math.RayTraceResult;
-import net.minecraft.util.math.Vec3d;
-import org.lwjgl.opengl.GL11;
-
-public class TrajectoriesMod extends Module {
- public static final RenderColor lineColor = new RenderColor(51, 196, 191, 128);
- public static TrajectoriesMod INSTANCE;
-
- {
- INSTANCE = this;
- }
-
- public TrajectoriesMod() {
- super("Trajectories");
- }
-
- @Override
- public void onEnable() {
- }
-
- @Override
- public void onDisable() {
- }
-
- @Override
- public void tick() {
- }
-
- @Override
- public void init() {
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[]{
-
- };
- }
-
- @Override
- public void onRender(float partialTicks) {
- EntityPlayerSP player = mc.player;
-
- ItemStack stack = player.inventory.getCurrentItem();
- if (stack == null) {
- return;
- }
-
- if (!PepsiUtils.isThrowable(stack)) {
- return;
- }
-
- boolean usingBow = stack.getItem() instanceof ItemBow;
-
- // calculate starting position
- double arrowPosX = player.lastTickPosX + (player.posX - player.lastTickPosX) * ReflectionStuff.getTimer().renderPartialTicks - Math.cos((float) Math.toRadians(player.rotationYaw)) * 0.16F;
- double arrowPosY = player.lastTickPosY + (player.posY - player.lastTickPosY) * ReflectionStuff.getTimer().renderPartialTicks + player.getEyeHeight() - 0.1;
- double arrowPosZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * ReflectionStuff.getTimer().renderPartialTicks - Math.sin((float) Math.toRadians(player.rotationYaw)) * 0.16F;
-
- // calculate starting motion
- float arrowMotionFactor = usingBow ? 1F : 0.4F;
- float yaw = (float) Math.toRadians(player.rotationYaw);
- float pitch = (float) Math.toRadians(player.rotationPitch);
- float arrowMotionX = (float) (-Math.sin(yaw) * Math.cos(pitch) * arrowMotionFactor);
- float arrowMotionY = (float) (-Math.sin(pitch) * arrowMotionFactor);
- float arrowMotionZ = (float) (Math.cos(yaw) * Math.cos(pitch) * arrowMotionFactor);
- double arrowMotion = Math.sqrt(arrowMotionX * arrowMotionX + arrowMotionY * arrowMotionY + arrowMotionZ * arrowMotionZ);
- arrowMotionX /= arrowMotion;
- arrowMotionY /= arrowMotion;
- arrowMotionZ /= arrowMotion;
- if (usingBow) {
- float bowPower = (72000 - player.getItemInUseCount()) / 20F;
- bowPower = (bowPower * bowPower + bowPower * 2F) / 3F;
-
- if (bowPower > 1F || bowPower <= 0.1F) {
- bowPower = 1F;
- }
-
- bowPower *= 3F;
- arrowMotionX *= bowPower;
- arrowMotionY *= bowPower;
- arrowMotionZ *= bowPower;
- } else {
- arrowMotionX *= 1.5D;
- arrowMotionY *= 1.5D;
- arrowMotionZ *= 1.5D;
- }
-
- // GL settings
- GL11.glPushMatrix();
- GL11.glDisable(GL11.GL_TEXTURE_2D);
- GL11.glEnable(GL11.GL_BLEND);
- GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
- GL11.glDisable(GL11.GL_DEPTH_TEST);
- GL11.glDepthMask(false);
- GL11.glEnable(GL11.GL_LINE_SMOOTH);
- GL11.glLineWidth(2);
-
- RenderManager renderManager = mc.getRenderManager();
-
- boolean hitEntity = false;
-
- // draw trajectory line
- double gravity = usingBow ? 0.05D : stack.getItem() instanceof ItemPotion ? 0.4D : stack.getItem() instanceof ItemFishingRod ? 0.15D : 0.03D;
- Vec3d playerVector = new Vec3d(player.posX, player.posY + player.getEyeHeight(), player.posZ);
- PepsiUtils.glColor(lineColor);
- GL11.glBegin(GL11.GL_LINE_STRIP);
- for (int i = 0; i < 1000; i++) {
- GL11.glVertex3d(arrowPosX - ReflectionStuff.getRenderPosX(renderManager), arrowPosY - ReflectionStuff.getRenderPosY(renderManager), arrowPosZ - ReflectionStuff.getRenderPosZ(renderManager));
-
- arrowPosX += arrowMotionX * 0.1;
- arrowPosY += arrowMotionY * 0.1;
- arrowPosZ += arrowMotionZ * 0.1;
- arrowMotionX *= 0.999D;
- arrowMotionY *= 0.999D;
- arrowMotionZ *= 0.999D;
- arrowMotionY -= gravity * 0.1;
-
- RayTraceResult result = mc.world.rayTraceBlocks(playerVector, new Vec3d(arrowPosX, arrowPosY, arrowPosZ));
- if (result != null) {
- break;
- } else if (!mc.world.checkNoEntityCollision(new AxisAlignedBB(
- arrowPosX - 0.25d, arrowPosY - 0.25d, arrowPosZ - 0.25d,
- arrowPosX + 0.25d, arrowPosY + 0.25d, arrowPosZ + 0.25d
- ), mc.player)) {
- hitEntity = true;
- break;
- }
- }
- GL11.glEnd();
-
- // draw end of trajectory line
- double renderX = arrowPosX - ReflectionStuff.getRenderPosX(renderManager);
- double renderY = arrowPosY - ReflectionStuff.getRenderPosY(renderManager);
- double renderZ = arrowPosZ - ReflectionStuff.getRenderPosZ(renderManager);
-
- GL11.glPushMatrix();
- GL11.glTranslated(renderX - 0.5, renderY - 0.5, renderZ - 0.5);
-
- if (hitEntity) {
- GL11.glColor4f(1F, 0F, 0F, 0.25F);
- } else {
- GL11.glColor4f(0F, 1F, 0F, 0.25F);
- }
- RenderUtils.drawSolidBox();
- if (hitEntity) {
- GL11.glColor4f(1F, 0F, 0F, 0.75F);
- } else {
- GL11.glColor4f(0F, 1F, 0F, 0.75F);
- }
- RenderUtils.drawOutlinedBox();
-
- GL11.glPopMatrix();
-
- // GL resets
- GL11.glDisable(GL11.GL_BLEND);
- GL11.glEnable(GL11.GL_TEXTURE_2D);
- GL11.glEnable(GL11.GL_DEPTH_TEST);
- GL11.glDepthMask(true);
- GL11.glDisable(GL11.GL_LINE_SMOOTH);
- GL11.glPopMatrix();
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.RENDER;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/render/UnfocusedCPUMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/render/UnfocusedCPUMod.java
deleted file mode 100644
index 4f7682f..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/render/UnfocusedCPUMod.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.render;
-
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-import net.daporkchop.pepsimod.module.api.OptionCompletions;
-import net.daporkchop.pepsimod.module.api.option.ExtensionSlider;
-import net.daporkchop.pepsimod.module.api.option.ExtensionType;
-import net.daporkchop.pepsimod.util.config.impl.CpuLimitTranslator;
-
-public class UnfocusedCPUMod extends Module {
- public static UnfocusedCPUMod INSTANCE;
-
- {
- INSTANCE = this;
- }
-
- public UnfocusedCPUMod() {
- super("UnfocusedCPU");
- INSTANCE = this;
- }
-
- @Override
- public void onEnable() {
- INSTANCE = this;
- }
-
- @Override
- public void onDisable() {
- INSTANCE = this;
- }
-
- @Override
- public void tick() {
-
- }
-
- @Override
- public void init() {
- INSTANCE = this;
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[]{
- new ModuleOption<>(CpuLimitTranslator.INSTANCE.limit, "limit", OptionCompletions.INTEGER,
- (value) -> {
- CpuLimitTranslator.INSTANCE.limit = Math.max(1, value);
- return true;
- },
- () -> {
- return CpuLimitTranslator.INSTANCE.limit;
- }, "Limit", new ExtensionSlider(ExtensionType.VALUE_INT, 1, 60, 1))
- };
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.RENDER;
- }
-
- @Override
- public boolean hasModeInName() {
- return true;
- }
-
- @Override
- public String getModeForName() {
- return String.valueOf(CpuLimitTranslator.INSTANCE.limit);
-
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/render/XrayMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/render/XrayMod.java
deleted file mode 100644
index 37934d4..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/render/XrayMod.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.render;
-
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-import net.daporkchop.pepsimod.optimization.BlockID;
-import net.daporkchop.pepsimod.util.PepsiUtils;
-import net.daporkchop.pepsimod.util.config.impl.XrayTranslator;
-import net.minecraft.block.Block;
-import net.minecraft.util.ResourceLocation;
-
-public class XrayMod extends Module {
- public static XrayMod INSTANCE;
-
- {
- INSTANCE = this;
- }
-
- public XrayMod() {
- super("Xray");
- }
-
- @Override
- public void onEnable() {
- try {
- mc.renderGlobal.loadRenderers();
- } catch (NullPointerException e) {
- //we don't care, mc isn't initialized yet
- }
- }
-
- @Override
- public void onDisable() {
- try {
- mc.renderGlobal.loadRenderers();
- } catch (NullPointerException e) {
- //we don't care, mc isn't initialized yet
- }
- }
-
- @Override
- public void tick() {
- }
-
- @Override
- public void init() {
- INSTANCE = this;
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[]{
- new ModuleOption<>(0, "add", new String[0],
- (value) -> {
- return true;
- },
- () -> {
- return 0;
- }, "add", false),
- new ModuleOption<>(0, "remove", new String[0],
- (value) -> {
- return true;
- },
- () -> {
- return 0;
- }, "remove", false)
- };
- }
-
- @Override
- public String getSuggestion(String cmd, String[] args) {
- if (args.length == 2 && args[1].equals("add")) {
- return cmd + " " + Block.REGISTRY.getObjectById(7).getRegistryName().toString();
- } else if (args.length == 3 && args[1].equals("add")) {
- if (args[2].isEmpty()) {
- return cmd + Block.REGISTRY.getObjectById(7).getRegistryName().toString();
- } else {
- String arg = args[2];
- for (Block b : Block.REGISTRY) {
- String s = b.getRegistryName().toString();
- if (s.startsWith(arg)) {
- return args[0] + " " + args[1] + " " + s;
- }
- }
-
- return "";
- }
- } else if (args.length == 2 && args[1].equals("remove")) {
- return cmd + " " + Block.REGISTRY.getObjectById(XrayTranslator.INSTANCE.target_blocks.iterator().nextInt()).getRegistryName();
- } else if (args.length == 3 && args[1].equals("remove")) {
- if (args[2].isEmpty()) {
- return cmd + Block.REGISTRY.getObjectById(XrayTranslator.INSTANCE.target_blocks.iterator().nextInt()).getRegistryName();
- } else {
- String arg = args[2];
- for (Integer i : XrayTranslator.INSTANCE.target_blocks) {
- String s = Block.REGISTRY.getObjectById(i).getRegistryName().toString();
- if (s.startsWith(arg)) {
- return args[0] + " " + args[1] + " " + s;
- }
- }
-
- return "";
- }
- }
-
- return super.getSuggestion(cmd, args);
- }
-
- @Override
- public void execute(String cmd, String[] args) {
- if (args.length == 3 && !args[2].isEmpty() && cmd.startsWith(".xray add ")) {
- String s = args[2].toLowerCase();
- try {
- int id = Integer.parseInt(s);
- Block block = Block.REGISTRY.getObjectById(id);
- if (block == null) {
- clientMessage("Not a valid block ID: " + PepsiUtils.COLOR_ESCAPE + "o" + args[2]);
- } else {
- XrayTranslator.INSTANCE.target_blocks.add(id);
- clientMessage("Added " + PepsiUtils.COLOR_ESCAPE + "o" + block.getRegistryName().toString() + PepsiUtils.COLOR_ESCAPE + "r to the Xray list");
- if (this.state.enabled) {
- mc.renderGlobal.loadRenderers();
- }
- }
- } catch (NumberFormatException e) {
- if (s.contains(":") && !s.endsWith(":") && !s.startsWith(":")) {
- String[] split = s.split(":");
- Block block = Block.REGISTRY.getObject(new ResourceLocation(split[0], split[1]));
- if (block == null) {
- clientMessage("Invalid id: " + PepsiUtils.COLOR_ESCAPE + "o" + s);
- } else {
- XrayTranslator.INSTANCE.target_blocks.add(((BlockID) block).getBlockId());
- clientMessage("Added " + PepsiUtils.COLOR_ESCAPE + "o" + block.getRegistryName().toString() + PepsiUtils.COLOR_ESCAPE + "r to the Xray list");
- if (this.state.enabled) {
- mc.renderGlobal.loadRenderers();
- }
- }
- } else {
- clientMessage("Invalid id: " + PepsiUtils.COLOR_ESCAPE + "o" + s);
- }
- }
- return;
- } else if (args.length == 3 && !args[2].isEmpty() && cmd.startsWith(".xray remove ")) {
- String s = args[2].toLowerCase();
- try {
- int id = Integer.parseInt(s);
- if (XrayTranslator.INSTANCE.target_blocks.contains(id)) {
- XrayTranslator.INSTANCE.target_blocks.remove((Integer) id);
- clientMessage("Removed " + PepsiUtils.COLOR_ESCAPE + "o" + id + PepsiUtils.COLOR_ESCAPE + "r from the Xray list");
- if (this.state.enabled) {
- mc.renderGlobal.loadRenderers();
- }
- } else {
- clientMessage("Block ID " + PepsiUtils.COLOR_ESCAPE + "o" + args[2] + PepsiUtils.COLOR_ESCAPE + "r is not on the Xray list!");
- }
- } catch (NumberFormatException e) {
- if (s.contains(":") && !s.endsWith(":") && !s.startsWith(":")) {
- String[] split = s.split(":");
- Block block = Block.REGISTRY.getObject(new ResourceLocation(split[0], split[1]));
- if (block == null) {
- clientMessage("Invalid id: " + PepsiUtils.COLOR_ESCAPE + "o" + s);
- } else {
- int id = ((BlockID) block).getBlockId();
- if (XrayTranslator.INSTANCE.target_blocks.contains(id)) {
- XrayTranslator.INSTANCE.target_blocks.remove(id);
- clientMessage("Removed " + PepsiUtils.COLOR_ESCAPE + "o" + s + PepsiUtils.COLOR_ESCAPE + "r from the Xray list");
- if (this.state.enabled) {
- mc.renderGlobal.loadRenderers();
- }
- } else {
- clientMessage("Block ID " + PepsiUtils.COLOR_ESCAPE + "o" + s + PepsiUtils.COLOR_ESCAPE + "r is not on the Xray list!");
- }
- }
- } else {
- clientMessage("Invalid id: " + PepsiUtils.COLOR_ESCAPE + "o" + s);
- }
- }
- return;
- }
-
- super.execute(cmd, args);
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.RENDER;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/render/ZoomMod.java b/src/main/java/net/daporkchop/pepsimod/module/impl/render/ZoomMod.java
deleted file mode 100644
index ff3844d..0000000
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/render/ZoomMod.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.module.impl.render;
-
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleLaunchState;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-
-public class ZoomMod extends Module {
- public static ZoomMod INSTANCE;
- public float fov = -1f;
-
- {
- INSTANCE = this;
- }
-
- public ZoomMod(int key) {
- super(false, "Zoom", key, true);
- }
-
- @Override
- public void onEnable() {
- if (this.fov == -1f || mc.gameSettings.fovSetting == this.fov) {
- this.fov = mc.gameSettings.fovSetting;
- }
- }
-
- @Override
- public void onDisable() {
-
- }
-
- @Override
- public void tick() {
- if (this.state.enabled) {
- if (mc.gameSettings.fovSetting > 12f) {
- for (int i = 0; i < 100; i++) {
- if (mc.gameSettings.fovSetting > 12f) {
- mc.gameSettings.fovSetting -= 0.1f;
- }
- }
- }
- } else if (mc.gameSettings.fovSetting < this.fov) {
- for (int i = 0; i < 100; i++) {
- mc.gameSettings.fovSetting += 0.1F;
- }
- }
- }
-
- @Override
- public void init() {
-
- }
-
- @Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[0];
- }
-
- @Override
- public boolean shouldTick() {
- return true;
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.RENDER;
- }
-
- @Override
- public ModuleLaunchState getLaunchState() {
- return ModuleLaunchState.DISABLED;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/util/Mod.java b/src/main/java/net/daporkchop/pepsimod/module/util/Mod.java
new file mode 100644
index 0000000..179bd42
--- /dev/null
+++ b/src/main/java/net/daporkchop/pepsimod/module/util/Mod.java
@@ -0,0 +1,60 @@
+/*
+ * Adapted from The MIT License (MIT)
+ *
+ * Copyright (c) 2016-2020 DaPorkchop_
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions:
+ *
+ * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
+ * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+package net.daporkchop.pepsimod.module.util;
+
+import lombok.Getter;
+import lombok.NonNull;
+import lombok.experimental.Accessors;
+import net.daporkchop.pepsimod.module.Module;
+
+import java.util.function.Supplier;
+
+/**
+ * A container for a module.
+ *
+ * Note that the actual module instance referenced by this instance can change between module manager init cycles, or even be {@code null} if the module
+ * manager is not currently active.
+ *
+ * @author DaPorkchop_
+ */
+@Getter
+public class Mod {
+ protected M instance; //global module instance reference
+ protected final Class clazz; //the module's class
+ protected final Supplier factory; //supplies new instances for use after module manager reloads
+
+ protected final String id;
+
+ protected boolean enabled;
+ protected boolean visible;
+
+ public Mod(@NonNull Class clazz, @NonNull Supplier factory) {
+ this.clazz = clazz;
+ this.factory = factory;
+
+ Module.Info info = clazz.getAnnotation(Module.Info.class);
+ if (info != null) {
+ this.id = info.id();
+ } else {
+ throw new IllegalArgumentException(String.format("Class %s is missing @Module.Info annotation!", clazz.getCanonicalName()));
+ }
+ }
+}
diff --git a/src/main/java/net/daporkchop/pepsimod/the/wurst/pkg/name/BlockUtils.java b/src/main/java/net/daporkchop/pepsimod/the/wurst/pkg/name/BlockUtils.java
deleted file mode 100644
index 9f62187..0000000
--- a/src/main/java/net/daporkchop/pepsimod/the/wurst/pkg/name/BlockUtils.java
+++ /dev/null
@@ -1,556 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.the.wurst.pkg.name;
-
-import com.google.common.collect.AbstractIterator;
-import net.daporkchop.pepsimod.util.ReflectionStuff;
-import net.minecraft.block.material.Material;
-import net.minecraft.client.Minecraft;
-import net.minecraft.network.play.client.CPacketPlayerDigging;
-import net.minecraft.network.play.client.CPacketPlayerDigging.Action;
-import net.minecraft.util.EnumFacing;
-import net.minecraft.util.math.BlockPos;
-import net.minecraft.util.math.Vec3d;
-
-import java.util.ArrayDeque;
-import java.util.Arrays;
-import java.util.HashSet;
-
-public class BlockUtils {
- private static final Minecraft mc = Minecraft.getMinecraft();
-
- public static boolean placeBlockLegit(BlockPos pos) {
- Vec3d eyesPos = RotationUtils.getEyesPos();
- Vec3d posVec = new Vec3d(pos).add(0.5, 0.5, 0.5);
- double distanceSqPosVec = eyesPos.squareDistanceTo(posVec);
-
- for (EnumFacing side : EnumFacing.values()) {
- BlockPos neighbor = pos.offset(side);
-
- // check if neighbor can be right clicked
- if (!WBlock.canBeClicked(neighbor)) {
- continue;
- }
-
- Vec3d dirVec = new Vec3d(side.getDirectionVec());
- Vec3d hitVec = posVec.add(dirVec.scale(0.5));
-
- // check if hitVec is within range (4.25 blocks)
- if (eyesPos.squareDistanceTo(hitVec) > 18.0625) {
- continue;
- }
-
- // check if side is visible (facing away from player)
- if (distanceSqPosVec > eyesPos.squareDistanceTo(posVec.add(dirVec))) {
- continue;
- }
-
- // check line of sight
- if (mc.world.rayTraceBlocks(eyesPos, hitVec, false,
- true, false) != null) {
- continue;
- }
-
- // face block
- RotationUtils.faceVectorPacketInstant(hitVec);
-
- // place block
- WPlayerController.processRightClickBlock(neighbor, side.getOpposite(), hitVec);
- WPlayer.swingArmClient();
- ReflectionStuff.setRightClickDelayTimer(4);
-
- return true;
- }
-
- return false;
- }
-
- public static boolean placeBlockScaffold(BlockPos pos) {
- Vec3d eyesPos = new Vec3d(mc.player.posX, mc.player.posY + mc.player.getEyeHeight(), mc.player.posZ);
-
- for (EnumFacing side : EnumFacing.values()) {
- BlockPos neighbor = pos.offset(side);
- EnumFacing side2 = side.getOpposite();
-
- // check if side is visible (facing away from player)
- if (eyesPos.squareDistanceTo(
- new Vec3d(pos).add(0.5, 0.5, 0.5)) >= eyesPos
- .squareDistanceTo(
- new Vec3d(neighbor).add(0.5, 0.5, 0.5))) {
- continue;
- }
-
- // check if neighbor can be right clicked
- if (!WBlock.canBeClicked(neighbor)) {
- continue;
- }
-
- Vec3d hitVec = new Vec3d(neighbor).add(0.5, 0.5, 0.5)
- .add(new Vec3d(side2.getDirectionVec()).scale(0.5));
-
- // check if hitVec is within range (4.25 blocks)
- if (eyesPos.squareDistanceTo(hitVec) > 18.0625) {
- continue;
- }
-
- // place block
- RotationUtils.faceVectorPacketInstant(hitVec);
- WPlayerController.processRightClickBlock(neighbor, side2, hitVec);
- WPlayer.swingArmClient();
- ReflectionStuff.setRightClickDelayTimer(4);
-
- return true;
- }
-
- return false;
- }
-
- public static boolean placeBlockSimple(BlockPos pos) {
- Vec3d eyesPos = RotationUtils.getEyesPos();
- Vec3d posVec = new Vec3d(pos).add(0.5, 0.5, 0.5);
-
- for (EnumFacing side : EnumFacing.values()) {
- BlockPos neighbor = pos.offset(side);
-
- // check if neighbor can be right clicked
- if (!WBlock.canBeClicked(neighbor)) {
- continue;
- }
-
- Vec3d hitVec =
- posVec.add(new Vec3d(side.getDirectionVec()).scale(0.5));
-
- // check if hitVec is within range (6 blocks)
- if (eyesPos.squareDistanceTo(hitVec) > 36) {
- continue;
- }
-
- // place block
- WPlayerController.processRightClickBlock(neighbor,
- side.getOpposite(), hitVec);
-
- return true;
- }
-
- return false;
- }
-
- public static boolean prepareToBreakBlockLegit(BlockPos pos) {
- Vec3d eyesPos = RotationUtils.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);
-
- // check if hitVec is within range (4.25 blocks)
- if (distanceSqHitVec > 18.0625) {
- continue;
- }
-
- // check if side is facing towards player
- if (distanceSqHitVec >= distanceSqPosVec) {
- continue;
- }
-
- // check line of sight
- if (mc.world.rayTraceBlocks(eyesPos, hitVec, false,
- true, false) != null) {
- continue;
- }
-
- // face block
- if (!RotationUtils.faceVectorPacket(hitVec)) {
- return true;
- }
-
- return true;
- }
-
- return false;
- }
-
- public static boolean breakBlockLegit(BlockPos pos) {
- Vec3d eyesPos = RotationUtils.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);
-
- // check if hitVec is within range (4.25 blocks)
- if (distanceSqHitVec > 18.0625) {
- continue;
- }
-
- // check if side is facing towards player
- if (distanceSqHitVec >= distanceSqPosVec) {
- continue;
- }
-
- // check line of sight
- if (mc.world.rayTraceBlocks(eyesPos, hitVec, false,
- true, false) != null) {
- continue;
- }
-
- // damage block
- if (!mc.playerController.onPlayerDamageBlock(pos, side)) {
- return false;
- }
-
- // swing arm
- WPlayer.swingArmPacket();
-
- return true;
- }
-
- return false;
- }
-
- public static boolean breakBlockExtraLegit(BlockPos pos) {
- Vec3d eyesPos = RotationUtils.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);
-
- // check if hitVec is within range (4.25 blocks)
- if (distanceSqHitVec > 18.0625) {
- continue;
- }
-
- // check if side is facing towards player
- if (distanceSqHitVec >= distanceSqPosVec) {
- continue;
- }
-
- // check line of sight
- if (mc.world.rayTraceBlocks(eyesPos, hitVec, false,
- true, false) != null) {
- continue;
- }
-
- // face block
- if (!RotationUtils.faceVectorClient(hitVec)) {
- return true;
- }
-
- // if attack key is down but nothing happens, release it for one
- // tick
- if (mc.gameSettings.keyBindAttack.isPressed()
- && !mc.playerController.getIsHittingBlock()) {
- ReflectionStuff.setPressed(mc.gameSettings.keyBindAttack, false);
- return true;
- }
-
- // damage block
- ReflectionStuff.setPressed(mc.gameSettings.keyBindAttack, true);
-
- return true;
- }
-
- return false;
- }
-
- public static boolean breakBlockSimple(BlockPos pos) {
- Vec3d eyesPos = RotationUtils.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);
-
- // check if hitVec is within range (6 blocks)
- if (distanceSqHitVec > 36) {
- continue;
- }
-
- // check if side is facing towards player
- if (distanceSqHitVec >= distanceSqPosVec) {
- continue;
- }
-
- // face block
- RotationUtils.faceVectorPacket(hitVec);
-
- // damage block
- if (!mc.playerController.onPlayerDamageBlock(pos, side)) {
- return false;
- }
-
- // swing arm
- WPlayer.swingArmPacket();
-
- return true;
- }
-
- return false;
- }
-
- public static void breakBlockPacketSpam(BlockPos pos) {
- Vec3d eyesPos = RotationUtils.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));
-
- // check if side is facing towards player
- if (eyesPos.squareDistanceTo(hitVec) >= distanceSqPosVec) {
- continue;
- }
-
- // break block
- mc.player.connection.sendPacket(new CPacketPlayerDigging(
- Action.START_DESTROY_BLOCK, pos, side));
- mc.player.connection.sendPacket(
- new CPacketPlayerDigging(Action.STOP_DESTROY_BLOCK, pos, side));
-
- return;
- }
- }
-
- public static boolean rightClickBlockLegit(BlockPos pos) {
- Vec3d eyesPos = RotationUtils.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);
-
- // check if hitVec is within range (4.25 blocks)
- if (distanceSqHitVec > 18.0625) {
- continue;
- }
-
- // check if side is facing towards player
- if (distanceSqHitVec >= distanceSqPosVec) {
- continue;
- }
-
- // check line of sight
- if (mc.world.rayTraceBlocks(eyesPos, hitVec, false,
- true, false) != null) {
- continue;
- }
-
- // face block
- if (!RotationUtils.faceVectorPacket(hitVec)) {
- return true;
- }
-
- // place block
- WPlayerController.processRightClickBlock(pos, side, hitVec);
- WPlayer.swingArmClient();
- ReflectionStuff.setRightClickDelayTimer(4);
-
- return true;
- }
-
- return false;
- }
-
- public static boolean rightClickBlockSimple(BlockPos pos) {
- Vec3d eyesPos = RotationUtils.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);
-
- // check if hitVec is within range (6 blocks)
- if (distanceSqHitVec > 36) {
- continue;
- }
-
- // check if side is facing towards player
- if (distanceSqHitVec >= distanceSqPosVec) {
- continue;
- }
-
- // place block
- WPlayerController.processRightClickBlock(pos, side, hitVec);
-
- return true;
- }
-
- return false;
- }
-
- public static Iterable getValidBlocksByDistance(double range, boolean ignoreVisibility, BlockValidator validator) {
- // prepare range check
- Vec3d eyesPos = RotationUtils.getEyesPos().subtract(0.5, 0.5, 0.5);
- double rangeSq = Math.pow(range + 0.5, 2);
-
- // set start pos
- BlockPos startPos = new BlockPos(RotationUtils.getEyesPos());
-
- return () -> new AbstractIterator() {
- // initialize queue
- private ArrayDeque queue =
- new ArrayDeque<>(Arrays.asList(startPos));
- private HashSet visited = new HashSet<>();
-
- @Override
- protected BlockPos computeNext() {
- // find block using breadth first search
- while (!this.queue.isEmpty()) {
- BlockPos current = this.queue.pop();
-
- // check range
- if (eyesPos.squareDistanceTo(new Vec3d(current)) > rangeSq) {
- continue;
- }
-
- boolean canBeClicked = WBlock.canBeClicked(current);
-
- if (ignoreVisibility || !canBeClicked)
- // add neighbors
- {
- for (EnumFacing facing : EnumFacing.values()) {
- BlockPos next = current.offset(facing);
-
- if (this.visited.contains(next)) {
- continue;
- }
-
- this.queue.add(next);
- this.visited.add(next);
- }
- }
-
- // check if block is valid
- if (canBeClicked && validator.isValid(current)) {
- return current;
- }
- }
-
- return this.endOfData();
- }
- };
- }
-
- public static Iterable getValidBlocksByDistanceReversed(
- double range, boolean ignoreVisibility, BlockValidator validator) {
- ArrayDeque validBlocks = new ArrayDeque<>();
-
- BlockUtils.getValidBlocksByDistance(range, ignoreVisibility, validator)
- .forEach(validBlocks::push);
-
- return validBlocks;
- }
-
- public static Iterable getValidBlocks(double range,
- BlockValidator validator) {
- // prepare range check
- Vec3d eyesPos = RotationUtils.getEyesPos().subtract(0.5, 0.5, 0.5);
- double rangeSq = Math.pow(range + 0.5, 2);
-
- return getValidBlocks((int) Math.ceil(range), (pos) -> {
-
- // check range
- if (eyesPos.squareDistanceTo(new Vec3d(pos)) > rangeSq) {
- return false;
- }
-
- // check if block is valid
- return validator.isValid(pos);
- });
- }
-
- public static Iterable getValidBlocks(int blockRange,
- BlockValidator validator) {
- BlockPos playerPos = new BlockPos(RotationUtils.getEyesPos());
-
- BlockPos min = playerPos.add(-blockRange, -blockRange, -blockRange);
- BlockPos max = playerPos.add(blockRange, blockRange, blockRange);
-
- return () -> new AbstractIterator() {
- private BlockPos last;
-
- private BlockPos computeNextUnchecked() {
- if (this.last == null) {
- this.last = min;
- return this.last;
- }
-
- int x = this.last.getX();
- int y = this.last.getY();
- int z = this.last.getZ();
-
- if (z < max.getZ()) {
- z++;
- } else if (x < max.getX()) {
- z = min.getZ();
- x++;
- } else if (y < max.getY()) {
- z = min.getZ();
- x = min.getX();
- y++;
- } else {
- return null;
- }
-
- this.last = new BlockPos(x, y, z);
- return this.last;
- }
-
- @Override
- protected BlockPos computeNext() {
- BlockPos pos;
- while ((pos = this.computeNextUnchecked()) != null) {
- // skip air blocks
- if (WBlock.getMaterial(pos) == Material.AIR) {
- continue;
- }
-
- // check if block is valid
- if (!validator.isValid(pos)) {
- continue;
- }
-
- return pos;
- }
-
- return this.endOfData();
- }
- };
- }
-
- public interface BlockValidator {
- boolean isValid(BlockPos pos);
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/the/wurst/pkg/name/EntityUtils.java b/src/main/java/net/daporkchop/pepsimod/the/wurst/pkg/name/EntityUtils.java
deleted file mode 100644
index e645b60..0000000
--- a/src/main/java/net/daporkchop/pepsimod/the/wurst/pkg/name/EntityUtils.java
+++ /dev/null
@@ -1,328 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.the.wurst.pkg.name;
-
-import net.daporkchop.pepsimod.util.PepsiConstants;
-import net.daporkchop.pepsimod.util.PepsiUtils;
-import net.daporkchop.pepsimod.util.config.impl.FriendsTranslator;
-import net.daporkchop.pepsimod.util.config.impl.TargettingTranslator;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.EntityAgeable;
-import net.minecraft.entity.EntityFlying;
-import net.minecraft.entity.EntityLiving;
-import net.minecraft.entity.EntityLivingBase;
-import net.minecraft.entity.monster.EntityGolem;
-import net.minecraft.entity.monster.EntityMob;
-import net.minecraft.entity.monster.EntitySlime;
-import net.minecraft.entity.passive.EntityAmbientCreature;
-import net.minecraft.entity.passive.EntityWaterMob;
-import net.minecraft.entity.player.EntityPlayer;
-
-import java.util.ArrayList;
-
-public class EntityUtils extends PepsiConstants {
- public static final TargetSettings DEFAULT_SETTINGS = new TargetSettings();
- public static final String[] colors = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"};
-
- public static boolean isCorrectEntity(Entity en, TargetSettings settings) {
- // non-entities
- if (en == null) {
- return false;
- }
-
- // dead entities
- if (en instanceof EntityLivingBase && (((EntityLivingBase) en).isDead || ((EntityLivingBase) en).getHealth() <= 0)) {
- return false;
- }
-
- // entities outside the range
- if (mc.player.getDistance(en) > settings.getRange()) {
- return false;
- }
-
- // entities outside the FOV
- if (settings.getFOV() < 360F && RotationUtils.getAngleToClientRotation(PepsiUtils.adjustVectorForBone(en.getEntityBoundingBox().getCenter(), en, settings.getTargetBone())) > settings.getFOV() / 2F) {
- return false;
- }
-
- // entities behind walls
- if (!settings.targetBehindWalls() && !PepsiUtils.canEntityBeSeen(en, mc.player, settings.getTargetBone())) {
- return false;
- }
-
- // friends
- if (!settings.targetFriends() && FriendsTranslator.INSTANCE.isFriend(en)) {
- return false;
- }
-
- // players
- if (en instanceof EntityPlayer) {
- // normal players
- if (!settings.targetPlayers()) {
- if (!((EntityPlayer) en).isPlayerSleeping() && !en.isInvisible()) {
- return false;
- }
-
- // sleeping players
- } else if (!settings.targetSleepingPlayers()) {
- if (((EntityPlayer) en).isPlayerSleeping()) {
- return false;
- }
-
- // invisible players
- } else if (!settings.targetInvisiblePlayers()) {
- if (en.isInvisible()) {
- return false;
- }
- }
-
- // team players
- if (settings.targetTeams() && !checkName(
- en.getDisplayName().getFormattedText(),
- settings.getTeamColors())) {
- return false;
- }
-
- // the user
- if (en == mc.player) {
- return false;
- }
-
- // Freecam entity
- if (en.getName()
- .equals(mc.player.getName())) {
- return false;
- }
-
- // mobs
- } else if (en instanceof EntityLiving) {
- // invisible mobs
- if (en.isInvisible()) {
- if (!settings.targetInvisibleMobs()) {
- return false;
- }
-
- // animals
- } else if (en instanceof EntityAgeable
- || en instanceof EntityAmbientCreature
- || en instanceof EntityWaterMob) {
- if (!settings.targetAnimals()) {
- return false;
- }
-
- // monsters
- } else if (en instanceof EntityMob || en instanceof EntitySlime
- || en instanceof EntityFlying) {
- if (!settings.targetMonsters()) {
- return false;
- }
-
- // golems
- } else if (en instanceof EntityGolem) {
- if (!settings.targetGolems()) {
- return false;
- }
-
- // other mobs
- } else {
- return false;
- }
-
- // team mobs
- if (settings.targetTeams() && en.hasCustomName()
- && !checkName(en.getCustomNameTag(),
- settings.getTeamColors())) {
- return false;
- }
-
- // other entities
- } else {
- return false;
- }
-
- return true;
- }
-
- private static boolean checkName(String name, boolean[] teamColors) {
- // check colors
- boolean hasKnownColor = false;
- for (int i = 0; i < 16; i++) {
- if (name.contains('\u00A7' + colors[i])) {
- hasKnownColor = true;
- if (teamColors[i]) {
- return true;
- }
- }
- }
-
- // no known color => white
- return !hasKnownColor && teamColors[15];
- }
-
- public static ArrayList getValidEntities(TargetSettings settings) {
- ArrayList validEntities = new ArrayList<>();
-
- for (Entity entity : mc.world.loadedEntityList) {
- if (isCorrectEntity(entity, settings)) {
- validEntities.add(entity);
- }
-
- if (validEntities.size() >= 64) {
- break;
- }
- }
-
- return validEntities;
- }
-
- public static Entity getClosestEntity(TargetSettings settings) {
- Entity closestEntity = null;
-
- for (Entity entity : mc.world.loadedEntityList) {
- if (isCorrectEntity(entity, settings)
- && (closestEntity == null || mc.player
- .getDistance(entity) < mc.player
- .getDistance(closestEntity))) {
- closestEntity = entity;
- }
- }
-
- return closestEntity;
- }
-
- public static Entity getBestEntityToAttack(TargetSettings settings) {
- Entity bestEntity = null;
- float bestAngle = Float.POSITIVE_INFINITY;
-
- for (Entity entity : mc.world.loadedEntityList) {
- if (!isCorrectEntity(entity, settings)) {
- continue;
- }
-
- float angle = RotationUtils.getAngleToServerRotation(PepsiUtils.adjustVectorForBone(entity.getEntityBoundingBox().getCenter(), entity, settings.getTargetBone()));
-
- if (angle < bestAngle) {
- bestEntity = entity;
- bestAngle = angle;
- }
- }
-
- return bestEntity;
- }
-
- public static Entity getClosestEntityOtherThan(Entity otherEntity,
- TargetSettings settings) {
- Entity closestEnemy = null;
-
- for (Entity entity : mc.world.loadedEntityList) {
- if (isCorrectEntity(entity, settings) && entity != otherEntity
- && (closestEnemy == null || mc.player
- .getDistance(entity) < mc.player
- .getDistance(closestEnemy))) {
- closestEnemy = entity;
- }
- }
-
- return closestEnemy;
- }
-
- public static Entity getClosestEntityWithName(String name,
- TargetSettings settings) {
- Entity closestEntity = null;
-
- for (Entity entity : mc.world.loadedEntityList) {
- if (!isCorrectEntity(entity, settings)) {
- continue;
- }
- if (!entity.getName().equalsIgnoreCase(name)) {
- continue;
- }
-
- if (closestEntity == null || mc.player
- .getDistanceSq(entity) < mc.player
- .getDistanceSq(closestEntity)) {
- closestEntity = entity;
- }
- }
-
- return closestEntity;
- }
-
- public static class TargetSettings {
- public static final boolean[] team_colors = {true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true};
-
- public boolean targetFriends() {
- return TargettingTranslator.INSTANCE.friends;
- }
-
- public boolean targetBehindWalls() {
- return TargettingTranslator.INSTANCE.through_walls;
- }
-
- public float getRange() {
- return TargettingTranslator.INSTANCE.reach;
- }
-
- public float getFOV() {
- return TargettingTranslator.INSTANCE.fov;
- }
-
- public boolean targetPlayers() {
- return TargettingTranslator.INSTANCE.players;
- }
-
- public boolean targetAnimals() {
- return TargettingTranslator.INSTANCE.animals;
- }
-
- public boolean targetMonsters() {
- return TargettingTranslator.INSTANCE.monsters;
- }
-
- public boolean targetGolems() {
- return TargettingTranslator.INSTANCE.golems;
- }
-
- public boolean targetSleepingPlayers() {
- return TargettingTranslator.INSTANCE.sleeping;
- }
-
- public boolean targetInvisiblePlayers() {
- return TargettingTranslator.INSTANCE.players && TargettingTranslator.INSTANCE.invisible;
- }
-
- public boolean targetInvisibleMobs() {
- return TargettingTranslator.INSTANCE.monsters && TargettingTranslator.INSTANCE.invisible;
- }
-
- public boolean targetTeams() {
- return TargettingTranslator.INSTANCE.teams;
- }
-
- public boolean[] getTeamColors() {
- return team_colors;
- }
-
- public TargettingTranslator.TargetBone getTargetBone() {
- return TargettingTranslator.INSTANCE.targetBone;
- }
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/the/wurst/pkg/name/RenderUtils.java b/src/main/java/net/daporkchop/pepsimod/the/wurst/pkg/name/RenderUtils.java
deleted file mode 100644
index 24beb1c..0000000
--- a/src/main/java/net/daporkchop/pepsimod/the/wurst/pkg/name/RenderUtils.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.the.wurst.pkg.name;
-
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.ScaledResolution;
-import net.minecraft.util.math.AxisAlignedBB;
-
-import java.awt.Color;
-
-import static org.lwjgl.opengl.GL11.*;
-
-public class RenderUtils {
- private static final AxisAlignedBB DEFAULT_AABB =
- new AxisAlignedBB(0, 0, 0, 1, 1, 1);
-
- public static void scissorBox(int x, int y, int xend, int yend) {
- int width = xend - x;
- int height = yend - y;
- ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft());
- int factor = sr.getScaleFactor();
- int bottomY = Minecraft.getMinecraft().currentScreen.height - yend;
- glScissor(x * factor, bottomY * factor, width * factor,
- height * factor);
- }
-
- public static void setColor(Color c) {
- glColor4f(c.getRed() / 255f, c.getGreen() / 255f, c.getBlue() / 255f,
- c.getAlpha() / 255f);
- }
-
- public static void drawSolidBox() {
- drawSolidBox(DEFAULT_AABB);
- }
-
- public static void drawSolidBox(AxisAlignedBB bb) {
- glBegin(GL_QUADS);
- {
- glVertex3d(bb.minX, bb.minY, bb.minZ);
- glVertex3d(bb.maxX, bb.minY, bb.minZ);
- glVertex3d(bb.maxX, bb.minY, bb.maxZ);
- glVertex3d(bb.minX, bb.minY, bb.maxZ);
-
- glVertex3d(bb.minX, bb.maxY, bb.minZ);
- glVertex3d(bb.minX, bb.maxY, bb.maxZ);
- glVertex3d(bb.maxX, bb.maxY, bb.maxZ);
- glVertex3d(bb.maxX, bb.maxY, bb.minZ);
-
- glVertex3d(bb.minX, bb.minY, bb.minZ);
- glVertex3d(bb.minX, bb.maxY, bb.minZ);
- glVertex3d(bb.maxX, bb.maxY, bb.minZ);
- glVertex3d(bb.maxX, bb.minY, bb.minZ);
-
- glVertex3d(bb.maxX, bb.minY, bb.minZ);
- glVertex3d(bb.maxX, bb.maxY, bb.minZ);
- glVertex3d(bb.maxX, bb.maxY, bb.maxZ);
- glVertex3d(bb.maxX, bb.minY, bb.maxZ);
-
- glVertex3d(bb.minX, bb.minY, bb.maxZ);
- glVertex3d(bb.maxX, bb.minY, bb.maxZ);
- glVertex3d(bb.maxX, bb.maxY, bb.maxZ);
- glVertex3d(bb.minX, bb.maxY, bb.maxZ);
-
- glVertex3d(bb.minX, bb.minY, bb.minZ);
- glVertex3d(bb.minX, bb.minY, bb.maxZ);
- glVertex3d(bb.minX, bb.maxY, bb.maxZ);
- glVertex3d(bb.minX, bb.maxY, bb.minZ);
- }
- glEnd();
- }
-
- public static void drawOutlinedBox() {
- drawOutlinedBox(DEFAULT_AABB);
- }
-
- public static void drawOutlinedBox(AxisAlignedBB bb) {
- glBegin(GL_LINES);
- {
- glVertex3d(bb.minX, bb.minY, bb.minZ);
- glVertex3d(bb.maxX, bb.minY, bb.minZ);
-
- glVertex3d(bb.maxX, bb.minY, bb.minZ);
- glVertex3d(bb.maxX, bb.minY, bb.maxZ);
-
- glVertex3d(bb.maxX, bb.minY, bb.maxZ);
- glVertex3d(bb.minX, bb.minY, bb.maxZ);
-
- glVertex3d(bb.minX, bb.minY, bb.maxZ);
- glVertex3d(bb.minX, bb.minY, bb.minZ);
-
- glVertex3d(bb.minX, bb.minY, bb.minZ);
- glVertex3d(bb.minX, bb.maxY, bb.minZ);
-
- glVertex3d(bb.maxX, bb.minY, bb.minZ);
- glVertex3d(bb.maxX, bb.maxY, bb.minZ);
-
- glVertex3d(bb.maxX, bb.minY, bb.maxZ);
- glVertex3d(bb.maxX, bb.maxY, bb.maxZ);
-
- glVertex3d(bb.minX, bb.minY, bb.maxZ);
- glVertex3d(bb.minX, bb.maxY, bb.maxZ);
-
- glVertex3d(bb.minX, bb.maxY, bb.minZ);
- glVertex3d(bb.maxX, bb.maxY, bb.minZ);
-
- glVertex3d(bb.maxX, bb.maxY, bb.minZ);
- glVertex3d(bb.maxX, bb.maxY, bb.maxZ);
-
- glVertex3d(bb.maxX, bb.maxY, bb.maxZ);
- glVertex3d(bb.minX, bb.maxY, bb.maxZ);
-
- glVertex3d(bb.minX, bb.maxY, bb.maxZ);
- glVertex3d(bb.minX, bb.maxY, bb.minZ);
- }
- glEnd();
- }
-
- public static void drawCrossBox() {
- drawOutlinedBox(DEFAULT_AABB);
- }
-
- public static void drawCrossBox(AxisAlignedBB bb) {
- glBegin(GL_LINES);
- {
- glVertex3d(bb.minX, bb.minY, bb.minZ);
- glVertex3d(bb.maxX, bb.maxY, bb.minZ);
-
- glVertex3d(bb.maxX, bb.minY, bb.minZ);
- glVertex3d(bb.maxX, bb.maxY, bb.maxZ);
-
- glVertex3d(bb.maxX, bb.minY, bb.maxZ);
- glVertex3d(bb.minX, bb.maxY, bb.maxZ);
-
- glVertex3d(bb.minX, bb.minY, bb.maxZ);
- glVertex3d(bb.minX, bb.maxY, bb.minZ);
-
- glVertex3d(bb.maxX, bb.minY, bb.minZ);
- glVertex3d(bb.minX, bb.maxY, bb.minZ);
-
- glVertex3d(bb.maxX, bb.minY, bb.maxZ);
- glVertex3d(bb.maxX, bb.maxY, bb.minZ);
-
- glVertex3d(bb.minX, bb.minY, bb.maxZ);
- glVertex3d(bb.maxX, bb.maxY, bb.maxZ);
-
- glVertex3d(bb.minX, bb.minY, bb.minZ);
- glVertex3d(bb.minX, bb.maxY, bb.maxZ);
-
- glVertex3d(bb.minX, bb.maxY, bb.minZ);
- glVertex3d(bb.maxX, bb.maxY, bb.maxZ);
-
- glVertex3d(bb.maxX, bb.maxY, bb.minZ);
- glVertex3d(bb.minX, bb.maxY, bb.maxZ);
-
- glVertex3d(bb.maxX, bb.minY, bb.minZ);
- glVertex3d(bb.minX, bb.minY, bb.maxZ);
-
- glVertex3d(bb.maxX, bb.minY, bb.maxZ);
- glVertex3d(bb.minX, bb.minY, bb.minZ);
- }
- glEnd();
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/the/wurst/pkg/name/RotationUtils.java b/src/main/java/net/daporkchop/pepsimod/the/wurst/pkg/name/RotationUtils.java
deleted file mode 100644
index f840d14..0000000
--- a/src/main/java/net/daporkchop/pepsimod/the/wurst/pkg/name/RotationUtils.java
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.the.wurst.pkg.name;
-
-import net.daporkchop.pepsimod.util.PepsiConstants;
-import net.daporkchop.pepsimod.util.PepsiUtils;
-import net.minecraft.entity.Entity;
-import net.minecraft.network.play.client.CPacketPlayer;
-import net.minecraft.util.math.AxisAlignedBB;
-import net.minecraft.util.math.MathHelper;
-import net.minecraft.util.math.Vec3d;
-
-public class RotationUtils extends PepsiConstants {
- private static boolean fakeRotation;
- private static float serverYaw;
- private static float serverPitch;
-
- public static Vec3d getEyesPos() {
- return new Vec3d(mc.player.posX,
- mc.player.posY + mc.player.getEyeHeight(),
- mc.player.posZ);
- }
-
- public static Vec3d getClientLookVec() {
- float f = MathHelper.cos(-mc.player.rotationYaw * 0.017453292F
- - (float) Math.PI);
- float f1 = MathHelper.sin(-mc.player.rotationYaw * 0.017453292F
- - (float) Math.PI);
- float f2 =
- -MathHelper.cos(-mc.player.rotationPitch * 0.017453292F);
- float f3 =
- MathHelper.sin(-mc.player.rotationPitch * 0.017453292F);
- return new Vec3d(f1 * f2, f3 + mc.player.getEyeHeight(), f * f2);
- }
-
- public static Vec3d getServerLookVec() {
- float f = MathHelper.cos(-serverYaw * 0.017453292F - (float) Math.PI);
- float f1 = MathHelper.sin(-serverYaw * 0.017453292F - (float) Math.PI);
- float f2 = -MathHelper.cos(-serverPitch * 0.017453292F);
- float f3 = MathHelper.sin(-serverPitch * 0.017453292F);
- return new Vec3d(f1 * f2, f3, f * f2);
- }
-
- private static float[] getNeededRotations(Vec3d vec) {
- Vec3d eyesPos = 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)) - 90F;
- float pitch = (float) -Math.toDegrees(Math.atan2(diffY, diffXZ));
-
- return new float[]{MathHelper.wrapDegrees(yaw), MathHelper.wrapDegrees(pitch)};
- }
-
- private static float[] getNeededRotations2(Vec3d vec) {
- Vec3d eyesPos = 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)) - 90F;
- 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 float limitAngleChange(float current, float intended,
- float maxChange) {
- float change = MathHelper.wrapDegrees(intended - current);
-
- change = MathHelper.clamp(change, -maxChange, maxChange);
-
- return MathHelper.wrapDegrees(current + change);
- }
-
- public static boolean faceVectorPacket(Vec3d vec) {
- // use fake rotation in next packet
- fakeRotation = true;
-
- float[] rotations = getNeededRotations(vec);
-
- serverYaw = rotations[0];
- serverPitch = MathHelper.normalizeAngle((int) rotations[1], 360);
-
- return Math.abs(serverYaw - rotations[0]) < 1F;
- }
-
- public static void faceVectorPacketInstant(Vec3d vec) {
- float[] rotations = getNeededRotations2(vec);
-
- mc.getConnection().sendPacket(new CPacketPlayer.Rotation(rotations[0],
- MathHelper.normalizeAngle((int) rotations[1], 360), mc.player.onGround));
- }
-
- public static boolean faceVectorClient(Vec3d vec) {
- float[] rotations = getNeededRotations(vec);
-
- float oldYaw = mc.player.prevRotationYaw;
- float oldPitch = mc.player.prevRotationPitch;
-
- mc.player.rotationYaw = rotations[0];
- mc.player.rotationPitch = MathHelper.normalizeAngle((int) rotations[1], 360);
-
- return Math.abs(oldYaw - rotations[0])
- + Math.abs(oldPitch - rotations[1]) < 1F;
- }
-
-
- public static boolean faceEntityClient(Entity entity) {
- // get position & rotation
- Vec3d eyesPos = getEyesPos();
- Vec3d lookVec = getServerLookVec();
-
- // try to face center of boundingBox
- AxisAlignedBB bb = entity.getEntityBoundingBox();
- if (faceVectorClient(PepsiUtils.adjustVectorForBone(bb.getCenter(), entity, EntityUtils.DEFAULT_SETTINGS.getTargetBone()))) {
- return true;
- }
-
- // if not facing center, check if facing anything in boundingBox
- return bb.calculateIntercept(eyesPos,
- eyesPos.add(lookVec.scale(6))) != null;
- }
-
- public static boolean faceEntityPacket(Entity entity) {
- // get position & rotation
- Vec3d eyesPos = getEyesPos();
- Vec3d lookVec = getServerLookVec();
-
- // try to face center of boundingBox
- AxisAlignedBB bb = entity.getEntityBoundingBox();
- if (faceVectorPacket(PepsiUtils.adjustVectorForBone(bb.getCenter(), entity, EntityUtils.DEFAULT_SETTINGS.getTargetBone()))) {
- return true;
- }
-
- // if not facing center, check if facing anything in boundingBox
- return bb.calculateIntercept(eyesPos,
- eyesPos.add(lookVec.scale(6))) != null;
- }
-
- public static boolean faceVectorForWalking(Vec3d vec) {
- float[] rotations = getNeededRotations(vec);
-
- float oldYaw = mc.player.prevRotationYaw;
-
- mc.player.rotationYaw = MathHelper.normalizeAngle((int) rotations[0], 360);
-
- return Math.abs(oldYaw - rotations[0]) < 1F;
- }
-
- public static float getAngleToClientRotation(Vec3d vec) {
- float[] needed = getNeededRotations(vec);
-
- float diffYaw =
- MathHelper.wrapDegrees(mc.player.rotationYaw) - needed[0];
- float diffPitch =
- MathHelper.wrapDegrees(mc.player.rotationPitch) - needed[1];
-
- float angle =
- (float) Math.sqrt(diffYaw * diffYaw + diffPitch * diffPitch);
-
- return angle;
- }
-
- public static float getHorizontalAngleToClientRotation(Vec3d vec) {
- float[] needed = getNeededRotations(vec);
-
- float angle =
- MathHelper.wrapDegrees(mc.player.rotationYaw) - needed[0];
-
- return angle;
- }
-
- public static float getAngleToServerRotation(Vec3d vec) {
- float[] needed = getNeededRotations(vec);
-
- float diffYaw = serverYaw - needed[0];
- float diffPitch = serverPitch - needed[1];
-
- float angle =
- (float) Math.sqrt(diffYaw * diffYaw + diffPitch * diffPitch);
-
- return angle;
- }
-
- public static void updateServerRotation() {
- // disable fake rotation in next packet unless manually enabled again
- if (fakeRotation) {
- fakeRotation = false;
- return;
- }
-
- // slowly synchronize server rotation with client
- serverYaw = limitAngleChange(serverYaw, mc.player.rotationYaw, 30);
- serverPitch = mc.player.rotationPitch;
- }
-
- public static float getServerYaw() {
- return serverYaw;
- }
-
- public static float getServerPitch() {
- return serverPitch;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/the/wurst/pkg/name/WBlock.java b/src/main/java/net/daporkchop/pepsimod/the/wurst/pkg/name/WBlock.java
deleted file mode 100644
index 42e5b4a..0000000
--- a/src/main/java/net/daporkchop/pepsimod/the/wurst/pkg/name/WBlock.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.the.wurst.pkg.name;
-
-import net.daporkchop.pepsimod.util.PepsiConstants;
-import net.minecraft.block.Block;
-import net.minecraft.block.material.Material;
-import net.minecraft.block.state.IBlockState;
-import net.minecraft.util.math.AxisAlignedBB;
-import net.minecraft.util.math.BlockPos;
-
-public class WBlock extends PepsiConstants {
- public static IBlockState getState(BlockPos pos) {
- return mc.world.getBlockState(pos);
- }
-
- public static Block getBlock(BlockPos pos) {
- return getState(pos).getBlock();
- }
-
- public static int getId(BlockPos pos) {
- return Block.getIdFromBlock(getBlock(pos));
- }
-
- public static String getName(Block block) {
- return "" + Block.REGISTRY.getNameForObject(block);
- }
-
- public static Material getMaterial(BlockPos pos) {
- return getState(pos).getMaterial();
- }
-
- public static AxisAlignedBB getBoundingBox(BlockPos pos) {
- return getState(pos).getBoundingBox(mc.world, pos).offset(pos);
- }
-
- public static boolean canBeClicked(BlockPos pos) {
- return getBlock(pos).canCollideCheck(getState(pos), false);
- }
-
- public static float getHardness(BlockPos pos) {
- return getState(pos).getPlayerRelativeBlockHardness(mc.player, mc.world, pos);
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/the/wurst/pkg/name/WPlayer.java b/src/main/java/net/daporkchop/pepsimod/the/wurst/pkg/name/WPlayer.java
deleted file mode 100644
index 73f8e70..0000000
--- a/src/main/java/net/daporkchop/pepsimod/the/wurst/pkg/name/WPlayer.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.the.wurst.pkg.name;
-
-import net.daporkchop.pepsimod.util.PepsiConstants;
-import net.minecraft.client.Minecraft;
-import net.minecraft.entity.Entity;
-import net.minecraft.network.play.client.CPacketAnimation;
-import net.minecraft.network.play.client.CPacketUseEntity;
-import net.minecraft.potion.Potion;
-import net.minecraft.potion.PotionEffect;
-import net.minecraft.util.EnumHand;
-
-public class WPlayer extends PepsiConstants {
- public static void swingArmClient() {
- mc.player.swingArm(EnumHand.MAIN_HAND);
- }
-
- public static void swingArmPacket() {
- mc.player.connection.sendPacket(new CPacketAnimation(EnumHand.MAIN_HAND));
- }
-
- public static void attackEntity(Entity entity) {
- Minecraft.getMinecraft().playerController.attackEntity(mc.player, entity);
- swingArmClient();
- }
-
- public static void sendAttackPacket(Entity entity) {
- mc.player.connection.sendPacket(new CPacketUseEntity(entity, EnumHand.MAIN_HAND));
- }
-
- public static float getCooldown() {
- return mc.player.getCooledAttackStrength(0);
- }
-
- public static void addPotionEffect(Potion potion) {
- mc.player
- .addPotionEffect(new PotionEffect(potion, 10801220));
- }
-
- public static void removePotionEffect(Potion potion) {
- mc.player.removePotionEffect(potion);
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/the/wurst/pkg/name/WPlayerController.java b/src/main/java/net/daporkchop/pepsimod/the/wurst/pkg/name/WPlayerController.java
deleted file mode 100644
index dc60dfb..0000000
--- a/src/main/java/net/daporkchop/pepsimod/the/wurst/pkg/name/WPlayerController.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.the.wurst.pkg.name;
-
-import net.daporkchop.pepsimod.util.PepsiConstants;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.multiplayer.PlayerControllerMP;
-import net.minecraft.inventory.ClickType;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.EnumFacing;
-import net.minecraft.util.EnumHand;
-import net.minecraft.util.math.BlockPos;
-import net.minecraft.util.math.Vec3d;
-
-public class WPlayerController extends PepsiConstants {
- private static PlayerControllerMP getPlayerController() {
- return Minecraft.getMinecraft().playerController;
- }
-
- public static ItemStack windowClick_PICKUP(int slot) {
- return getPlayerController().windowClick(0, slot, 0, ClickType.PICKUP, mc.player);
- }
-
- public static ItemStack windowClick_QUICK_MOVE(int slot) {
- return getPlayerController().windowClick(0, slot, 0, ClickType.QUICK_MOVE, mc.player);
- }
-
- public static ItemStack windowClick_THROW(int slot) {
- return getPlayerController().windowClick(0, slot, 1, ClickType.THROW,
- mc.player);
- }
-
- public static void processRightClick() {
- getPlayerController().processRightClick(mc.player,
- mc.world, EnumHand.MAIN_HAND);
- }
-
- public static void processRightClickBlock(BlockPos pos, EnumFacing side, Vec3d hitVec) {
- getPlayerController().processRightClickBlock(mc.player,
- mc.world, pos, side, hitVec, EnumHand.MAIN_HAND);
- }
-}
-
diff --git a/src/main/java/net/daporkchop/pepsimod/the/wurst/pkg/name/package-info.java b/src/main/java/net/daporkchop/pepsimod/the/wurst/pkg/name/package-info.java
deleted file mode 100644
index cdbab51..0000000
--- a/src/main/java/net/daporkchop/pepsimod/the/wurst/pkg/name/package-info.java
+++ /dev/null
@@ -1,403 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-/**
- * This package contains classes that were definitely not skidded from Wurst
- * (((((wait, what am i talking about?)))))
- *
- * In the VERY UNLIKELY case that this entire package WAS skidded from Wurst, this package is also distributed under the Mozilla Public Liscense 2.0
- * the header is simply there because my IDE keeps adding it back and i don't think i can exclude packages to add copy-rights to
- * anyway, the MPE2 is as follows:
- *
- * Mozilla Public License Version 2.0
- * ==================================
- *
- * 1. Definitions
- * --------------
- *
- * 1.1. "Contributor"
- * means each individual or legal entity that creates, contributes to
- * the creation of, or owns Covered Software.
- *
- * 1.2. "Contributor Version"
- * means the combination of the Contributions of others (if any) used
- * by a Contributor and that particular Contributor's Contribution.
- *
- * 1.3. "Contribution"
- * means Covered Software of a particular Contributor.
- *
- * 1.4. "Covered Software"
- * means Source Code Form to which the initial Contributor has attached
- * the notice in Exhibit A, the Executable Form of such Source Code
- * Form, and Modifications of such Source Code Form, in each case
- * including portions thereof.
- *
- * 1.5. "Incompatible With Secondary Licenses"
- * means
- *
- * (a) that the initial Contributor has attached the notice described
- * in Exhibit B to the Covered Software; or
- *
- * (b) that the Covered Software was made available under the terms of
- * version 1.1 or earlier of the License, but not also under the
- * terms of a Secondary License.
- *
- * 1.6. "Executable Form"
- * means any form of the work other than Source Code Form.
- *
- * 1.7. "Larger Work"
- * means a work that combines Covered Software with other material, in
- * a separate file or files, that is not Covered Software.
- *
- * 1.8. "License"
- * means this document.
- *
- * 1.9. "Licensable"
- * means having the right to grant, to the maximum extent possible,
- * whether at the time of the initial grant or subsequently, any and
- * all of the rights conveyed by this License.
- *
- * 1.10. "Modifications"
- * means any of the following:
- *
- * (a) any file in Source Code Form that results from an addition to,
- * deletion from, or modification of the contents of Covered
- * Software; or
- *
- * (b) any new file in Source Code Form that contains any Covered
- * Software.
- *
- * 1.11. "Patent Claims" of a Contributor
- * means any patent claim(s), including without limitation, method,
- * process, and apparatus claims, in any patent Licensable by such
- * Contributor that would be infringed, but for the grant of the
- * License, by the making, using, selling, offering for sale, having
- * made, import, or transfer of either its Contributions or its
- * Contributor Version.
- *
- * 1.12. "Secondary License"
- * means either the GNU General Public License, Version 2.0, the GNU
- * Lesser General Public License, Version 2.1, the GNU Affero General
- * Public License, Version 3.0, or any later versions of those
- * licenses.
- *
- * 1.13. "Source Code Form"
- * means the form of the work preferred for making modifications.
- *
- * 1.14. "You" (or "Your")
- * means an individual or a legal entity exercising rights under this
- * License. For legal entities, "You" includes any entity that
- * controls, is controlled by, or is under common control with You. For
- * purposes of this definition, "control" means (a) the power, direct
- * or indirect, to cause the direction or management of such entity,
- * whether by contract or otherwise, or (b) ownership of more than
- * fifty percent (50%) of the outstanding shares or beneficial
- * ownership of such entity.
- *
- * 2. License Grants and Conditions
- * --------------------------------
- *
- * 2.1. Grants
- *
- * Each Contributor hereby grants You a world-wide, royalty-free,
- * non-exclusive license:
- *
- * (a) under intellectual property rights (other than patent or trademark)
- * Licensable by such Contributor to use, reproduce, make available,
- * modify, display, perform, distribute, and otherwise exploit its
- * Contributions, either on an unmodified basis, with Modifications, or
- * as part of a Larger Work; and
- *
- * (b) under Patent Claims of such Contributor to make, use, sell, offer
- * for sale, have made, import, and otherwise transfer either its
- * Contributions or its Contributor Version.
- *
- * 2.2. Effective Date
- *
- * The licenses granted in Section 2.1 with respect to any Contribution
- * become effective for each Contribution on the date the Contributor first
- * distributes such Contribution.
- *
- * 2.3. Limitations on Grant Scope
- *
- * The licenses granted in this Section 2 are the only rights granted under
- * this License. No additional rights or licenses will be implied from the
- * distribution or licensing of Covered Software under this License.
- * Notwithstanding Section 2.1(b) above, no patent license is granted by a
- * Contributor:
- *
- * (a) for any code that a Contributor has removed from Covered Software;
- * or
- *
- * (b) for infringements caused by: (i) Your and any other third party's
- * modifications of Covered Software, or (ii) the combination of its
- * Contributions with other software (except as part of its Contributor
- * Version); or
- *
- * (c) under Patent Claims infringed by Covered Software in the absence of
- * its Contributions.
- *
- * This License does not grant any rights in the trademarks, service marks,
- * or logos of any Contributor (except as may be necessary to comply with
- * the notice requirements in Section 3.4).
- *
- * 2.4. Subsequent Licenses
- *
- * No Contributor makes additional grants as a result of Your choice to
- * distribute the Covered Software under a subsequent version of this
- * License (see Section 10.2) or under the terms of a Secondary License (if
- * permitted under the terms of Section 3.3).
- *
- * 2.5. Representation
- *
- * Each Contributor represents that the Contributor believes its
- * Contributions are its original creation(s) or it has sufficient rights
- * to grant the rights to its Contributions conveyed by this License.
- *
- * 2.6. Fair Use
- *
- * This License is not intended to limit any rights You have under
- * applicable copy-right doctrines of fair use, fair dealing, or other
- * equivalents.
- *
- * 2.7. Conditions
- *
- * Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
- * in Section 2.1.
- *
- * 3. Responsibilities
- * -------------------
- *
- * 3.1. Distribution of Source Form
- *
- * All distribution of Covered Software in Source Code Form, including any
- * Modifications that You create or to which You contribute, must be under
- * the terms of this License. You must inform recipients that the Source
- * Code Form of the Covered Software is governed by the terms of this
- * License, and how they can obtain a copy of this License. You may not
- * attempt to alter or restrict the recipients' rights in the Source Code
- * Form.
- *
- * 3.2. Distribution of Executable Form
- *
- * If You distribute Covered Software in Executable Form then:
- *
- * (a) such Covered Software must also be made available in Source Code
- * Form, as described in Section 3.1, and You must inform recipients of
- * the Executable Form how they can obtain a copy of such Source Code
- * Form by reasonable means in a timely manner, at a charge no more
- * than the cost of distribution to the recipient; and
- *
- * (b) You may distribute such Executable Form under the terms of this
- * License, or sublicense it under different terms, provided that the
- * license for the Executable Form does not attempt to limit or alter
- * the recipients' rights in the Source Code Form under this License.
- *
- * 3.3. Distribution of a Larger Work
- *
- * You may create and distribute a Larger Work under terms of Your choice,
- * provided that You also comply with the requirements of this License for
- * the Covered Software. If the Larger Work is a combination of Covered
- * Software with a work governed by one or more Secondary Licenses, and the
- * Covered Software is not Incompatible With Secondary Licenses, this
- * License permits You to additionally distribute such Covered Software
- * under the terms of such Secondary License(s), so that the recipient of
- * the Larger Work may, at their option, further distribute the Covered
- * Software under the terms of either this License or such Secondary
- * License(s).
- *
- * 3.4. Notices
- *
- * You may not remove or alter the substance of any license notices
- * (including copy-right notices, patent notices, disclaimers of warranty,
- * or limitations of liability) contained within the Source Code Form of
- * the Covered Software, except that You may alter any license notices to
- * the extent required to remedy known factual inaccuracies.
- *
- * 3.5. Application of Additional Terms
- *
- * You may choose to offer, and to charge a fee for, warranty, support,
- * indemnity or liability obligations to one or more recipients of Covered
- * Software. However, You may do so only on Your own behalf, and not on
- * behalf of any Contributor. You must make it absolutely clear that any
- * such warranty, support, indemnity, or liability obligation is offered by
- * You alone, and You hereby agree to indemnify every Contributor for any
- * liability incurred by such Contributor as a result of warranty, support,
- * indemnity or liability terms You offer. You may include additional
- * disclaimers of warranty and limitations of liability specific to any
- * jurisdiction.
- *
- * 4. Inability to Comply Due to Statute or Regulation
- * ---------------------------------------------------
- *
- * If it is impossible for You to comply with any of the terms of this
- * License with respect to some or all of the Covered Software due to
- * statute, judicial order, or regulation then You must: (a) comply with
- * the terms of this License to the maximum extent possible; and (b)
- * describe the limitations and the code they affect. Such description must
- * be placed in a text file included with all distributions of the Covered
- * Software under this License. Except to the extent prohibited by statute
- * or regulation, such description must be sufficiently detailed for a
- * recipient of ordinary skill to be able to understand it.
- *
- * 5. Termination
- * --------------
- *
- * 5.1. The rights granted under this License will terminate automatically
- * if You fail to comply with any of its terms. However, if You become
- * compliant, then the rights granted under this License from a particular
- * Contributor are reinstated (a) provisionally, unless and until such
- * Contributor explicitly and finally terminates Your grants, and (b) on an
- * ongoing basis, if such Contributor fails to notify You of the
- * non-compliance by some reasonable means prior to 60 days after You have
- * come back into compliance. Moreover, Your grants from a particular
- * Contributor are reinstated on an ongoing basis if such Contributor
- * notifies You of the non-compliance by some reasonable means, this is the
- * first time You have received notice of non-compliance with this License
- * from such Contributor, and You become compliant prior to 30 days after
- * Your receipt of the notice.
- *
- * 5.2. If You initiate litigation against any entity by asserting a patent
- * infringement claim (excluding declaratory judgment actions,
- * counter-claims, and cross-claims) alleging that a Contributor Version
- * directly or indirectly infringes any patent, then the rights granted to
- * You by any and all Contributors for the Covered Software under Section
- * 2.1 of this License shall terminate.
- *
- * 5.3. In the event of termination under Sections 5.1 or 5.2 above, all
- * end user license agreements (excluding distributors and resellers) which
- * have been validly granted by You or Your distributors under this License
- * prior to termination shall survive termination.
- *
- * ***********************************************************************
- * *
- * 6. Disclaimer of Warranty *
- * ------------------------- *
- * *
- * Covered Software is provided under this License on an "as is" *
- * basis, without warranty of any kind, either expressed, implied, or *
- * statutory, including, without limitation, warranties that the *
- * Covered Software is free of defects, merchantable, fit for a *
- * particular purpose or non-infringing. The entire risk as to the *
- * quality and performance of the Covered Software is with You. *
- * Should any Covered Software prove defective in any respect, You *
- * (not any Contributor) assume the cost of any necessary servicing, *
- * repair, or correction. This disclaimer of warranty constitutes an *
- * essential part of this License. No use of any Covered Software is *
- * authorized under this License except under this disclaimer. *
- * *
- * ***********************************************************************
- *
- * ***********************************************************************
- * *
- * 7. Limitation of Liability *
- * -------------------------- *
- * *
- * Under no circumstances and under no legal theory, whether tort *
- * (including negligence), contract, or otherwise, shall any *
- * Contributor, or anyone who distributes Covered Software as *
- * permitted above, be liable to You for any direct, indirect, *
- * special, incidental, or consequential damages of any character *
- * including, without limitation, damages for lost profits, loss of *
- * goodwill, work stoppage, computer failure or malfunction, or any *
- * and all other commercial damages or losses, even if such party *
- * shall have been informed of the possibility of such damages. This *
- * limitation of liability shall not apply to liability for death or *
- * personal injury resulting from such party's negligence to the *
- * extent applicable law prohibits such limitation. Some *
- * jurisdictions do not allow the exclusion or limitation of *
- * incidental or consequential damages, so this exclusion and *
- * limitation may not apply to You. *
- * *
- * ***********************************************************************
- *
- * 8. Litigation
- * -------------
- *
- * Any litigation relating to this License may be brought only in the
- * courts of a jurisdiction where the defendant maintains its principal
- * place of business and such litigation shall be governed by laws of that
- * jurisdiction, without reference to its conflict-of-law provisions.
- * Nothing in this Section shall prevent a party's ability to bring
- * cross-claims or counter-claims.
- *
- * 9. Miscellaneous
- * ----------------
- *
- * This License represents the complete agreement concerning the subject
- * matter hereof. If any provision of this License is held to be
- * unenforceable, such provision shall be reformed only to the extent
- * necessary to make it enforceable. Any law or regulation which provides
- * that the language of a contract shall be construed against the drafter
- * shall not be used to construe this License against a Contributor.
- *
- * 10. Versions of the License
- * ---------------------------
- *
- * 10.1. New Versions
- *
- * Mozilla Foundation is the license steward. Except as provided in Section
- * 10.3, no one other than the license steward has the right to modify or
- * publish new versions of this License. Each version will be given a
- * distinguishing version number.
- *
- * 10.2. Effect of New Versions
- *
- * You may distribute the Covered Software under the terms of the version
- * of the License under which You originally received the Covered Software,
- * or under the terms of any subsequent version published by the license
- * steward.
- *
- * 10.3. Modified Versions
- *
- * If you create software not governed by this License, and you want to
- * create a new license for such software, you may create and use a
- * modified version of this License if you rename the license and remove
- * any references to the name of the license steward (except to note that
- * such modified license differs from this License).
- *
- * 10.4. Distributing Source Code Form that is Incompatible With Secondary
- * Licenses
- *
- * If You choose to distribute Source Code Form that is Incompatible With
- * Secondary Licenses under the terms of this version of the License, the
- * notice described in Exhibit B of this License must be attached.
- *
- * Exhibit A - Source Code Form License Notice
- * -------------------------------------------
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * If it is not possible or desirable to put the notice in a particular
- * file, then You may include the notice in a location (such as a LICENSE
- * file in a relevant directory) where a recipient would be likely to look
- * for such a notice.
- *
- * You may add additional accurate notices of copy-right ownership.
- *
- * Exhibit B - "Incompatible With Secondary Licenses" Notice
- * ---------------------------------------------------------
- *
- * This Source Code Form is "Incompatible With Secondary Licenses", as
- * defined by the Mozilla Public License, v. 2.0.
- */
-package net.daporkchop.pepsimod.the.wurst.pkg.name;
diff --git a/src/main/java/net/daporkchop/pepsimod/util/AccountManager.java b/src/main/java/net/daporkchop/pepsimod/util/AccountManager.java
deleted file mode 100644
index 6ab2350..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/AccountManager.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util;
-
-import com.mojang.authlib.Agent;
-import com.mojang.authlib.AuthenticationService;
-import com.mojang.authlib.UserAuthentication;
-import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
-import com.mojang.util.UUIDTypeAdapter;
-import net.minecraft.client.Minecraft;
-import net.minecraft.util.Session;
-
-import java.lang.reflect.Field;
-import java.util.UUID;
-
-public class AccountManager extends PepsiConstants {
-
- private final UserAuthentication auth;
-
- public AccountManager() {
- UUID uuid = UUID.randomUUID();
- AuthenticationService authService = new YggdrasilAuthenticationService(Minecraft.getMinecraft().getProxy(), uuid.toString());
- this.auth = authService.createUserAuthentication(Agent.MINECRAFT);
- authService.createMinecraftSessionService();
- }
-
- /**
- * Sets the current session
- *
- * @param s
- * @throws Exception
- */
- public void setSession(Session s) throws Exception {
- Class extends Minecraft> mc = Minecraft.getMinecraft().getClass();
- try {
- Field session = null;
-
- for (Field f : mc.getDeclaredFields()) {
- if (f.getType().isInstance(s)) {
- session = f;
- //FMLLog.log.info("Found field " + f.toString() + ", injecting...");
- }
- }
-
- if (session == null) {
- throw new IllegalStateException("No field of type " + Session.class.getCanonicalName() + " declared.");
- }
-
- session.setAccessible(true);
- if (pepsimod.originalSession == null) {
- pepsimod.originalSession = Minecraft.getMinecraft().getSession();
- }
- session.set(Minecraft.getMinecraft(), s);
- session.setAccessible(false);
- } catch (Exception e) {
- e.printStackTrace();
- throw e;
- }
- }
-
- /**
- * Sets the current user as a player with the given credentials
- *
- * @param username
- * @param password
- * @return
- */
- public void setUser(String username, String password) {
- if (Minecraft.getMinecraft().getSession().getUsername() != username || "0".equals(Minecraft.getMinecraft().getSession().getToken())) {
- /*for (Config.AccountEntry data : Pepsimod.pepsimodInstance.getConfig().getAccounts()) {
- if (data.getUsername().equals(Minecraft.getMinecraft().getSession().getUsername()) && data.getUsername().equals(username)) {
- return;
- }
- }*/
- this.auth.logOut();
- this.auth.setUsername(username);
- this.auth.setPassword(password);
- try {
- this.auth.logIn();
- Session session = new Session(this.auth.getSelectedProfile().getName(), UUIDTypeAdapter.fromUUID(this.auth.getSelectedProfile().getId()), this.auth.getAuthenticatedToken(), this.auth.getUserType().getName());
- this.setSession(session);
- /*for (int i = 0; i < Pepsimod.pepsimodInstance.getConfig().getAccounts().size(); i++) {
- Config.AccountEntry data = Pepsimod.pepsimodInstance.getConfig().getAccounts().get(i);
- if (data.getUsername().equals(username) && data.getPassword().equals(password)) {
- data.setName(session.getUsername());
- }
- }*/
- } catch (Exception e) {
- e.printStackTrace();
- }
- } else {
- //user is already logged in, do nothing
- }
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/EntityFakePlayer.java b/src/main/java/net/daporkchop/pepsimod/util/EntityFakePlayer.java
deleted file mode 100644
index 041c980..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/EntityFakePlayer.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util;
-
-import net.minecraft.client.entity.EntityOtherPlayerMP;
-
-import static net.daporkchop.pepsimod.util.PepsiConstants.mc;
-
-public class EntityFakePlayer extends EntityOtherPlayerMP {
- public EntityFakePlayer() {
- super(mc.world, mc.player.getGameProfile());
- this.copyLocationAndAnglesFrom(mc.player);
-
- // fix inventory
- this.inventory.copyInventory(mc.player.inventory);
- PepsiUtils.copyPlayerModel(mc.player, this);
-
- // fix rotation
- this.rotationYawHead = mc.player.rotationYawHead;
- this.renderYawOffset = mc.player.renderYawOffset;
-
- // fix cape movement
- this.chasingPosX = this.posX;
- this.chasingPosY = this.posY;
- this.chasingPosZ = this.posZ;
-
- // spawn
- mc.world.addEntityToWorld(this.getEntityId(), this);
- }
-
- public void resetPlayerPosition() {
- mc.player.setPositionAndRotation(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
- }
-
- public void despawn() {
- mc.world.removeEntityFromWorld(this.getEntityId());
- }
-}
\ No newline at end of file
diff --git a/src/main/java/net/daporkchop/pepsimod/util/HTTPUtils.java b/src/main/java/net/daporkchop/pepsimod/util/HTTPUtils.java
deleted file mode 100644
index 56d585a..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/HTTPUtils.java
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util;
-
-import org.apache.commons.codec.Charsets;
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang3.Validate;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
-import java.net.HttpURLConnection;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLEncoder;
-import java.util.Map;
-
-@SuppressWarnings("deprecation")
-public class HTTPUtils {
-
- public static HttpURLConnection createUrlConnection(final URL url) throws IOException {
- Validate.notNull(url);
- final HttpURLConnection connection = (HttpURLConnection) url.openConnection();
- connection.setConnectTimeout(15000);
- connection.setReadTimeout(15000);
- connection.setUseCaches(false);
- return connection;
- }
-
- /**
- * Performs a POST request to the specified URL and returns the result.
- *
- * The POST data will be encoded in UTF-8 as the specified contentType. The response will be parsed as UTF-8.
- * If the server returns an error but still provides a body, the body will be returned as normal.
- * If the server returns an error without any body, a relevant {@link java.io.IOException} will be thrown.
- *
- * @param url URL to submit the POST request to
- * @param post POST data in the correct format to be submitted
- * @param contentType Content type of the POST data
- * @return Raw text response from the server
- * @throws IOException The request was not successful
- */
- public static String performPostRequest(final URL url, final String post, final String contentType) throws IOException {
- Validate.notNull(url);
- Validate.notNull(post);
- Validate.notNull(contentType);
- final HttpURLConnection connection = createUrlConnection(url);
- final byte[] postAsBytes = post.getBytes(Charsets.UTF_8);
-
- connection.setRequestProperty("Content-Type", contentType + "; charset=utf-8");
- connection.setRequestProperty("Content-Length", "" + postAsBytes.length);
- connection.setDoOutput(true);
-
- OutputStream outputStream = null;
- try {
- outputStream = connection.getOutputStream();
- IOUtils.write(postAsBytes, outputStream);
- } finally {
- IOUtils.closeQuietly(outputStream);
- }
-
- InputStream inputStream = null;
- try {
- inputStream = connection.getInputStream();
- final String result = IOUtils.toString(inputStream, Charsets.UTF_8);
- return result;
- } catch (final IOException e) {
- IOUtils.closeQuietly(inputStream);
- inputStream = connection.getErrorStream();
-
- if (inputStream != null) {
- final String result = IOUtils.toString(inputStream, Charsets.UTF_8);
- return result;
- } else {
- throw e;
- }
- } finally {
- IOUtils.closeQuietly(inputStream);
- }
- }
-
- /**
- * Performs a POST request to the specified URL and returns the result.
- *
- * The POST data will be encoded in UTF-8 as the specified contentType. The response will be parsed as UTF-8.
- * If the server returns an error but still provides a body, the body will be returned as normal.
- * If the server returns an error without any body, a relevant {@link java.io.IOException} will be thrown.
- *
- * @param url URL to submit the POST request to
- * @param post POST data in the correct format to be submitted
- * @param contentType Content type of the POST data
- * @return Raw text response from the server
- * @throws IOException The request was not successful
- */
- public static String performPostRequestWithAuth(final URL url, final String post, final String contentType, final String auth) throws IOException {
- Validate.notNull(url);
- Validate.notNull(post);
- Validate.notNull(contentType);
- final HttpURLConnection connection = createUrlConnection(url);
- final byte[] postAsBytes = post.getBytes(Charsets.UTF_8);
-
- connection.setRequestProperty("Authorization", auth);
- connection.setRequestProperty("Content-Type", contentType + "; charset=utf-8");
- connection.setRequestProperty("Content-Length", "" + postAsBytes.length);
- connection.setDoOutput(true);
-
- OutputStream outputStream = null;
- try {
- outputStream = connection.getOutputStream();
- IOUtils.write(postAsBytes, outputStream);
- } finally {
- IOUtils.closeQuietly(outputStream);
- }
-
- InputStream inputStream = null;
- try {
- inputStream = connection.getInputStream();
- final String result = IOUtils.toString(inputStream, Charsets.UTF_8);
- return result;
- } catch (final IOException e) {
- IOUtils.closeQuietly(inputStream);
- inputStream = connection.getErrorStream();
-
- if (inputStream != null) {
- final String result = IOUtils.toString(inputStream, Charsets.UTF_8);
- return result;
- } else {
- throw e;
- }
- } finally {
- IOUtils.closeQuietly(inputStream);
- }
- }
-
- /**
- * Performs a GET request to the specified URL and returns the result.
- *
- * The response will be parsed as UTF-8.
- * If the server returns an error but still provides a body, the body will be returned as normal.
- * If the server returns an error without any body, a relevant {@link java.io.IOException} will be thrown.
- *
- * @param url URL to submit the GET request to
- * @return Raw text response from the server
- * @throws IOException The request was not successful
- */
- public static String performGetRequest(final URL url) throws IOException {
- Validate.notNull(url);
- final HttpURLConnection connection = createUrlConnection(url);
-
- InputStream inputStream = null;
- try {
- inputStream = connection.getInputStream();
- final String result = IOUtils.toString(inputStream, Charsets.UTF_8);
- return result;
- } catch (final IOException e) {
- IOUtils.closeQuietly(inputStream);
- inputStream = connection.getErrorStream();
-
- if (inputStream != null) {
- final String result = IOUtils.toString(inputStream, Charsets.UTF_8);
- return result;
- } else {
- throw e;
- }
- } finally {
- IOUtils.closeQuietly(inputStream);
- }
- }
-
- /**
- * Creates a {@link URL} with the specified string, throwing an {@link java.lang.Error} if the URL was malformed.
- *
- * This is just a wrapper to allow URLs to be created in constants, where you know the URL is valid.
- *
- * @param url URL to construct
- * @return URL constructed
- */
- public static URL constantURL(final String url) {
- try {
- return new URL(url);
- } catch (final MalformedURLException ex) {
- throw new Error("Couldn't create constant for " + url, ex);
- }
- }
-
- /**
- * Turns the specified Map into an encoded & escaped query
- *
- * @param query Map to convert into a text based query
- * @return Resulting query.
- */
- public static String buildQuery(final Map query) {
- if (query == null) {
- return "";
- }
- final StringBuilder builder = new StringBuilder();
-
- for (final Map.Entry entry : query.entrySet()) {
- if (builder.length() > 0) {
- builder.append('&');
- }
-
- try {
- builder.append(URLEncoder.encode(entry.getKey(), "UTF-8"));
- } catch (final UnsupportedEncodingException e) {
- }
-
- if (entry.getValue() != null) {
- builder.append('=');
- try {
- builder.append(URLEncoder.encode(entry.getValue().toString(), "UTF-8"));
- } catch (final UnsupportedEncodingException e) {
- }
- }
- }
-
- return builder.toString();
- }
-
- /**
- * Concatenates the given {@link java.net.URL} and query.
- *
- * @param url URL to base off
- * @param query Query to append to URL
- * @return URL constructed
- */
- public static URL concatenateURL(final URL url, final String query) {
- try {
- return url.getQuery() != null && !url.getQuery().isEmpty() ? new URL(url.getProtocol(), url.getHost(), url.getPort(), url.getFile() + "&" + query) : new URL(url.getProtocol(), url.getHost(), url.getPort(), url.getFile() + "?" + query);
- } catch (final MalformedURLException ex) {
- throw new IllegalArgumentException("Could not concatenate given URL with GET arguments!", ex);
- }
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/MCLeaks.java b/src/main/java/net/daporkchop/pepsimod/util/MCLeaks.java
deleted file mode 100644
index 474c3f5..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/MCLeaks.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util;
-
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
-import net.minecraft.client.Minecraft;
-import net.minecraft.network.NetworkManager;
-import net.minecraft.network.login.client.CPacketEncryptionResponse;
-import net.minecraft.network.login.server.SPacketEncryptionRequest;
-import net.minecraft.util.CryptManager;
-import net.minecraft.util.text.TextComponentString;
-import net.minecraftforge.fml.common.FMLLog;
-
-import javax.annotation.Nullable;
-import javax.crypto.SecretKey;
-import javax.swing.JOptionPane;
-import java.io.IOException;
-import java.math.BigInteger;
-import java.net.URL;
-import java.security.PublicKey;
-
-public class MCLeaks {
-
- public static final URL redeemUrl = HTTPUtils.constantURL("http://auth.mcleaks.net/v1/redeem");
- public static final URL joinUrl = HTTPUtils.constantURL("http://auth.mcleaks.net/v1/joinserver");
-
- public static RedeemResponse redeemToken(String token) {
- try {
- String response = HTTPUtils.performPostRequest(redeemUrl,
- "{ \"token\": \"" + token + "\" }",
- "application/json");
-
- JsonObject json = (new JsonParser()).parse(response).getAsJsonObject();
- JsonObject result = json.getAsJsonObject("result");
-
- return new RedeemResponse(result.get("mcname").getAsString(), result.get("session").getAsString());
- } catch (IOException e) {
- e.printStackTrace();
- } catch (NullPointerException e) {
- JOptionPane.showMessageDialog(null, "Invalid or expired token!", "MCLeaks Error", JOptionPane.OK_OPTION);
- }
- return new RedeemResponse();
- }
-
- public static void joinServerStuff(SPacketEncryptionRequest pck, NetworkManager mgr) {
- try {
- final SecretKey secretkey = CryptManager.createNewSharedKey();
- String s = pck.getServerId();
- PublicKey publickey = pck.getPublicKey();
- String serverhash = (new BigInteger(CryptManager.getServerIdHash(s, publickey, secretkey))).toString(16);
-
- String request = "{ \"session\": \"" + Minecraft.getMinecraft().getSession().getToken() + "\", " +
- "\"mcname\": \"" + Minecraft.getMinecraft().getSession().getUsername() + "\", " +
- "\"serverhash\": \"" + serverhash + "\", \"server\": " +
- '"' + (Minecraft.getMinecraft().getCurrentServerData().serverIP.split(":").length == 1 ? Minecraft.getMinecraft().getCurrentServerData().serverIP + ":25565" : Minecraft.getMinecraft().getCurrentServerData().serverIP) + "\" }";
-
- FMLLog.log.info(request);
-
- String result = HTTPUtils.performPostRequest(joinUrl, request, "application/json");
-
- FMLLog.log.info(result);
-
- JsonObject json = (new JsonParser()).parse(result).getAsJsonObject();
- if (!json.get("success").getAsBoolean()) {
- mgr.closeChannel(new TextComponentString("\u00A7c\u00A7lError validating \u00A79MCLeaks \u00A7ckey!"));
- }
-
- mgr.sendPacket(new CPacketEncryptionResponse(secretkey, publickey, pck.getVerifyToken()), p_operationComplete_1_ -> mgr.enableEncryption(secretkey));
-
- } catch (Exception e) {
- e.printStackTrace();
- System.exit(0);
- }
- }
-
- public static class RedeemResponse {
-
- public boolean success;
-
- @Nullable
- private String name;
-
- @Nullable
- private String session;
-
- public RedeemResponse() { //welp
- this.success = false;
- }
-
- public RedeemResponse(String n, String s) {
- this.success = true;
- this.name = n;
- this.session = s;
- }
-
- public String getName() {
- return this.name;
- }
-
- public String getSession() {
- return this.session;
- }
- }
-}
\ No newline at end of file
diff --git a/src/main/java/net/daporkchop/pepsimod/util/PepsiConstants.java b/src/main/java/net/daporkchop/pepsimod/util/PepsiConstants.java
index 2d882b7..88a1496 100644
--- a/src/main/java/net/daporkchop/pepsimod/util/PepsiConstants.java
+++ b/src/main/java/net/daporkchop/pepsimod/util/PepsiConstants.java
@@ -20,11 +20,28 @@
package net.daporkchop.pepsimod.util;
+import com.google.gson.JsonParser;
import net.daporkchop.pepsimod.Pepsimod;
+import net.daporkchop.pepsimod.util.event.EventManager;
+import net.daporkchop.pepsimod.util.render.BetterScaledResolution;
import net.minecraft.client.Minecraft;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
-public abstract class PepsiConstants {
- public static Minecraft mc = null;
- public static Pepsimod pepsimod = null;
- public static boolean mcStartedSuccessfully = false;
+/**
+ * Constant values used throughout the mod.
+ *
+ * @author DaPorkchop_
+ */
+public interface PepsiConstants {
+ Minecraft mc = PepsiUtil.getNull();
+ Pepsimod pepsimod = Pepsimod.INSTANCE();
+ Logger log = LogManager.getFormatterLogger("pepsimod");
+ EventManager EVENT_MANAGER = PepsiUtil.getInputValue(new EventManager());
+ JsonParser JSON_PARSER = new JsonParser();
+ BetterScaledResolution RESOLUTION = BetterScaledResolution.NOOP;
+
+ String MOD_ID = "pepsimod";
+ String VERSION = PepsiUtil.getInputValue("unknown");
+ String VERSION_FULL = PepsiUtil.getInputValue("unknown");
}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/PepsiUtil.java b/src/main/java/net/daporkchop/pepsimod/util/PepsiUtil.java
new file mode 100644
index 0000000..159abae
--- /dev/null
+++ b/src/main/java/net/daporkchop/pepsimod/util/PepsiUtil.java
@@ -0,0 +1,206 @@
+/*
+ * Adapted from The MIT License (MIT)
+ *
+ * Copyright (c) 2016-2020 DaPorkchop_
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions:
+ *
+ * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
+ * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+package net.daporkchop.pepsimod.util;
+
+import lombok.NonNull;
+import lombok.experimental.UtilityClass;
+import net.daporkchop.pepsimod.asm.PepsimodMixinLoader;
+import net.daporkchop.pepsimod.util.event.EventPriority;
+import net.daporkchop.pepsimod.util.event.impl.render.PreRenderEvent;
+import net.daporkchop.pepsimod.util.render.text.FixedColorTextRenderer;
+import net.daporkchop.pepsimod.util.render.text.TextRenderer;
+import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
+
+import javax.imageio.ImageIO;
+import java.awt.Color;
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.util.Arrays;
+
+/**
+ * Common methods used throughout the mod.
+ *
+ * @author DaPorkchop_
+ */
+@UtilityClass
+public final class PepsiUtil implements PepsiConstants {
+ public final int[] PEPSI_LOGO_SIZES = {16, 32, 64, 128, 256};
+ public final BufferedImage[] PEPSI_LOGOS = new BufferedImage[PEPSI_LOGO_SIZES.length];
+ public final char[] RANDOM_COLORS = {'c', '9', 'f', '1', '4'};
+ public TextRenderer TEXT_RENDERER = new FixedColorTextRenderer(Color.RED);
+ public final Field FIELD_MODIFIERS = getField(Field.class, "modifiers");
+
+ protected final Object PEPSIUTIL_MUTEX = new Object[0];
+ protected boolean STANDARD_EVENTS_REGISTERED = false;
+
+ static {
+ for (int i = PEPSI_LOGOS.length - 1; i >= 0; i--) {
+ try (InputStream in = PepsiUtil.class.getResourceAsStream(String.format("/assets/pepsimod/textures/icon/pepsilogo-%d.png", PEPSI_LOGO_SIZES[i]))) {
+ PEPSI_LOGOS[i] = ImageIO.read(in);
+ } catch (Exception e) {
+ log.error("Unable to load pepsilogo at %1$dx%1$d resolution!", PEPSI_LOGO_SIZES[i]);
+ }
+ }
+ }
+
+ /**
+ * This returns {@code null} in a very roundabout way. This is to work around warnings in IntelliJ that certain values are always
+ * {@code null} when they're actually initialized reflectively at runtime.
+ *
+ * @param the type of {@code null} to get
+ * @return {@code null}
+ */
+ @SuppressWarnings("unchecked")
+ public T getNull() {
+ Object[] o = new Object[1];
+ return (T) o[0];
+ }
+
+ /**
+ * This returns the input value in a very roundabout way. This is to work around warnings in IntelliJ that certain values are constant when
+ * they're actually initialized reflectively at runtime.
+ *
+ * @param val the value to get
+ * @param the type of value to get
+ * @return the input value
+ */
+ public T getInputValue(T val) {
+ return val;
+ }
+
+ /**
+ * Registers all standard event listeners (listeners that are always active).
+ *
+ * May only be invoked once by {@link net.daporkchop.pepsimod.Pepsimod#preInit(FMLPreInitializationEvent)}.
+ */
+ public void registerStandardEvents() {
+ synchronized (PEPSIUTIL_MUTEX) {
+ if (!STANDARD_EVENTS_REGISTERED) {
+ STANDARD_EVENTS_REGISTERED = true;
+
+ EVENT_MANAGER.register(PreRenderEvent.class, partialTicks -> {
+ TEXT_RENDERER.update();
+ RESOLUTION.update();
+ }, EventPriority.MONITOR);
+ } else {
+ throw new IllegalStateException("Standard events already registered!");
+ }
+ }
+ }
+
+ /**
+ * Gets a field from a class with any one of the given names.
+ *
+ * @param clazz the class containing the field
+ * @param names all of the possible names for the field. The first match will be used
+ * @return a {@link Field} with one of the given names
+ * @throws IllegalStateException if no field with any of the given names could be found in the given class
+ */
+ public Field getField(@NonNull Class> clazz, @NonNull String... names) throws IllegalStateException {
+ Field field = null;
+ for (String name : names) {
+ if (name == null) {
+ throw new NullPointerException();
+ }
+ try {
+ field = clazz.getDeclaredField(name);
+ break;
+ } catch (NoSuchFieldException e) {
+ }
+ }
+ if (field != null) {
+ field.setAccessible(true);
+ return field;
+ } else {
+ throw new IllegalStateException(String.format("Couldn't find field in class \"%s\" with any of the following names: %s", clazz, Arrays.toString(names)));
+ }
+ }
+
+ /**
+ * Replaces the value of a {@code static final} field.
+ *
+ * @param val the new value
+ * @param clazz the class containing the field
+ * @param names all of the possible names of the field
+ * @throws IllegalStateException if no field with any of the given names could be found in the given class
+ */
+ public void putStaticFinalField(Object val, @NonNull Class> clazz, @NonNull String... names) throws IllegalStateException {
+ putFinalField(null, val, clazz, names);
+ }
+
+ /**
+ * Replaces the value of a {@code final} field.
+ *
+ * @param obj an instance of which to replace the value
+ * @param val the new value
+ * @param clazz the class containing the field
+ * @param names all of the possible names of the field
+ * @throws IllegalStateException if no field with any of the given names could be found in the given class
+ */
+ public void putFinalField(Object obj, Object val, @NonNull Class> clazz, @NonNull String... names) throws IllegalStateException {
+ try {
+ Field field = getField(clazz, names);
+ FIELD_MODIFIERS.setInt(field, field.getModifiers() & ~Modifier.FINAL);
+ field.set(obj, val);
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * Replaces the global text renderer instance.
+ *
+ * @param renderer the new text renderer to use
+ */
+ public void setTextRenderer(@NonNull TextRenderer renderer) {
+ synchronized (PEPSIUTIL_MUTEX) {
+ TextRenderer old = TEXT_RENDERER;
+ TEXT_RENDERER = renderer;
+ old.close();
+ }
+ }
+
+ /**
+ * Gets a resource as an {@link InputStream}.
+ *
+ * Functions the same as {@link Class#getResourceAsStream(String)}, with the only major difference being that this is is hot-swap safe for dev
+ * environments.
+ *
+ * @param name the name of the resource
+ * @return an {@link InputStream} allowing the reading of the resource with the given name, or {@code null} if it could not be found
+ */
+ public InputStream getResourceAsStream(@NonNull String name) {
+ if (PepsimodMixinLoader.OBFUSCATED) {
+ return PepsiUtil.class.getResourceAsStream(name);
+ } else {
+ try {
+ return new FileInputStream(new File(mc.gameDir, "../src/main/resources" + name));
+ } catch (FileNotFoundException e) {
+ return null;
+ }
+ }
+ }
+}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/PepsiUtils.java b/src/main/java/net/daporkchop/pepsimod/util/PepsiUtils.java
deleted file mode 100644
index 6a55d9e..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/PepsiUtils.java
+++ /dev/null
@@ -1,617 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util;
-
-import net.daporkchop.pepsimod.Pepsimod;
-import net.daporkchop.pepsimod.optimization.BlockID;
-import net.daporkchop.pepsimod.util.colors.ColorizedText;
-import net.daporkchop.pepsimod.util.colors.FixedColorElement;
-import net.daporkchop.pepsimod.util.colors.GradientText;
-import net.daporkchop.pepsimod.util.colors.rainbow.ColorChangeType;
-import net.daporkchop.pepsimod.util.colors.rainbow.RainbowCycle;
-import net.daporkchop.pepsimod.util.colors.rainbow.RainbowText;
-import net.daporkchop.pepsimod.util.config.impl.GeneralTranslator;
-import net.daporkchop.pepsimod.util.config.impl.TargettingTranslator;
-import net.daporkchop.pepsimod.util.misc.IWurstRenderListener;
-import net.minecraft.block.Block;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.FontRenderer;
-import net.minecraft.client.gui.GuiButton;
-import net.minecraft.client.gui.GuiDisconnected;
-import net.minecraft.client.multiplayer.ServerData;
-import net.minecraft.client.renderer.BufferBuilder;
-import net.minecraft.client.renderer.GlStateManager;
-import net.minecraft.client.renderer.RenderHelper;
-import net.minecraft.client.renderer.Tessellator;
-import net.minecraft.client.renderer.Vector3d;
-import net.minecraft.client.renderer.block.model.IBakedModel;
-import net.minecraft.client.renderer.entity.RenderManager;
-import net.minecraft.client.renderer.texture.TextureAtlasSprite;
-import net.minecraft.client.renderer.texture.TextureMap;
-import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
-import net.minecraft.client.settings.KeyBinding;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.EntityLivingBase;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemArmor;
-import net.minecraft.item.ItemBow;
-import net.minecraft.item.ItemEgg;
-import net.minecraft.item.ItemEnderPearl;
-import net.minecraft.item.ItemFishingRod;
-import net.minecraft.item.ItemLingeringPotion;
-import net.minecraft.item.ItemSnowball;
-import net.minecraft.item.ItemSplashPotion;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.EnumFacing;
-import net.minecraft.util.math.AxisAlignedBB;
-import net.minecraft.util.math.BlockPos;
-import net.minecraft.util.math.Vec3d;
-import net.minecraftforge.fml.client.FMLClientHandler;
-import org.apache.commons.lang3.ArrayUtils;
-import org.lwjgl.opengl.GL11;
-
-import javax.imageio.ImageIO;
-import java.awt.Color;
-import java.awt.image.BufferedImage;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Timer;
-import java.util.TimerTask;
-import java.util.concurrent.ThreadLocalRandom;
-
-public class PepsiUtils extends PepsiConstants {
- public static final char COLOR_ESCAPE = '\u00A7';
- public static final String[] colorCodes = {"c", "9", "f", "1", "4"};
- public static final Timer timer = new Timer();
- public static final ServerData TOOBEETOOTEE_DATA = new ServerData("toobeetootee", "2b2t.org", false);
- public static final KeyBinding[] controls = {
- mc.gameSettings.keyBindForward, mc.gameSettings.keyBindBack,
- mc.gameSettings.keyBindRight, mc.gameSettings.keyBindLeft,
- mc.gameSettings.keyBindJump, mc.gameSettings.keyBindSneak
- };
- public static final BufferedImage PEPSI_LOGO;
- public static String buttonPrefix = COLOR_ESCAPE + "c";
- public static RainbowCycle rainbowCycle = new RainbowCycle();
- public static Color RAINBOW_COLOR = new Color(0, 0, 0);
- public static RainbowText PEPSI_NAME = new RainbowText(Pepsimod.NAME_VERSION);
- public static ArrayList wurstRenderListeners = new ArrayList<>();
- public static ArrayList toRemoveWurstRenderListeners = new ArrayList<>();
- public static GuiButton reconnectButton;
- public static GuiButton autoReconnectButton;
- public static int autoReconnectWaitTime = 5;
- public static String lastIp;
- public static int lastPort;
-
- static {
- TOOBEETOOTEE_DATA.setResourceMode(ServerData.ServerResourceMode.PROMPT);
-
- timer.schedule(new TimerTask() {
- @Override
- public void run() {// random colors
- PepsiUtils.buttonPrefix = PepsiUtils.COLOR_ESCAPE + colorCodes[ThreadLocalRandom.current().nextInt(PepsiUtils.colorCodes.length)];
- }
- }, 1000, 1000);
-
- timer.schedule(new TimerTask() { //autoreconnect
- @Override
- public void run() {
- if (mc.currentScreen != null && mc.currentScreen instanceof GuiDisconnected && autoReconnectButton != null && GeneralTranslator.INSTANCE.autoReconnect) {
- autoReconnectButton.displayString = "AutoReconnect (\u00A7a" + --autoReconnectWaitTime + "\u00A7r)";
- if (autoReconnectWaitTime <= 0) {
- ServerData data = new ServerData("", lastIp + ':' + lastPort, false);
- data.setResourceMode(ServerData.ServerResourceMode.PROMPT);
- mc.addScheduledTask(() -> FMLClientHandler.instance().connectToServer(mc.currentScreen, data));
- autoReconnectWaitTime = 5;
- }
- }
- }
- }, 1000, 1000);
-
- timer.schedule(new TimerTask() {
- @Override
- public void run() { //rainbow
- //red
- if (rainbowCycle.red == ColorChangeType.INCREASE) {
- rainbowCycle.r += 4;
- if (rainbowCycle.r > 255) {
- rainbowCycle.red = ColorChangeType.DECRASE;
- rainbowCycle.green = ColorChangeType.INCREASE;
- }
- } else if (rainbowCycle.red == ColorChangeType.DECRASE) {
- rainbowCycle.r -= 4;
- if (rainbowCycle.r == 0) {
- rainbowCycle.red = ColorChangeType.NONE;
- }
- }
- //green
- if (rainbowCycle.green == ColorChangeType.INCREASE) {
- rainbowCycle.g += 4;
- if (rainbowCycle.g > 255) {
- rainbowCycle.green = ColorChangeType.DECRASE;
- rainbowCycle.blue = ColorChangeType.INCREASE;
- }
- } else if (rainbowCycle.green == ColorChangeType.DECRASE) {
- rainbowCycle.g -= 4;
- if (rainbowCycle.g == 0) {
- rainbowCycle.green = ColorChangeType.NONE;
- }
- }
- //blue
- if (rainbowCycle.blue == ColorChangeType.INCREASE) {
- rainbowCycle.b += 4;
- if (rainbowCycle.b > 255) {
- rainbowCycle.blue = ColorChangeType.DECRASE;
- rainbowCycle.red = ColorChangeType.INCREASE;
- }
- } else if (rainbowCycle.blue == ColorChangeType.DECRASE) {
- rainbowCycle.b -= 4;
- if (rainbowCycle.b == 0) {
- rainbowCycle.blue = ColorChangeType.NONE;
- }
- }
- RAINBOW_COLOR = new Color(ensureRange(rainbowCycle.r, 0, 255), ensureRange(rainbowCycle.g, 0, 255), ensureRange(rainbowCycle.b, 0, 255));
- }
- }, 0, 50);
-
- BufferedImage pepsiLogo = null;
- try (InputStream in = PepsiUtils.class.getResourceAsStream("/pepsilogo.png")) {
- pepsiLogo = ImageIO.read(in);
- } catch (IOException e) {
- throw new RuntimeException(e);
- } finally {
- PEPSI_LOGO = pepsiLogo;
- }
- }
-
- /**
- * Makes a gradient! Cache this, as it's quite resource-intensive
- *
- * @param text the text to gradient-ify
- * @param color1 the starting color
- * @param color2 the ending color
- * @param through the color in the middle
- * @return a filled GradientText
- */
- public static ColorizedText getGradientFromStringThroughColor(String text, Color color1, Color color2, Color through) {
- int charCount = text.length();
- String[] letters = text.split("");
- int colorCountPart1 = Math.floorDiv(charCount, 2);
- int colorCountPart2 = ceilDiv(charCount, 2);
- Color[] colorsPart1 = new Color[colorCountPart1];
- Color[] colorsPart2 = new Color[colorCountPart2];
- int rDiffStep = (color1.getRed() - through.getRed()) / colorCountPart1;
- int gDiffStep = (color1.getGreen() - through.getGreen()) / colorCountPart1;
- int bDiffStep = (color1.getBlue() - through.getBlue()) / colorCountPart1;
- for (int i = 0; i < colorCountPart1; i++) { //first step
- colorsPart1[i] = new Color(ensureRange(color1.getRed() + i * rDiffStep * -1, 0, 255), ensureRange(color1.getGreen() + i * gDiffStep * -1, 0, 255), ensureRange(color1.getBlue() + i * bDiffStep * -1, 0, 255));
- }
- rDiffStep = (through.getRed() - color2.getRed()) / colorCountPart2;
- gDiffStep = (through.getGreen() - color2.getGreen()) / colorCountPart2;
- bDiffStep = (through.getBlue() - color2.getBlue()) / colorCountPart2;
- for (int i = 0; i < colorCountPart2; i++) { //second step
- colorsPart2[i] = new Color(ensureRange(through.getRed() + i * rDiffStep * -1, 0, 255), ensureRange(through.getGreen() + i * gDiffStep * -1, 0, 255), ensureRange(through.getBlue() + i * bDiffStep * -1, 0, 255));
- }
- FixedColorElement[] elements = new FixedColorElement[charCount];
- Color[] merged = ArrayUtils.addAll(colorsPart1, colorsPart2);
- for (int i = 0; i < charCount; i++) {
- elements[i] = new FixedColorElement(merged[i].getRGB(), letters[i]);
- }
- return new GradientText(elements, Minecraft.getMinecraft().fontRenderer.getStringWidth(text));
- }
-
- public static int ceilDiv(int x, int y) {
- return Math.floorDiv(x, y) + (x % y == 0 ? 0 : 1);
- }
-
- public static int ensureRange(int value, int min, int max) {
- int toReturn = Math.min(Math.max(value, min), max);
- return toReturn;
- }
-
- public static RainbowCycle rainbowCycle(int count, RainbowCycle toRunOn) {
- for (int i = 0; i < count; i++) {
- //red
- if (toRunOn.red == ColorChangeType.INCREASE) {
- toRunOn.r += 4;
- if (toRunOn.r > 255) {
- toRunOn.red = ColorChangeType.DECRASE;
- toRunOn.green = ColorChangeType.INCREASE;
- }
- } else if (toRunOn.red == ColorChangeType.DECRASE) {
- toRunOn.r -= 4;
- if (toRunOn.r == 0) {
- toRunOn.red = ColorChangeType.NONE;
- }
- }
- //green
- if (toRunOn.green == ColorChangeType.INCREASE) {
- toRunOn.g += 4;
- if (toRunOn.g > 255) {
- toRunOn.green = ColorChangeType.DECRASE;
- toRunOn.blue = ColorChangeType.INCREASE;
- }
- } else if (toRunOn.green == ColorChangeType.DECRASE) {
- toRunOn.g -= 4;
- if (toRunOn.g == 0) {
- toRunOn.green = ColorChangeType.NONE;
- }
- }
- //blue
- if (toRunOn.blue == ColorChangeType.INCREASE) {
- toRunOn.b += 4;
- if (toRunOn.b > 255) {
- toRunOn.blue = ColorChangeType.DECRASE;
- toRunOn.red = ColorChangeType.INCREASE;
- }
- } else if (toRunOn.blue == ColorChangeType.DECRASE) {
- toRunOn.b -= 4;
- if (toRunOn.b == 0) {
- toRunOn.blue = ColorChangeType.NONE;
- }
- }
- }
- return toRunOn;
- }
-
- public static RainbowCycle rainbowCycleBackwards(int count, RainbowCycle toRunOn) {
- for (int i = 0; i < count; i++) {
- //red
- if (toRunOn.red == ColorChangeType.INCREASE) { //decrease value
- toRunOn.r -= 8;
- if (toRunOn.r == 0) {
- toRunOn.red = ColorChangeType.NONE;
- }
- } else if (toRunOn.red == ColorChangeType.DECRASE) {
- toRunOn.r += 8;
- if (toRunOn.r > 255) {
- toRunOn.red = ColorChangeType.INCREASE;
- toRunOn.green = ColorChangeType.DECRASE;
- }
- }
-
- //green
- if (toRunOn.green == ColorChangeType.INCREASE) { //decrease value
- toRunOn.g -= 8;
- if (toRunOn.g == 0) {
- toRunOn.green = ColorChangeType.NONE;
- }
- } else if (toRunOn.green == ColorChangeType.DECRASE) {
- toRunOn.g += 8;
- if (toRunOn.g > 255) {
- toRunOn.green = ColorChangeType.INCREASE;
- toRunOn.blue = ColorChangeType.DECRASE;
- }
- }
-
- //blue
- if (toRunOn.blue == ColorChangeType.INCREASE) { //decrease value
- toRunOn.b -= 8;
- if (toRunOn.b == 0) {
- toRunOn.blue = ColorChangeType.NONE;
- }
- } else if (toRunOn.blue == ColorChangeType.DECRASE) {
- toRunOn.b += 8;
- if (toRunOn.b > 255) {
- toRunOn.blue = ColorChangeType.INCREASE;
- toRunOn.red = ColorChangeType.DECRASE;
- }
- }
- }
- return toRunOn;
- }
-
- public static boolean canEntityBeSeen(Entity entityIn, EntityPlayer player, TargettingTranslator.TargetBone bone) {
- return entityIn.world.rayTraceBlocks(new Vec3d(player.posX, player.posY + (double) player.getEyeHeight(), player.posZ), new Vec3d(entityIn.posX, getTargetHeight(entityIn, bone), entityIn.posZ), false, true, false) == null;
- }
-
- public static double getTargetHeight(Entity entity, TargettingTranslator.TargetBone bone) {
- double targetHeight = entity.posY;
- if (bone == TargettingTranslator.TargetBone.HEAD) {
- targetHeight = entity.getEyeHeight();
- } else if (bone == TargettingTranslator.TargetBone.MIDDLE) {
- targetHeight = entity.getEyeHeight() / 2;
- }
- return targetHeight;
- }
-
- public static Vec3d adjustVectorForBone(Vec3d vec3d, Entity entity, TargettingTranslator.TargetBone bone) {
- ReflectionStuff.setY_vec3d(vec3d, getTargetHeight(entity, bone));
- return vec3d;
- }
-
- public static void setBlockIdFields() {
- Block.REGISTRY.forEach(block -> ((BlockID) block).internal_setBlockId(Block.REGISTRY.getIDForObject(block)));
- }
-
- public static AxisAlignedBB cloneBB(AxisAlignedBB bb) {
- return new AxisAlignedBB(bb.minX, bb.minY, bb.minZ, bb.maxX, bb.maxY, bb.maxZ);
- }
-
- public static AxisAlignedBB offsetBB(AxisAlignedBB bb, BlockPos pos) {
- ReflectionStuff.setMinX(bb, ReflectionStuff.getMinX(bb) + pos.getX());
- ReflectionStuff.setMinY(bb, ReflectionStuff.getMinY(bb) + pos.getY());
- ReflectionStuff.setMinZ(bb, ReflectionStuff.getMinZ(bb) + pos.getZ());
- ReflectionStuff.setMaxX(bb, ReflectionStuff.getMaxX(bb) + pos.getX());
- ReflectionStuff.setMaxY(bb, ReflectionStuff.getMaxY(bb) + pos.getY());
- ReflectionStuff.setMaxZ(bb, ReflectionStuff.getMaxZ(bb) + pos.getZ());
- return bb;
- }
-
- public static AxisAlignedBB unionBB(AxisAlignedBB bb1, AxisAlignedBB bb2) {
- ReflectionStuff.setMinX(bb1, Math.min(ReflectionStuff.getMinX(bb1), ReflectionStuff.getMinX(bb2)));
- ReflectionStuff.setMinY(bb1, Math.min(ReflectionStuff.getMinY(bb1), ReflectionStuff.getMinY(bb2)));
- ReflectionStuff.setMinZ(bb1, Math.min(ReflectionStuff.getMinZ(bb1), ReflectionStuff.getMinZ(bb2)));
- ReflectionStuff.setMaxX(bb1, Math.min(ReflectionStuff.getMaxX(bb1), ReflectionStuff.getMaxX(bb2)));
- ReflectionStuff.setMaxY(bb1, Math.min(ReflectionStuff.getMaxY(bb1), ReflectionStuff.getMaxY(bb2)));
- ReflectionStuff.setMaxZ(bb1, Math.min(ReflectionStuff.getMaxZ(bb1), ReflectionStuff.getMaxZ(bb2)));
- return bb1;
- }
-
- public static Vector3d sub(Vector3d in, Vector3d with) {
- in.x -= with.x;
- in.y -= with.y;
- in.z -= with.z;
- return in;
- }
-
- public static Vec3d getInterpolatedAmount(Entity entity, double x, double y, double z) {
- return new Vec3d(
- (entity.posX - entity.lastTickPosX) * x,
- (entity.posY - entity.lastTickPosY) * y,
- (entity.posZ - entity.lastTickPosZ) * z
- );
- }
-
- public static Vec3d getInterpolatedAmount(Entity entity, double ticks) {
- return getInterpolatedAmount(entity, ticks, ticks, ticks);
- }
-
- public static void copyPlayerModel(EntityPlayer from, EntityPlayer to) {
- to.getDataManager().set(ReflectionStuff.getPLAYER_MODEL_FLAG(), from.getDataManager().get(ReflectionStuff.getPLAYER_MODEL_FLAG()));
- }
-
- public static void glColor(RenderColor color) {
- GL11.glColor4b(color.r, color.g, color.b, color.a);
- }
-
- public static void glColor(Color color) {
- RenderColor.glColor(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha());
- }
-
- public static boolean isThrowable(ItemStack stack) {
- Item item = stack.getItem();
- return item instanceof ItemBow || item instanceof ItemSnowball || item instanceof ItemEgg || item instanceof ItemEnderPearl || item instanceof ItemSplashPotion || item instanceof ItemLingeringPotion || item instanceof ItemFishingRod;
- }
-
- public static float round(float input, float step) {
- return ((Math.round(input / step)) * step);
- }
-
- public static float ensureRange(float value, float min, float max) {
- float toReturn = Math.min(Math.max(value, min), max);
- return toReturn;
- }
-
- public static String roundFloatForSlider(float f) {
- return String.format("%.2f", f);
- }
-
- public static String roundCoords(double d) {
- return String.format("%.2f", d);
- }
-
- public static String getFacing() {
- Entity entity = mc.getRenderViewEntity();
- EnumFacing enumfacing = entity.getHorizontalFacing();
- String s = "Invalid";
-
- switch (enumfacing) {
- case NORTH:
- s = "-Z";
- break;
- case SOUTH:
- s = "+Z";
- break;
- case WEST:
- s = "-X";
- break;
- case EAST:
- s = "+X";
- }
-
- return s;
- }
-
- public static void renderItem(int x, int y, float partialTicks, EntityPlayer player, ItemStack stack) {
- if (!stack.isEmpty()) {
- GlStateManager.pushMatrix();
- RenderHelper.enableGUIStandardItemLighting();
- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
- try {
- GlStateManager.translate(0.0F, 0.0F, 32.0F);
- mc.getRenderItem().zLevel = 200F;
- mc.getRenderItem().renderItemAndEffectIntoGUI(stack, x, y);
- mc.getRenderItem().renderItemOverlayIntoGUI(mc.fontRenderer, stack, x, y, "");
- mc.getRenderItem().zLevel = 0F;
- } catch (Exception e) {
- e.printStackTrace();
- }
- RenderHelper.disableStandardItemLighting();
- GlStateManager.popMatrix();
- }
- }
-
- public static ItemStack getWearingArmor(int armorType) {
- return mc.player.inventoryContainer.getSlot(5 + armorType).getStack();
- }
-
- public static void drawNameplateNoScale(FontRenderer fontRendererIn, String str, float x, float y, float z, int verticalShift, float viewerYaw, float viewerPitch, boolean isThirdPersonFrontal, float offset, float size) {
- GlStateManager.pushMatrix();
-
- double dist = new Vec3d(x, y + offset, z).length();
- GlStateManager.translate(x, y + offset, z);
-
- GlStateManager.glNormal3f(0.0F, 1.0F, 0.0F);
- GlStateManager.rotate(-viewerYaw, 0.0F, 1.0F, 0.0F);
- GlStateManager.rotate((float) (isThirdPersonFrontal ? -1 : 1) * viewerPitch, 1.0F, 0.0F, 0.0F);
- size *= dist * 0.3d;
- GlStateManager.scale(-0.025F * size, -0.025F * size, 0.025F * size);
- GlStateManager.disableLighting();
- GlStateManager.depthMask(false);
-
- GlStateManager.disableDepth();
-
- GlStateManager.enableBlend();
- GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
- int i = fontRendererIn.getStringWidth(str) / 2;
- GlStateManager.disableTexture2D();
- Tessellator tessellator = Tessellator.getInstance();
- BufferBuilder bufferbuilder = tessellator.getBuffer();
- bufferbuilder.begin(7, DefaultVertexFormats.POSITION_COLOR);
- bufferbuilder.pos((double) (-i - 1), (double) (-8 + verticalShift), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
- bufferbuilder.pos((double) (-i - 1), (double) (1 + verticalShift), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
- bufferbuilder.pos((double) (i + 1), (double) (1 + verticalShift), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
- bufferbuilder.pos((double) (i + 1), (double) (-8 + verticalShift), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
- tessellator.draw();
- GlStateManager.enableTexture2D();
-
- int color = 0xFFFFFFFF;
- GlStateManager.enableDepth();
-
- GlStateManager.depthMask(true);
- fontRendererIn.drawString(str, -fontRendererIn.getStringWidth(str) / 2, verticalShift - 7, color);
- GlStateManager.enableLighting();
- GlStateManager.disableBlend();
- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
- GlStateManager.popMatrix();
-
- //TODO: draw items in name tag
- }
-
- public static int getBestTool(Block block) {
- float best = -1.0F;
- int index = -1;
- for (int i = 0; i < 9; i++) {
- ItemStack itemStack = mc.player.inventory.getStackInSlot(i);
- if (!itemStack.isEmpty()) {
- float str = itemStack.getItem().getDestroySpeed(itemStack, block.getDefaultState());
- if (str > best) {
- best = str;
- index = i;
- }
- }
- }
- return index;
- }
-
- public static double getDimensionCoord(double coord) {
- return mc.player.dimension == 0 ? coord / 8 : coord * 8;
- }
-
- public static int getArmorType(ItemArmor armor) {
- return armor.armorType.ordinal() - 2;
- }
-
- public static double[] interpolate(Entity entity) {
- double partialTicks = ReflectionStuff.getTimer().renderPartialTicks;
- double[] pos = {entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * partialTicks, entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * partialTicks, entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * partialTicks};
-
- return pos;
- }
-
- public static boolean isAttackable(EntityLivingBase entity) {
- return entity != null && entity != mc.player && entity.isEntityAlive();
- }
-
- public static EntityLivingBase getClosestEntityWithoutReachFactor() {
- EntityLivingBase closestEntity = null;
- double distance = 9999.0D;
- for (Object object : mc.world.loadedEntityList) {
- if ((object instanceof EntityLivingBase)) {
- EntityLivingBase entity = (EntityLivingBase) object;
- if (isAttackable(entity)) {
- double newDistance = mc.player.getDistanceSq(entity);
- if (closestEntity != null) {
- if (distance > newDistance) {
- closestEntity = entity;
- distance = newDistance;
- }
- } else {
- closestEntity = entity;
- distance = newDistance;
- }
- }
- }
- }
- return closestEntity;
- }
-
- public static boolean isControlsPressed() {
- for (KeyBinding keyBinding : controls) {
- if (ReflectionStuff.getPressed(keyBinding)) {
- return true;
- }
- }
- return false;
- }
-
- public static void drawRect(float paramXStart, float paramYStart, float paramXEnd, float paramYEnd, int paramColor) {
- float alpha = (float) (paramColor >> 24 & 0xFF) / 255F;
- float red = (float) (paramColor >> 16 & 0xFF) / 255F;
- float green = (float) (paramColor >> 8 & 0xFF) / 255F;
- float blue = (float) (paramColor & 0xFF) / 255F;
- GL11.glPushMatrix();
- GL11.glEnable(GL11.GL_BLEND);
- GL11.glDisable(GL11.GL_TEXTURE_2D);
- GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
- GL11.glEnable(GL11.GL_LINE_SMOOTH);
-
- GL11.glColor4f(red, green, blue, alpha);
- GL11.glBegin(GL11.GL_QUADS);
- GL11.glVertex2d(paramXEnd, paramYStart);
- GL11.glVertex2d(paramXStart, paramYStart);
- GL11.glVertex2d(paramXStart, paramYEnd);
- GL11.glVertex2d(paramXEnd, paramYEnd);
- GL11.glEnd();
-
- GL11.glEnable(GL11.GL_TEXTURE_2D);
- GL11.glDisable(GL11.GL_BLEND);
- GL11.glDisable(GL11.GL_LINE_SMOOTH);
- GL11.glPopMatrix();
- }
-
- public static Vec3d getPlayerPos(float partialTicks) {
- return getEntityPos(partialTicks, mc.player);
- }
-
- public static Vec3d getEntityPos(float partialTicks, Entity entity) {
- if (partialTicks == 1.0F) {
- return new Vec3d(entity.posX, entity.posY, entity.posZ);
- } else {
- double x = entity.prevPosX + (entity.posX - entity.prevPosX) * partialTicks;
- double y = entity.prevPosY + (entity.posY - entity.prevPosY) * partialTicks;
- double z = entity.prevPosZ + (entity.posZ - entity.prevPosZ) * partialTicks;
- return new Vec3d(x, y, z);
- }
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/ReflectionStuff.java b/src/main/java/net/daporkchop/pepsimod/util/ReflectionStuff.java
deleted file mode 100644
index 29cd9e2..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/ReflectionStuff.java
+++ /dev/null
@@ -1,616 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util;
-
-import com.google.common.collect.ImmutableSet;
-import net.minecraft.block.state.IBlockState;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.entity.EntityPlayerSP;
-import net.minecraft.client.gui.GuiDisconnected;
-import net.minecraft.client.gui.GuiScreen;
-import net.minecraft.client.multiplayer.PlayerControllerMP;
-import net.minecraft.client.renderer.ItemRenderer;
-import net.minecraft.client.renderer.RenderItem;
-import net.minecraft.client.renderer.entity.RenderManager;
-import net.minecraft.client.resources.DefaultResourcePack;
-import net.minecraft.client.settings.KeyBinding;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.EntityLivingBase;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.network.datasync.DataParameter;
-import net.minecraft.network.play.client.CPacketPlayer;
-import net.minecraft.network.play.client.CPacketVehicleMove;
-import net.minecraft.util.Timer;
-import net.minecraft.util.math.AxisAlignedBB;
-import net.minecraft.util.math.BlockPos;
-import net.minecraft.util.math.Vec3d;
-import net.minecraft.util.text.translation.LanguageMap;
-import net.minecraftforge.fml.common.FMLLog;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.Map;
-import java.util.Set;
-
-//TODO: replace this with Unsafe or access transformers
-public class ReflectionStuff extends PepsiConstants {
- public static Field renderPosX;
- public static Field renderPosY;
- public static Field renderPosZ;
- public static Field sleeping;
- public static Field PLAYER_MODEL_FLAG;
- public static Field minX;
- public static Field minY;
- public static Field minZ;
- public static Field maxX;
- public static Field maxY;
- public static Field maxZ;
- public static Field y_vec3d;
- public static Field timer;
- public static Field boundingBox;
- public static Field debugFps;
- public static Field itemRenderer;
- public static Field pressed;
- public static Field ridingEntity;
- public static Field horseJumpPower;
- public static Field cPacketPlayer_x;
- public static Field cPacketPlayer_y;
- public static Field cPacketPlayer_z;
- public static Field landMovementFactor;
- public static Field inWater;
- public static Field rightClickDelayTimer;
- public static Field curBlockDamageMP;
- public static Field blockHitDelay;
- public static Field cPacketPlayer_onGround;
- public static Field parentScreen;
- public static Field DEFAULT_RESOURCE_DOMAINS;
- public static Field cPacketVehicleMove_y;
- public static Field currentPlayerItem;
- public static Field languageMap_instance;
- public static Field languageMap_languageList;
-
- public static Method updateFallState;
- public static Method rightClickMouse;
-
- private static Field modifiersField;
-
- static {
- try {
- modifiersField = Field.class.getDeclaredField("modifiers");
- modifiersField.setAccessible(true);
- } catch (Exception e) {
- //impossible!
- }
- }
-
- public static Field getField(Class c, String... names) {
- for (String s : names) {
- try {
- Field f = c.getDeclaredField(s);
- f.setAccessible(true);
- modifiersField.setInt(f, f.getModifiers() & ~Modifier.FINAL);
- return f;
- } catch (NoSuchFieldException e) {
- FMLLog.log.info("unable to find field: " + s);
- } catch (IllegalAccessException e) {
- FMLLog.log.info("unable to make field changeable!");
- }
- }
-
- throw new IllegalStateException("Field with names: " + names + " not found!");
- }
-
- public static Method getMethod(Class c, String[] names, Class>... args) {
- for (String s : names) {
- try {
- Method m = c.getDeclaredMethod(s, args);
- m.setAccessible(true);
- return m;
- } catch (NoSuchMethodException e) {
- FMLLog.log.info("unable to find method: " + s);
- }
- }
-
- throw new IllegalStateException("Method with names: " + names + " not found!");
- }
-
- public static void init() {
- try {
- renderPosX = getField(RenderManager.class, "renderPosX", "field_78725_b", "o");
- renderPosY = getField(RenderManager.class, "renderPosY", "field_78726_c", "p");
- renderPosZ = getField(RenderManager.class, "renderPosZ", "field_78723_d", "q");
- sleeping = getField(EntityPlayer.class, "sleeping", "field_71083_bS", "bK");
- PLAYER_MODEL_FLAG = getField(EntityPlayer.class, "PLAYER_MODEL_FLAG", "field_184827_bp", "br");
- minX = getField(AxisAlignedBB.class, "minX", "field_72340_a", "a");
- minY = getField(AxisAlignedBB.class, "minY", "field_72338_b", "b");
- minZ = getField(AxisAlignedBB.class, "minZ", "field_72339_c", "c");
- maxX = getField(AxisAlignedBB.class, "maxX", "field_72336_d", "d");
- maxY = getField(AxisAlignedBB.class, "maxY", "field_72337_e", "e");
- maxZ = getField(AxisAlignedBB.class, "maxZ", "field_72334_f", "f");
- y_vec3d = getField(Vec3d.class, "y", "field_72448_b", "c");
- timer = getField(Minecraft.class, "timer", "field_71428_T", "Y");
- boundingBox = getField(Entity.class, "boundingBox", "field_70121_D", "av");
- debugFps = getField(Minecraft.class, "debugFPS", "field_71470_ab", "ar");
- itemRenderer = getField(ItemRenderer.class, "itemRenderer", "field_178112_h", "k");
- pressed = getField(KeyBinding.class, "pressed", "field_74513_e", "i");
- ridingEntity = getField(Entity.class, "ridingEntity", "field_184239_as", "au");
- horseJumpPower = getField(EntityPlayerSP.class, "horseJumpPower", "field_110321_bQ", "cq");
- cPacketPlayer_x = getField(CPacketPlayer.class, "x", "field_149479_a", "a");
- cPacketPlayer_y = getField(CPacketPlayer.class, "y", "field_149477_b", "b");
- cPacketPlayer_z = getField(CPacketPlayer.class, "z", "field_149478_c", "c");
- inWater = getField(Entity.class, "inWater", "field_70171_ac", "U");
- landMovementFactor = getField(EntityLivingBase.class, "landMovementFactor", "field_70746_aG", "bC");
- rightClickDelayTimer = getField(Minecraft.class, "rightClickDelayTimer", "field_71467_ac", "as");
- blockHitDelay = getField(PlayerControllerMP.class, "blockHitDelay", "field_78781_i", "g");
- curBlockDamageMP = getField(PlayerControllerMP.class, "curBlockDamageMP", "field_78770_f", "e");
- cPacketPlayer_onGround = getField(CPacketPlayer.class, "onGround", "field_149474_g", "f");
- parentScreen = getField(GuiDisconnected.class, "parentScreen", "field_146307_h", "h");
- DEFAULT_RESOURCE_DOMAINS = getField(DefaultResourcePack.class, "DEFAULT_RESOURCE_DOMAINS", "field_110608_a", "a");
- cPacketVehicleMove_y = getField(CPacketVehicleMove.class, "y", "field_187008_b", "b");
- currentPlayerItem = getField(PlayerControllerMP.class, "currentPlayerItem", "field_78777_l", "j");
- languageMap_instance = getField(LanguageMap.class, "instance", "field_74817_a", "c");
- languageMap_languageList = getField(LanguageMap.class, "languageList", "field_74816_c", "d");
-
- updateFallState = getMethod(Entity.class, new String[]{"updateFallState", "func_184231_a", "a"}, double.class, boolean.class, IBlockState.class, BlockPos.class);
- rightClickMouse = getMethod(Minecraft.class, new String[]{"rightClickMouse", "func_147121_ag", "aB"});
-
- setDEFAULT_RESOURCE_DOMAINS(ImmutableSet.builder().addAll(DefaultResourcePack.DEFAULT_RESOURCE_DOMAINS).add("wdl").build());
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- @SuppressWarnings("unchecked")
- public static Map getLanguageMapMap() {
- try {
- return (Map) languageMap_languageList.get(languageMap_instance.get(null));
- } catch (Exception e) {
- throw new IllegalStateException(e);
- }
- }
-
- public static LanguageMap getLanguageMap() {
- try {
- return (LanguageMap) languageMap_instance.get(null);
- } catch (Exception e) {
- throw new IllegalStateException(e);
- }
- }
-
- public static void setCurrentPlayerItem(int i) {
- try {
- currentPlayerItem.setInt(mc.playerController, i);
- } catch (Exception e) {
- throw new IllegalStateException(e);
- }
- }
-
- public static double getCPacketVehicleMove_y(CPacketVehicleMove n) {
- try {
- return cPacketVehicleMove_y.getDouble(n);
- } catch (Exception e) {
- throw new IllegalStateException(e);
- }
- }
-
- public static void setcPacketVehicleMove_y(CPacketVehicleMove n, double y) {
- try {
- cPacketVehicleMove_y.setDouble(n, y);
- } catch (Exception e) {
- throw new IllegalStateException(e);
- }
- }
-
- public static void setDEFAULT_RESOURCE_DOMAINS(Set n) {
- try {
- DEFAULT_RESOURCE_DOMAINS.set(null, n);
- } catch (Exception e) {
- throw new IllegalStateException(e);
- }
- }
-
- public static GuiScreen getParentScreen(GuiDisconnected disconnected) {
- try {
- return (GuiScreen) parentScreen.get(disconnected);
- } catch (Exception e) {
- throw new IllegalStateException(e);
- }
- }
-
- public static void rightClickMouse() {
- try {
- rightClickMouse.invoke(mc);
- } catch (Exception e) {
- e.printStackTrace();
- throw new IllegalStateException(e);
- }
- }
-
- public static void setcPacketPlayer_onGround(CPacketPlayer packet, boolean onGround) {
- try {
- cPacketPlayer_onGround.setBoolean(packet, onGround);
- } catch (Exception e) {
- e.printStackTrace();
- throw new IllegalStateException(e);
- }
- }
-
- public static boolean getPressed(KeyBinding binding) {
- try {
- return pressed.getBoolean(binding);
- } catch (Exception e) {
- e.printStackTrace();
- throw new IllegalStateException(e);
- }
- }
-
- public static float getCurBlockDamageMP() {
- try {
- return curBlockDamageMP.getFloat(mc.playerController);
- } catch (Exception e) {
- e.printStackTrace();
- throw new IllegalStateException(e);
- }
- }
-
- public static void setCurBlockDamageMP(float val) {
- try {
- curBlockDamageMP.setFloat(mc.playerController, val);
- } catch (Exception e) {
- e.printStackTrace();
- throw new IllegalStateException(e);
- }
- }
-
- public static int getBlockHitDelay() {
- try {
- return blockHitDelay.getInt(mc.playerController);
- } catch (Exception e) {
- e.printStackTrace();
- throw new IllegalStateException(e);
- }
- }
-
- public static void setBlockHitDelay(int val) {
- try {
- blockHitDelay.setInt(mc.playerController, val);
- } catch (Exception e) {
- e.printStackTrace();
- throw new IllegalStateException(e);
- }
- }
-
- public static void setRightClickDelayTimer(int val) {
- try {
- rightClickDelayTimer.setInt(mc, val);
- } catch (Exception e) {
- e.printStackTrace();
- throw new IllegalStateException(e);
- }
- }
-
- public static void setInWater(Entity entity, boolean y) {
- try {
- inWater.setBoolean(entity, y);
- } catch (Exception e) {
- e.printStackTrace();
- throw new IllegalStateException(e);
- }
- }
-
- public static void setLandMovementFactor(EntityLivingBase entity, float y) {
- try {
- landMovementFactor.setFloat(entity, y);
- } catch (Exception e) {
- e.printStackTrace();
- throw new IllegalStateException(e);
- }
- }
-
- public static void setCPacketPlayer_x(CPacketPlayer packet, double x) {
- try {
- cPacketPlayer_x.setDouble(packet, x);
- } catch (Exception e) {
- e.printStackTrace();
- throw new IllegalStateException(e);
- }
- }
-
- public static void setCPacketPlayer_y(CPacketPlayer packet, double y) {
- try {
- cPacketPlayer_y.setDouble(packet, y);
- } catch (Exception e) {
- e.printStackTrace();
- throw new IllegalStateException(e);
- }
- }
-
- public static void setCPacketPlayer_z(CPacketPlayer packet, double z) {
- try {
- cPacketPlayer_z.setDouble(packet, z);
- } catch (Exception e) {
- e.printStackTrace();
- throw new IllegalStateException(e);
- }
- }
-
- public static void setHorseJumpPower(float value) {
- try {
- horseJumpPower.setFloat(mc.player, value);
- } catch (Exception e) {
- e.printStackTrace();
- throw new IllegalStateException(e);
- }
- }
-
- public static void updateEntityFallState(Entity e, double d, boolean b, IBlockState state, BlockPos pos) {
- try {
- updateFallState.invoke(e, d, b, state, pos);
- } catch (Exception exception) {
- exception.printStackTrace();
- throw new IllegalStateException(exception);
- }
- }
-
- public static Entity getRidingEntity(Entity toGetFrom) {
- try {
- return (Entity) ridingEntity.get(toGetFrom);
- } catch (Exception e) {
- e.printStackTrace();
- throw new IllegalStateException(e);
- }
- }
-
- public static void setPressed(KeyBinding keyBinding, boolean state) {
- try {
- pressed.setBoolean(keyBinding, state);
- } catch (Exception e) {
- e.printStackTrace();
- throw new IllegalStateException(e);
- }
- }
-
- public static RenderItem getItemRenderer() {
- try {
- return (RenderItem) itemRenderer.get(mc.getItemRenderer());
- } catch (Exception e) {
- e.printStackTrace();
- throw new IllegalStateException(e);
- }
- }
-
- public static int getDebugFps() {
- try {
- return debugFps.getInt(null);
- } catch (Exception e) {
- e.printStackTrace();
- throw new IllegalStateException(e);
- }
- }
-
- public static AxisAlignedBB getBoundingBox(Entity entity) {
- try {
- return (AxisAlignedBB) boundingBox.get(entity);
- } catch (Exception e) {
- e.printStackTrace();
- throw new IllegalStateException(e);
- }
- }
-
- public static Timer getTimer() {
- try {
- return (Timer) timer.get(mc);
- } catch (Exception e) {
- e.printStackTrace();
- throw new IllegalStateException(e);
- }
- }
-
- public static void setY_vec3d(Vec3d vec, double val) {
- try {
- y_vec3d.setDouble(vec, val);
- } catch (Exception e) {
- e.printStackTrace();
- throw new IllegalStateException(e);
- }
- }
-
- public static double getMinX(AxisAlignedBB bb) {
- try {
- return minX.getDouble(bb);
- } catch (Exception e) {
- e.printStackTrace();
- throw new IllegalStateException(e);
- }
- }
-
- public static double getMinY(AxisAlignedBB bb) {
- try {
- return minY.getDouble(bb);
- } catch (Exception e) {
- e.printStackTrace();
- throw new IllegalStateException(e);
- }
- }
-
- public static double getMinZ(AxisAlignedBB bb) {
- try {
- return minZ.getDouble(bb);
- } catch (Exception e) {
- e.printStackTrace();
- throw new IllegalStateException(e);
- }
- }
-
- public static double getMaxX(AxisAlignedBB bb) {
- try {
- return maxX.getDouble(bb);
- } catch (Exception e) {
- e.printStackTrace();
- throw new IllegalStateException(e);
- }
- }
-
- public static double getMaxY(AxisAlignedBB bb) {
- try {
- return maxY.getDouble(bb);
- } catch (Exception e) {
- e.printStackTrace();
- throw new IllegalStateException(e);
- }
- }
-
- public static double getMaxZ(AxisAlignedBB bb) {
- try {
- return maxZ.getDouble(bb);
- } catch (Exception e) {
- e.printStackTrace();
- throw new IllegalStateException(e);
- }
- }
-
- public static void setMinX(AxisAlignedBB bb, double val) {
- try {
- minX.setDouble(bb, val);
- } catch (Exception e) {
- e.printStackTrace();
- throw new IllegalStateException(e);
- }
- }
-
- public static void setMinY(AxisAlignedBB bb, double val) {
- try {
- minY.setDouble(bb, val);
- } catch (Exception e) {
- e.printStackTrace();
- throw new IllegalStateException(e);
- }
- }
-
- public static void setMinZ(AxisAlignedBB bb, double val) {
- try {
- minZ.setDouble(bb, val);
- } catch (Exception e) {
- e.printStackTrace();
- throw new IllegalStateException(e);
- }
- }
-
- public static void setMaxX(AxisAlignedBB bb, double val) {
- try {
- maxX.setDouble(bb, val);
- } catch (Exception e) {
- e.printStackTrace();
- throw new IllegalStateException(e);
- }
- }
-
- public static void setMaxY(AxisAlignedBB bb, double val) {
- try {
- maxY.setDouble(bb, val);
- } catch (Exception e) {
- e.printStackTrace();
- throw new IllegalStateException(e);
- }
- }
-
- public static void setMaxZ(AxisAlignedBB bb, double val) {
- try {
- maxZ.setDouble(bb, val);
- } catch (Exception e) {
- e.printStackTrace();
- throw new IllegalStateException(e);
- }
- }
-
- public static DataParameter getPLAYER_MODEL_FLAG() {
- try {
- return (DataParameter) PLAYER_MODEL_FLAG.get(null);
- } catch (Exception e) {
- e.printStackTrace();
- throw new IllegalStateException(e);
- }
- }
-
- public static double getRenderPosX(RenderManager mgr) {
- try {
- return renderPosX.getDouble(mgr);
- } catch (Exception e) {
- e.printStackTrace();
- throw new IllegalStateException(e);
- }
- }
-
- public static double getRenderPosY(RenderManager mgr) {
- try {
- return renderPosY.getDouble(mgr);
- } catch (Exception e) {
- e.printStackTrace();
- throw new IllegalStateException(e);
- }
- }
-
- public static double getRenderPosZ(RenderManager mgr) {
- try {
- return renderPosZ.getDouble(mgr);
- } catch (Exception e) {
- e.printStackTrace();
- throw new IllegalStateException(e);
- }
- }
-
- public static double getRenderPosX() {
- try {
- return renderPosX.getDouble(mc.getRenderManager());
- } catch (Exception e) {
- e.printStackTrace();
- throw new IllegalStateException(e);
- }
- }
-
- public static double getRenderPosY() {
- try {
- return renderPosY.getDouble(mc.getRenderManager());
- } catch (Exception e) {
- e.printStackTrace();
- throw new IllegalStateException(e);
- }
- }
-
- public static double getRenderPosZ() {
- try {
- return renderPosZ.getDouble(mc.getRenderManager());
- } catch (Exception e) {
- e.printStackTrace();
- throw new IllegalStateException(e);
- }
- }
-
- public static boolean getSleeping(EntityPlayer mgr) {
- try {
- return sleeping.getBoolean(mgr);
- } catch (Exception e) {
- e.printStackTrace();
- throw new IllegalStateException(e);
- }
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/RenderColor.java b/src/main/java/net/daporkchop/pepsimod/util/RenderColor.java
deleted file mode 100644
index 17e3cee..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/RenderColor.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util;
-
-import org.lwjgl.opengl.GL11;
-
-public class RenderColor {
- public static void glColor(int r, int g, int b) {
- glColor(r, g, b, 255);
- }
-
- public static void glColor(int r, int g, int b, int a) {
- GL11.glColor4b((byte) Math.floorDiv(r, 2), (byte) Math.floorDiv(g, 2), (byte) Math.floorDiv(b, 2), (byte) Math.floorDiv(a, 2));
- }
-
- public byte r;
- public byte g;
- public byte b;
- public byte a;
- public int rOrig;
- public int gOrig;
- public int bOrig;
- public int aOrig;
-
- public RenderColor(int r, int g, int b, int a) {
- this.r = (byte) Math.floorDiv(r, 2);
- this.g = (byte) Math.floorDiv(g, 2);
- this.b = (byte) Math.floorDiv(b, 2);
- this.a = (byte) Math.floorDiv(a, 2);
- this.rOrig = r;
- this.gOrig = g;
- this.bOrig = b;
- this.aOrig = a;
- }
-
- public int getIntColor() {
- return (this.a & 255) << 24 | (this.r & 255) << 16 | (this.g & 255) << 8 | (this.b & 255);
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/capability/Updateable.java b/src/main/java/net/daporkchop/pepsimod/util/capability/Updateable.java
new file mode 100644
index 0000000..44020cf
--- /dev/null
+++ b/src/main/java/net/daporkchop/pepsimod/util/capability/Updateable.java
@@ -0,0 +1,47 @@
+/*
+ * Adapted from The MIT License (MIT)
+ *
+ * Copyright (c) 2016-2020 DaPorkchop_
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions:
+ *
+ * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
+ * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+package net.daporkchop.pepsimod.util.capability;
+
+/**
+ * A type that can be updated, and provides a single method to tell it to do so.
+ *
+ * @author DaPorkchop_
+ */
+@FunctionalInterface
+public interface Updateable> {
+ /**
+ * Updates this type.
+ */
+ void update();
+
+ /**
+ * Updates this type.
+ *
+ * Does nothing but invoke {@link #update()} and then return itself (for method chaining).
+ *
+ * @return this instance
+ */
+ @SuppressWarnings("unchecked")
+ default I updateChained() {
+ this.update();
+ return (I) this;
+ }
+}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/colors/ColorUtils.java b/src/main/java/net/daporkchop/pepsimod/util/colors/ColorUtils.java
deleted file mode 100644
index 8ed2984..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/colors/ColorUtils.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util.colors;
-
-import java.awt.Color;
-
-public class ColorUtils {
- public static final int BUTTON_OFF_OFF = new Color(255, 32, 32).getRGB();
- public static final int BUTTON_ON_OFF = new Color(244, 66, 66).getRGB();
- public static final int BUTTON_OFF_ON = new Color(43, 120, 255).getRGB();
- public static final int BUTTON_ON_ON = new Color(88, 143, 239).getRGB();
- public static final int WINDOW_ON = new Color(255, 255, 255).getRGB();
- public static final int WINDOW_OFF = new Color(183, 183, 183).getRGB();
- public static final int BACKGROUND = new Color(128, 128, 128).getRGB();
- public static final int TYPE_BUTTON = 0;
- public static final int TYPE_WINDOW = 1;
- public static final int TYPE_SLIDER = 2;
- public static final int TYPE_BG = 3;
-
- public static int getColorForGuiEntry(int type, boolean hovered, boolean state) {
- switch (type) {
- case TYPE_BUTTON:
- if (hovered) {
- return state ? BUTTON_ON_ON : BUTTON_ON_OFF;
- } else {
- return state ? BUTTON_OFF_ON : BUTTON_OFF_OFF;
- }
- case TYPE_WINDOW:
- return hovered ? WINDOW_ON : WINDOW_OFF;
- case TYPE_SLIDER:
- return hovered ? BUTTON_ON_ON : BUTTON_OFF_ON;
- default:
- throw new IllegalStateException("Invalid type: " + type);
- }
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/colors/ColorizedElement.java b/src/main/java/net/daporkchop/pepsimod/util/colors/ColorizedElement.java
deleted file mode 100644
index 5d6671c..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/colors/ColorizedElement.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util.colors;
-
-public abstract class ColorizedElement {
- public int width;
- public String text;
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/colors/ColorizedText.java b/src/main/java/net/daporkchop/pepsimod/util/colors/ColorizedText.java
deleted file mode 100644
index bfc8479..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/colors/ColorizedText.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util.colors;
-
-import net.daporkchop.pepsimod.util.PepsiConstants;
-import net.minecraft.client.gui.Gui;
-
-public abstract class ColorizedText extends PepsiConstants {
- public abstract int width();
-
- public abstract void drawAtPos(Gui screen, int x, int y);
-
- public abstract String getRawText();
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/colors/FixedColorElement.java b/src/main/java/net/daporkchop/pepsimod/util/colors/FixedColorElement.java
deleted file mode 100644
index 762d8ff..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/colors/FixedColorElement.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util.colors;
-
-import net.minecraft.client.Minecraft;
-
-public class FixedColorElement extends ColorizedElement {
- public final int color;
-
- public FixedColorElement(int color, String text) {
- this.color = color;
- this.text = text;
- this.width = Minecraft.getMinecraft().fontRenderer.getStringWidth(text);
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/colors/GradientText.java b/src/main/java/net/daporkchop/pepsimod/util/colors/GradientText.java
deleted file mode 100644
index 02b556d..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/colors/GradientText.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util.colors;
-
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.Gui;
-
-public class GradientText extends ColorizedText {
- public final FixedColorElement[] elements;
- public final int width;
- public String text = "";
-
- public GradientText(FixedColorElement[] elements, int width) {
- this.elements = elements;
- this.width = width;
- for (FixedColorElement element : elements) {
- this.text += element.text;
- }
- }
-
- public void drawAtPos(Gui screen, int x, int y) {
- int i = 0;
- for (FixedColorElement element : this.elements) {
- screen.drawString(Minecraft.getMinecraft().fontRenderer, element.text, x + i, y, element.color);
- i += element.width;
- }
- }
-
- public void drawWithEndAtPos(Gui screen, int x, int y) {
- int i = 0;
- for (FixedColorElement element : this.elements) {
- i -= element.width;
- }
- for (FixedColorElement element : this.elements) {
- screen.drawString(Minecraft.getMinecraft().fontRenderer, element.text, x + i, y, element.color);
- i += element.width;
- }
- }
-
- public int width() {
- return this.width;
- }
-
- public String getRawText() {
- return this.text;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/colors/PlainColorElement.java b/src/main/java/net/daporkchop/pepsimod/util/colors/PlainColorElement.java
deleted file mode 100644
index b354171..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/colors/PlainColorElement.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util.colors;
-
-import static net.daporkchop.pepsimod.util.PepsiConstants.mc;
-
-public class PlainColorElement extends ColorizedElement {
- public PlainColorElement(String text) {
- this.text = text;
- this.width = mc.fontRenderer.getStringWidth(text);
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/colors/rainbow/ColorChangeType.java b/src/main/java/net/daporkchop/pepsimod/util/colors/rainbow/ColorChangeType.java
deleted file mode 100644
index 2f9c4a4..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/colors/rainbow/ColorChangeType.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util.colors.rainbow;
-
-public enum ColorChangeType {
- INCREASE,
- DECRASE,
- NONE
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/colors/rainbow/RainbowCycle.java b/src/main/java/net/daporkchop/pepsimod/util/colors/rainbow/RainbowCycle.java
deleted file mode 100644
index 454d1eb..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/colors/rainbow/RainbowCycle.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util.colors.rainbow;
-
-public class RainbowCycle implements Cloneable {
- public ColorChangeType red = ColorChangeType.INCREASE;
- public ColorChangeType green = ColorChangeType.NONE;
- public ColorChangeType blue = ColorChangeType.NONE;
- public int r = 0;
- public int g = 0;
- public int b = 0;
-
- public RainbowCycle clone() {
- try {
- return (RainbowCycle) super.clone();
- } catch (CloneNotSupportedException e) {
- e.printStackTrace();
- return this;
- }
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/colors/rainbow/RainbowText.java b/src/main/java/net/daporkchop/pepsimod/util/colors/rainbow/RainbowText.java
deleted file mode 100644
index 38ab45c..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/colors/rainbow/RainbowText.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util.colors.rainbow;
-
-import net.daporkchop.pepsimod.util.PepsiUtils;
-import net.daporkchop.pepsimod.util.colors.ColorizedElement;
-import net.daporkchop.pepsimod.util.colors.ColorizedText;
-import net.daporkchop.pepsimod.util.colors.FixedColorElement;
-import net.daporkchop.pepsimod.util.colors.PlainColorElement;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.FontRenderer;
-import net.minecraft.client.gui.Gui;
-
-import java.awt.Color;
-
-public class RainbowText extends ColorizedText {
- private final ColorizedElement[] elements;
- private final int width;
- private final FontRenderer fontRenderer;
- public String text;
- private int offset;
-
- public RainbowText(String text) {
- this(text, 0);
- }
-
- public RainbowText(String text, int offset) {
- this.fontRenderer = mc.fontRenderer;
- this.offset = offset;
- String[] split = text.split(PepsiUtils.COLOR_ESCAPE + "custom");
- String[] split2 = split[0].split("");
- this.elements = new ColorizedElement[split2.length + (split.length > 1 ? 1 : 0)];
- for (int i = 0; i < split2.length; i++) {
- this.elements[i] = new PlainColorElement(split2[i]);
- }
- if (split.length > 1) {
- this.elements[this.elements.length - 1] = new FixedColorElement(Integer.parseInt(split[1].substring(0, Math.min(split[1].length(), 6)), 16), split[1].substring(6));
- int i = 0;
- for (ColorizedElement element : this.elements) {
- i += element.width;
- }
- this.width = i;
- this.text = split[0] + split[1].substring(6);
- } else {
- this.width = this.fontRenderer.getStringWidth(text);
- }
- this.text = text;
- }
-
- //int debug = 0;
- public void drawAtPos(Gui screen, int x, int y) {
- int i = 0;
- RainbowCycle cycle = PepsiUtils.rainbowCycle(this.offset, PepsiUtils.rainbowCycle.clone());
- for (ColorizedElement element : this.elements) {
- if (element instanceof FixedColorElement) {
- screen.drawString(Minecraft.getMinecraft().fontRenderer, element.text, x + i, y, ((FixedColorElement) element).color);
- return;
- }
- cycle = PepsiUtils.rainbowCycle(1, cycle);
- Color color = new Color(PepsiUtils.ensureRange(cycle.r, 0, 255), PepsiUtils.ensureRange(cycle.g, 0, 255), PepsiUtils.ensureRange(cycle.b, 0, 255));
- screen.drawString(Minecraft.getMinecraft().fontRenderer, element.text, x + i, y, color.getRGB());
- i += element.width;
- }
- }
-
- public void drawAtPos(Gui screen, int x, int y, int offset) {
- int tempOffset = this.offset;
- this.offset = offset;
- this.drawAtPos(screen, x, y);
- this.offset = tempOffset;
- }
-
- public int width() {
- return this.width;
- }
-
- public String getRawText() {
- return this.text;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/config/Config.java b/src/main/java/net/daporkchop/pepsimod/util/config/Config.java
deleted file mode 100644
index 866da69..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/config/Config.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util.config;
-
-import com.google.gson.Gson;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
-import net.daporkchop.pepsimod.util.config.impl.AnnouncerTranslator;
-import net.daporkchop.pepsimod.util.config.impl.AntiAFKTranslator;
-import net.daporkchop.pepsimod.util.config.impl.AutoEatTranslator;
-import net.daporkchop.pepsimod.util.config.impl.BedBomberTranslator;
-import net.daporkchop.pepsimod.util.config.impl.ClickGUITranslator;
-import net.daporkchop.pepsimod.util.config.impl.CpuLimitTranslator;
-import net.daporkchop.pepsimod.util.config.impl.CriticalsTranslator;
-import net.daporkchop.pepsimod.util.config.impl.CrystalAuraTranslator;
-import net.daporkchop.pepsimod.util.config.impl.ESPTranslator;
-import net.daporkchop.pepsimod.util.config.impl.ElytraFlyTranslator;
-import net.daporkchop.pepsimod.util.config.impl.EntitySpeedTranslator;
-import net.daporkchop.pepsimod.util.config.impl.FlightTranslator;
-import net.daporkchop.pepsimod.util.config.impl.FreecamTranslator;
-import net.daporkchop.pepsimod.util.config.impl.FriendsTranslator;
-import net.daporkchop.pepsimod.util.config.impl.GeneralTranslator;
-import net.daporkchop.pepsimod.util.config.impl.HUDTranslator;
-import net.daporkchop.pepsimod.util.config.impl.NameTagsTranslator;
-import net.daporkchop.pepsimod.util.config.impl.NoWeatherTranslator;
-import net.daporkchop.pepsimod.util.config.impl.NotificationsTranslator;
-import net.daporkchop.pepsimod.util.config.impl.SpeedmineTranslator;
-import net.daporkchop.pepsimod.util.config.impl.StepTranslator;
-import net.daporkchop.pepsimod.util.config.impl.TargettingTranslator;
-import net.daporkchop.pepsimod.util.config.impl.TimerTranslator;
-import net.daporkchop.pepsimod.util.config.impl.TracersTranslator;
-import net.daporkchop.pepsimod.util.config.impl.VelocityTranslator;
-import net.daporkchop.pepsimod.util.config.impl.XrayTranslator;
-import net.minecraftforge.fml.common.FMLLog;
-
-import java.util.Hashtable;
-import java.util.Map;
-
-public class Config {
- private static Hashtable translators = new Hashtable<>();
-
- static {
- registerConfigTranslator(AnnouncerTranslator.INSTANCE);
- registerConfigTranslator(AntiAFKTranslator.INSTANCE);
- registerConfigTranslator(AutoEatTranslator.INSTANCE);
- registerConfigTranslator(BedBomberTranslator.INSTANCE);
- registerConfigTranslator(ClickGUITranslator.INSTANCE);
- registerConfigTranslator(CpuLimitTranslator.INSTANCE);
- registerConfigTranslator(CriticalsTranslator.INSTANCE);
- registerConfigTranslator(CrystalAuraTranslator.INSTANCE);
- registerConfigTranslator(ElytraFlyTranslator.INSTANCE);
- registerConfigTranslator(EntitySpeedTranslator.INSTANCE);
- registerConfigTranslator(ESPTranslator.INSTANCE);
- registerConfigTranslator(FlightTranslator.INSTANCE);
- registerConfigTranslator(FreecamTranslator.INSTANCE);
- registerConfigTranslator(FriendsTranslator.INSTANCE);
- registerConfigTranslator(GeneralTranslator.INSTANCE);
- registerConfigTranslator(HUDTranslator.INSTANCE);
- registerConfigTranslator(NameTagsTranslator.INSTANCE);
- registerConfigTranslator(NotificationsTranslator.INSTANCE);
- registerConfigTranslator(NoWeatherTranslator.INSTANCE);
- registerConfigTranslator(SpeedmineTranslator.INSTANCE);
- registerConfigTranslator(StepTranslator.INSTANCE);
- registerConfigTranslator(TargettingTranslator.INSTANCE);
- registerConfigTranslator(TimerTranslator.INSTANCE);
- registerConfigTranslator(TracersTranslator.INSTANCE);
- registerConfigTranslator(VelocityTranslator.INSTANCE);
- registerConfigTranslator(XrayTranslator.INSTANCE);
- }
-
- public static void registerConfigTranslator(IConfigTranslator element) {
- translators.put(element.name(), element);
- }
-
- public static void loadConfig(String configJson) {
- System.out.println("Loading config!");
- System.out.println(configJson);
-
- JsonObject object = null;
- try {
- object = new JsonParser().parse(configJson).getAsJsonObject();
- } catch (IllegalStateException e) {
- //Thrown when the config is an empty string
- FMLLog.info("Using default config because the file is empty or unreadable");
- return;
- }
- for (Map.Entry entry : object.entrySet()) {
- translators.getOrDefault(entry.getKey(), NullConfigTranslator.INSTANCE).decode(entry.getKey(), entry.getValue().getAsJsonObject());
- }
- }
-
- public static String saveConfig() {
- JsonObject object = new JsonObject();
-
- for (IConfigTranslator translator : translators.values()) {
- JsonObject elementObj = new JsonObject();
- translator.encode(elementObj);
- object.add(translator.name(), elementObj);
- }
-
- return new Gson().toJson(object);
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/config/ConfigManager.java b/src/main/java/net/daporkchop/pepsimod/util/config/ConfigManager.java
new file mode 100644
index 0000000..925fd19
--- /dev/null
+++ b/src/main/java/net/daporkchop/pepsimod/util/config/ConfigManager.java
@@ -0,0 +1,291 @@
+/*
+ * Adapted from The MIT License (MIT)
+ *
+ * Copyright (c) 2016-2020 DaPorkchop_
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions:
+ *
+ * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
+ * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+package net.daporkchop.pepsimod.util.config;
+
+import lombok.Getter;
+import lombok.NonNull;
+import lombok.RequiredArgsConstructor;
+import lombok.Setter;
+import lombok.experimental.UtilityClass;
+import net.daporkchop.lib.common.function.VoidFunction;
+import net.daporkchop.lib.unsafe.PUnsafe;
+import net.daporkchop.pepsimod.util.PepsiConstants;
+import net.daporkchop.pepsimod.util.config.annotation.Option;
+import net.daporkchop.pepsimod.util.config.annotation.OptionListener;
+import net.minecraftforge.fml.common.discovery.ASMDataTable;
+import net.minecraftforge.fml.common.discovery.ASMDataTable.ASMData;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.IdentityHashMap;
+import java.util.Map;
+import java.util.Objects;
+
+/**
+ * @author DaPorkchop_
+ */
+@UtilityClass
+public class ConfigManager implements PepsiConstants {
+ private final Map, Map> GLOBAL_OPTIONS = new HashMap<>();
+ private final Map, Map> ALL_OPTIONS = new HashMap<>();
+ private boolean INITIALIZED = false;
+
+ /**
+ * Initializes the config manager.
+ *
+ * This causes it to use the given {@link ASMDataTable} to find all valid option annotations, and prepare the
+ * config system for loading them later.
+ *
+ * @param table the {@link ASMDataTable} to use
+ */
+ public void init(@NonNull ASMDataTable table) {
+ synchronized (ConfigManager.class) {
+ if (INITIALIZED) {
+ throw new IllegalStateException("ConfigManager already initialized!");
+ } else {
+ INITIALIZED = true;
+ }
+ }
+
+ //load options themselves
+ for (ASMData data : table.getAll(Option.class.getName())) {
+ try {
+ Class> clazz = Class.forName(data.getClassName());
+ Field field = clazz.getField(data.getObjectName());
+ OptionContainer container = new OptionContainer(
+ (field.getModifiers() & Modifier.STATIC) != 0 ? PUnsafe.staticFieldOffset(field) : PUnsafe.objectFieldOffset(field),
+ clazz,
+ (field.getModifiers() & Modifier.STATIC) != 0 ? PUnsafe.staticFieldBase(field) : null,
+ field.getType(),
+ Type.fromFieldType(field.getType())
+ );
+ container.option.loadFromMap(data.getAnnotationInfo());
+ if ((field.getModifiers() & Modifier.STATIC) != 0) {
+ GLOBAL_OPTIONS.computeIfAbsent(clazz, c -> new HashMap<>()).put(container.option.id, container);
+ }
+ ALL_OPTIONS.computeIfAbsent(clazz, c -> new HashMap<>()).put(container.option.id, container);
+ } catch (Exception e) {
+ throw new RuntimeException(String.format("Exception while parsing ASM data: className=%s,objectName=%s", data.getClassName(), data.getObjectName()), e);
+ }
+ }
+
+ //TODO: load option constraints (min/max)
+
+ //find option listeners
+ for (ASMData data : table.getAll(OptionListener.class.getName())) {
+ try {
+ Class> clazz = Class.forName(data.getClassName());
+ Method method = clazz.getMethod(data.getObjectName());
+ } catch (Exception e) {
+ throw new RuntimeException(String.format("Exception while parsing ASM data: className=%s,objectName=%s", data.getClassName(), data.getObjectName()), e);
+ }
+ }
+
+ log.info("Found %d option fields (%d of which are global), and %d option listeners.", ALL_OPTIONS.size(), GLOBAL_OPTIONS.size(), ALL_OPTIONS.values().stream().flatMap(m -> m.values().stream()).mapToLong(oc -> oc.listeners.size()).sum());
+ }
+
+ @RequiredArgsConstructor
+ @Getter
+ private enum Type {
+ INT(0) {
+ @Override
+ public void set(@NonNull OptionContainer container, Object instance, @NonNull Object value) {
+ PUnsafe.putInt(
+ container.global() ? container.staticFieldBase : Objects.requireNonNull(instance),
+ container.offset,
+ ((Number) value).intValue()
+ );
+ }
+
+ @Override
+ public Object get(@NonNull OptionContainer container, Object instance) {
+ return PUnsafe.getInt(
+ container.global() ? container.staticFieldBase : Objects.requireNonNull(instance),
+ container.offset
+ );
+ }
+ },
+ LONG(0L) {
+ @Override
+ public void set(@NonNull OptionContainer container, Object instance, @NonNull Object value) {
+ PUnsafe.putLong(
+ container.global() ? container.staticFieldBase : Objects.requireNonNull(instance),
+ container.offset,
+ ((Number) value).longValue()
+ );
+ }
+
+ @Override
+ public Object get(@NonNull OptionContainer container, Object instance) {
+ return PUnsafe.getLong(
+ container.global() ? container.staticFieldBase : Objects.requireNonNull(instance),
+ container.offset
+ );
+ }
+ },
+ FLOAT(0.0f) {
+ @Override
+ public void set(@NonNull OptionContainer container, Object instance, @NonNull Object value) {
+ PUnsafe.putFloat(
+ container.global() ? container.staticFieldBase : Objects.requireNonNull(instance),
+ container.offset,
+ ((Number) value).floatValue()
+ );
+ }
+
+ @Override
+ public Object get(@NonNull OptionContainer container, Object instance) {
+ return PUnsafe.getFloat(
+ container.global() ? container.staticFieldBase : Objects.requireNonNull(instance),
+ container.offset
+ );
+ }
+ },
+ DOUBLE(0.0d) {
+ @Override
+ public void set(@NonNull OptionContainer container, Object instance, @NonNull Object value) {
+ PUnsafe.putDouble(
+ container.global() ? container.staticFieldBase : Objects.requireNonNull(instance),
+ container.offset,
+ ((Number) value).doubleValue()
+ );
+ }
+
+ @Override
+ public Object get(@NonNull OptionContainer container, Object instance) {
+ return PUnsafe.getDouble(
+ container.global() ? container.staticFieldBase : Objects.requireNonNull(instance),
+ container.offset
+ );
+ }
+ },
+ TEXT("") {
+ @Override
+ public void set(@NonNull OptionContainer container, Object instance, @NonNull Object value) {
+ PUnsafe.putObject(
+ container.global() ? container.staticFieldBase : Objects.requireNonNull(instance),
+ container.offset,
+ String.class.cast(value) //prevent the cast from being inlined so we can assert the type
+ );
+ }
+
+ @Override
+ public Object get(@NonNull OptionContainer container, Object instance) {
+ return String.class.cast(PUnsafe.getObject(
+ container.global() ? container.staticFieldBase : Objects.requireNonNull(instance),
+ container.offset
+ ));
+ }
+ },
+ ENUM("") {
+ @Override
+ public void set(@NonNull OptionContainer container, Object instance, @NonNull Object value) {
+ PUnsafe.putObject(
+ container.global() ? container.staticFieldBase : Objects.requireNonNull(instance),
+ container.offset,
+ String.class.cast(value) //prevent the cast from being inlined so we can assert the type
+ );
+ }
+
+ @Override
+ public Object get(@NonNull OptionContainer container, Object instance) {
+ return String.class.cast(PUnsafe.getObject(
+ container.global() ? container.staticFieldBase : Objects.requireNonNull(instance),
+ container.offset
+ ));
+ }
+ };
+
+ public static Type fromFieldType(@NonNull Class> clazz) {
+ if (clazz == int.class) {
+ return INT;
+ } else if (clazz == long.class) {
+ return LONG;
+ } else if (clazz == float.class) {
+ return FLOAT;
+ } else if (clazz == double.class) {
+ return DOUBLE;
+ } else if (clazz == String.class) {
+ return TEXT;
+ } else if (clazz != Enum.class && Enum.class.isAssignableFrom(clazz)) {
+ return ENUM;
+ } else {
+ throw new IllegalArgumentException(String.format("Invalid option type: %s", clazz.getName()));
+ }
+ }
+
+ protected final Object fallbackDefault;
+
+ public Object decodeValue(@NonNull OptionContainer container, @NonNull Object valueObj) {
+ return valueObj;
+ }
+
+ public Object encodeValue(@NonNull OptionContainer container, @NonNull Object valueObj) {
+ return valueObj;
+ }
+
+ public abstract void set(@NonNull OptionContainer container, Object instance, @NonNull Object value);
+
+ public abstract Object get(@NonNull OptionContainer container, Object instance);
+ }
+
+ @Getter
+ @Setter
+ private final class OptionImpl implements Option {
+ private static final String[] EMPTY_STRING_ARRAY = new String[0];
+
+ public String id;
+ public String[] comment;
+ public Input input;
+
+ public void loadFromMap(@NonNull Map map) {
+ this.id = (String) map.get("id");
+ this.comment = (String[]) map.getOrDefault("comment", EMPTY_STRING_ARRAY);
+ this.input = (Input) map.getOrDefault("input", Input.AUTO);
+ }
+
+ @Override
+ public Class extends Annotation> annotationType() {
+ return Option.class;
+ }
+ }
+
+ @RequiredArgsConstructor
+ private final class OptionContainer {
+ public final long offset;
+ @NonNull
+ public final Class> holder;
+ public final Object staticFieldBase;
+ public final Class> typeClass;
+ public final Type type;
+ public final OptionImpl option = new OptionImpl();
+ public final Collection listeners = Collections.newSetFromMap(new IdentityHashMap<>()); //TODO: this is dumb
+
+ public boolean global() {
+ return this.staticFieldBase != null;
+ }
+ }
+}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/config/Configuration.java b/src/main/java/net/daporkchop/pepsimod/util/config/Configuration.java
new file mode 100644
index 0000000..29d752c
--- /dev/null
+++ b/src/main/java/net/daporkchop/pepsimod/util/config/Configuration.java
@@ -0,0 +1,50 @@
+/*
+ * Adapted from The MIT License (MIT)
+ *
+ * Copyright (c) 2016-2020 DaPorkchop_
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions:
+ *
+ * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
+ * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+package net.daporkchop.pepsimod.util.config;
+
+import lombok.NonNull;
+
+/**
+ * A key => value store for settings, using strings as keys.
+ *
+ * Note that many instances of this may store only some (or none) of the settings, delegating requests to other configuration instances. This system allows
+ * for e.g. server-, world- or even dimension-specific configurations, where only the differences between the current configuration and the base are
+ * stored, enabling much more fine-grained control over config.
+ *
+ * @author DaPorkchop_
+ */
+public interface Configuration {
+ /**
+ * Gets a configuration object.
+ *
+ * @param qualifiedName the qualified name of the object, separated with periods
+ * @return the configuration object
+ */
+ Configuration getObj(@NonNull String qualifiedName);
+
+ /**
+ * Gets a configuration field.
+ *
+ * @param qualifiedName the qualified name of the field, separated with periods
+ * @return the field's value
+ */
+ int getInt(@NonNull String qualifiedName);
+}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/config/GlobalConfig.java b/src/main/java/net/daporkchop/pepsimod/util/config/GlobalConfig.java
new file mode 100644
index 0000000..69b5c4e
--- /dev/null
+++ b/src/main/java/net/daporkchop/pepsimod/util/config/GlobalConfig.java
@@ -0,0 +1,70 @@
+/*
+ * Adapted from The MIT License (MIT)
+ *
+ * Copyright (c) 2016-2020 DaPorkchop_
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions:
+ *
+ * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
+ * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+package net.daporkchop.pepsimod.util.config;
+
+import lombok.experimental.UtilityClass;
+import net.daporkchop.pepsimod.util.config.annotation.Option;
+import net.daporkchop.pepsimod.util.config.annotation.OptionRoot;
+import net.daporkchop.pepsimod.util.config.annotation.OptionRoot.Type;
+import net.daporkchop.pepsimod.util.render.text.TextRenderer;
+
+/**
+ * @author DaPorkchop_
+ */
+@UtilityClass
+@OptionRoot(id = "general", type = Type.GLOBAL)
+public class GlobalConfig {
+ @UtilityClass
+ @OptionRoot(id = "general.text", type = Type.GLOBAL)
+ public static class Text {
+ @Option(comment = {
+ "The renderer used for displaying most pepsimod text.",
+ "Valid options are: NORMAL, RAINBOW"
+ })
+ @Option.Default(enumValue = "RAINBOW")
+ public TextRenderer.Type type;
+
+ @UtilityClass
+ @OptionRoot(id = "general.text.rainbow", type = Type.GLOBAL)
+ public static class Rainbow {
+ @Option(comment = {
+ "The speed at which the rainbow effect will run.",
+ "Unit: ms per full color cycle"
+ })
+ @Option.Default(intValue = 3000)
+ public int speed;
+
+ @Option(comment = {
+ "The scale of the rainbow effect.",
+ "Unit: (not sure)"
+ })
+ @Option.Default(floatValue = 0.03f)
+ public float scale;
+
+ @Option(comment = {
+ "The direction that the rainbow effect will move towards.",
+ "Unit: degrees"
+ })
+ @Option.Default(floatValue = 45.0f)
+ public float rotation;
+ }
+ }
+}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/config/IConfigTranslator.java b/src/main/java/net/daporkchop/pepsimod/util/config/IConfigTranslator.java
deleted file mode 100644
index fe41e6b..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/config/IConfigTranslator.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util.config;
-
-import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-
-public interface IConfigTranslator {
- void encode(JsonObject json);
-
- void decode(String fieldName, JsonObject json);
-
- String name();
-
- default int getInt(JsonObject object, String name, int def) {
- if (object.has(name)) {
- JsonElement element = object.get(name);
- if (element.isJsonPrimitive() && element.getAsJsonPrimitive().isNumber()) {
- return element.getAsJsonPrimitive().getAsNumber().intValue();
- }
- }
-
- return def;
- }
-
- default short getShort(JsonObject object, String name, short def) {
- if (object.has(name)) {
- JsonElement element = object.get(name);
- if (element.isJsonPrimitive() && element.getAsJsonPrimitive().isNumber()) {
- return element.getAsJsonPrimitive().getAsNumber().shortValue();
- }
- }
-
- return def;
- }
-
- default byte getByte(JsonObject object, String name, byte def) {
- if (object.has(name)) {
- JsonElement element = object.get(name);
- if (element.isJsonPrimitive() && element.getAsJsonPrimitive().isNumber()) {
- return element.getAsJsonPrimitive().getAsNumber().byteValue();
- }
- }
-
- return def;
- }
-
- default long getLong(JsonObject object, String name, long def) {
- if (object.has(name)) {
- JsonElement element = object.get(name);
- if (element.isJsonPrimitive() && element.getAsJsonPrimitive().isNumber()) {
- return element.getAsJsonPrimitive().getAsNumber().longValue();
- }
- }
-
- return def;
- }
-
- default float getFloat(JsonObject object, String name, float def) {
- if (object.has(name)) {
- JsonElement element = object.get(name);
- if (element.isJsonPrimitive() && element.getAsJsonPrimitive().isNumber()) {
- return element.getAsJsonPrimitive().getAsNumber().floatValue();
- }
- }
-
- return def;
- }
-
- default double getDouble(JsonObject object, String name, double def) {
- if (object.has(name)) {
- JsonElement element = object.get(name);
- if (element.isJsonPrimitive() && element.getAsJsonPrimitive().isNumber()) {
- return element.getAsJsonPrimitive().getAsNumber().doubleValue();
- }
- }
-
- return def;
- }
-
- default boolean getBoolean(JsonObject object, String name, boolean def) {
- if (object.has(name)) {
- JsonElement element = object.get(name);
- if (element.isJsonPrimitive() && element.getAsJsonPrimitive().isBoolean()) {
- return element.getAsJsonPrimitive().getAsBoolean();
- }
- }
-
- return def;
- }
-
- default String getString(JsonObject object, String name, String def) {
- if (object.has(name)) {
- JsonElement element = object.get(name);
- if (element.isJsonPrimitive() && element.getAsJsonPrimitive().isString()) {
- return element.getAsJsonPrimitive().getAsString();
- }
- }
-
- return def;
- }
-
- default JsonArray getArray(JsonObject object, String name, JsonArray def) {
- if (object.has(name)) {
- JsonElement element = object.get(name);
- if (element.isJsonArray()) {
- return element.getAsJsonArray();
- }
- }
-
- return def;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/config/annotation/Option.java b/src/main/java/net/daporkchop/pepsimod/util/config/annotation/Option.java
new file mode 100644
index 0000000..bcd1abb
--- /dev/null
+++ b/src/main/java/net/daporkchop/pepsimod/util/config/annotation/Option.java
@@ -0,0 +1,137 @@
+/*
+ * Adapted from The MIT License (MIT)
+ *
+ * Copyright (c) 2016-2020 DaPorkchop_
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions:
+ *
+ * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
+ * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+package net.daporkchop.pepsimod.util.config.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Fields decorated with this annotation are considered to be configuration options.
+ *
+ * @author DaPorkchop_
+ */
+@Target(ElementType.FIELD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Option {
+ /**
+ * The unique ID of this option.
+ *
+ * This is never displayed directly to the user, but rather is used internally for things such as serialization.
+ *
+ * If unset, defaults to the name of the field.
+ */
+ String id() default "";
+
+ /**
+ * A comment describing the option.
+ *
+ * This will be used as a tooltip in the GUI, and shown as a popup when configuring the option using commands.
+ *
+ * If unset, no comment will be shown.
+ */
+ String[] comment() default {};
+
+ /**
+ * The input type used for this option.
+ *
+ * If unset, defaults to {@link Input#AUTO}.
+ */
+ Input input() default Input.AUTO;
+
+ /**
+ * The input type used for an option.
+ *
+ * Only used for the GUI.
+ *
+ * @author DaPorkchop_
+ */
+ enum Input {
+ /**
+ * Automatically choose the type best suited for this option.
+ */
+ AUTO,
+ /**
+ * A bar that can be slid back and forth to change the value between the minimum and maximum values.
+ */
+ NUMBER_SLIDER,
+ /**
+ * A number input field with arrows on the right to increase/decrease the value by the step size.
+ */
+ NUMBER_SPINNER,
+ /**
+ * A simple, scrollable dropdown menu.
+ */
+ ENUM_DROPDOWN,
+ /**
+ * A simple, editable line of text that sits flush with other options in the GUI.
+ */
+ TEXT_INLINE,
+ /**
+ * The GUI element will be a clickable prompt to edit the value. When clicked, a fullscreen popup menu will appear to edit the text.
+ */
+ TEXT_POPUP,
+ /**
+ * The GUI element will be a clickable prompt to edit the value. When clicked, a fullscreen popup menu will appear to edit the text lines.
+ *
+ * All text lines will be displayed in a single text box, with line breaks separating them. Text may be edited normally, and when saved, each
+ * line break will be considered the beginning of a new line of text.
+ */
+ LINES_SINGLE,
+ /**
+ * The GUI element will be a clickable prompt to edit the value. When clicked, a fullscreen popup menu will appear to edit the text lines.
+ *
+ * All text lines will be displayed in their own, single-line text box. Additional lines may be added, inserted or removed, and the order of
+ * existing lines may be changed.
+ */
+ LINES_MULTI,
+ /**
+ * The option will not be configurable in the GUI.
+ */
+ NONE;
+ }
+
+ /**
+ * Sets the default value for an option.
+ *
+ * Must be applied to a field with the {@link Option} annotation.
+ *
+ * Any annotation values that do not correspond to the type will be ignored.
+ *
+ * @author DaPorkchop_
+ */
+ @interface Default {
+ boolean booleanValue() default false;
+
+ int intValue() default 0;
+
+ long longValue() default 0L;
+
+ float floatValue() default 0.0f;
+
+ double doubleValue() default 0.0d;
+
+ String textValue() default "";
+
+ String enumValue() default "";
+ }
+}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/config/annotation/OptionListener.java b/src/main/java/net/daporkchop/pepsimod/util/config/annotation/OptionListener.java
new file mode 100644
index 0000000..259e697
--- /dev/null
+++ b/src/main/java/net/daporkchop/pepsimod/util/config/annotation/OptionListener.java
@@ -0,0 +1,41 @@
+/*
+ * Adapted from The MIT License (MIT)
+ *
+ * Copyright (c) 2016-2020 DaPorkchop_
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions:
+ *
+ * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
+ * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+package net.daporkchop.pepsimod.util.config.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Decorates a callback method that will be invoked when an option is updated.
+ *
+ * @author DaPorkchop_
+ */
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+//TODO: refactor this somehow, also use annotations for encoder/decoder functions
+public @interface OptionListener {
+ /**
+ * The ID of the option to listen for changes to.
+ */
+ String value();
+}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/config/annotation/OptionRoot.java b/src/main/java/net/daporkchop/pepsimod/util/config/annotation/OptionRoot.java
new file mode 100644
index 0000000..7f9ecbb
--- /dev/null
+++ b/src/main/java/net/daporkchop/pepsimod/util/config/annotation/OptionRoot.java
@@ -0,0 +1,65 @@
+/*
+ * Adapted from The MIT License (MIT)
+ *
+ * Copyright (c) 2016-2020 DaPorkchop_
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions:
+ *
+ * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
+ * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+package net.daporkchop.pepsimod.util.config.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Decorates a class that contains static (global) options.
+ *
+ * @author DaPorkchop_
+ */
+@Target(ElementType.TYPE)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface OptionRoot {
+ /**
+ * The path to this option group.
+ */
+ String id();
+
+ /**
+ * The type of this option root.
+ */
+ Type type() default Type.NORMAL;
+
+ /**
+ * The different option root types.
+ *
+ * @author DaPorkchop_
+ */
+ enum Type {
+ /**
+ * Global options are unaffected by profiles, and are loaded statically.
+ */
+ GLOBAL,
+ /**
+ * Normal values are affected by config profiles.
+ */
+ NORMAL,
+ /**
+ * The same as {@link #NORMAL}, however stored relative to a module-specific config section.
+ */
+ MODULE;
+ }
+}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/config/impl/AnnouncerTranslator.java b/src/main/java/net/daporkchop/pepsimod/util/config/impl/AnnouncerTranslator.java
deleted file mode 100644
index 642be67..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/config/impl/AnnouncerTranslator.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util.config.impl;
-
-import com.google.gson.JsonObject;
-import net.daporkchop.pepsimod.util.config.IConfigTranslator;
-
-public class AnnouncerTranslator implements IConfigTranslator {
- public static final AnnouncerTranslator INSTANCE = new AnnouncerTranslator();
- public boolean clientSide = false;
- public boolean join = false;
- public boolean leave = false;
- public boolean eat = false;
- public boolean walk = false;
- public boolean mine = false;
- public boolean place = false;
- public int delay = 5000;
-
- private AnnouncerTranslator() {
-
- }
-
- public void encode(JsonObject json) {
- json.addProperty("clientSide", this.clientSide);
- json.addProperty("join", this.join);
- json.addProperty("leave", this.leave);
- json.addProperty("eat", this.eat);
- json.addProperty("walk", this.walk);
- json.addProperty("mine", this.mine);
- json.addProperty("place", this.place);
- json.addProperty("delay", this.delay);
- }
-
- public void decode(String fieldName, JsonObject json) {
- this.clientSide = this.getBoolean(json, "clientSide", this.clientSide);
- this.join = this.getBoolean(json, "join", this.join);
- this.leave = this.getBoolean(json, "leave", this.leave);
- this.eat = this.getBoolean(json, "eat", this.eat);
- this.walk = this.getBoolean(json, "walk", this.walk);
- this.mine = this.getBoolean(json, "mine", this.mine);
- this.place = this.getBoolean(json, "place", this.place);
- this.delay = this.getInt(json, "delay", this.delay);
- }
-
- public String name() {
- return "announcer";
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/config/impl/AntiAFKTranslator.java b/src/main/java/net/daporkchop/pepsimod/util/config/impl/AntiAFKTranslator.java
deleted file mode 100644
index 5378969..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/config/impl/AntiAFKTranslator.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util.config.impl;
-
-import com.google.gson.JsonObject;
-import net.daporkchop.pepsimod.util.config.IConfigTranslator;
-
-public class AntiAFKTranslator implements IConfigTranslator {
- public static final AntiAFKTranslator INSTANCE = new AntiAFKTranslator();
-
- //spinning
- public boolean spin = false;
- public boolean sneak = true;
- public boolean swingArm = true;
- public boolean move = false;
- public boolean strafe = false;
-
- public int delay = 5000;
- public boolean requireInactive = true;
-
- private AntiAFKTranslator() {
- }
-
- public void encode(JsonObject json) {
- json.addProperty("spin", this.spin);
- json.addProperty("sneak", this.sneak);
- json.addProperty("swingArm", this.swingArm);
- json.addProperty("move", this.move);
- json.addProperty("strafe", this.strafe);
- json.addProperty("delay", this.delay);
- json.addProperty("requireInactive", this.requireInactive);
- }
-
- public void decode(String fieldName, JsonObject json) {
- this.spin = this.getBoolean(json, "spin", this.spin);
- this.sneak = this.getBoolean(json, "sneak", this.sneak);
- this.swingArm = this.getBoolean(json, "swingArm", this.swingArm);
- this.move = this.getBoolean(json, "move", this.move);
- this.strafe = this.getBoolean(json, "strafe", this.strafe);
- this.delay = this.getInt(json, "delay", this.delay);
- this.requireInactive = this.getBoolean(json, "requireInactive", this.requireInactive);
- }
-
- public String name() {
- return "antiafk";
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/config/impl/AutoEatTranslator.java b/src/main/java/net/daporkchop/pepsimod/util/config/impl/AutoEatTranslator.java
deleted file mode 100644
index 330d6f7..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/config/impl/AutoEatTranslator.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util.config.impl;
-
-import com.google.gson.JsonObject;
-import net.daporkchop.pepsimod.util.config.IConfigTranslator;
-
-public class AutoEatTranslator implements IConfigTranslator {
- public static final AutoEatTranslator INSTANCE = new AutoEatTranslator();
- public float threshold = 7f;
-
- private AutoEatTranslator() {
-
- }
-
- public void encode(JsonObject json) {
- json.addProperty("threshold", this.threshold);
- }
-
- public void decode(String fieldName, JsonObject json) {
- this.threshold = this.getFloat(json, "threshold", this.threshold);
- }
-
- public String name() {
- return "autoeat";
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/config/impl/BedBomberTranslator.java b/src/main/java/net/daporkchop/pepsimod/util/config/impl/BedBomberTranslator.java
deleted file mode 100644
index 3d511f7..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/config/impl/BedBomberTranslator.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util.config.impl;
-
-import com.google.gson.JsonObject;
-import net.daporkchop.pepsimod.util.config.IConfigTranslator;
-
-public class BedBomberTranslator implements IConfigTranslator {
- public static final BedBomberTranslator INSTANCE = new BedBomberTranslator();
- public float range = 4.0f;
- public int delay = 500;
- public boolean resupply = true;
-
- private BedBomberTranslator() {
-
- }
-
- public void encode(JsonObject json) {
- json.addProperty("range", this.range);
- json.addProperty("delay", this.delay);
- json.addProperty("resupply", this.resupply);
- }
-
- public void decode(String fieldName, JsonObject json) {
- this.range = this.getFloat(json, "range", this.range);
- this.delay = this.getInt(json, "delay", this.delay);
- this.resupply = this.getBoolean(json, "resupply", this.resupply);
- }
-
- public String name() {
- return "bedbomber";
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/config/impl/ClickGUITranslator.java b/src/main/java/net/daporkchop/pepsimod/util/config/impl/ClickGUITranslator.java
deleted file mode 100644
index 65ec69e..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/config/impl/ClickGUITranslator.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util.config.impl;
-
-import com.google.gson.JsonObject;
-import net.daporkchop.pepsimod.gui.clickgui.ClickGUI;
-import net.daporkchop.pepsimod.gui.clickgui.Window;
-import net.daporkchop.pepsimod.gui.clickgui.api.IEntry;
-import net.daporkchop.pepsimod.util.config.IConfigTranslator;
-
-public class ClickGUITranslator implements IConfigTranslator {
- public static final ClickGUITranslator INSTANCE = new ClickGUITranslator();
-
- private ClickGUITranslator() {
-
- }
-
- public void encode(JsonObject json) {
- for (Window window : ClickGUI.INSTANCE.windows) {
- json.addProperty(window.text + ".x", window.x);
- json.addProperty(window.text + ".y", window.y);
- json.addProperty(window.text + ".open", window.isOpen());
-
- for (IEntry entry : window.entries) {
- json.addProperty(window.text + '.' + entry.getName() + ".open", entry.isOpen());
- }
- }
- }
-
- public void decode(String fieldName, JsonObject json) {
- for (Window window : ClickGUI.INSTANCE.windows) {
- window.setX(this.getInt(json, window.text + ".x", window.x));
- window.setY(this.getInt(json, window.text + ".y", window.y));
- window.setOpen(this.getBoolean(json, window.text + ".open", window.isOpen()));
-
- for (IEntry entry : window.entries) {
- entry.setOpen(this.getBoolean(json, window.text + '.' + entry.getName() + ".open", entry.isOpen()));
- }
- }
- }
-
- public String name() {
- return "clickgui";
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/config/impl/CpuLimitTranslator.java b/src/main/java/net/daporkchop/pepsimod/util/config/impl/CpuLimitTranslator.java
deleted file mode 100644
index 241a88f..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/config/impl/CpuLimitTranslator.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util.config.impl;
-
-import com.google.gson.JsonObject;
-import net.daporkchop.pepsimod.util.config.IConfigTranslator;
-
-public class CpuLimitTranslator implements IConfigTranslator {
- public static final CpuLimitTranslator INSTANCE = new CpuLimitTranslator();
- public int limit = 5;
-
- private CpuLimitTranslator() {
-
- }
-
- public void encode(JsonObject json) {
- json.addProperty("limit", this.limit);
- }
-
- public void decode(String fieldName, JsonObject json) {
- this.limit = this.getInt(json, "limit", this.limit);
- }
-
- public String name() {
- return "cpuLimit";
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/config/impl/CriticalsTranslator.java b/src/main/java/net/daporkchop/pepsimod/util/config/impl/CriticalsTranslator.java
deleted file mode 100644
index 10f2375..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/config/impl/CriticalsTranslator.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util.config.impl;
-
-import com.google.gson.JsonObject;
-import net.daporkchop.pepsimod.util.config.IConfigTranslator;
-
-public class CriticalsTranslator implements IConfigTranslator {
- public static final CriticalsTranslator INSTANCE = new CriticalsTranslator();
- public boolean packet = true;
-
- private CriticalsTranslator() {
-
- }
-
- public void encode(JsonObject json) {
- json.addProperty("packet", this.packet);
- }
-
- public void decode(String fieldName, JsonObject json) {
- this.packet = this.getBoolean(json, "packet", this.packet);
- }
-
- public String name() {
- return "criticals";
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/config/impl/CrystalAuraTranslator.java b/src/main/java/net/daporkchop/pepsimod/util/config/impl/CrystalAuraTranslator.java
deleted file mode 100644
index 8b3036d..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/config/impl/CrystalAuraTranslator.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util.config.impl;
-
-import com.google.gson.JsonObject;
-import net.daporkchop.pepsimod.util.config.IConfigTranslator;
-
-public class CrystalAuraTranslator implements IConfigTranslator {
- public static final CrystalAuraTranslator INSTANCE = new CrystalAuraTranslator();
- public float speed = 1.0f;
- public float range = 3.8f;
-
- private CrystalAuraTranslator() {
-
- }
-
- public void encode(JsonObject json) {
- json.addProperty("speed", this.speed);
- json.addProperty("range", this.range);
- }
-
- public void decode(String fieldName, JsonObject json) {
- this.speed = this.getFloat(json, "speed", this.speed);
- this.range = this.getFloat(json, "range", this.range);
- }
-
- public String name() {
- return "crystalaura";
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/config/impl/ESPTranslator.java b/src/main/java/net/daporkchop/pepsimod/util/config/impl/ESPTranslator.java
deleted file mode 100644
index e6ec61e..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/config/impl/ESPTranslator.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util.config.impl;
-
-import com.google.gson.JsonObject;
-import net.daporkchop.pepsimod.util.config.IConfigTranslator;
-
-public class ESPTranslator implements IConfigTranslator {
- public static final ESPTranslator INSTANCE = new ESPTranslator();
- public boolean basic = false;
- public boolean trapped = false;
- public boolean ender = false;
- public boolean hopper = false;
- public boolean furnace = false;
-
- public boolean monsters = false;
- public boolean animals = false;
- public boolean players = false;
- public boolean golems = false;
- public boolean invisible = false;
- public boolean friendColors = true;
- public boolean box = false;
-
- private ESPTranslator() {
-
- }
-
- public void encode(JsonObject json) {
- json.addProperty("basic", this.basic);
- json.addProperty("trapped", this.trapped);
- json.addProperty("ender", this.ender);
- json.addProperty("hopper", this.hopper);
- json.addProperty("furnace", this.furnace);
-
- json.addProperty("monsters", this.monsters);
- json.addProperty("animals", this.animals);
- json.addProperty("players", this.players);
- json.addProperty("golems", this.golems);
- json.addProperty("invisible", this.invisible);
- json.addProperty("friendColors", this.friendColors);
- json.addProperty("box", this.box);
- }
-
- public void decode(String fieldName, JsonObject json) {
- this.basic = this.getBoolean(json, "basic", this.basic);
- this.trapped = this.getBoolean(json, "trapped", this.trapped);
- this.ender = this.getBoolean(json, "ender", this.ender);
- this.hopper = this.getBoolean(json, "hopper", this.hopper);
- this.furnace = this.getBoolean(json, "furnace", this.furnace);
-
- this.monsters = this.getBoolean(json, "monsters", this.monsters);
- this.animals = this.getBoolean(json, "animals", this.animals);
- this.players = this.getBoolean(json, "players", this.players);
- this.golems = this.getBoolean(json, "golems", this.golems);
- this.invisible = this.getBoolean(json, "invisible", this.invisible);
- this.friendColors = this.getBoolean(json, "friendColors", this.friendColors);
- this.box = this.getBoolean(json, "box", this.box);
- }
-
- public String name() {
- return "esp";
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/config/impl/ElytraFlyTranslator.java b/src/main/java/net/daporkchop/pepsimod/util/config/impl/ElytraFlyTranslator.java
deleted file mode 100644
index 68ea917..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/config/impl/ElytraFlyTranslator.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util.config.impl;
-
-import com.google.gson.JsonObject;
-import net.daporkchop.pepsimod.util.config.IConfigTranslator;
-
-public class ElytraFlyTranslator implements IConfigTranslator {
- public static final ElytraFlyTranslator INSTANCE = new ElytraFlyTranslator();
- public boolean easyStart = false;
- public boolean stopInWater = true;
- public boolean fly = false;
- public float speed = 0.2f;
- public ElytraFlyMode mode = ElytraFlyMode.getMode(0);
-
- private ElytraFlyTranslator() {
-
- }
-
- public void encode(JsonObject json) {
- json.addProperty("easyStart", this.easyStart);
- json.addProperty("stopInWater", this.stopInWater);
- json.addProperty("fly", this.fly);
- json.addProperty("speed", this.speed);
- json.addProperty("mode", this.mode.ordinal());
- }
-
- public void decode(String fieldName, JsonObject json) {
- this.easyStart = this.getBoolean(json, "easyStart", this.easyStart);
- this.stopInWater = this.getBoolean(json, "stopInWater", this.stopInWater);
- this.fly = this.getBoolean(json, "fly", this.fly);
- this.speed = this.getFloat(json, "speed", this.speed);
- this.mode = ElytraFlyMode.getMode(this.getInt(json, "mode", this.mode.ordinal()));
- }
-
- public String name() {
- return "elytraFly";
- }
-
- public enum ElytraFlyMode {
- NORMAL,
- PACKET;
-
- public static ElytraFlyMode getMode(int id) {
- return values()[id];
- }
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/config/impl/EntitySpeedTranslator.java b/src/main/java/net/daporkchop/pepsimod/util/config/impl/EntitySpeedTranslator.java
deleted file mode 100644
index f8780e7..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/config/impl/EntitySpeedTranslator.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util.config.impl;
-
-import com.google.gson.JsonObject;
-import net.daporkchop.pepsimod.util.config.IConfigTranslator;
-
-public class EntitySpeedTranslator implements IConfigTranslator {
- public static final EntitySpeedTranslator INSTANCE = new EntitySpeedTranslator();
- public float speed = 1.0f;
- public float idleSpeed = 1.0f;
-
- private EntitySpeedTranslator() {
- }
-
- public void encode(JsonObject json) {
- json.addProperty("speed", this.speed);
- json.addProperty("idleSpeed", this.idleSpeed);
- }
-
- public void decode(String fieldName, JsonObject json) {
- this.speed = this.getFloat(json, "speed", this.speed);
- this.idleSpeed = this.getFloat(json, "idleSpeed", this.idleSpeed);
- }
-
- public String name() {
- return "entityspeed";
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/config/impl/FlightTranslator.java b/src/main/java/net/daporkchop/pepsimod/util/config/impl/FlightTranslator.java
deleted file mode 100644
index e006f7d..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/config/impl/FlightTranslator.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util.config.impl;
-
-import com.google.gson.JsonObject;
-import net.daporkchop.pepsimod.util.config.IConfigTranslator;
-
-public class FlightTranslator implements IConfigTranslator {
- public static final FlightTranslator INSTANCE = new FlightTranslator();
- public float speed = 1.0f;
-
- private FlightTranslator() {
-
- }
-
- public void encode(JsonObject json) {
- json.addProperty("speed", this.speed);
- }
-
- public void decode(String fieldName, JsonObject json) {
- this.speed = this.getFloat(json, "speed", this.speed);
- }
-
- public String name() {
- return "flight";
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/config/impl/FreecamTranslator.java b/src/main/java/net/daporkchop/pepsimod/util/config/impl/FreecamTranslator.java
deleted file mode 100644
index 127d41d..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/config/impl/FreecamTranslator.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util.config.impl;
-
-import com.google.gson.JsonObject;
-import net.daporkchop.pepsimod.util.config.IConfigTranslator;
-
-public class FreecamTranslator implements IConfigTranslator {
- public static final FreecamTranslator INSTANCE = new FreecamTranslator();
- public float speed = 1.0f;
-
- private FreecamTranslator() {
-
- }
-
- public void encode(JsonObject json) {
- json.addProperty("speed", this.speed);
- }
-
- public void decode(String fieldName, JsonObject json) {
- this.speed = this.getFloat(json, "speed", this.speed);
- }
-
- public String name() {
- return "freecam";
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/config/impl/FriendsTranslator.java b/src/main/java/net/daporkchop/pepsimod/util/config/impl/FriendsTranslator.java
deleted file mode 100644
index 3e3e7af..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/config/impl/FriendsTranslator.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util.config.impl;
-
-import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonPrimitive;
-import net.daporkchop.pepsimod.util.config.IConfigTranslator;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.player.EntityPlayer;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.UUID;
-
-public class FriendsTranslator implements IConfigTranslator {
- public static final FriendsTranslator INSTANCE = new FriendsTranslator();
- public Set friends = new HashSet<>();
-
- private FriendsTranslator() {
- }
-
- public void encode(JsonObject json) {
- JsonArray array = new JsonArray();
- for (UUID uuid : this.friends) {
- JsonObject object = new JsonObject();
- object.addProperty("msb", uuid.getMostSignificantBits());
- object.addProperty("lsb", uuid.getLeastSignificantBits());
- array.add(object);
- }
- json.add("friends", array);
- }
-
- public void decode(String fieldName, JsonObject json) {
- JsonArray array = this.getArray(json, "friends", new JsonArray());
- for (JsonElement element : array) {
- if (element.isJsonPrimitive()) {
- //convert old format
- this.friends.add(UUID.fromString(element.getAsString()));
- } else {
- JsonObject object = element.getAsJsonObject();
- this.friends.add(new UUID(object.get("msb").getAsLong(), object.get("lsb").getAsLong()));
- }
- }
- }
-
- public boolean isFriend(Entity entity) {
- return this.friends.contains(entity.getUniqueID());
- }
-
- public String name() {
- return "friends";
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/config/impl/GeneralTranslator.java b/src/main/java/net/daporkchop/pepsimod/util/config/impl/GeneralTranslator.java
deleted file mode 100644
index 520a0af..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/config/impl/GeneralTranslator.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util.config.impl;
-
-import com.google.gson.JsonObject;
-import net.daporkchop.pepsimod.module.ModuleManager;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleSortType;
-import net.daporkchop.pepsimod.util.config.IConfigTranslator;
-
-import java.util.HashMap;
-
-public class GeneralTranslator implements IConfigTranslator {
- public static final GeneralTranslator INSTANCE = new GeneralTranslator();
- public boolean autoReconnect = false;
- public HashMap states = new HashMap<>();
- public ModuleSortType sortType = ModuleSortType.SIZE;
- public JsonObject json = new JsonObject();
-
- private GeneralTranslator() {
-
- }
-
- public void encode(JsonObject json) {
- for (Module module : ModuleManager.AVALIBLE_MODULES) {
- json.addProperty("module.enabled." + module.nameFull, module.state.toString());
- }
- json.addProperty("autoReconnect", this.autoReconnect);
- json.addProperty("sortType", this.sortType.ordinal());
- }
-
- public void decode(String fieldName, JsonObject json) {
- this.json = json;
- this.autoReconnect = this.getBoolean(json, "autoReconnect", this.autoReconnect);
- this.sortType = ModuleSortType.fromOrdinal(this.getInt(json, "sortType", this.sortType.ordinal()));
- }
-
- public ModuleState getState(String name, ModuleState fallback) {
- if (this.json.has("module.enabled." + name)) {
- return ModuleState.fromString(this.json.get("module.enabled." + name).getAsString());
- }
-
- return fallback;
- }
-
- public String name() {
- return "general";
- }
-
- public static class ModuleState {
- public static ModuleState DEFAULT = new ModuleState(false, false);
-
- public static ModuleState fromString(String from) {
- String[] split = from.split(" ");
- return new ModuleState(Boolean.parseBoolean(split[0]), Boolean.parseBoolean(split[1]));
- }
- public boolean enabled;
- public boolean hidden;
-
- public ModuleState(boolean a, boolean b) {
- this.enabled = a;
- this.hidden = b;
- }
-
- @Override
- public String toString() {
- return this.enabled + " " + this.hidden;
- }
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/config/impl/HUDTranslator.java b/src/main/java/net/daporkchop/pepsimod/util/config/impl/HUDTranslator.java
deleted file mode 100644
index b0b4569..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/config/impl/HUDTranslator.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util.config.impl;
-
-import com.google.gson.JsonObject;
-import net.daporkchop.pepsimod.util.config.IConfigTranslator;
-import org.lwjgl.opengl.GL11;
-
-public class HUDTranslator implements IConfigTranslator {
- public static final HUDTranslator INSTANCE = new HUDTranslator();
-
- public boolean drawLogo = true;
- public boolean arrayList = true;
- public boolean TPS = false;
- public boolean coords = false;
- public boolean netherCoords = false;
- public boolean arrayListTop = true;
- public boolean serverBrand = false;
- public boolean rainbow = true;
- public int r = 0;
- public int g = 0;
- public int b = 0;
- public boolean direction = true;
- public boolean armor = false;
- public boolean effects = false;
- public boolean fps = true;
- public boolean ping = true;
- public boolean clampTabList = false;
- public int maxTabRows = 20;
- //public int maxTabCols = 5;
- public JsonObject json = new JsonObject();
-
- private HUDTranslator() {
-
- }
-
- public void encode(JsonObject json) {
- json.addProperty("drawLogo", this.drawLogo);
- json.addProperty("arrayList", this.arrayList);
- json.addProperty("tps", this.TPS);
- json.addProperty("coords", this.coords);
- json.addProperty("netherCoords", this.netherCoords);
- json.addProperty("arrayListTop", this.arrayListTop);
- json.addProperty("serverBrand", this.serverBrand);
- json.addProperty("rainbow", this.rainbow);
- json.addProperty("r", this.r);
- json.addProperty("g", this.g);
- json.addProperty("b", this.b);
- json.addProperty("direction", this.direction);
- json.addProperty("armor", this.armor);
- json.addProperty("effects", this.effects);
- json.addProperty("fps", this.fps);
- json.addProperty("ping", this.ping);
- json.addProperty("clampTabList", this.clampTabList);
- json.addProperty("maxTabRows", this.maxTabRows);
- //json.addProperty("maxTabCols", this.maxTabCols);
- }
-
- public void decode(String fieldName, JsonObject json) {
- this.json = json;
- }
-
- public void parseConfigLate() {
- this.drawLogo = this.getBoolean(this.json, "drawLogo", this.drawLogo);
- this.arrayList = this.getBoolean(this.json, "arrayList", this.arrayList);
- this.TPS = this.getBoolean(this.json, "tps", this.TPS);
- this.coords = this.getBoolean(this.json, "coords", this.coords);
- this.netherCoords = this.getBoolean(this.json, "netherCoords", this.netherCoords);
- this.arrayListTop = this.getBoolean(this.json, "arrayListTop", this.arrayListTop);
- this.serverBrand = this.getBoolean(this.json, "serverBrand", this.serverBrand);
- this.rainbow = this.getBoolean(this.json, "rainbow", this.rainbow);
- this.r = this.getInt(this.json, "r", this.r);
- this.g = this.getInt(this.json, "g", this.g);
- this.b = this.getInt(this.json, "b", this.b);
- this.direction = this.getBoolean(this.json, "direction", this.direction);
- this.armor = this.getBoolean(this.json, "armor", this.armor);
- this.effects = this.getBoolean(this.json, "effects", this.effects);
- this.fps = this.getBoolean(this.json, "fps", this.fps);
- this.ping = this.getBoolean(this.json, "ping", this.ping);
- this.clampTabList = this.getBoolean(this.json, "clampTabList", this.clampTabList);
- this.maxTabRows = this.getInt(this.json, "maxTabRows", this.maxTabRows);
- //this.maxTabCols = this.getInt(this.json, "maxTabCols", this.maxTabCols);
- }
-
- public String name() {
- return "hud";
- }
-
- public void bindColor() {
- byte r = (byte) Math.floorDiv(this.r, 2);
- byte g = (byte) Math.floorDiv(this.g, 2);
- byte b = (byte) Math.floorDiv(this.b, 2);
- GL11.glColor3b(r, g, b);
- }
-
- public int getColor() {
- return (255) << 24 | (this.r & 255) << 16 | (this.g & 255) << 8 | (this.b & 255);
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/config/impl/NameTagsTranslator.java b/src/main/java/net/daporkchop/pepsimod/util/config/impl/NameTagsTranslator.java
deleted file mode 100644
index 3d3e713..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/config/impl/NameTagsTranslator.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util.config.impl;
-
-import com.google.gson.JsonObject;
-import net.daporkchop.pepsimod.util.config.IConfigTranslator;
-
-public class NameTagsTranslator implements IConfigTranslator {
- public static final NameTagsTranslator INSTANCE = new NameTagsTranslator();
-
- public float scale = 1.0f;
-
- private NameTagsTranslator() {
-
- }
-
- public void encode(JsonObject json) {
- json.addProperty("scale", this.scale);
- }
-
- public void decode(String fieldName, JsonObject json) {
- this.scale = this.getFloat(json, "scale", this.scale);
- }
-
- public String name() {
- return "nametags";
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/config/impl/NoWeatherTranslator.java b/src/main/java/net/daporkchop/pepsimod/util/config/impl/NoWeatherTranslator.java
deleted file mode 100644
index 0b732b2..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/config/impl/NoWeatherTranslator.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util.config.impl;
-
-import com.google.gson.JsonObject;
-import net.daporkchop.pepsimod.util.config.IConfigTranslator;
-
-public class NoWeatherTranslator implements IConfigTranslator {
- public static final NoWeatherTranslator INSTANCE = new NoWeatherTranslator();
- public boolean disableRain = false;
- public boolean changeTime = false;
- public int time = 0;
-
- private NoWeatherTranslator() {
-
- }
-
- public void encode(JsonObject json) {
- json.addProperty("disableRain", this.disableRain);
- json.addProperty("changeTime", this.changeTime);
- json.addProperty("time", this.time);
- }
-
- public void decode(String fieldName, JsonObject json) {
- this.disableRain = this.getBoolean(json, "disableRain", this.disableRain);
- this.changeTime = this.getBoolean(json, "changeTime", this.changeTime);
- this.time = this.getInt(json, "time", this.time);
- }
-
- public String name() {
- return "noWeather";
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/config/impl/NotificationsTranslator.java b/src/main/java/net/daporkchop/pepsimod/util/config/impl/NotificationsTranslator.java
deleted file mode 100644
index e3546bd..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/config/impl/NotificationsTranslator.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util.config.impl;
-
-import com.google.gson.JsonObject;
-import net.daporkchop.pepsimod.util.config.IConfigTranslator;
-
-public class NotificationsTranslator implements IConfigTranslator {
- public static final NotificationsTranslator INSTANCE = new NotificationsTranslator();
- public boolean queue = false;
- public boolean death = false;
- public boolean chat = false;
- public boolean player = false;
-
- private NotificationsTranslator() {
-
- }
-
- public void encode(JsonObject json) {
- json.addProperty("queue", this.queue);
- json.addProperty("death", this.death);
- json.addProperty("chat", this.chat);
- json.addProperty("player", this.player);
- }
-
- public void decode(String fieldName, JsonObject json) {
- this.queue = this.getBoolean(json, "queue", this.queue);
- this.death = this.getBoolean(json, "death", this.death);
- this.chat = this.getBoolean(json, "chat", this.chat);
- this.player = this.getBoolean(json, "player", this.player);
- }
-
- public String name() {
- return "notifications";
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/config/impl/SpeedmineTranslator.java b/src/main/java/net/daporkchop/pepsimod/util/config/impl/SpeedmineTranslator.java
deleted file mode 100644
index e88f746..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/config/impl/SpeedmineTranslator.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util.config.impl;
-
-import com.google.gson.JsonObject;
-import net.daporkchop.pepsimod.util.config.IConfigTranslator;
-
-public class SpeedmineTranslator implements IConfigTranslator {
- public static final SpeedmineTranslator INSTANCE = new SpeedmineTranslator();
- public float speed = 0.4f;
-
- private SpeedmineTranslator() {
-
- }
-
- public void encode(JsonObject json) {
- json.addProperty("speed", this.speed);
- }
-
- public void decode(String fieldName, JsonObject json) {
- this.speed = this.getFloat(json, "speed", this.speed);
- }
-
- public String name() {
- return "speedmine";
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/config/impl/StepTranslator.java b/src/main/java/net/daporkchop/pepsimod/util/config/impl/StepTranslator.java
deleted file mode 100644
index dd139e0..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/config/impl/StepTranslator.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util.config.impl;
-
-import com.google.gson.JsonObject;
-import net.daporkchop.pepsimod.util.config.IConfigTranslator;
-
-public class StepTranslator implements IConfigTranslator {
- public static final StepTranslator INSTANCE = new StepTranslator();
- public boolean legit = false;
- public int height = 1;
-
- private StepTranslator() {
-
- }
-
- public void encode(JsonObject json) {
- json.addProperty("legit", this.legit);
- json.addProperty("height", this.height);
- }
-
- public void decode(String fieldName, JsonObject json) {
- this.legit = this.getBoolean(json, "legit", this.legit);
- this.height = this.getInt(json, "height", this.height);
- }
-
- public String name() {
- return "step";
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/config/impl/TargettingTranslator.java b/src/main/java/net/daporkchop/pepsimod/util/config/impl/TargettingTranslator.java
deleted file mode 100644
index 6b39754..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/config/impl/TargettingTranslator.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util.config.impl;
-
-import com.google.gson.JsonObject;
-import net.daporkchop.pepsimod.util.config.IConfigTranslator;
-
-public class TargettingTranslator implements IConfigTranslator {
- public static final TargettingTranslator INSTANCE = new TargettingTranslator();
- public boolean players = false;
- public boolean animals = false;
- public boolean monsters = false;
- public boolean golems = false;
- public boolean sleeping = false;
- public boolean invisible = false;
- public boolean teams = false;
- public boolean friends = false;
- public boolean through_walls = false;
- public boolean use_cooldown = false;
- public boolean silent = false;
- public boolean rotate = false;
- public TargetBone targetBone = TargetBone.FEET;
- public float fov = 360f;
- public float reach = 4.25f;
- public int delay = 20;
-
- private TargettingTranslator() {
-
- }
-
- public void encode(JsonObject json) {
- json.addProperty("players", this.players);
- json.addProperty("animals", this.animals);
- json.addProperty("monsters", this.monsters);
- json.addProperty("golems", this.golems);
- json.addProperty("sleeping", this.sleeping);
- json.addProperty("invisible", this.invisible);
- json.addProperty("teams", this.teams);
- json.addProperty("friends", this.friends);
- json.addProperty("through_walls", this.through_walls);
- json.addProperty("use_cooldown", this.use_cooldown);
- json.addProperty("silent", this.silent);
- json.addProperty("rotate", this.rotate);
- json.addProperty("bone", this.targetBone.ordinal());
- json.addProperty("fov", this.fov);
- json.addProperty("reach", this.reach);
- json.addProperty("delay", this.delay);
- }
-
- public void decode(String fieldName, JsonObject json) {
- this.players = this.getBoolean(json, "players", this.players);
- this.animals = this.getBoolean(json, "animals", this.animals);
- this.monsters = this.getBoolean(json, "monsters", this.monsters);
- this.golems = this.getBoolean(json, "golems", this.golems);
- this.sleeping = this.getBoolean(json, "sleeping", this.sleeping);
- this.invisible = this.getBoolean(json, "invisible", this.invisible);
- this.teams = this.getBoolean(json, "teams", this.teams);
- this.friends = this.getBoolean(json, "friends", this.friends);
- this.through_walls = this.getBoolean(json, "through_walls", this.through_walls);
- this.use_cooldown = this.getBoolean(json, "use_cooldown", this.use_cooldown);
- this.silent = this.getBoolean(json, "silent", this.silent);
- this.rotate = this.getBoolean(json, "rotate", this.rotate);
- this.targetBone = TargetBone.getBone(this.getInt(json, "bone", this.targetBone.ordinal()));
- this.fov = this.getFloat(json, "fov", this.fov);
- this.reach = this.getFloat(json, "reach", this.reach);
- this.delay = this.getInt(json, "delay", this.delay);
- }
-
- public String name() {
- return "targetting";
- }
-
- public enum TargetBone {
- HEAD,
- FEET,
- MIDDLE;
-
- public static TargetBone getBone(int id) {
- return values()[id];
- }
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/config/impl/TimerTranslator.java b/src/main/java/net/daporkchop/pepsimod/util/config/impl/TimerTranslator.java
deleted file mode 100644
index 6c30fb0..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/config/impl/TimerTranslator.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util.config.impl;
-
-import com.google.gson.JsonObject;
-import net.daporkchop.pepsimod.util.config.IConfigTranslator;
-
-public class TimerTranslator implements IConfigTranslator {
- public static final TimerTranslator INSTANCE = new TimerTranslator();
- public float multiplier = 1.0f;
- public boolean tpsSync = false;
-
- private TimerTranslator() {
-
- }
-
- public void encode(JsonObject json) {
- json.addProperty("multiplier", this.multiplier);
- json.addProperty("tpsSync", this.tpsSync);
- }
-
- public void decode(String fieldName, JsonObject json) {
- this.multiplier = this.getFloat(json, "multiplier", this.multiplier);
- this.tpsSync = this.getBoolean(json, "tpsSync", this.tpsSync);
- }
-
- public String name() {
- return "timer";
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/config/impl/TracersTranslator.java b/src/main/java/net/daporkchop/pepsimod/util/config/impl/TracersTranslator.java
deleted file mode 100644
index 900d728..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/config/impl/TracersTranslator.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util.config.impl;
-
-import com.google.gson.JsonObject;
-import net.daporkchop.pepsimod.util.config.IConfigTranslator;
-
-public class TracersTranslator implements IConfigTranslator {
- public static final TracersTranslator INSTANCE = new TracersTranslator();
- public boolean sleeping = false;
- public boolean invisible = false;
- public boolean friendColors = true;
- public boolean animals = false;
- public boolean monsters = false;
- public boolean players = false;
- public boolean items = false;
- public boolean everything = false;
- public boolean distanceColor = true;
- public float width = 2.0f;
-
- private TracersTranslator() {
- }
-
- public void encode(JsonObject json) {
- json.addProperty("sleeping", this.sleeping);
- json.addProperty("invisible", this.invisible);
- json.addProperty("friendColors", this.friendColors);
- json.addProperty("animals", this.animals);
- json.addProperty("monsters", this.monsters);
- json.addProperty("players", this.players);
- json.addProperty("items", this.items);
- json.addProperty("everything", this.everything);
- json.addProperty("distanceColor", this.distanceColor);
- json.addProperty("width", this.width);
- }
-
- public void decode(String fieldName, JsonObject json) {
- this.sleeping = this.getBoolean(json, "sleeping", this.sleeping);
- this.invisible = this.getBoolean(json, "invisible", this.invisible);
- this.friendColors = this.getBoolean(json, "friendColors", this.friendColors);
- this.animals = this.getBoolean(json, "animals", this.animals);
- this.monsters = this.getBoolean(json, "monsters", this.monsters);
- this.players = this.getBoolean(json, "players", this.players);
- this.items = this.getBoolean(json, "items", this.items);
- this.everything = this.getBoolean(json, "everything", this.everything);
- this.distanceColor = this.getBoolean(json, "distanceColor", this.distanceColor);
- this.width = this.getFloat(json, "width", this.width);
- }
-
- public String name() {
- return "tracers";
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/config/impl/VelocityTranslator.java b/src/main/java/net/daporkchop/pepsimod/util/config/impl/VelocityTranslator.java
deleted file mode 100644
index aeb2f2c..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/config/impl/VelocityTranslator.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util.config.impl;
-
-import com.google.gson.JsonObject;
-import net.daporkchop.pepsimod.util.config.IConfigTranslator;
-
-public class VelocityTranslator implements IConfigTranslator {
- public static final VelocityTranslator INSTANCE = new VelocityTranslator();
- public float multiplier = 1.0f;
-
- private VelocityTranslator() {
-
- }
-
- public void encode(JsonObject json) {
- json.addProperty("multiplier", this.multiplier);
- }
-
- public void decode(String fieldName, JsonObject json) {
- this.multiplier = this.getFloat(json, "multiplier", this.multiplier);
- }
-
- public String name() {
- return "velocity";
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/config/impl/XrayTranslator.java b/src/main/java/net/daporkchop/pepsimod/util/config/impl/XrayTranslator.java
deleted file mode 100644
index ddf473b..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/config/impl/XrayTranslator.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util.config.impl;
-
-import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonPrimitive;
-import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
-import net.daporkchop.pepsimod.optimization.BlockID;
-import net.daporkchop.pepsimod.util.config.IConfigTranslator;
-import net.minecraft.block.Block;
-import net.minecraft.util.ResourceLocation;
-
-import java.util.stream.StreamSupport;
-
-public class XrayTranslator implements IConfigTranslator {
- public static final XrayTranslator INSTANCE = new XrayTranslator();
- public IntOpenHashSet target_blocks = new IntOpenHashSet();
-
- private XrayTranslator() {
- }
-
- public void encode(JsonObject json) {
- JsonArray array = new JsonArray();
- for (int id : this.target_blocks){
- array.add(Block.REGISTRY.getObjectById(id).getRegistryName().toString());
- }
- json.add("targetBlocks_v2", array);
- }
-
- public void decode(String fieldName, JsonObject json) {
- this.target_blocks.clear();
- StreamSupport.stream(this.getArray(json, "targetBlocks", new JsonArray()).spliterator(), false)
- .mapToInt(JsonElement::getAsInt)
- .forEach(this.target_blocks::add);
- StreamSupport.stream(this.getArray(json, "targetBlocks_v2", new JsonArray()).spliterator(), false)
- .map(JsonElement::getAsString)
- .map(ResourceLocation::new)
- .map(Block.REGISTRY::getObject)
- .map(BlockID.class::cast)
- .mapToInt(BlockID::getBlockId)
- .forEach(this.target_blocks::add);
- this.target_blocks.trim();
- }
-
- public String name() {
- return "xray";
- }
-
- public boolean isTargeted(Block block) {
- return this.target_blocks.contains(((BlockID) block).getBlockId());
- }
-
- public boolean isTargeted(BlockID block) {
- return this.target_blocks.contains(block.getBlockId());
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/config/storage/ConfNode.java b/src/main/java/net/daporkchop/pepsimod/util/config/storage/ConfNode.java
new file mode 100644
index 0000000..2674709
--- /dev/null
+++ b/src/main/java/net/daporkchop/pepsimod/util/config/storage/ConfNode.java
@@ -0,0 +1,303 @@
+/*
+ * Adapted from The MIT License (MIT)
+ *
+ * Copyright (c) 2016-2020 DaPorkchop_
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions:
+ *
+ * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
+ * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+package net.daporkchop.pepsimod.util.config.storage;
+
+import lombok.Getter;
+import lombok.NonNull;
+import lombok.experimental.Accessors;
+import net.daporkchop.pepsimod.util.config.Configuration;
+import net.daporkchop.pepsimod.util.exception.InvalidTypeException;
+
+import java.util.StringJoiner;
+
+/**
+ * Base for the different configuration node types.
+ *
+ * @author DaPorkchop_
+ */
+public interface ConfNode {
+ /**
+ * @return this node's value's type
+ */
+ ValueType type();
+
+ /**
+ * @return this node's name
+ */
+ String name();
+
+ /**
+ * @return this node's qualified name
+ */
+ String qualifiedName();
+
+ /**
+ * @return this node's path
+ */
+ String[] path();
+
+ /**
+ * @return this node's value
+ */
+ Configuration objValue();
+
+ /**
+ * @return this node's value
+ */
+ int intValue();
+
+ /**
+ * @return this node's value
+ */
+ long longValue();
+
+ /**
+ * @return this node's value
+ */
+ float floatValue();
+
+ /**
+ * @return this node's value
+ */
+ double doubleValue();
+
+ /**
+ * @return this node's value
+ */
+ boolean booleanValue();
+
+ /**
+ * A base implementation of {@link ConfNode}.
+ *
+ * @author DaPorkchop_
+ */
+ @Getter
+ abstract class AbstractConfNode implements ConfNode {
+ protected final String[] path;
+ protected String qualifiedName;
+
+ public AbstractConfNode(@NonNull String[] path) {
+ if (path.length <= 0) {
+ throw new IllegalArgumentException("Path length must be at least 1!");
+ } else {
+ this.path = path;
+ }
+ }
+
+ @Override
+ public String name() {
+ return this.path[this.path.length - 1];
+ }
+
+ @Override
+ public String qualifiedName() {
+ String qualifiedName = this.qualifiedName;
+ if (qualifiedName == null) {
+ StringJoiner joiner = new StringJoiner(".");
+ for (String s : this.path) {
+ joiner.add(s);
+ }
+ qualifiedName = this.qualifiedName = joiner.toString();
+ }
+ return qualifiedName;
+ }
+
+ @Override
+ public Configuration objValue() {
+ throw new InvalidTypeException(ValueType.OBJ, this.type());
+ }
+
+ @Override
+ public int intValue() {
+ throw new InvalidTypeException(ValueType.INT, this.type());
+ }
+
+ @Override
+ public long longValue() {
+ throw new InvalidTypeException(ValueType.LONG, this.type());
+ }
+
+ @Override
+ public float floatValue() {
+ throw new InvalidTypeException(ValueType.FLOAT, this.type());
+ }
+
+ @Override
+ public double doubleValue() {
+ throw new InvalidTypeException(ValueType.DOUBLE, this.type());
+ }
+
+ @Override
+ public boolean booleanValue() {
+ throw new InvalidTypeException(ValueType.BOOLEAN, this.type());
+ }
+ }
+
+ /**
+ * Implementation of {@link ConfNode} for {@link ValueType#OBJ}.
+ *
+ * @author DaPorkchop_
+ */
+ final class Obj extends AbstractConfNode {
+ protected final Configuration value;
+
+ public Obj(@NonNull String[] path, @NonNull Configuration value) {
+ super(path);
+
+ this.value = value;
+ }
+
+ @Override
+ public ValueType type() {
+ return ValueType.OBJ;
+ }
+
+ @Override
+ public Configuration objValue() {
+ return this.value;
+ }
+ }
+
+ /**
+ * Implementation of {@link ConfNode} for {@link ValueType#INT}.
+ *
+ * @author DaPorkchop_
+ */
+ final class Int extends AbstractConfNode {
+ protected final int value;
+
+ public Int(@NonNull String[] path, int value) {
+ super(path);
+
+ this.value = value;
+ }
+
+ @Override
+ public ValueType type() {
+ return ValueType.INT;
+ }
+
+ @Override
+ public int intValue() {
+ return this.value;
+ }
+ }
+
+ /**
+ * Implementation of {@link ConfNode} for {@link ValueType#LONG}.
+ *
+ * @author DaPorkchop_
+ */
+ final class Long extends AbstractConfNode {
+ protected final long value;
+
+ public Long(@NonNull String[] path, long value) {
+ super(path);
+
+ this.value = value;
+ }
+
+ @Override
+ public ValueType type() {
+ return ValueType.LONG;
+ }
+
+ @Override
+ public long longValue() {
+ return this.value;
+ }
+ }
+
+ /**
+ * Implementation of {@link ConfNode} for {@link ValueType#FLOAT}.
+ *
+ * @author DaPorkchop_
+ */
+ final class Float extends AbstractConfNode {
+ protected final float value;
+
+ public Float(@NonNull String[] path, float value) {
+ super(path);
+
+ this.value = value;
+ }
+
+ @Override
+ public ValueType type() {
+ return ValueType.FLOAT;
+ }
+
+ @Override
+ public float floatValue() {
+ return this.value;
+ }
+ }
+
+ /**
+ * Implementation of {@link ConfNode} for {@link ValueType#DOUBLE}.
+ *
+ * @author DaPorkchop_
+ */
+ final class Double extends AbstractConfNode {
+ protected final double value;
+
+ public Double(@NonNull String[] path, double value) {
+ super(path);
+
+ this.value = value;
+ }
+
+ @Override
+ public ValueType type() {
+ return ValueType.DOUBLE;
+ }
+
+ @Override
+ public double doubleValue() {
+ return this.value;
+ }
+ }
+
+ /**
+ * Implementation of {@link ConfNode} for {@link ValueType#BOOLEAN}.
+ *
+ * @author DaPorkchop_
+ */
+ final class Boolean extends AbstractConfNode {
+ protected final boolean value;
+
+ public Boolean(@NonNull String[] path, boolean value) {
+ super(path);
+
+ this.value = value;
+ }
+
+ @Override
+ public ValueType type() {
+ return ValueType.BOOLEAN;
+ }
+
+ @Override
+ public boolean booleanValue() {
+ return this.value;
+ }
+ }
+}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/config/storage/ValueType.java b/src/main/java/net/daporkchop/pepsimod/util/config/storage/ValueType.java
new file mode 100644
index 0000000..3a2f3a0
--- /dev/null
+++ b/src/main/java/net/daporkchop/pepsimod/util/config/storage/ValueType.java
@@ -0,0 +1,73 @@
+/*
+ * Adapted from The MIT License (MIT)
+ *
+ * Copyright (c) 2016-2020 DaPorkchop_
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions:
+ *
+ * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
+ * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+package net.daporkchop.pepsimod.util.config.storage;
+
+import net.daporkchop.pepsimod.util.exception.InvalidTypeException;
+
+/**
+ * The different types permitted to be used as configuration values.
+ *
+ * @author DaPorkchop_
+ */
+public enum ValueType {
+ OBJ,
+ INT,
+ LONG {
+ @Override
+ public boolean checkCompatible(ValueType other) {
+ return other == this || other == INT;
+ }
+ },
+ FLOAT,
+ DOUBLE {
+ @Override
+ public boolean checkCompatible(ValueType other) {
+ return other == this || other == FLOAT;
+ }
+ },
+ BOOLEAN;
+
+ /**
+ * Checks whether a type is compatible with this type.
+ *
+ * Compatibility means that the value in the configuration is of this type, but the user is trying to read it as the other type.
+ *
+ * @param other the other type
+ * @return whether or not the types are compatible
+ */
+ public boolean checkCompatible(ValueType other) {
+ return other == this;
+ }
+
+ /**
+ * Asserts that a type is compatible with this type.
+ *
+ * Compatibility means that the value in the configuration is of this type, but the user is trying to read it as the other type.
+ *
+ * @param other the other type
+ * @throws InvalidTypeException if the types are not compatible
+ */
+ public void assertCompatible(ValueType other) throws InvalidTypeException {
+ if (!this.checkCompatible(other)) {
+ throw new InvalidTypeException(other.name(), this.name());
+ }
+ }
+}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/event/EventManager.java b/src/main/java/net/daporkchop/pepsimod/util/event/EventManager.java
new file mode 100644
index 0000000..1c8b4e6
--- /dev/null
+++ b/src/main/java/net/daporkchop/pepsimod/util/event/EventManager.java
@@ -0,0 +1,358 @@
+/*
+ * Adapted from The MIT License (MIT)
+ *
+ * Copyright (c) 2016-2020 DaPorkchop_
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions:
+ *
+ * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
+ * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+package net.daporkchop.pepsimod.util.event;
+
+import com.google.common.collect.ImmutableSet;
+import lombok.NonNull;
+import net.daporkchop.pepsimod.util.PepsiConstants;
+import net.daporkchop.pepsimod.util.event.annotation.PepsiEvent;
+import net.daporkchop.pepsimod.util.event.impl.AllEvents;
+import net.daporkchop.pepsimod.util.event.impl.Event;
+import net.daporkchop.pepsimod.util.event.impl.render.PreRenderEvent;
+import net.daporkchop.pepsimod.util.event.impl.render.RenderHUDEvent;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.IdentityHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReadWriteLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
+/**
+ * pepsimod's event manager.
+ *
+ * This class is used to actually fire events and add/remove handlers, and is accessed via {@link PepsiConstants#EVENT_MANAGER}. It's optimized to cause
+ * as few object allocations as reasonably possible, with quality of code being marginal as a result.
+ *
+ * This is superior to other annotation+class-based event handlers as it doesn't require object allocations every time an event is fired, however
+ * it requires a method to be added for every event, and all event fields must be passed as method parameters.
+ *
+ * @author DaPorkchop_
+ */
+public final class EventManager implements AllEvents, PepsiConstants {
+ protected static final Constructor> LIST_CONSTRUCTOR;
+ public static final Collection> EVENT_CLASSES;
+
+ static {
+ Constructor> listConstructor = null;
+ Collection> eventClasses = new HashSet<>();
+ try {
+ {
+ //i hate java
+ @SuppressWarnings("unchecked")
+ Constructor> listConstructor_butINeedItToBeUnchecked
+ = (Constructor>) Class.forName("sun.awt.util.IdentityArrayList").getConstructor();
+ listConstructor = listConstructor_butINeedItToBeUnchecked;
+ }
+ @SuppressWarnings("unchecked")
+ Class extends Event>[] interfaces = (Class extends Event>[]) AllEvents.class.getInterfaces();
+ for (Class extends Event> clazz : interfaces) {
+ if (Event.class.isAssignableFrom(clazz)) {
+ eventClasses.add(clazz);
+ } else {
+ log.warn("%s holds non-event interface: %s", AllEvents.class, clazz);
+ }
+ }
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ } finally {
+ LIST_CONSTRUCTOR = listConstructor;
+ EVENT_CLASSES = ImmutableSet.copyOf(eventClasses);
+ }
+ }
+
+ /**
+ * I need to reflect to get access to {@link sun.awt.util.IdentityArrayList}, since using any classes in the {@link sun} package cause un-suppressable
+ * compile-time warnings.
+ *
+ * @return a new instance of {@link sun.awt.util.IdentityArrayList}
+ */
+ @SuppressWarnings("unchecked")
+ protected static List createList() {
+ try {
+ return (List) LIST_CONSTRUCTOR.newInstance();
+ } catch (IllegalAccessException | InvocationTargetException | InstantiationException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ protected final Map, List extends Event>[]> activeHandlers = new IdentityHashMap<>();
+ protected final Lock readLock;
+ protected final Lock writeLock;
+
+ public EventManager() {
+ if (EVENT_MANAGER != null) {
+ throw new IllegalStateException("Event manager already instantiated!");
+ }
+
+ @SuppressWarnings("unchecked")
+ List extends Event>[] templateArray = new List[EventPriority.VALUES.length];
+ for (int i = templateArray.length - 1; i >= 0; i--) {
+ templateArray[i] = Collections.emptyList();
+ }
+
+ //intialize active handlers map
+ for (Class extends Event> clazz : EVENT_CLASSES) {
+ this.activeHandlers.put(clazz, templateArray.clone());
+ }
+
+ //eliminate pointer chasing by directly referencing the read and the write lock
+ ReadWriteLock lock = new ReentrantReadWriteLock();
+ this.readLock = lock.readLock();
+ this.writeLock = lock.writeLock();
+ }
+
+ //
+ //
+ //internal methods
+ //
+ //
+
+ /**
+ * Gets all the currently active handlers for the given event class.
+ *
+ * @param clazz the event class
+ * @param the event type (same as the class)
+ * @return currently active handlers for the given event class
+ */
+ protected List[] getHandlers(@NonNull Class clazz) {
+ @SuppressWarnings("unchecked")
+ List[] handlers = (List[]) this.activeHandlers.get(clazz);
+ if (handlers != null) {
+ return handlers;
+ } else { //put throw last to avoid unnecessary branch
+ throw new IllegalStateException(String.format("Unregistered event class: \"%s\"", clazz));
+ }
+ }
+
+ //
+ //
+ //register/deregister methods
+ //
+ //
+
+ /**
+ * Registers all handlers defined in the given object's class, excluding those with the {@link PepsiEvent} where {@link PepsiEvent#addByDefault()} is set
+ * to {@code false}.
+ *
+ * @param handler the event handler
+ */
+ @SuppressWarnings("unchecked")
+ public void register(@NonNull Event handler) {
+ EventUtil.CachedData[] cache = EventUtil.getCache(handler.getClass());
+ this.writeLock.lock();
+ try {
+ for (EventUtil.CachedData data : cache) {
+ if (data.def) {
+ this.register((Class) data.clazz, handler, data.priority);
+ }
+ }
+ } finally {
+ this.writeLock.unlock();
+ }
+ }
+
+ /**
+ * Registers all handlers defined in the given object's class, including those with the {@link PepsiEvent} where {@link PepsiEvent#addByDefault()} is set
+ * to {@code false}.
+ *
+ * @param handler the event handler
+ */
+ @SuppressWarnings("unchecked")
+ public void registerAll(@NonNull Event handler) {
+ EventUtil.CachedData[] cache = EventUtil.getCache(handler.getClass());
+ this.writeLock.lock();
+ try {
+ for (EventUtil.CachedData data : cache) {
+ this.register((Class) data.clazz, handler, data.priority);
+ }
+ } finally {
+ this.writeLock.unlock();
+ }
+ }
+
+ /**
+ * @see #register(Class, Event, EventPriority)
+ */
+ public boolean register(@NonNull Class eventClass, @NonNull E handler) {
+ return this.register(eventClass, handler, EventPriority.NORMAL);
+ }
+
+ /**
+ * Registers a new event handler that will listen for the given event class.
+ *
+ * This will ignore any annotations applied to the event handler class, as this is intended for lambdas.
+ *
+ * @param eventClass the class of the event that will be listened for
+ * @param handler the handler for the given event
+ * @param priority the priority of the new handler
+ * @param the event type (same as the class)
+ * @return whether or not the handler was registered (if {@code false}, it was already added)
+ */
+ public boolean register(@NonNull Class eventClass, @NonNull E handler, @NonNull EventPriority priority) {
+ this.writeLock.lock();
+ try {
+ List[] handlers = this.getHandlers(eventClass);
+ List list = handlers[priority.ordinal()];
+ if (list.isEmpty()) {
+ //we need to add the handler
+ list = createList();
+ list.add(handler);
+ handlers[priority.ordinal()] = list;
+ return true;
+ } else if (!list.contains(handler)) {
+ list.add(handler);
+ return true;
+ } else {
+ return false;
+ }
+ } finally {
+ this.writeLock.unlock();
+ }
+ }
+
+ /**
+ * Deregisters all handlers defined in the given object's class.
+ *
+ * @param handler the event handler
+ */
+ @SuppressWarnings("unchecked")
+ public void deregister(@NonNull Event handler) {
+ EventUtil.CachedData[] cache = EventUtil.getCache(handler.getClass());
+ this.writeLock.lock();
+ try {
+ for (EventUtil.CachedData data : cache) {
+ this.deregister((Class) data.clazz, handler, data.priority);
+ }
+ } finally {
+ this.writeLock.unlock();
+ }
+ }
+
+ /**
+ * @see #deregister(Class, Event, EventPriority)
+ */
+ public boolean deregister(@NonNull Class eventClass, @NonNull E handler) {
+ return this.deregister(eventClass, handler, null);
+ }
+
+ /**
+ * Deregisters an already registered event handler that is currently listening for the given event class.
+ *
+ * @param eventClass the class of the event that is being listened for
+ * @param handler the handler for the given event
+ * @param priority the priority with which the event was registered. If unknown, {@code null} may be passed, which will result in a brute-force search
+ * through all valid priority levels
+ * @param the event type (same as the class)
+ * @return whether or not the handler was deregistered (if {@code false}, it wasn't registered)
+ */
+ public boolean deregister(@NonNull Class eventClass, @NonNull E handler, EventPriority priority) {
+ this.writeLock.lock();
+ try {
+ List[] handlers = this.getHandlers(eventClass);
+ if (priority == null) {
+ for (int i = 5; i >= 0; i--) {
+ List list = handlers[i];
+ if (!list.isEmpty() && list.remove(handler)) {
+ if (list.isEmpty()) {
+ //replace with empty list if all handlers are removed
+ handlers[i] = Collections.emptyList();
+ }
+ return true;
+ }
+ }
+ } else {
+ List list = handlers[priority.ordinal()];
+ if (!list.isEmpty() && list.remove(handler)) {
+ if (list.isEmpty()) {
+ //replace with empty list if all handlers are removed
+ handlers[priority.ordinal()] = Collections.emptyList();
+ }
+ return true;
+ }
+ }
+ return false;
+ } finally {
+ this.writeLock.unlock();
+ }
+ }
+
+ //
+ //
+ // event fire methods
+ //
+ //
+
+ @Override
+ public void firePreRender(float partialTicks) {
+ this.readLock.lock();
+ try {
+ for (List handlers : this.getHandlers(PreRenderEvent.class)) {
+ for (int i = handlers.size() - 1; i >= 0; i--) {
+ handlers.get(i).firePreRender(partialTicks);
+ }
+ }
+ } finally {
+ this.readLock.unlock();
+ }
+ }
+
+ @Override
+ public EventStatus firePreRenderHUD(float partialTicks, int width, int height) {
+ this.readLock.lock();
+ try {
+ EventStatus status = EventStatus.OK;
+ for (List handlers : this.getHandlers(RenderHUDEvent.Pre.class)) {
+ for (int i = handlers.size() - 1; i >= 0; i--) {
+ switch (handlers.get(i).firePreRenderHUD(partialTicks, width, height)) {
+ case CANCEL:
+ status = EventStatus.CANCEL;
+ break;
+ case ABORT:
+ return EventStatus.ABORT;
+ }
+ }
+ }
+ return status;
+ } finally {
+ this.readLock.unlock();
+ }
+ }
+
+ @Override
+ public void firePostRenderHUD(float partialTicks, int width, int height) {
+ this.readLock.lock();
+ try {
+ for (List handlers : this.getHandlers(RenderHUDEvent.Post.class)) {
+ for (int i = handlers.size() - 1; i >= 0; i--) {
+ handlers.get(i).firePostRenderHUD(partialTicks, width, height);
+ }
+ }
+ } finally {
+ this.readLock.unlock();
+ }
+ }
+}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/event/MoveEvent.java b/src/main/java/net/daporkchop/pepsimod/util/event/EventPriority.java
similarity index 71%
rename from src/main/java/net/daporkchop/pepsimod/util/event/MoveEvent.java
rename to src/main/java/net/daporkchop/pepsimod/util/event/EventPriority.java
index 340db42..028c965 100644
--- a/src/main/java/net/daporkchop/pepsimod/util/event/MoveEvent.java
+++ b/src/main/java/net/daporkchop/pepsimod/util/event/EventPriority.java
@@ -20,8 +20,20 @@
package net.daporkchop.pepsimod.util.event;
-public class MoveEvent {
- public double x = 0;
- public double y = 0;
- public double z = 0;
+/**
+ * The priority of an event handler defines in which order the handlers will be executed. Handlers with lower priority are guaranteed to be notified later
+ * than handlers with a higher priority. The order in which handlers with identical priorities will be executed is undefined.
+ *
+ * @author DaPorkchop_
+ */
+public enum EventPriority {
+ MONITOR,
+ HIGHEST,
+ HIGH,
+ NORMAL,
+ LOW,
+ LOWEST;
+
+ static final EventPriority[] VALUES = values();
+ static final int ITERATE_START = LOWEST.ordinal();
}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/event/EventStatus.java b/src/main/java/net/daporkchop/pepsimod/util/event/EventStatus.java
new file mode 100644
index 0000000..663ef6f
--- /dev/null
+++ b/src/main/java/net/daporkchop/pepsimod/util/event/EventStatus.java
@@ -0,0 +1,46 @@
+/*
+ * Adapted from The MIT License (MIT)
+ *
+ * Copyright (c) 2016-2020 DaPorkchop_
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions:
+ *
+ * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
+ * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+package net.daporkchop.pepsimod.util.event;
+
+import net.daporkchop.pepsimod.util.event.annotation.Cancellable;
+import net.daporkchop.pepsimod.util.event.impl.Event;
+
+/**
+ * The status with which a {@link Event} annotated with {@link Cancellable} may complete.
+ *
+ * @author DaPorkchop_
+ */
+public enum EventStatus {
+ /**
+ * Indicates that the event has been handled successfully, and execution should proceed onto the next handler as usual.
+ *
+ * A handler exiting with {@code null} is the same as if it were to exit with {@link #OK}.
+ */
+ OK,
+ /**
+ * Indicates that the event should be cancelled. Execution will proceed onto the next handler as usual, however the exit code will be {@link #CANCEL}.
+ */
+ CANCEL,
+ /**
+ * Similar to {@link #CANCEL}, however this will abort the event handling process and later handlers will not be notified.
+ */
+ ABORT;
+}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/event/EventUtil.java b/src/main/java/net/daporkchop/pepsimod/util/event/EventUtil.java
new file mode 100644
index 0000000..75b6a00
--- /dev/null
+++ b/src/main/java/net/daporkchop/pepsimod/util/event/EventUtil.java
@@ -0,0 +1,100 @@
+/*
+ * Adapted from The MIT License (MIT)
+ *
+ * Copyright (c) 2016-2020 DaPorkchop_
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions:
+ *
+ * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
+ * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+package net.daporkchop.pepsimod.util.event;
+
+import com.google.common.collect.ImmutableList;
+import lombok.NonNull;
+import lombok.RequiredArgsConstructor;
+import lombok.experimental.UtilityClass;
+import net.daporkchop.pepsimod.util.event.annotation.PepsiEvent;
+import net.daporkchop.pepsimod.util.event.impl.Event;
+
+import java.lang.reflect.Method;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.stream.Collectors;
+
+import static net.daporkchop.pepsimod.util.event.EventManager.EVENT_CLASSES;
+
+/**
+ * @author DaPorkchop_
+ */
+@UtilityClass
+class EventUtil {
+ private final Map, CachedData[]> CACHE = new ConcurrentHashMap<>();
+
+ CachedData[] getCache(@NonNull Class extends Event> clazz) {
+ return CACHE.computeIfAbsent(clazz, EventUtil::computeCache);
+ }
+
+ private CachedData[] computeCache(@NonNull Class extends Event> clazz) {
+ return computeAllHandlers(clazz).stream()
+ .map(interfaz -> {
+ Method implementation = findImplementationOf(clazz, interfaz);
+ PepsiEvent pepsiEvent = implementation.getAnnotation(PepsiEvent.class);
+ return pepsiEvent == null ? new CachedData(clazz, EventPriority.NORMAL, true) : new CachedData(clazz, pepsiEvent.priority(), pepsiEvent.addByDefault());
+ })
+ .toArray(CachedData[]::new);
+ }
+
+ private Method findImplementationOf(@NonNull Class extends Event> clazz, @NonNull Class extends Event> interfaz) {
+ try {
+ Method method = interfaz.getDeclaredMethods()[0];
+ return clazz.getMethod(method.getName(), method.getParameterTypes());
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private List> computeAllHandlers(@NonNull Class extends Event> clazz) {
+ return (List>) (Object) findClassHeirachy(clazz).stream().filter(EVENT_CLASSES::contains).collect(Collectors.toList());
+ }
+
+ private Collection> findClassHeirachy(@NonNull Class extends Event> clazz) {
+ Collection> heirachy = new HashSet<>();
+ do_findClassHeirachy(clazz, heirachy);
+ return heirachy;
+ }
+
+ private void do_findClassHeirachy(Class> clazz, @NonNull Collection> heirachy) {
+ if (clazz != null && clazz != Object.class && heirachy.add(clazz)) {
+ if (heirachy.add(clazz.getSuperclass())) {
+ do_findClassHeirachy(clazz.getSuperclass(), heirachy);
+ }
+ for (Class> interfaz : clazz.getInterfaces()) {
+ do_findClassHeirachy(interfaz, heirachy);
+ }
+ }
+ }
+
+ @RequiredArgsConstructor
+ class CachedData {
+ @NonNull
+ protected final Class extends Event> clazz;
+ @NonNull
+ protected final EventPriority priority;
+ protected final boolean def;
+ }
+}
diff --git a/src/main/java/net/daporkchop/pepsimod/mixin/entity/MixinEntityAgeable.java b/src/main/java/net/daporkchop/pepsimod/util/event/annotation/Cancellable.java
similarity index 70%
rename from src/main/java/net/daporkchop/pepsimod/mixin/entity/MixinEntityAgeable.java
rename to src/main/java/net/daporkchop/pepsimod/util/event/annotation/Cancellable.java
index 8b13006..f8c7366 100644
--- a/src/main/java/net/daporkchop/pepsimod/mixin/entity/MixinEntityAgeable.java
+++ b/src/main/java/net/daporkchop/pepsimod/util/event/annotation/Cancellable.java
@@ -18,25 +18,23 @@
*
*/
-package net.daporkchop.pepsimod.mixin.entity;
+package net.daporkchop.pepsimod.util.event.annotation;
-import net.daporkchop.pepsimod.optimization.SizeSettable;
-import net.minecraft.entity.EntityAgeable;
-import net.minecraft.entity.EntityCreature;
-import net.minecraft.world.World;
-import org.spongepowered.asm.mixin.Mixin;
+import net.daporkchop.pepsimod.util.event.EventStatus;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
/**
+ * An annotation used to decorate an event that can be cancelled.
+ *
+ * This means that the event method will return {@link EventStatus} instead of {@code void}.
+ *
* @author DaPorkchop_
*/
-@Mixin(EntityAgeable.class)
-public abstract class MixinEntityAgeable extends EntityCreature implements SizeSettable {
- public MixinEntityAgeable() {
- super(null);
- }
-
- @Override
- public void forceSetSize(float width, float height) {
- super.setSize(width, height);
- }
+@Retention(RetentionPolicy.CLASS)
+@Target(ElementType.TYPE)
+public @interface Cancellable {
}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/event/annotation/PepsiEvent.java b/src/main/java/net/daporkchop/pepsimod/util/event/annotation/PepsiEvent.java
new file mode 100644
index 0000000..bcc966b
--- /dev/null
+++ b/src/main/java/net/daporkchop/pepsimod/util/event/annotation/PepsiEvent.java
@@ -0,0 +1,53 @@
+/*
+ * Adapted from The MIT License (MIT)
+ *
+ * Copyright (c) 2016-2020 DaPorkchop_
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions:
+ *
+ * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
+ * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+package net.daporkchop.pepsimod.util.event.annotation;
+
+import net.daporkchop.pepsimod.util.event.impl.Event;
+import net.daporkchop.pepsimod.util.event.EventPriority;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * An optional annotation that may be used to specify things about a specific handler method, such as the handler's priority or whether or not it should
+ * be added by default.
+ *
+ * @author DaPorkchop_
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+public @interface PepsiEvent {
+ /**
+ * @return this handler's priority
+ * @see EventPriority
+ */
+ EventPriority priority() default EventPriority.NORMAL;
+
+ /**
+ * Whether or not the annotated event handler should be registered by default when an instance of the class containing the method is registered using
+ * {@link net.daporkchop.pepsimod.util.event.EventManager#register(Event)}.
+ *
+ * @return whether or not the annotated event handler should be registered by default
+ */
+ boolean addByDefault() default true;
+}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/impl/movement/SpeedMod.java b/src/main/java/net/daporkchop/pepsimod/util/event/impl/AllEvents.java
similarity index 63%
rename from src/main/java/net/daporkchop/pepsimod/module/impl/movement/SpeedMod.java
rename to src/main/java/net/daporkchop/pepsimod/util/event/impl/AllEvents.java
index 44795ec..adf0807 100644
--- a/src/main/java/net/daporkchop/pepsimod/module/impl/movement/SpeedMod.java
+++ b/src/main/java/net/daporkchop/pepsimod/util/event/impl/AllEvents.java
@@ -18,49 +18,30 @@
*
*/
-package net.daporkchop.pepsimod.module.impl.movement;
+package net.daporkchop.pepsimod.util.event.impl;
-import net.daporkchop.pepsimod.module.ModuleCategory;
-import net.daporkchop.pepsimod.module.api.Module;
-import net.daporkchop.pepsimod.module.api.ModuleOption;
-
-public class SpeedMod extends Module {
- public static SpeedMod INSTANCE;
-
- {
- INSTANCE = this;
- }
-
- public SpeedMod() {
- super("Speed");
- }
-
- @Override
- public void onEnable() {
-
- }
-
- @Override
- public void onDisable() {
-
- }
+import net.daporkchop.pepsimod.util.event.EventManager;
+import net.daporkchop.pepsimod.util.event.EventStatus;
+import net.daporkchop.pepsimod.util.event.impl.render.PreRenderEvent;
+import net.daporkchop.pepsimod.util.event.impl.render.RenderHUDEvent;
+/**
+ * A type that listens for every event.
+ *
+ * Currently only used by {@link EventManager}.
+ *
+ * @author DaPorkchop_
+ */
+public interface AllEvents extends
+ PreRenderEvent,
+ RenderHUDEvent.Pre,
+ RenderHUDEvent.Post {
@Override
- public void tick() {
-
- }
+ void firePreRender(float partialTicks);
@Override
- public void init() {
- INSTANCE = this;
- }
+ EventStatus firePreRenderHUD(float partialTicks, int width, int height);
@Override
- public ModuleOption[] getDefaultOptions() {
- return new ModuleOption[0];
- }
-
- public ModuleCategory getCategory() {
- return ModuleCategory.MOVEMENT;
- }
+ void firePostRenderHUD(float partialTicks, int width, int height);
}
diff --git a/src/main/java/net/daporkchop/pepsimod/module/api/option/ExtensionBoolean.java b/src/main/java/net/daporkchop/pepsimod/util/event/impl/Event.java
similarity index 81%
rename from src/main/java/net/daporkchop/pepsimod/module/api/option/ExtensionBoolean.java
rename to src/main/java/net/daporkchop/pepsimod/util/event/impl/Event.java
index c882b9d..ebceadd 100644
--- a/src/main/java/net/daporkchop/pepsimod/module/api/option/ExtensionBoolean.java
+++ b/src/main/java/net/daporkchop/pepsimod/util/event/impl/Event.java
@@ -18,11 +18,13 @@
*
*/
-package net.daporkchop.pepsimod.module.api.option;
+package net.daporkchop.pepsimod.util.event.impl;
-public class ExtensionBoolean extends OptionExtended { //tbh this will probably never be used but whatever
- @Override
- public ExtensionType getType() {
- return ExtensionType.TYPE_BOOLEAN;
- }
+/**
+ * An interface identifying an event handler. All specific event handler interfaces inherit from this, as a fast way of identifying which interfaces
+ * on a class are actually events.
+ *
+ * @author DaPorkchop_
+ */
+public interface Event {
}
diff --git a/src/main/java/net/daporkchop/pepsimod/command/impl/SaveCommand.java b/src/main/java/net/daporkchop/pepsimod/util/event/impl/render/PreRenderEvent.java
similarity index 72%
rename from src/main/java/net/daporkchop/pepsimod/command/impl/SaveCommand.java
rename to src/main/java/net/daporkchop/pepsimod/util/event/impl/render/PreRenderEvent.java
index 653bf7c..b3348f0 100644
--- a/src/main/java/net/daporkchop/pepsimod/command/impl/SaveCommand.java
+++ b/src/main/java/net/daporkchop/pepsimod/util/event/impl/render/PreRenderEvent.java
@@ -18,23 +18,19 @@
*
*/
-package net.daporkchop.pepsimod.command.impl;
+package net.daporkchop.pepsimod.util.event.impl.render;
-import net.daporkchop.pepsimod.command.api.Command;
+import net.daporkchop.pepsimod.util.event.impl.Event;
-public class SaveCommand extends Command {
- public SaveCommand() {
- super("save");
- }
-
- @Override
- public void execute(String cmd, String[] args) {
- pepsimod.saveConfig();
- clientMessage("Saved config!");
- }
-
- @Override
- public String getSuggestion(String cmd, String[] args) {
- return ".save";
- }
+/**
+ * Fired before a world render pass is started.
+ *
+ * This may be used to do some sort of initialization of resources needed later for rendering, and will be fired regardless of whether a world is
+ * currently active.
+ *
+ * @author DaPorkchop_
+ */
+@FunctionalInterface
+public interface PreRenderEvent extends Event {
+ void firePreRender(float partialTicks);
}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/event/impl/render/RenderHUDEvent.java b/src/main/java/net/daporkchop/pepsimod/util/event/impl/render/RenderHUDEvent.java
new file mode 100644
index 0000000..b8b88a6
--- /dev/null
+++ b/src/main/java/net/daporkchop/pepsimod/util/event/impl/render/RenderHUDEvent.java
@@ -0,0 +1,55 @@
+/*
+ * Adapted from The MIT License (MIT)
+ *
+ * Copyright (c) 2016-2020 DaPorkchop_
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions:
+ *
+ * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
+ * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+package net.daporkchop.pepsimod.util.event.impl.render;
+
+import net.daporkchop.pepsimod.util.event.annotation.Cancellable;
+import net.daporkchop.pepsimod.util.event.impl.Event;
+import net.daporkchop.pepsimod.util.event.EventStatus;
+
+/**
+ * Container class for events related to rendering the HUD.
+ *
+ * @author DaPorkchop_
+ */
+public interface RenderHUDEvent extends Event {
+ /**
+ * Fired before the HUD is rendered.
+ *
+ * If cancelled, the HUD will not be rendered.
+ *
+ * @author DaPorkchop_
+ */
+ @Cancellable
+ @FunctionalInterface
+ interface Pre extends RenderHUDEvent {
+ EventStatus firePreRenderHUD(float partialTicks, int width, int height);
+ }
+
+ /**
+ * Fired after the HUD has been rendered.
+ *
+ * @author DaPorkchop_
+ */
+ @FunctionalInterface
+ interface Post extends RenderHUDEvent {
+ void firePostRenderHUD(float partialTicks, int width, int height);
+ }
+}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/config/NullConfigTranslator.java b/src/main/java/net/daporkchop/pepsimod/util/exception/InvalidTypeException.java
similarity index 60%
rename from src/main/java/net/daporkchop/pepsimod/util/config/NullConfigTranslator.java
rename to src/main/java/net/daporkchop/pepsimod/util/exception/InvalidTypeException.java
index 5d4c413..0c0ae4f 100644
--- a/src/main/java/net/daporkchop/pepsimod/util/config/NullConfigTranslator.java
+++ b/src/main/java/net/daporkchop/pepsimod/util/exception/InvalidTypeException.java
@@ -18,29 +18,31 @@
*
*/
-package net.daporkchop.pepsimod.util.config;
+package net.daporkchop.pepsimod.util.exception;
-import com.google.gson.JsonObject;
+import lombok.NonNull;
+import net.daporkchop.pepsimod.util.config.storage.ConfNode;
+import net.daporkchop.pepsimod.util.config.storage.ValueType;
/**
- * A config translator that does nothing with the given data
+ * Thrown when a config value is accessed with an accessor for the wrong type.
+ *
+ * @author DaPorkchop_
*/
-public class NullConfigTranslator implements IConfigTranslator {
- public static final IConfigTranslator INSTANCE = new NullConfigTranslator();
-
- private NullConfigTranslator() {
-
+public final class InvalidTypeException extends PepsimodException {
+ public InvalidTypeException(String message) {
+ super(message);
}
- public void encode(JsonObject json) {
-
+ public InvalidTypeException(@NonNull ValueType expected) {
+ this(String.format("Invalid type! Expected: %s", expected.name()));
}
- public void decode(String fieldName, JsonObject json) {
- System.out.println("[Warning] Config element with name " + fieldName + "is being ignored, discarding " + json.entrySet().size() + " values!");
+ public InvalidTypeException(String found, String expected) {
+ super(String.format("Invalid type! Found: %s, expected: %s", found, expected));
}
- public String name() {
- return null;
+ public InvalidTypeException(@NonNull ValueType found, @NonNull ValueType expected) {
+ this(found.name(), expected.name());
}
}
diff --git a/src/main/java/net/daporkchop/pepsimod/optimization/BlockID.java b/src/main/java/net/daporkchop/pepsimod/util/exception/PepsimodException.java
similarity index 64%
rename from src/main/java/net/daporkchop/pepsimod/optimization/BlockID.java
rename to src/main/java/net/daporkchop/pepsimod/util/exception/PepsimodException.java
index 6432284..f910df8 100644
--- a/src/main/java/net/daporkchop/pepsimod/optimization/BlockID.java
+++ b/src/main/java/net/daporkchop/pepsimod/util/exception/PepsimodException.java
@@ -18,37 +18,34 @@
*
*/
-package net.daporkchop.pepsimod.optimization;
-
-import net.minecraft.block.Block;
-
-import java.util.ArrayList;
-import java.util.List;
+package net.daporkchop.pepsimod.util.exception;
/**
- * Injected into {@link net.minecraft.block.Block} at runtime for fast access to block IDs.
+ * Base type for all exceptions thrown by pepsimod.
*
* @author DaPorkchop_
*/
-public interface BlockID {
- /**
- * A lookup table of block IDs to block instances.
- */
- List BLOCK_LOOKUP = new ArrayList<>(); //basically as fast as it gets
+public abstract class PepsimodException extends RuntimeException {
+ public PepsimodException() {
+ }
+
+ public PepsimodException(String message) {
+ super(message);
+ }
+
+ public PepsimodException(Throwable cause, String message) {
+ super(message, cause);
+ }
+
+ public PepsimodException(Throwable cause) {
+ super(cause);
+ }
- /**
- * Gets the numeric ID of this block.
- *
- * @return this block's ID
- */
- int getBlockId();
+ public PepsimodException(String message, String... format) {
+ super(String.format(message, format));
+ }
- /**
- * Sets the cached numeric ID of this block.
- *
- * Only used internally, don't touch!
- *
- * @param id the new ID
- */
- void internal_setBlockId(int id);
+ public PepsimodException(Throwable cause, String message, String... format) {
+ super(String.format(message, format), cause);
+ }
}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/misc/ITickListener.java b/src/main/java/net/daporkchop/pepsimod/util/misc/ITickListener.java
deleted file mode 100644
index 091e190..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/misc/ITickListener.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util.misc;
-
-public interface ITickListener {
- void tick();
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/misc/IWurstRenderListener.java b/src/main/java/net/daporkchop/pepsimod/util/misc/IWurstRenderListener.java
deleted file mode 100644
index 28fe864..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/misc/IWurstRenderListener.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util.misc;
-
-public interface IWurstRenderListener {
- void render(float partialTicks);
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/misc/announcer/MessagePrefixes.java b/src/main/java/net/daporkchop/pepsimod/util/misc/announcer/MessagePrefixes.java
deleted file mode 100644
index cd3e8f3..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/misc/announcer/MessagePrefixes.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util.misc.announcer;
-
-import java.util.Arrays;
-import java.util.EnumMap;
-import java.util.Map;
-import java.util.Random;
-import java.util.concurrent.ThreadLocalRandom;
-
-public class MessagePrefixes {
- private static Map messageMakers = new EnumMap<>(TaskType.class);
-
- static {
- messageMakers.put(TaskType.JOIN, new MessageMaker(new String[]{
- "Welcome, %1$s",
- "Greetings, %1$s",
- "Hi %1$s!",
- "%1$s joined the game",
- "Hey there, %1$s"
- }));
- messageMakers.put(TaskType.LEAVE, new MessageMaker(new String[]{
- "Bye, %1$s!",
- "See ya later, %1$s",
- "%1$s left the game"
- }));
- messageMakers.put(TaskType.BREAK, new MessageMaker(new String[]{
- "I just mined %2$d %1$s!",
- "I just broke %2$d %1$s!"
- }));
- messageMakers.put(TaskType.PLACE, new MessageMaker(new String[]{
- "I just placed %2$d %1$s!"
- }));
- messageMakers.put(TaskType.EAT, new MessageMaker(new String[]{
- "I just ate %2$d %1$s!"
- }));
- messageMakers.put(TaskType.WALK, new MessageMaker(new String[]{
- "I just walked %1$.2f meters!",
- "I just walked %1$.2f blocks!"
- }));
- }
-
- public static String getMessage(TaskType type, Object... args) {
- return "> " + messageMakers.get(type).getMessage(args);
- }
-
- private static class MessageMaker {
- public String[] messages;
-
- public MessageMaker(String[] messages) {
- this.messages = messages;
- }
-
- public String getMessage(Object... args) {
- return String.format(this.messages[ThreadLocalRandom.current().nextInt(this.messages.length)], args);
- }
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/misc/announcer/QueuedTask.java b/src/main/java/net/daporkchop/pepsimod/util/misc/announcer/QueuedTask.java
deleted file mode 100644
index 34f331d..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/misc/announcer/QueuedTask.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util.misc.announcer;
-
-import net.daporkchop.pepsimod.util.PepsiConstants;
-
-public abstract class QueuedTask extends PepsiConstants {
- public final TaskType type;
-
- public QueuedTask(TaskType type) {
- this.type = type;
- }
-
- public abstract String getMessage();
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/misc/announcer/TaskType.java b/src/main/java/net/daporkchop/pepsimod/util/misc/announcer/TaskType.java
deleted file mode 100644
index cf1ce55..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/misc/announcer/TaskType.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util.misc.announcer;
-
-public enum TaskType {
- PLACE, //
- BREAK, //
- JOIN, //
- LEAVE, //
- EAT,
- WALK //
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/misc/announcer/impl/TaskBasic.java b/src/main/java/net/daporkchop/pepsimod/util/misc/announcer/impl/TaskBasic.java
deleted file mode 100644
index 1934ab3..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/misc/announcer/impl/TaskBasic.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util.misc.announcer.impl;
-
-import net.daporkchop.pepsimod.util.misc.announcer.QueuedTask;
-import net.daporkchop.pepsimod.util.misc.announcer.TaskType;
-
-public class TaskBasic extends QueuedTask {
- public String message;
-
- public TaskBasic(TaskType type, String message) {
- super(type);
- this.message = message;
- }
-
- public String getMessage() {
- return this.message;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/misc/announcer/impl/TaskBlock.java b/src/main/java/net/daporkchop/pepsimod/util/misc/announcer/impl/TaskBlock.java
deleted file mode 100644
index 2fecec6..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/misc/announcer/impl/TaskBlock.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util.misc.announcer.impl;
-
-import net.daporkchop.pepsimod.util.misc.announcer.MessagePrefixes;
-import net.daporkchop.pepsimod.util.misc.announcer.QueuedTask;
-import net.daporkchop.pepsimod.util.misc.announcer.TaskType;
-import net.minecraft.block.Block;
-
-public class TaskBlock extends QueuedTask {
- public Block block;
- public int count = 1;
-
- public TaskBlock(TaskType type, Block block) {
- super(type);
- this.block = block;
- }
-
- public String getMessage() {
- return MessagePrefixes.getMessage(this.type, this.block.getLocalizedName(), this.count);
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/misc/announcer/impl/TaskMove.java b/src/main/java/net/daporkchop/pepsimod/util/misc/announcer/impl/TaskMove.java
deleted file mode 100644
index b3b6c76..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/misc/announcer/impl/TaskMove.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util.misc.announcer.impl;
-
-import net.daporkchop.pepsimod.module.impl.misc.AnnouncerMod;
-import net.daporkchop.pepsimod.util.PepsiUtils;
-import net.daporkchop.pepsimod.util.misc.announcer.MessagePrefixes;
-import net.daporkchop.pepsimod.util.misc.announcer.QueuedTask;
-import net.daporkchop.pepsimod.util.misc.announcer.TaskType;
-import net.minecraft.util.math.Vec3d;
-
-public class TaskMove extends QueuedTask {
- public double dist = 0.0d;
- public Vec3d lastPos = null;
-
- public TaskMove(TaskType type) {
- super(type);
- this.lastPos = mc.player.getPositionVector();
- }
-
- public String getMessage() {
- if (!AnnouncerMod.INSTANCE.state.enabled || this.dist == 0.0d) {
- return null;
- }
-
- return MessagePrefixes.getMessage(TaskType.WALK, this.dist);
- }
-
- public void update(Vec3d nextPos) {
- if (this.lastPos != null && nextPos != null) {
- this.dist += this.lastPos.distanceTo(nextPos);
- }
- this.lastPos = nextPos;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/misc/waypoints/DimensionWaypoints.java b/src/main/java/net/daporkchop/pepsimod/util/misc/waypoints/DimensionWaypoints.java
deleted file mode 100644
index ff8c175..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/misc/waypoints/DimensionWaypoints.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util.misc.waypoints;
-
-import java.util.Hashtable;
-
-public class DimensionWaypoints {
- public Hashtable waypoints = new Hashtable<>();
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/misc/waypoints/ServerWaypoints.java b/src/main/java/net/daporkchop/pepsimod/util/misc/waypoints/ServerWaypoints.java
deleted file mode 100644
index a6647c3..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/misc/waypoints/ServerWaypoints.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util.misc.waypoints;
-
-import java.util.Hashtable;
-
-public class ServerWaypoints {
- public Hashtable waypoints = new Hashtable<>();
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/misc/waypoints/Waypoint.java b/src/main/java/net/daporkchop/pepsimod/util/misc/waypoints/Waypoint.java
deleted file mode 100644
index c9be9c2..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/misc/waypoints/Waypoint.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util.misc.waypoints;
-
-import net.minecraft.util.math.Vec3d;
-
-public class Waypoint {
- public final String name;
- public final int x;
- public final int y;
- public final int z;
- public final int dim;
- public boolean shown;
-
- public Waypoint(String name, double x, double y, double z, int dim) {
- this(name, x, y, z, true, dim);
- }
-
- public Waypoint(String name, double x, double y, double z, boolean shown, int dim) {
- this(name, (int) Math.floor(x), (int) Math.floor(y), (int) Math.floor(z), shown, dim);
- }
-
- public Waypoint(String name, int x, int y, int z, int dim) {
- this(name, x, y, z, true, dim);
- }
-
- public Waypoint(String name, int x, int y, int z, boolean shown, int dim) {
- this.name = name;
- this.x = x;
- this.y = y;
- this.z = z;
- this.shown = shown;
- this.dim = dim;
- }
-
- public Vec3d getPosition() {
- return new Vec3d(this.x, this.y, this.z);
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/mixin/client/gui/GuiBossOverlay/MergedBossInfo.java b/src/main/java/net/daporkchop/pepsimod/util/mixin/client/gui/GuiBossOverlay/MergedBossInfo.java
new file mode 100644
index 0000000..a2c6969
--- /dev/null
+++ b/src/main/java/net/daporkchop/pepsimod/util/mixin/client/gui/GuiBossOverlay/MergedBossInfo.java
@@ -0,0 +1,82 @@
+/*
+ * Adapted from The MIT License (MIT)
+ *
+ * Copyright (c) 2016-2020 DaPorkchop_
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions:
+ *
+ * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
+ * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+package net.daporkchop.pepsimod.util.mixin.client.gui.GuiBossOverlay;
+
+import lombok.Getter;
+import lombok.NonNull;
+import lombok.experimental.Accessors;
+import net.minecraft.client.gui.BossInfoClient;
+import net.minecraft.world.BossInfo;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.IdentityHashMap;
+
+/**
+ * Used by {@link net.daporkchop.pepsimod.asm.core.minecraft.client.gui.MixinGuiBossOverlay} to actually have boss bars merged together.
+ *
+ * I can't have this as an inner class because Mixin so it's going here.
+ *
+ * @author DaPorkchop_
+ */
+@Getter
+public final class MergedBossInfo {
+ private final String name;
+ private final Collection entries = Collections.newSetFromMap(new IdentityHashMap<>());
+
+ private BossInfo.Color color;
+ private BossInfo.Overlay overlay;
+
+ public MergedBossInfo(@NonNull String name) {
+ this.name = name;
+ }
+
+ public void add(@NonNull BossInfoClient info) {
+ if (!this.name.equals(info.getName().getFormattedText())) {
+ throw new IllegalStateException("Incompatible names!");
+ } else if (this.entries.add(info)) {
+ this.update();
+ }
+ }
+
+ public boolean remove(@NonNull BossInfoClient info) {
+ if (!this.name.equals(info.getName().getFormattedText())) {
+ throw new IllegalStateException("Incompatible names!");
+ } else {
+ return this.entries.remove(info) && this.update();
+ }
+ }
+
+ public boolean update() {
+ if (!this.entries.isEmpty()) {
+ BossInfo first = this.entries.iterator().next();
+ this.color = first.getColor();
+ this.overlay = first.getOverlay();
+ return false;
+ } else {
+ return true;
+ }
+ }
+
+ public int count() {
+ return this.entries.size();
+ }
+}
diff --git a/src/main/java/net/daporkchop/pepsimod/gui/clickgui/window/WindowMovement.java b/src/main/java/net/daporkchop/pepsimod/util/mixin/package-info.java
similarity index 77%
rename from src/main/java/net/daporkchop/pepsimod/gui/clickgui/window/WindowMovement.java
rename to src/main/java/net/daporkchop/pepsimod/util/mixin/package-info.java
index 225fa2f..df84146 100644
--- a/src/main/java/net/daporkchop/pepsimod/gui/clickgui/window/WindowMovement.java
+++ b/src/main/java/net/daporkchop/pepsimod/util/mixin/package-info.java
@@ -18,14 +18,12 @@
*
*/
-package net.daporkchop.pepsimod.gui.clickgui.window;
-
-import net.daporkchop.pepsimod.gui.clickgui.Window;
-import net.daporkchop.pepsimod.module.ModuleCategory;
-
-public class WindowMovement extends Window {
-
- public WindowMovement() {
- super(308, 2, "Movement", ModuleCategory.MOVEMENT);
- }
-}
\ No newline at end of file
+/**
+ * Mixin doesn't allow inner classes within mixin classes, since the Mixin classes are never actually loaded at runtime. Therefore, whenever I need an inner
+ * class for something or other, I add it to this package.
+ *
+ * Don't use anything here unless you know what you're doing!
+ *
+ * @author DaPorkchop_
+ */
+package net.daporkchop.pepsimod.util.mixin;
\ No newline at end of file
diff --git a/src/main/java/net/daporkchop/pepsimod/util/render/BetterScaledResolution.java b/src/main/java/net/daporkchop/pepsimod/util/render/BetterScaledResolution.java
new file mode 100644
index 0000000..ef60da0
--- /dev/null
+++ b/src/main/java/net/daporkchop/pepsimod/util/render/BetterScaledResolution.java
@@ -0,0 +1,74 @@
+/*
+ * Adapted from The MIT License (MIT)
+ *
+ * Copyright (c) 2016-2020 DaPorkchop_
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions:
+ *
+ * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
+ * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+package net.daporkchop.pepsimod.util.render;
+
+import net.daporkchop.pepsimod.util.capability.Updateable;
+import net.minecraft.client.gui.ScaledResolution;
+
+/**
+ * An interface injected into {@link ScaledResolution} to prevent it from having to be allocated hundreds of times per frame.
+ *
+ * @author DaPorkchop_
+ */
+public interface BetterScaledResolution extends Updateable {
+ /**
+ * A {@link BetterScaledResolution} that does nothing at all, and can serve as a placeholder instead of {@code null}.
+ */
+ BetterScaledResolution NOOP = new BetterScaledResolution() {
+ @Override
+ public int width() {
+ return 0;
+ }
+
+ @Override
+ public int height() {
+ return 0;
+ }
+
+ @Override
+ public ScaledResolution getAsMinecraft() throws UnsupportedOperationException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void update() {
+ }
+ };
+
+ /**
+ * @see ScaledResolution#getScaledWidth()
+ */
+ int width();
+
+ /**
+ * @see ScaledResolution#getScaledHeight()
+ */
+ int height();
+
+ /**
+ * @return this instance as a {@link ScaledResolution}
+ * @throws UnsupportedOperationException if this isn't an instance of {@link ScaledResolution}
+ */
+ ScaledResolution getAsMinecraft() throws UnsupportedOperationException;
+
+ @Override
+ void update();
+}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/render/OpenGL.java b/src/main/java/net/daporkchop/pepsimod/util/render/OpenGL.java
new file mode 100644
index 0000000..b7e8914
--- /dev/null
+++ b/src/main/java/net/daporkchop/pepsimod/util/render/OpenGL.java
@@ -0,0 +1,229 @@
+/*
+ * Adapted from The MIT License (MIT)
+ *
+ * Copyright (c) 2016-2020 DaPorkchop_
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions:
+ *
+ * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
+ * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+package net.daporkchop.pepsimod.util.render;
+
+import lombok.NonNull;
+import lombok.experimental.UtilityClass;
+import org.lwjgl.opengl.ARBShaderObjects;
+import org.lwjgl.opengl.ContextCapabilities;
+import org.lwjgl.opengl.GL11;
+import org.lwjgl.opengl.GL20;
+import org.lwjgl.opengl.GLContext;
+import org.lwjgl.util.glu.GLU;
+
+import java.nio.ByteBuffer;
+
+/**
+ * {@link net.minecraft.client.renderer.OpenGlHelper}, but better.
+ *
+ * @author DaPorkchop_
+ */
+@UtilityClass
+public class OpenGL {
+ public ContextCapabilities CAPABILITIES;
+
+ public int VERSION = -1;
+
+ public int GL_FALSE = GL11.GL_FALSE;
+ public int GL_NO_ERROR = GL11.GL_NO_ERROR;
+ public int GL_COMPILE_STATUS = GL20.GL_COMPILE_STATUS;
+ public int GL_LINK_STATUS = GL20.GL_LINK_STATUS;
+ public int GL_VALIDATE_STATUS = GL20.GL_VALIDATE_STATUS;
+ public int GL_VERTEX_SHADER = GL20.GL_VERTEX_SHADER;
+ public int GL_FRAGMENT_SHADER = GL20.GL_FRAGMENT_SHADER;
+
+ public synchronized void init(@NonNull ContextCapabilities capabilities) {
+ if (CAPABILITIES != null) {
+ throw new IllegalStateException("Already initialized!");
+ }
+ CAPABILITIES = capabilities;
+
+ if (capabilities.OpenGL45) {
+ VERSION = 45;
+ } else if (capabilities.OpenGL44) {
+ VERSION = 44;
+ } else if (capabilities.OpenGL43) {
+ VERSION = 43;
+ } else if (capabilities.OpenGL42) {
+ VERSION = 42;
+ } else if (capabilities.OpenGL41) {
+ VERSION = 41;
+ } else if (capabilities.OpenGL40) {
+ VERSION = 40;
+ } else if (capabilities.OpenGL33) {
+ VERSION = 33;
+ } else if (capabilities.OpenGL32) {
+ VERSION = 32;
+ } else if (capabilities.OpenGL31) {
+ VERSION = 31;
+ } else if (capabilities.OpenGL30) {
+ VERSION = 30;
+ } else if (capabilities.OpenGL21) {
+ VERSION = 21;
+ } else if (capabilities.OpenGL20) {
+ VERSION = 20;
+ } else if (capabilities.OpenGL15) {
+ VERSION = 15;
+ } else if (capabilities.OpenGL14) {
+ VERSION = 14;
+ } else if (capabilities.OpenGL13) {
+ VERSION = 13;
+ } else if (capabilities.OpenGL12) {
+ VERSION = 12;
+ } else if (capabilities.OpenGL11) {
+ VERSION = 11;
+ }
+
+ if (VERSION < 21) {
+ throw new IllegalStateException("Requires at least OpenGL 2.1, but found " + VERSION);
+ }
+ }
+
+ public boolean checkOpenGL() {
+ try {
+ GLContext.getCapabilities();
+ } catch (RuntimeException e) {
+ if (e.getMessage() == "No OpenGL context found in the current thread.") {
+ return false;
+ } else {
+ throw e;
+ }
+ }
+ return true;
+ }
+
+ public void assertOpenGL() {
+ GLContext.getCapabilities();
+ }
+
+ public int glCreateShader(int type) {
+ return ARBShaderObjects.glCreateShaderObjectARB(type);
+ }
+
+ public void glDeleteShader(int shader) {
+ ARBShaderObjects.glDeleteObjectARB(shader);
+ }
+
+ public void glShaderSource(int type, @NonNull ByteBuffer buffer) {
+ ARBShaderObjects.glShaderSourceARB(type, buffer);
+ }
+
+ public void glShaderSource(int type, @NonNull CharSequence text) {
+ ARBShaderObjects.glShaderSourceARB(type, text);
+ }
+
+ public void glCompileShader(int id) {
+ ARBShaderObjects.glCompileShaderARB(id);
+ }
+
+ public int glGetShaderi(int shader, int pname) {
+ return ARBShaderObjects.glGetObjectParameteriARB(shader, pname);
+ }
+
+ public String glGetShaderInfoLog(int shader, int maxLength) {
+ return ARBShaderObjects.glGetInfoLogARB(shader, maxLength);
+ }
+
+ public String glGetProgramInfoLog(int program, int maxLength) {
+ return ARBShaderObjects.glGetInfoLogARB(program, maxLength);
+ }
+
+ public int glCreateProgram() {
+ return ARBShaderObjects.glCreateProgramObjectARB();
+ }
+
+ public void glDeleteProgram(int program) {
+ ARBShaderObjects.glDeleteObjectARB(program);
+ }
+
+ public void glUseProgram(int program) {
+ ARBShaderObjects.glUseProgramObjectARB(program);
+ }
+
+ public void glAttachShader(int program, int shader) {
+ ARBShaderObjects.glAttachObjectARB(program, shader);
+ }
+
+ public void glLinkProgram(int program) {
+ ARBShaderObjects.glLinkProgramARB(program);
+ }
+
+ public void glValidateProgram(int program) {
+ ARBShaderObjects.glValidateProgramARB(program);
+ }
+
+ public String glGetLogInfo(int program) {
+ return ARBShaderObjects.glGetInfoLogARB(program, ARBShaderObjects.glGetObjectParameteriARB(program, ARBShaderObjects.GL_OBJECT_INFO_LOG_LENGTH_ARB));
+ }
+
+ public int glGetUniformLocation(int program, @NonNull CharSequence name) {
+ return ARBShaderObjects.glGetUniformLocationARB(program, name);
+ }
+
+ public void glUniform1i(int location, int v0) {
+ ARBShaderObjects.glUniform1iARB(location, v0);
+ }
+
+ public void glUniform2i(int location, int v0, int v1) {
+ ARBShaderObjects.glUniform2iARB(location, v0, v1);
+ }
+
+ public void glUniform3i(int location, int v0, int v1, int v2) {
+ ARBShaderObjects.glUniform3iARB(location, v0, v1, v2);
+ }
+
+ public void glUniform4i(int location, int v0, int v1, int v2, int v3) {
+ ARBShaderObjects.glUniform4iARB(location, v0, v1, v2, v3);
+ }
+
+ public void glUniform1f(int location, float v0) {
+ ARBShaderObjects.glUniform1fARB(location, v0);
+ }
+
+ public void glUniform2f(int location, float v0, float v1) {
+ ARBShaderObjects.glUniform2fARB(location, v0, v1);
+ }
+
+ public void glUniform3f(int location, float v0, float v1, float v2) {
+ ARBShaderObjects.glUniform3fARB(location, v0, v1, v2);
+ }
+
+ public void glUniform4f(int location, float v0, float v1, float v2, float v3) {
+ ARBShaderObjects.glUniform4fARB(location, v0, v1, v2, v3);
+ }
+
+ public void checkGLError() {
+ checkGLError("unknown");
+ }
+
+ public void checkGLError(@NonNull String msg) {
+ int i = 0;
+ int error;
+ while ((error = GL11.glGetError()) != GL_NO_ERROR) {
+ if (++i == 1) {
+ System.err.printf("########## GL ERROR ##########\n@ %s\n%d: %s\n", msg, error, GLU.gluErrorString(error));
+ } else {
+ System.err.printf("########## GL ERROR ##########\n@ %s (x%d)\n%d: %s\n", msg, i, error, GLU.gluErrorString(error));
+ }
+ }
+ System.err.flush();
+ }
+}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/render/WorldRenderer.java b/src/main/java/net/daporkchop/pepsimod/util/render/WorldRenderer.java
deleted file mode 100644
index 241383d..0000000
--- a/src/main/java/net/daporkchop/pepsimod/util/render/WorldRenderer.java
+++ /dev/null
@@ -1,254 +0,0 @@
-/*
- * Adapted from The MIT License (MIT)
- *
- * Copyright (c) 2016-2020 DaPorkchop_
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
- * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package net.daporkchop.pepsimod.util.render;
-
-import net.daporkchop.pepsimod.util.RenderColor;
-import net.minecraft.entity.Entity;
-import net.minecraft.util.math.AxisAlignedBB;
-import net.minecraft.util.math.Vec3d;
-import org.lwjgl.opengl.GL11;
-
-import java.awt.*;
-
-import static org.lwjgl.opengl.GL11.*;
-
-/**
- * Helps with drawing things in the world.
- *
- * @author DaPorkchop_
- */
-public class WorldRenderer implements AutoCloseable {
- protected final double startX;
- protected final double startY;
- protected final double startZ;
-
- protected final double x;
- protected final double y;
- protected final double z;
-
- protected final float partialTicks;
-
- public WorldRenderer(double startX, double startY, double startZ, double x, double y, double z, float partialTicks) {
- this.startX = startX;
- this.startY = startY;
- this.startZ = startZ;
- this.x = x;
- this.y = y;
- this.z = z;
- this.partialTicks = partialTicks;
-
- this.init();
- }
-
- public WorldRenderer init() {
- glEnable(GL11.GL_BLEND);
- glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL11.GL_LINE_SMOOTH);
- glLineWidth(2.0f);
- glDisable(GL11.GL_TEXTURE_2D);
- glEnable(GL11.GL_CULL_FACE);
- glDisable(GL11.GL_DEPTH_TEST);
-
- return this.resume();
- }
-
- @Override
- public void close() {
- glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
- this.pause();
-
- glEnable(GL11.GL_DEPTH_TEST);
- glEnable(GL11.GL_TEXTURE_2D);
- glDisable(GL11.GL_CULL_FACE);
- glDisable(GL11.GL_LINE_SMOOTH);
- glDisable(GL11.GL_BLEND);
- }
-
- public WorldRenderer resume() {
- glBegin(GL11.GL_LINES);
- return this;
- }
-
- public WorldRenderer pause() {
- glEnd();
- return this;
- }
-
- public WorldRenderer(Vec3d start, double x, double y, double z, float partialTicks) {
- this(start.x, start.y, start.z, x, y, z, partialTicks);
- }
-
- public WorldRenderer(Vec3d start, Vec3d pos, float partialTicks) {
- this(start.x, start.y, start.z, pos.x, pos.y, pos.z, partialTicks);
- }
-
- public WorldRenderer color(float r, float g, float b) {
- glColor4f(r, g, b, 1.0f);
- return this;
- }
-
- public WorldRenderer color(float r, float g, float b, float a) {
- glColor4f(r, g, b, a);
- return this;
- }
-
- public WorldRenderer color(int r, int g, int b) {
- glColor4f(r * 0.003921569f, g * 0.003921569f, b * 0.003921569f, 1.0f);
- return this;
- }
-
- public WorldRenderer color(int r, int g, int b, int a) {
- glColor4f(r * 0.003921569f, g * 0.003921569f, b * 0.003921569f, a * 0.003921569f);
- return this;
- }
-
- public WorldRenderer color(RenderColor color) {
- glColor4b(color.r, color.g, color.b, color.a);
- return this;
- }
-
- public WorldRenderer color(Color color) {
- glColor4f(color.getRed() * 0.003921569f, color.getGreen() * 0.003921569f, color.getBlue() * 0.003921569f, color.getAlpha() * 0.003921569f);
- return this;
- }
-
- public WorldRenderer width(float width) {
- this.pause();
- glLineWidth(width);
- return this.resume();
- }
-
- public WorldRenderer line(double x1, double y1, double z1, double x2, double y2, double z2) {
- glVertex3d(x1 - this.x, y1 - this.y, z1 - this.z);
- glVertex3d(x2 - this.x, y2 - this.y, z2 - this.z);
- return this;
- }
-
- public WorldRenderer line(float x1, float y1, float z1, float x2, float y2, float z2) {
- glVertex3d(x1 - this.x, y1 - this.y, z1 - this.z);
- glVertex3d(x2 - this.x, y2 - this.y, z2 - this.z);
- return this;
- }
-
- public WorldRenderer line(int x1, int y1, int z1, int x2, int y2, int z2) {
- glVertex3d(x1 - this.x, y1 - this.y, z1 - this.z);
- glVertex3d(x2 - this.x, y2 - this.y, z2 - this.z);
- return this;
- }
-
- public WorldRenderer line(Vec3d pos1, Vec3d pos2) {
- return this.line(pos1.x, pos1.y, pos1.z, pos2.x, pos2.y, pos2.z);
- }
-
- public WorldRenderer line(Vec3d pos1, Entity pos2) {
- return this.line(pos1.x, pos1.y, pos1.z, pos2.posX, pos2.posY, pos2.posZ);
- }
-
- public WorldRenderer line(Entity pos1, Entity pos2) {
- return this.line(pos1.posX, pos1.posY, pos1.posZ, pos2.posX, pos2.posY, pos2.posZ);
- }
-
- public WorldRenderer lineFromEyes(double x, double y, double z) {
- glVertex3d(this.startX, this.startY, this.startZ);
- glVertex3d(x - this.x, y - this.y, z - this.z);
- return this;
- }
-
- public WorldRenderer lineFromEyes(Vec3d pos) {
- return this.lineFromEyes(pos.x, pos.y, pos.z);
- }
-
- public WorldRenderer lineFromEyes(Entity entity, float partialTicks) {
- if (partialTicks == 1.0F) {
- return this.lineFromEyes(entity.posX, entity.posY, entity.posZ);
- } else {
- double x = entity.prevPosX + (entity.posX - entity.prevPosX) * partialTicks;
- double y = entity.prevPosY + (entity.posY - entity.prevPosY) * partialTicks;
- double z = entity.prevPosZ + (entity.posZ - entity.prevPosZ) * partialTicks;
- return this.lineFromEyes(x, y, z);
- }
- }
-
- public WorldRenderer lineFromEyes(Entity entity) {
- return this.lineFromEyes(entity, this.partialTicks);
- }
-
- public WorldRenderer outline(AxisAlignedBB bb) {
- return this.outline(bb.minX, bb.minY, bb.minZ, bb.maxX, bb.maxY, bb.maxZ);
- }
-
- public WorldRenderer outline(Entity entity) {
- double x = entity.prevPosX + (entity.posX - entity.prevPosX) * partialTicks;
- double y = entity.prevPosY + (entity.posY - entity.prevPosY) * partialTicks;
- double z = entity.prevPosZ + (entity.posZ - entity.prevPosZ) * partialTicks;
- double halfwidth = entity.width * 0.5d;
- return this.outline(
- x - halfwidth, y, z - halfwidth,
- x + halfwidth, y + entity.height, z + halfwidth
- );
- }
-
- public WorldRenderer outline(double minX, double minY, double minZ, double maxX, double maxY, double maxZ) {
- return this.internal_outline(
- minX - this.x, minY - this.y, minZ - this.z,
- maxX - this.x, maxY - this.y, maxZ - this.z
- );
- }
-
- protected WorldRenderer internal_outline(double minX, double minY, double minZ, double maxX, double maxY, double maxZ) {
- glVertex3d(minX, minY, minZ);
- glVertex3d(maxX, minY, minZ);
-
- glVertex3d(maxX, minY, minZ);
- glVertex3d(maxX, minY, maxZ);
-
- glVertex3d(maxX, minY, maxZ);
- glVertex3d(minX, minY, maxZ);
-
- glVertex3d(minX, minY, maxZ);
- glVertex3d(minX, minY, minZ);
-
- glVertex3d(minX, minY, minZ);
- glVertex3d(minX, maxY, minZ);
-
- glVertex3d(maxX, minY, minZ);
- glVertex3d(maxX, maxY, minZ);
-
- glVertex3d(maxX, minY, maxZ);
- glVertex3d(maxX, maxY, maxZ);
-
- glVertex3d(minX, minY, maxZ);
- glVertex3d(minX, maxY, maxZ);
-
- glVertex3d(minX, maxY, minZ);
- glVertex3d(maxX, maxY, minZ);
-
- glVertex3d(maxX, maxY, minZ);
- glVertex3d(maxX, maxY, maxZ);
-
- glVertex3d(maxX, maxY, maxZ);
- glVertex3d(minX, maxY, maxZ);
-
- glVertex3d(minX, maxY, maxZ);
- glVertex3d(minX, maxY, minZ);
- return this;
- }
-}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/render/color/ChatColor.java b/src/main/java/net/daporkchop/pepsimod/util/render/color/ChatColor.java
new file mode 100644
index 0000000..7f7dc28
--- /dev/null
+++ b/src/main/java/net/daporkchop/pepsimod/util/render/color/ChatColor.java
@@ -0,0 +1,243 @@
+/*
+ * Adapted from The MIT License (MIT)
+ *
+ * Copyright (c) 2016-2020 DaPorkchop_
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions:
+ *
+ * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
+ * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+package net.daporkchop.pepsimod.util.render.color;
+
+import lombok.Getter;
+import lombok.NonNull;
+import lombok.RequiredArgsConstructor;
+import lombok.experimental.Accessors;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.util.text.TextFormatting;
+
+/**
+ * {@link RenderColor} implementations for each of the vanilla text colors.
+ *
+ * @author DaPorkchop_
+ * @see TextFormatting
+ */
+@RequiredArgsConstructor
+@Getter
+public enum ChatColor implements RenderColor {
+ BLACK(TextFormatting.BLACK, 0x000000),
+ DARK_BLUE(TextFormatting.DARK_BLUE, 0x0000AA),
+ DARK_GREEN(TextFormatting.DARK_GREEN, 0x00AA00),
+ DARK_AQUA(TextFormatting.DARK_AQUA, 0x00AAAA),
+ DARK_RED(TextFormatting.DARK_RED, 0xAA0000),
+ DARK_PURPLE(TextFormatting.DARK_PURPLE, 0xAA00AA),
+ GOLD(TextFormatting.GOLD, 0xFFAA00),
+ GRAY(TextFormatting.GRAY, 0xAAAAAA),
+ DARK_GRAY(TextFormatting.DARK_GRAY, 0x555555),
+ BLUE(TextFormatting.BLUE, 0x5555FF),
+ GREEN(TextFormatting.GREEN, 0x55FF55),
+ AQUA(TextFormatting.AQUA, 0x55FFFF),
+ RED(TextFormatting.RED, 0xFF5555),
+ LIGHT_PURPLE(TextFormatting.LIGHT_PURPLE, 0xFF55FF),
+ YELLOW(TextFormatting.YELLOW, 0xFFFF55),
+ WHITE(TextFormatting.WHITE, 0xFFFFFF);
+
+ public static final ChatColor[] VALUES = values();
+
+ /**
+ * Gets the {@link ChatColor} that corresponds to the given formatting code.
+ *
+ * @param formatting the formatting code
+ * @return the {@link ChatColor} that corresponds to the given formatting code
+ */
+ public static ChatColor fromMc(@NonNull TextFormatting formatting) {
+ switch (formatting) {
+ case BLACK:
+ return BLACK;
+ case DARK_BLUE:
+ return DARK_BLUE;
+ case DARK_GREEN:
+ return DARK_GREEN;
+ case DARK_AQUA:
+ return DARK_AQUA;
+ case DARK_RED:
+ return DARK_RED;
+ case DARK_PURPLE:
+ return DARK_PURPLE;
+ case GOLD:
+ return GOLD;
+ case GRAY:
+ return GRAY;
+ case DARK_GRAY:
+ return DARK_GRAY;
+ case BLUE:
+ return BLUE;
+ case GREEN:
+ return GREEN;
+ case AQUA:
+ return AQUA;
+ case RED:
+ return RED;
+ case LIGHT_PURPLE:
+ return LIGHT_PURPLE;
+ case YELLOW:
+ return YELLOW;
+ case WHITE:
+ return WHITE;
+ }
+ throw new IllegalArgumentException(String.format("Invalid formatting: %s", formatting));
+ }
+
+ /**
+ * Gets the {@link ChatColor} that corresponds to the given formatting code.
+ *
+ * @param code the formatting code
+ * @return the {@link ChatColor} that corresponds to the given formatting code
+ */
+ public static ChatColor fromMc(@NonNull String code) {
+ switch (code) {
+ case "0":
+ return BLACK;
+ case "1":
+ return DARK_BLUE;
+ case "2":
+ return DARK_GREEN;
+ case "3":
+ return DARK_AQUA;
+ case "4":
+ return DARK_RED;
+ case "5":
+ return DARK_PURPLE;
+ case "6":
+ return GOLD;
+ case "7":
+ return GRAY;
+ case "8":
+ return DARK_GRAY;
+ case "9":
+ return BLUE;
+ case "a":
+ return GREEN;
+ case "b":
+ return AQUA;
+ case "c":
+ return RED;
+ case "d":
+ return LIGHT_PURPLE;
+ case "e":
+ return YELLOW;
+ case "f":
+ return WHITE;
+ }
+ throw new IllegalArgumentException(String.format("Invalid formatting: \"%s\"", code));
+ }
+
+ /**
+ * Gets the {@link ChatColor} that corresponds to the given formatting code.
+ *
+ * @param code the formatting code
+ * @return the {@link ChatColor} that corresponds to the given formatting code
+ */
+ public static ChatColor fromMc(char code) {
+ switch (code) {
+ case '0':
+ return BLACK;
+ case '1':
+ return DARK_BLUE;
+ case '2':
+ return DARK_GREEN;
+ case '3':
+ return DARK_AQUA;
+ case '4':
+ return DARK_RED;
+ case '5':
+ return DARK_PURPLE;
+ case '6':
+ return GOLD;
+ case '7':
+ return GRAY;
+ case '8':
+ return DARK_GRAY;
+ case '9':
+ return BLUE;
+ case 'a':
+ return GREEN;
+ case 'b':
+ return AQUA;
+ case 'c':
+ return RED;
+ case 'd':
+ return LIGHT_PURPLE;
+ case 'e':
+ return YELLOW;
+ case 'f':
+ return WHITE;
+ }
+ throw new IllegalArgumentException(String.format("Invalid formatting: %c", code));
+ }
+
+ @NonNull
+ protected final TextFormatting mcColor;
+ protected final int rgb;
+
+ @Override
+ public void bind() {
+ GlStateManager.color(this.fR(), this.fG(), this.fB(), 1.0f);
+ }
+
+ @Override
+ public int argb() {
+ return this.rgb | 0xFF000000;
+ }
+
+ @Override
+ public int iA() {
+ return 0xFF;
+ }
+
+ @Override
+ public int iR() {
+ return (this.rgb >>> 16) & 0xFF;
+ }
+
+ @Override
+ public int iG() {
+ return (this.rgb >>> 8) & 0xFF;
+ }
+
+ @Override
+ public int iB() {
+ return this.rgb & 0xFF;
+ }
+
+ @Override
+ public float fA() {
+ return 1.0f;
+ }
+
+ @Override
+ public float fR() {
+ return ((this.rgb >>> 16) & 0xFF) * 255.0f;
+ }
+
+ @Override
+ public float fG() {
+ return ((this.rgb >>> 8) & 0xFF) * 255.0f;
+ }
+
+ @Override
+ public float fB() {
+ return (this.rgb & 0xFF) * 255.0f;
+ }
+}
diff --git a/src/main/java/net/daporkchop/pepsimod/misc/data/MainMenu.java b/src/main/java/net/daporkchop/pepsimod/util/render/color/RenderColor.java
similarity index 52%
rename from src/main/java/net/daporkchop/pepsimod/misc/data/MainMenu.java
rename to src/main/java/net/daporkchop/pepsimod/util/render/color/RenderColor.java
index 37dcf44..192430f 100644
--- a/src/main/java/net/daporkchop/pepsimod/misc/data/MainMenu.java
+++ b/src/main/java/net/daporkchop/pepsimod/util/render/color/RenderColor.java
@@ -18,47 +18,65 @@
*
*/
-package net.daporkchop.pepsimod.misc.data;
+package net.daporkchop.pepsimod.util.render.color;
-import net.daporkchop.pepsimod.util.render.Texture;
-
-import java.util.Objects;
-import java.util.Random;
-import java.util.concurrent.ThreadLocalRandom;
+import net.minecraft.client.renderer.GlStateManager;
/**
- * Contains additional data injected by pepsimod into Minecraft's main menu
+ * A container around a single color.
*
* @author DaPorkchop_
*/
-public class MainMenu implements AutoCloseable {
- protected String[] splashes;
- public Texture banner;
-
- public void setup(String[] splashes, Texture banner) {
- if (this.banner != null) {
- this.close();
- }
- this.splashes = Objects.requireNonNull(splashes, "splashes");
- this.banner = Objects.requireNonNull(banner, "banner");
+public interface RenderColor {
+ /**
+ * Binds this color to the renderer, using {@link net.minecraft.client.renderer.GlStateManager}.
+ */
+ default void bind() {
+ GlStateManager.color(this.fR(), this.fG(), this.fB(), this.fA());
}
- public String getRandomSplash() {
- Random r = ThreadLocalRandom.current();
- String[] colors = {
- "\u00A71",
- "\u00A79",
- "\u00A7a",
- "\u00A7b",
- "\u00A7c",
- "\u00A7f",
- };
- return colors[r.nextInt(colors.length)] + this.splashes[r.nextInt(this.splashes.length)];
- }
+ /**
+ * @return this color as a 32-bit ARGB int
+ */
+ int argb();
- @Override
- public void close() {
- this.banner.close();
- this.splashes = null;
- }
+ /**
+ * @return this color's alpha channel as an int from 0-255
+ */
+ int iA();
+
+ /**
+ * @return this color's red channel as an int from 0-255
+ */
+ int iR();
+
+ /**
+ * @return this color's green channel as an int from 0-255
+ */
+ int iG();
+
+ /**
+ * @return this color's blue channel as an int from 0-255
+ */
+ int iB();
+
+ /**
+ * @return this color's alpha channel as a float from 0-1
+ */
+ float fA();
+
+ /**
+ * @return this color's red channel as a float from 0-1
+ */
+ float fR();
+
+ /**
+ * @return this color's green channel as a float from 0-1
+ */
+ float fG();
+
+ /**
+ * @return this color's blue channel as a float from 0-1
+ */
+ float fB();
}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/render/color/SimpleColor.java b/src/main/java/net/daporkchop/pepsimod/util/render/color/SimpleColor.java
new file mode 100644
index 0000000..ccc0e28
--- /dev/null
+++ b/src/main/java/net/daporkchop/pepsimod/util/render/color/SimpleColor.java
@@ -0,0 +1,171 @@
+/*
+ * Adapted from The MIT License (MIT)
+ *
+ * Copyright (c) 2016-2020 DaPorkchop_
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions:
+ *
+ * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
+ * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+package net.daporkchop.pepsimod.util.render.color;
+
+import lombok.Getter;
+import lombok.experimental.Accessors;
+import net.minecraft.client.renderer.GlStateManager;
+
+import static net.minecraft.util.math.MathHelper.floor;
+
+/**
+ * A simple implementation of {@link RenderColor} which stores both float and int values, allowing for fast access of both.
+ *
+ * @author DaPorkchop_
+ */
+@Getter
+public final class SimpleColor implements RenderColor {
+ protected final float r;
+ protected final float g;
+ protected final float b;
+ protected final float a;
+ protected final int argb;
+
+ /**
+ * Constructs a {@link SimpleColor} instance from a 32-bit ARGB int.
+ *
+ * @param argb the ARGB value
+ */
+ public SimpleColor(int argb) {
+ this((argb >>> 24) & 0xFF, (argb >>> 16) & 0xFF, (argb >>> 8) & 0xFF, argb & 0xFF);
+ }
+
+ /**
+ * Constructs an opaque {@link SimpleColor} instance from 3 8-bit integer color values.
+ *
+ * @param r the red channel
+ * @param g the green channel
+ * @param b the blue channel
+ * @throws IllegalArgumentException if any of the color channels are not in the range 0-255
+ */
+ public SimpleColor(int r, int g, int b) {
+ this(0xFF, r, g, b);
+ }
+
+ /**
+ * Constructs a {@link SimpleColor} instance from 4 8-bit integer color values.
+ *
+ * @param a the alpha channel
+ * @param r the red channel
+ * @param g the green channel
+ * @param b the blue channel
+ * @throws IllegalArgumentException if any of the color channels are not in the range 0-255
+ */
+ public SimpleColor(int a, int r, int g, int b) {
+ if ((a & ~0xFF) != 0) {
+ throw new IllegalArgumentException(String.format("Invalid alpha value. Must be in range 0-255 (found: %d)", a));
+ } else if ((r & ~0xFF) != 0) {
+ throw new IllegalArgumentException(String.format("Invalid red value. Must be in range 0-255 (found: %d)", r));
+ } else if ((g & ~0xFF) != 0) {
+ throw new IllegalArgumentException(String.format("Invalid green value. Must be in range 0-255 (found: %d)", g));
+ } else if ((b & ~0xFF) != 0) {
+ throw new IllegalArgumentException(String.format("Invalid blue value. Must be in range 0-255 (found: %d)", b));
+ }
+ this.r = r / 255.0f;
+ this.g = g / 255.0f;
+ this.b = b / 255.0f;
+ this.a = a / 255.0f;
+ this.argb = (a << 24) | (r << 16) | (g << 8) | b;
+ }
+
+ /**
+ * Constructs an opaque {@link SimpleColor} instance from 3 float color values.
+ *
+ * @param r the red channel
+ * @param g the green channel
+ * @param b the blue channel
+ * @throws IllegalArgumentException if any of the color channels are not in the range 0-1
+ */
+ public SimpleColor(float r, float g, float b) {
+ this(1.0f, r, g, b);
+ }
+
+ /**
+ * Constructs a {@link SimpleColor} instance from 4 float color values.
+ *
+ * @param a the alpha channel
+ * @param r the red channel
+ * @param g the green channel
+ * @param b the blue channel
+ * @throws IllegalArgumentException if any of the color channels are not in the range 0-1
+ */
+ public SimpleColor(float a, float r, float g, float b) {
+ if (a < 0.0f || a > 1.0f) {
+ throw new IllegalArgumentException(String.format("Invalid alpha value. Must be in range 0-1 (found: %f)", a));
+ } else if (r < 0.0f || r > 1.0f) {
+ throw new IllegalArgumentException(String.format("Invalid red value. Must be in range 0-1 (found: %f)", r));
+ } else if (g < 0.0f || g > 1.0f) {
+ throw new IllegalArgumentException(String.format("Invalid green value. Must be in range 0-1 (found: %f)", g));
+ } else if (b < 0.0f || b > 1.0f) {
+ throw new IllegalArgumentException(String.format("Invalid blue value. Must be in range 0-1 (found: %f)", b));
+ }
+ this.r = r;
+ this.g = g;
+ this.b = b;
+ this.a = a;
+ this.argb = (floor(a * 255.0f) << 24) | (floor(r * 255.0f) << 16) | (floor(g * 255.0f) << 8) | floor(b * 255.0f);
+ }
+
+ @Override
+ public void bind() {
+ GlStateManager.color(this.r, this.g, this.b, this.a);
+ }
+
+ @Override
+ public int iA() {
+ return (this.argb >>> 24) & 0xFF;
+ }
+
+ @Override
+ public int iR() {
+ return (this.argb >>> 16) & 0xFF;
+ }
+
+ @Override
+ public int iG() {
+ return (this.argb >>> 8) & 0xFF;
+ }
+
+ @Override
+ public int iB() {
+ return this.argb & 0xFF;
+ }
+
+ @Override
+ public float fA() {
+ return this.a;
+ }
+
+ @Override
+ public float fR() {
+ return this.r;
+ }
+
+ @Override
+ public float fG() {
+ return this.g;
+ }
+
+ @Override
+ public float fB() {
+ return this.b;
+ }
+}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/render/shader/Shader.java b/src/main/java/net/daporkchop/pepsimod/util/render/shader/Shader.java
new file mode 100644
index 0000000..a0aa0e1
--- /dev/null
+++ b/src/main/java/net/daporkchop/pepsimod/util/render/shader/Shader.java
@@ -0,0 +1,194 @@
+/*
+ * Adapted from The MIT License (MIT)
+ *
+ * Copyright (c) 2016-2020 DaPorkchop_
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions:
+ *
+ * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
+ * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+package net.daporkchop.pepsimod.util.render.shader;
+
+import com.google.gson.JsonObject;
+import lombok.Getter;
+import lombok.NonNull;
+import lombok.experimental.Accessors;
+import net.daporkchop.pepsimod.util.render.OpenGL;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.IdentityHashMap;
+import java.util.Set;
+
+/**
+ * A container for a vertex or fragment shader.
+ *
+ * @author DaPorkchop_
+ */
+@Getter
+abstract class Shader {
+ protected final Set usages = Collections.newSetFromMap(new IdentityHashMap<>());
+ protected final String name;
+ protected int id;
+
+ protected Shader(@NonNull String name, @NonNull String code, @NonNull JsonObject meta) {
+ OpenGL.assertOpenGL();
+ this.name = name;
+ this.id = -1;
+
+ try {
+ //allocate shader
+ this.id = OpenGL.glCreateShader(this.type().openGlId);
+
+ //set shader source code
+ OpenGL.glShaderSource(this.id, code);
+
+ //compile and validate shader
+ OpenGL.glCompileShader(this.id);
+ ShaderManager.validate(name, this.id, OpenGL.GL_COMPILE_STATUS);
+ } catch (Exception e) {
+ if (this.id != -1) {
+ this.internal_dispose();
+ }
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * @return this shader's type
+ */
+ protected abstract ShaderType type();
+
+ /**
+ * Loads shader metadata.
+ *
+ * @param meta the shader metadata
+ */
+ protected abstract void load(@NonNull JsonObject meta);
+
+ /**
+ * Gets the list of variables provided by this vertex shader.
+ *
+ * @return the list of variables provided by this vertex shader
+ * @throws UnsupportedOperationException if this shader is a fragment shader
+ */
+ protected Collection provides() throws UnsupportedOperationException {
+ switch (this.type()) {
+ case VERTEX:
+ throw new AbstractMethodError();
+ case FRAGMENT:
+ throw new UnsupportedOperationException("requires() on fragment shader");
+ default:
+ throw new IllegalStateException(this.type() == null ? "null" : this.type().name());
+ }
+ }
+
+ /**
+ * Gets the list of variables required by this fragment shader.
+ *
+ * @return the list of variables required by this fragment shader
+ * @throws UnsupportedOperationException if this shader is a vertex shader
+ */
+ protected Collection requires() throws UnsupportedOperationException {
+ switch (this.type()) {
+ case VERTEX:
+ throw new UnsupportedOperationException("requires() on vertex shader");
+ case FRAGMENT:
+ throw new AbstractMethodError();
+ default:
+ throw new IllegalStateException(this.type() == null ? "null" : this.type().name());
+ }
+ }
+
+ /**
+ * Asserts that this shader can be linked with another one.
+ *
+ * @param counterpart the shader to check for compatibility with
+ * @throws IllegalArgumentException if the shaders are not compatible
+ */
+ protected void assertCompatible(@NonNull Shader counterpart) throws IllegalArgumentException {
+ if (counterpart == this) {
+ throw new IllegalArgumentException("Cannot be linked to self!");
+ } else if (counterpart.type() == this.type()) {
+ throw new IllegalArgumentException("Cannot be linked with other shader of same type!");
+ }
+ }
+
+ /**
+ * Attaches this shader to the given shader program.
+ *
+ * @param program the program to which to attach this shader
+ */
+ protected void attach(@NonNull ShaderProgram program) {
+ OpenGL.assertOpenGL();
+ if (this.id == -1) {
+ throw new IllegalStateException("Already deleted!");
+ } else if (!this.usages.add(program)) {
+ throw new IllegalStateException("Already attached to the given shader!");
+ } else {
+ OpenGL.glAttachShader(program.id, this.id);
+ }
+ }
+
+ /**
+ * Detaches this shader from the given shader program.
+ *
+ * @param program the program from which to detach this shader
+ * @return whether or not this shader has been disposed
+ */
+ protected boolean detach(@NonNull ShaderProgram program) {
+ OpenGL.assertOpenGL();
+ if (this.id == -1) {
+ throw new IllegalStateException("Already deleted!");
+ } else if (!this.usages.remove(program)) {
+ throw new IllegalStateException("Not attached to the given shader!");
+ } else if (this.usages.isEmpty()) {
+ this.internal_dispose();
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Less aggressive variant of {@link #detach(ShaderProgram)}.
+ *
+ * @see #detach(ShaderProgram)
+ */
+ protected boolean detachSoft(@NonNull ShaderProgram program) {
+ OpenGL.assertOpenGL();
+ if (this.id == -1) {
+ System.err.printf("Warning: Shader \"%s\" (%s) was not detached from program \"%s\" as it had already been disposed!\n", this.name, this.type(), program.name);
+ } else if (!this.usages.remove(program)) {
+ System.err.printf("Warning: Program \"%s\" incorrectly tried to detach shader \"%s\" (%s) from itself, but it wasn't attached!\n", program.name, this.name, this.type());
+ } else if (this.usages.isEmpty()) {
+ this.internal_dispose();
+ return true;
+ }
+ return false;
+ }
+
+ protected void internal_dispose() {
+ OpenGL.assertOpenGL();
+ if (this.id == -1) {
+ throw new IllegalStateException("Already disposed!");
+ } else {
+ OpenGL.glDeleteShader(this.id);
+ this.id = -1;
+ if (!this.type().compiledShaders.remove(this.name, this)) {
+ throw new IllegalStateException("Couldn't remove self from compiled shaders registry!");
+ }
+ }
+ }
+}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/render/shader/ShaderManager.java b/src/main/java/net/daporkchop/pepsimod/util/render/shader/ShaderManager.java
new file mode 100644
index 0000000..dac6a7c
--- /dev/null
+++ b/src/main/java/net/daporkchop/pepsimod/util/render/shader/ShaderManager.java
@@ -0,0 +1,145 @@
+/*
+ * Adapted from The MIT License (MIT)
+ *
+ * Copyright (c) 2016-2020 DaPorkchop_
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions:
+ *
+ * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
+ * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+package net.daporkchop.pepsimod.util.render.shader;
+
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
+import lombok.NonNull;
+import lombok.experimental.UtilityClass;
+import net.daporkchop.lib.common.function.io.IOFunction;
+import net.daporkchop.pepsimod.util.PepsiUtil;
+import net.daporkchop.pepsimod.util.render.OpenGL;
+import org.apache.commons.io.IOUtils;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.nio.charset.StandardCharsets;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Manages loaded shaders.
+ *
+ * @author DaPorkchop_
+ * @deprecated because you shouldn't be using this
+ */
+@UtilityClass
+public class ShaderManager {
+ protected final String BASE_PATH = "/assets/pepsimod/shaders";
+ protected final Map LINKED_PROGRAMS = new HashMap<>();
+ protected long RELOAD_COUNTER = 0L;
+
+ /**
+ * Obtains a shader program with the given name.
+ *
+ * @param programName the name of the shader to get
+ * @return the shader program with the given name
+ */
+ public ShaderProgram get(@NonNull String programName) {
+ OpenGL.assertOpenGL();
+ ShaderProgram program = LINKED_PROGRAMS.computeIfAbsent(programName, (IOFunction) ShaderManager::doGet);
+ program.usages++;
+ return program;
+ }
+
+ private ShaderProgram doGet(@NonNull String name) throws IOException {
+ return doGet(name, false);
+ }
+
+ private ShaderProgram doGet(@NonNull String name, boolean bypassCache) throws IOException {
+ String fileName = String.format("%s/prog/%s.json", BASE_PATH, name);
+ JsonObject meta;
+ try (InputStream in = PepsiUtil.getResourceAsStream(fileName)) {
+ if (in == null) {
+ throw new IllegalStateException(String.format("Unable to find shader meta file: \"%s\"!", fileName));
+ }
+ meta = new JsonParser().parse(new InputStreamReader(in)).getAsJsonObject();
+ }
+ if (!meta.has("vert")) {
+ throw new IllegalStateException(String.format("Shader \"%s\" has no vertex shader!", name));
+ } else if (!meta.has("frag")) {
+ throw new IllegalStateException(String.format("Shader \"%s\" has no fragment shader!", name));
+ }
+ String cacheName = bypassCache ? "_reload_" + String.valueOf(RELOAD_COUNTER++) : null;
+ return new ShaderProgram(
+ name,
+ get(meta.get("vert").getAsString(), cacheName, ShaderType.VERTEX),
+ get(meta.get("frag").getAsString(), cacheName, ShaderType.FRAGMENT)
+ );
+ }
+
+ /**
+ * Reloads the given shader program. The program will be disposed, and then replaced with a freshly loaded version from disk.
+ *
+ * This is only present for debug purposes, and is highly likely to break things.
+ *
+ * @param program the program to reload
+ * @return the reloaded shader program
+ */
+ public ShaderProgram reload(@NonNull ShaderProgram program) {
+ OpenGL.assertOpenGL();
+ program.release();
+ try {
+ program = doGet(program.name, true);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ LINKED_PROGRAMS.put(program.name, program);
+ return program.incrementUsages();
+ }
+
+ protected Shader get(@NonNull String name, String cacheName, @NonNull ShaderType type) {
+ OpenGL.assertOpenGL();
+ if (cacheName == null) {
+ cacheName = name;
+ } else {
+ cacheName = name + cacheName;
+ }
+ return type.compiledShaders.computeIfAbsent(cacheName, (IOFunction) aaaaaa_uselessParam -> {
+ String fileName = String.format("%s/%s/%s.%s", BASE_PATH, type.extension, name, type.extension);
+ String metaFileName = fileName + ".json";
+ JsonObject meta;
+ try (InputStream in = PepsiUtil.getResourceAsStream(metaFileName)) {
+ if (in == null) {
+ throw new IllegalStateException(String.format("Unable to find meta file: \"%s\"!", metaFileName));
+ }
+ meta = new JsonParser().parse(new InputStreamReader(in)).getAsJsonObject();
+ }
+ String code;
+ try (InputStream in = PepsiUtil.getResourceAsStream(fileName)) {
+ if (in == null) {
+ throw new IllegalStateException(String.format("Unable to find shader file: \"%s\"!", fileName));
+ }
+ code = IOUtils.toString(in, StandardCharsets.UTF_8);
+ }
+ return type.construct(name, code, meta);
+ });
+ }
+
+ protected void validate(@NonNull String name, int id, int type) {
+ if (OpenGL.glGetShaderi(id, type) == OpenGL.GL_FALSE) {
+ String error = String.format("Couldn't compile shader \"%s\": %s", name, OpenGL.glGetLogInfo(id));
+ System.err.println(error);
+ throw new IllegalStateException(error);
+ }
+ }
+}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/render/shader/ShaderProgram.java b/src/main/java/net/daporkchop/pepsimod/util/render/shader/ShaderProgram.java
new file mode 100644
index 0000000..e4328e5
--- /dev/null
+++ b/src/main/java/net/daporkchop/pepsimod/util/render/shader/ShaderProgram.java
@@ -0,0 +1,144 @@
+/*
+ * Adapted from The MIT License (MIT)
+ *
+ * Copyright (c) 2016-2020 DaPorkchop_
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions:
+ *
+ * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
+ * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+package net.daporkchop.pepsimod.util.render.shader;
+
+import lombok.Getter;
+import lombok.NonNull;
+import lombok.experimental.Accessors;
+import net.daporkchop.pepsimod.util.PepsiConstants;
+import net.daporkchop.pepsimod.util.render.OpenGL;
+
+/**
+ * Basic wrapper around a shader.
+ *
+ * @author DaPorkchop_
+ */
+public final class ShaderProgram implements PepsiConstants, AutoCloseable {
+ @Getter
+ protected final String name;
+ protected final Shader vertex;
+ protected final Shader fragment;
+ protected int id;
+ protected int usages;
+
+ /**
+ * Creates a new shader program by attaching the given vertex shader with the given fragment shader.
+ *
+ * @param name the program's name
+ * @param vertex the vertex shader
+ * @param fragment fragment shader
+ */
+ protected ShaderProgram(@NonNull String name, @NonNull Shader vertex, @NonNull Shader fragment) {
+ OpenGL.assertOpenGL();
+ this.name = name;
+ this.id = -1;
+
+ try {
+ //allocate program
+ this.id = OpenGL.glCreateProgram();
+
+ //attach shaders
+ vertex.attach(this);
+ fragment.attach(this);
+
+ //link and validate
+ OpenGL.glLinkProgram(this.id);
+ ShaderManager.validate(this.name, this.id, OpenGL.GL_LINK_STATUS);
+ OpenGL.glValidateProgram(this.id);
+ ShaderManager.validate(this.name, this.id, OpenGL.GL_VALIDATE_STATUS);
+ } catch (Exception e) {
+ vertex.detachSoft(this);
+ fragment.detachSoft(this);
+ this.release();
+ }
+
+ this.vertex = vertex;
+ this.fragment = fragment;
+ }
+
+ protected ShaderProgram incrementUsages() {
+ OpenGL.assertOpenGL();
+ if (this.id == -1) {
+ throw new IllegalStateException("Already deleted!");
+ } else {
+ this.usages++;
+ return this;
+ }
+ }
+
+ /**
+ * Decrements the shader's usage count by 1, deleting it if the usage count reaches 0.
+ *
+ * This must only be called when you are no longer using the shader.
+ */
+ public void release() {
+ OpenGL.assertOpenGL();
+ if (this.id == -1) {
+ throw new IllegalStateException("Already deleted!");
+ } else {
+ if (this.vertex != null) {
+ this.vertex.detach(this);
+ }
+ if (this.fragment != null) {
+ this.fragment.detach(this);
+ }
+ OpenGL.glDeleteProgram(this.id);
+ this.id = -1;
+ ShaderManager.LINKED_PROGRAMS.remove(this.name, this);
+ /*if (!ShaderManager.LINKED_PROGRAMS.remove(this.name, this)) {
+ throw new IllegalStateException("Couldn't remove self from linked programs registry!");
+ }*/
+ }
+ }
+
+ /**
+ * Gets the location of a uniform value in the fragment shader.
+ *
+ * @param name the uniform's name
+ * @return the uniform's location
+ */
+ public int uniformLocation(@NonNull String name) {
+ if (this.id == -1) {
+ throw new IllegalStateException("Already deleted!");
+ } else {
+ return OpenGL.glGetUniformLocation(this.id, name);
+ }
+ }
+
+ /**
+ * Binds this shader for use when rendering.
+ *
+ * This method returns itself, for use in a try-with-resources block.
+ */
+ public ShaderProgram use() {
+ if (this.id == -1) {
+ throw new IllegalStateException("Already deleted!");
+ } else {
+ OpenGL.glUseProgram(this.id);
+ return this;
+ }
+ }
+
+ @Override
+ public synchronized void close() {
+ OpenGL.glUseProgram(0);
+ }
+}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/render/shader/ShaderType.java b/src/main/java/net/daporkchop/pepsimod/util/render/shader/ShaderType.java
new file mode 100644
index 0000000..e39757e
--- /dev/null
+++ b/src/main/java/net/daporkchop/pepsimod/util/render/shader/ShaderType.java
@@ -0,0 +1,118 @@
+/*
+ * Adapted from The MIT License (MIT)
+ *
+ * Copyright (c) 2016-2020 DaPorkchop_
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions:
+ *
+ * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
+ * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+package net.daporkchop.pepsimod.util.render.shader;
+
+import com.google.common.base.Joiner;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import lombok.AccessLevel;
+import lombok.Getter;
+import lombok.NonNull;
+import lombok.RequiredArgsConstructor;
+import lombok.experimental.Accessors;
+import org.lwjgl.opengl.GL20;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+
+/**
+ * The different types of shaders.
+ *
+ * @author DaPorkchop_
+ */
+@RequiredArgsConstructor
+@Getter
+public enum ShaderType {
+ VERTEX("vert", GL20.GL_VERTEX_SHADER) {
+ @Override
+ protected Shader construct(@NonNull String name, @NonNull String code, @NonNull JsonObject meta) {
+ return new Shader(name, code, meta) {
+ @Getter
+ protected final Collection provides = new HashSet<>();
+
+ @Override
+ protected ShaderType type() {
+ return VERTEX;
+ }
+
+ @Override
+ protected void load(@NonNull JsonObject meta) {
+ if (!this.provides.isEmpty()) {
+ throw new IllegalStateException("Already initialized!");
+ } else if (!meta.has("provides") || !meta.get("provides").isJsonArray()) {
+ throw new IllegalArgumentException(String.format("Metadata for vertex shader \"%s\" does not define provided variables!", this.name));
+ }
+ for (JsonElement element : meta.getAsJsonArray("provides")) {
+ this.provides.add(element.getAsString());
+ }
+ }
+ };
+ }
+ },
+ FRAGMENT("frag", GL20.GL_FRAGMENT_SHADER) {
+ @Override
+ protected Shader construct(@NonNull String name, @NonNull String code, @NonNull JsonObject meta) {
+ return new Shader(name, code, meta) {
+ @Getter
+ protected final Collection requires = new HashSet<>();
+
+ @Override
+ protected ShaderType type() {
+ return FRAGMENT;
+ }
+
+ @Override
+ protected void load(@NonNull JsonObject meta) {
+ if (!this.requires.isEmpty()) {
+ throw new IllegalStateException("Already initialized!");
+ } else if (!meta.has("requires") || !meta.get("requires").isJsonArray()) {
+ throw new IllegalArgumentException(String.format("Metadata for fragment shader \"%s\" does not define required variables!", this.name));
+ }
+ for (JsonElement element : meta.getAsJsonArray("requires")) {
+ this.requires.add(element.getAsString());
+ }
+ }
+
+ @Override
+ protected void assertCompatible(@NonNull Shader counterpart) throws IllegalArgumentException {
+ super.assertCompatible(counterpart);
+ if (!counterpart.provides().containsAll(this.requires)) {
+ throw new IllegalArgumentException(String.format(
+ "Missing required parameters! Required: [%s], provided: [%s]",
+ Joiner.on(", ").join(this.requires),
+ Joiner.on(", ").join(counterpart.provides())
+ ));
+ }
+ }
+ };
+ }
+ };
+
+ @Getter(AccessLevel.NONE)
+ protected final Map compiledShaders = new HashMap<>();
+ @NonNull
+ protected final String extension;
+ protected final int openGlId;
+
+ protected abstract Shader construct(@NonNull String name, @NonNull String code, @NonNull JsonObject meta);
+}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/render/text/FixedColorTextRenderer.java b/src/main/java/net/daporkchop/pepsimod/util/render/text/FixedColorTextRenderer.java
new file mode 100644
index 0000000..fb91311
--- /dev/null
+++ b/src/main/java/net/daporkchop/pepsimod/util/render/text/FixedColorTextRenderer.java
@@ -0,0 +1,156 @@
+/*
+ * Adapted from The MIT License (MIT)
+ *
+ * Copyright (c) 2016-2020 DaPorkchop_
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions:
+ *
+ * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
+ * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+package net.daporkchop.pepsimod.util.render.text;
+
+import lombok.AccessLevel;
+import lombok.Getter;
+import lombok.NonNull;
+import lombok.RequiredArgsConstructor;
+import lombok.experimental.Accessors;
+import net.daporkchop.pepsimod.util.PepsiConstants;
+import net.minecraft.client.gui.FontRenderer;
+import net.minecraft.client.renderer.GlStateManager;
+
+import java.awt.Color;
+
+import static java.lang.Math.*;
+import static net.minecraft.util.math.MathHelper.clamp;
+
+/**
+ * A {@link TextRenderer} that renders text using a fixed color.
+ *
+ * @author DaPorkchop_
+ */
+@RequiredArgsConstructor
+@Getter
+public final class FixedColorTextRenderer implements TextRenderer, PepsiConstants {
+ protected final float r;
+ protected final float g;
+ protected final float b;
+ protected final float a;
+
+ public FixedColorTextRenderer(@NonNull Color color) {
+ this(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha());
+ }
+
+ public FixedColorTextRenderer(int argb) {
+ this((argb >>> 16) & 0xFF, (argb >>> 8) & 0xFF, argb & 0xFF, (argb >>> 24) & 0xFF);
+ }
+
+ public FixedColorTextRenderer(int r, int g, int b) {
+ this(r / 255.0f, g / 255.0f, b / 255.0f, 1.0f);
+ }
+
+ public FixedColorTextRenderer(int r, int g, int b, int a) {
+ this(r / 255.0f, g / 255.0f, b / 255.0f, a / 255.0f);
+ }
+
+ public FixedColorTextRenderer(float r, float g, float b) {
+ this(r, g, b, 1.0f);
+ }
+
+ @Override
+ public void update() {
+ }
+
+ /**
+ * Sets the gl render color to this renderer's color.
+ */
+ public void setColor() {
+ GlStateManager.color(this.r, this.g, this.b, this.a);
+ }
+
+ @Override
+ public FixedColorTextRenderer render(@NonNull CharSequence text, float x, float y, int startIndex, int length) throws IndexOutOfBoundsException {
+ if (startIndex < 0 || length < 0 || startIndex + length > text.length()) {
+ throw new IndexOutOfBoundsException();
+ }
+ this.setColor();
+ FontRenderer renderer = mc.fontRenderer;
+ renderer.posX = x;
+ renderer.posY = y;
+
+ length += startIndex;
+ for (; startIndex < length; startIndex++) {
+ renderer.posX += renderer.renderChar(text.charAt(startIndex), false);
+ }
+
+ return this;
+ }
+
+ @Override
+ public FixedColorTextRenderer renderPieces(@NonNull CharSequence[] textSegments, float x, float y) {
+ this.setColor();
+ FontRenderer renderer = mc.fontRenderer;
+ renderer.posX = x;
+ renderer.posY = y;
+
+ for (CharSequence text : textSegments) {
+ int length = text.length();
+ for (int i = 0; i < length; i++) {
+ renderer.posX += renderer.renderChar(text.charAt(i), false);
+ }
+ }
+
+ return this;
+ }
+
+ @Override
+ public FixedColorTextRenderer renderLines(@NonNull CharSequence[] lines, float x, float y) {
+ this.setColor();
+ FontRenderer renderer = mc.fontRenderer;
+ renderer.posX = x;
+ renderer.posY = y;
+
+ for (CharSequence text : lines) {
+ int length = text.length();
+ for (int i = 0; i < length; i++) {
+ renderer.posX += renderer.renderChar(text.charAt(i), false);
+ }
+ renderer.posX = x;
+ renderer.posY += 10.0f;
+ }
+
+ return this;
+ }
+
+ @Override
+ public FixedColorTextRenderer renderLinesSmart(@NonNull CharSequence[] lines, float x, float y) {
+ this.setColor();
+ FontRenderer renderer = mc.fontRenderer;
+ renderer.posX = x;
+ renderer.posY = y;
+
+ for (CharSequence text : lines) {
+ if (text != null) {
+ int length = text.length();
+ for (int i = 0; i < length; i++) {
+ renderer.posX += renderer.renderChar(text.charAt(i), false);
+ }
+ } else {
+ renderer.posX = x;
+ renderer.posY += 10.0f;
+ }
+ }
+
+ return this;
+ }
+}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/render/text/RainbowTextRenderer.java b/src/main/java/net/daporkchop/pepsimod/util/render/text/RainbowTextRenderer.java
new file mode 100644
index 0000000..d0b546f
--- /dev/null
+++ b/src/main/java/net/daporkchop/pepsimod/util/render/text/RainbowTextRenderer.java
@@ -0,0 +1,288 @@
+/*
+ * Adapted from The MIT License (MIT)
+ *
+ * Copyright (c) 2016-2020 DaPorkchop_
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions:
+ *
+ * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
+ * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+package net.daporkchop.pepsimod.util.render.text;
+
+import lombok.Getter;
+import lombok.NonNull;
+import lombok.experimental.Accessors;
+import net.daporkchop.pepsimod.util.PepsiConstants;
+import net.daporkchop.pepsimod.util.render.OpenGL;
+import net.daporkchop.pepsimod.util.render.shader.ShaderManager;
+import net.daporkchop.pepsimod.util.render.shader.ShaderProgram;
+import net.minecraft.client.gui.FontRenderer;
+import net.minecraft.client.renderer.GlStateManager;
+
+import static java.lang.Math.cos;
+import static java.lang.Math.sin;
+
+/**
+ * Used for managing rainbow-color text in a simple manner.
+ *
+ * Copy-paste the following to https://thebookofshaders.com/edit.php:
+ *
+ *
+ *
+ * #ifdef GL_ES
+ * precision mediump float;
+ * #endif
+ *
+ * uniform vec2 u_resolution;
+ * uniform vec2 u_mouse;
+ * uniform float u_time;
+ *
+ * const float PI = 3.1415926535;
+ * const float SCALE = 0.03;
+ * const float OFFSET = 0.5;
+ *
+ * const vec3 BASE = vec3(
+ * 0.,
+ * PI * 0.66666666666666,
+ * PI * 1.33333333333333
+ * );
+ *
+ * const float ROT = 45. / 360. * 2. * PI;
+ *
+ * void main() {
+ * float f = (gl_FragCoord.x* sin(ROT) - gl_FragCoord.y * cos(ROT)) * SCALE;
+ *
+ * gl_FragColor = vec4(
+ * OFFSET + sin(BASE + u_time + f),
+ * 1.
+ * );
+ * }
+ *
+ * @author DaPorkchop_
+ */
+public final class RainbowTextRenderer implements TextRenderer, PepsiConstants {
+ protected static final double PI = 3.1415926535897932384626433832795d;
+ protected static final double TWO_PI = 6.2831853071795864769252867665590d;
+ protected static final double BASE_SPEED = 159.15494309d;
+
+ protected ShaderProgram shader;
+
+ //protected final int speedLocation;
+ protected final int scaleLocation;
+ protected final int rotationLocation;
+ protected final int timeLocation;
+
+ @Getter
+ protected int speed;
+ @Getter
+ protected float scale;
+ protected float rotationX;
+ protected float rotationY;
+ protected float time;
+
+ @Getter
+ protected float rotation;
+ protected boolean changed = true;
+
+ public RainbowTextRenderer() {
+ this(0, 0.0f, 0.0f);
+ }
+
+ public RainbowTextRenderer(int speed, float scale, float rotation) {
+ this.shader = ShaderManager.get("rainbow");
+ OpenGL.checkGLError("Constructor");
+
+ //this.speedLocation = this.shader.uniformLocation("speed");
+ //OpenGL.checkGLError("speed");
+ this.scaleLocation = this.shader.uniformLocation("scale");
+ OpenGL.checkGLError("scale");
+ this.rotationLocation = this.shader.uniformLocation("rotation");
+ OpenGL.checkGLError("rotation");
+ this.timeLocation = this.shader.uniformLocation("time");
+ OpenGL.checkGLError("time");
+
+ //TODO: a better system for uniforms
+
+ this.speed(speed)
+ .scale(scale)
+ .rotation(rotation);
+ }
+
+ public void reloadShader() {
+ this.shader = ShaderManager.reload(this.shader);
+ }
+
+ /**
+ * Sets the speed of the rainbow effect.
+ *
+ * @param speed the speed of the effect
+ * @return this instance
+ */
+ public synchronized RainbowTextRenderer speed(int speed) {
+ this.changed = true;
+
+ this.speed = speed;
+ return this;
+ }
+
+ /**
+ * Sets the scale of the rainbow effect.
+ *
+ * @param scale the scale of the effect
+ * @return this instance
+ */
+ public synchronized RainbowTextRenderer scale(float scale) {
+ this.changed = true;
+
+ this.scale = scale;
+ return this;
+ }
+
+ /**
+ * Sets the rotation of the rainbow effect.
+ *
+ * @param rotation the rotation of the effect
+ * @return this instance
+ */
+ public synchronized RainbowTextRenderer rotation(float rotation) {
+ this.changed = true;
+
+ double offsetRadians = Math.toRadians(rotation) + PI;
+ this.rotationX = (float) -sin(offsetRadians);
+ this.rotationY = (float) cos(offsetRadians);
+ this.rotation = rotation;
+ return this;
+ }
+
+ /**
+ * Updates the rainbow cycle according to the current system time.
+ *
+ * This should be called once per frame to update the rainbow pattern's step.
+ */
+ @Override
+ public synchronized void update() {
+ this.time = (float) ((System.currentTimeMillis() % this.speed) * TWO_PI / (double) this.speed);
+ }
+
+ /**
+ * Prepares the shader for rendering by initializing all uniforms.
+ *
+ * The shader must not be bound before this method is invoked.
+ *
+ * @return the shader, to be used in a try-with-resources block
+ */
+ protected ShaderProgram prepare() {
+ ShaderProgram shader = this.shader.use();
+
+ /*OpenGL.glUniform1f(this.speedLocation, this.speed);
+ OpenGL.glUniform1f(this.scaleLocation, this.scale);
+ OpenGL.glUniform2f(this.rotationLocation, this.rotationX, this.rotationY);
+ OpenGL.glUniform1f(this.timeLocation, this.time);*/
+ //OpenGL.glUniform1f(shader.uniformLocation("speed"), this.speed);
+ OpenGL.glUniform1f(shader.uniformLocation("scale"), this.scale);
+ OpenGL.glUniform2f(shader.uniformLocation("rotation"), this.rotationX, this.rotationY);
+ OpenGL.glUniform1f(shader.uniformLocation("time"), this.time);
+ return shader;
+ }
+
+ @Override
+ public RainbowTextRenderer render(@NonNull CharSequence text, float x, float y, int startIndex, int length) throws IndexOutOfBoundsException {
+ if (startIndex < 0 || length < 0 || startIndex + length > text.length()) {
+ throw new IndexOutOfBoundsException();
+ }
+
+ FontRenderer renderer = mc.fontRenderer;
+ renderer.posX = x;
+ renderer.posY = y;
+
+ GlStateManager.color(1.0f, 1.0f, 1.0f, 0.0f);
+ try (ShaderProgram shader = this.prepare()) {
+ length += startIndex;
+ for (; startIndex < length; startIndex++) {
+ renderer.posX += renderer.renderChar(text.charAt(startIndex), false);
+ }
+ }
+
+ return this;
+ }
+
+ @Override
+ public RainbowTextRenderer renderPieces(@NonNull CharSequence[] textSegments, float x, float y) {
+ FontRenderer renderer = mc.fontRenderer;
+ renderer.posX = x;
+ renderer.posY = y;
+
+ GlStateManager.color(1.0f, 1.0f, 1.0f, 0.0f);
+ try (ShaderProgram shader = this.prepare()) {
+ for (CharSequence text : textSegments) {
+ int length = text.length();
+ for (int i = 0; i < length; i++) {
+ renderer.posX += renderer.renderChar(text.charAt(i), false);
+ }
+ }
+ }
+
+ return this;
+ }
+
+ @Override
+ public RainbowTextRenderer renderLines(@NonNull CharSequence[] lines, float x, float y) {
+ FontRenderer renderer = mc.fontRenderer;
+ renderer.posX = x;
+ renderer.posY = y;
+
+ GlStateManager.color(1.0f, 1.0f, 1.0f, 0.0f);
+ try (ShaderProgram shader = this.prepare()) {
+ for (CharSequence text : lines) {
+ int length = text.length();
+ for (int i = 0; i < length; i++) {
+ renderer.posX += renderer.renderChar(text.charAt(i), false);
+ }
+ renderer.posX = x;
+ renderer.posY += 10.0f;
+ }
+ }
+
+ return this;
+ }
+
+ @Override
+ public RainbowTextRenderer renderLinesSmart(@NonNull CharSequence[] lines, float x, float y) {
+ FontRenderer renderer = mc.fontRenderer;
+ renderer.posX = x;
+ renderer.posY = y;
+
+ GlStateManager.color(1.0f, 1.0f, 1.0f, 0.0f);
+ try (ShaderProgram shader = this.prepare()) {
+ for (CharSequence text : lines) {
+ if (text != null) {
+ int length = text.length();
+ for (int i = 0; i < length; i++) {
+ renderer.posX += renderer.renderChar(text.charAt(i), false);
+ }
+ } else {
+ renderer.posX = x;
+ renderer.posY += 10.0f;
+ }
+ }
+ }
+
+ return this;
+ }
+
+ @Override
+ public void close() {
+ this.shader.release();
+ }
+}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/render/text/TextRenderer.java b/src/main/java/net/daporkchop/pepsimod/util/render/text/TextRenderer.java
new file mode 100644
index 0000000..45fc52b
--- /dev/null
+++ b/src/main/java/net/daporkchop/pepsimod/util/render/text/TextRenderer.java
@@ -0,0 +1,207 @@
+/*
+ * Adapted from The MIT License (MIT)
+ *
+ * Copyright (c) 2016-2020 DaPorkchop_
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions:
+ *
+ * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
+ * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+package net.daporkchop.pepsimod.util.render.text;
+
+import lombok.Getter;
+import lombok.NonNull;
+import net.daporkchop.pepsimod.util.capability.Updateable;
+import net.daporkchop.pepsimod.util.config.GlobalConfig;
+
+/**
+ * Exposes the ability to render text on the screen in 2d space.
+ *
+ * @author DaPorkchop_
+ */
+public interface TextRenderer extends Updateable, AutoCloseable {
+ /**
+ * @see #render(CharSequence, float, float, int, int)
+ */
+ default TextRenderer render(int x, int y, @NonNull CharSequence text) {
+ return this.render(text, (float) x, (float) y, 0, text.length());
+ }
+
+ /**
+ * @see #render(CharSequence, float, float, int, int)
+ */
+ default TextRenderer render(int x, int y, int startIndex, int length, @NonNull CharSequence text) {
+ return this.render(text, (float) x, (float) y, startIndex, length);
+ }
+
+ /**
+ * @see #render(CharSequence, float, float, int, int)
+ */
+ default TextRenderer render(float x, float y, @NonNull CharSequence text) {
+ return this.render(text, x, y, 0, text.length());
+ }
+
+ /**
+ * @see #render(CharSequence, float, float, int, int)
+ */
+ default TextRenderer render(float x, float y, int startIndex, int length, @NonNull CharSequence text) {
+ return this.render(text, x, y, startIndex, length);
+ }
+
+ /**
+ * @see #render(CharSequence, float, float, int, int)
+ */
+ default TextRenderer render(@NonNull CharSequence text, int x, int y) {
+ return this.render(text, (float) x, (float) y, 0, text.length());
+ }
+
+ /**
+ * @see #render(CharSequence, float, float, int, int)
+ */
+ default TextRenderer render(@NonNull CharSequence text, int x, int y, int startIndex, int length) {
+ return this.render(text, (float) x, (float) y, startIndex, length);
+ }
+
+ /**
+ * @see #render(CharSequence, float, float, int, int)
+ */
+ default TextRenderer render(@NonNull CharSequence text, float x, float y) {
+ return this.render(text, x, y, 0, text.length());
+ }
+
+ /**
+ * Renders some text at the given coordinates.
+ *
+ * @param text the text to render
+ * @param x the X coordinate to render the text at
+ * @param y the Y coordinate to render the text at
+ * @param startIndex the first index of the text to render
+ * @param length the number of letters in the text to render
+ * @return this {@link RainbowTextRenderer} instance
+ * @throws IndexOutOfBoundsException if the startIndex and/or length aren't within the bounds of the given text
+ */
+ TextRenderer render(@NonNull CharSequence text, float x, float y, int startIndex, int length) throws IndexOutOfBoundsException;
+
+ /**
+ * @see #renderPieces(float, float, CharSequence[])
+ */
+ default TextRenderer renderPieces(float x, float y, @NonNull CharSequence... textSegments) {
+ return this.renderPieces(textSegments, x, y);
+ }
+
+ /**
+ * Renders multiple pieces of text sequentially at the given coordinates.
+ *
+ * This may be used to avoid redundant string concatenation.
+ *
+ * @param textSegments the pieces of text to render
+ * @param x the X coordinate to render the text at
+ * @param y the Y coordinate to render the text at
+ * @return this {@link RainbowTextRenderer} instance
+ */
+ TextRenderer renderPieces(@NonNull CharSequence[] textSegments, float x, float y);
+
+ /**
+ * @see #renderLines(float, float, CharSequence...)
+ */
+ default TextRenderer renderLines(float x, float y, @NonNull CharSequence... lines) {
+ return this.renderLines(lines, x, y);
+ }
+
+ /**
+ * Renders multiple lines of text at the given coordinates.
+ *
+ * @param lines the lines of text to render
+ * @param x the X coordinate to render the text at
+ * @param y the Y coordinate to render the text at
+ * @return this {@link RainbowTextRenderer} instance
+ */
+ TextRenderer renderLines(@NonNull CharSequence[] lines, float x, float y);
+
+ /**
+ * @see #renderLinesSmart(float, float, CharSequence...)
+ */
+ default TextRenderer renderLinesSmart(float x, float y, @NonNull CharSequence... lines) {
+ return this.renderLinesSmart(lines, x, y);
+ }
+
+ /**
+ * Renders multiple lines of text at the given coordinates.
+ *
+ * This is more powerful than {@link #renderLines(CharSequence[], float, float)} because it will only insert a line break when it finds a {@code null}
+ * value instead of text.
+ *
+ * @param lines the lines of text to render
+ * @param x the X coordinate to render the text at
+ * @param y the Y coordinate to render the text at
+ * @return this {@link RainbowTextRenderer} instance
+ */
+ TextRenderer renderLinesSmart(@NonNull CharSequence[] lines, float x, float y);
+
+ /**
+ * Updates this text renderer.
+ *
+ * Must be called once per frame.
+ *
+ * Must be called from the render thread.
+ */
+ @Override
+ void update();
+
+ @Override
+ default void close() {
+ }
+
+ /**
+ * The default text renderer types.
+ *
+ * @author DaPorkchop_
+ */
+ enum Type {
+ NORMAL {
+ @Override
+ public TextRenderer renderer() {
+ return null;
+ }
+
+ @Override
+ public void update() {
+
+ }
+ },
+ RAINBOW {
+ @Getter
+ private final RainbowTextRenderer renderer = new RainbowTextRenderer();
+
+ @Override
+ public void update() {
+ this.renderer.speed(GlobalConfig.Text.Rainbow.speed)
+ .scale(GlobalConfig.Text.Rainbow.scale)
+ .rotation(GlobalConfig.Text.Rainbow.rotation);
+ }
+ };
+
+ /**
+ * Creates a new {@link TextRenderer} instance using the current settings.
+ */
+ public abstract TextRenderer renderer();
+
+ /**
+ * Updates the text renderer.
+ *
+ * Should be fired whenever a config value changed, but otherwise may be safely left alone.
+ */
+ public abstract void update();
+ }
+}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/render/Texture.java b/src/main/java/net/daporkchop/pepsimod/util/render/texture/SimpleTexture.java
similarity index 50%
rename from src/main/java/net/daporkchop/pepsimod/util/render/Texture.java
rename to src/main/java/net/daporkchop/pepsimod/util/render/texture/SimpleTexture.java
index cf7af40..4bc5eef 100644
--- a/src/main/java/net/daporkchop/pepsimod/util/render/Texture.java
+++ b/src/main/java/net/daporkchop/pepsimod/util/render/texture/SimpleTexture.java
@@ -18,8 +18,12 @@
*
*/
-package net.daporkchop.pepsimod.util.render;
+package net.daporkchop.pepsimod.util.render.texture;
+import lombok.AccessLevel;
+import lombok.Getter;
+import lombok.NonNull;
+import lombok.experimental.Accessors;
import net.daporkchop.lib.unsafe.PCleaner;
import net.daporkchop.pepsimod.util.PepsiConstants;
import net.minecraft.client.renderer.BufferBuilder;
@@ -29,90 +33,65 @@
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.util.ResourceLocation;
-import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
import java.util.UUID;
-import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import static org.lwjgl.opengl.GL11.GL_QUADS;
/**
- * Simple texture class, originally loaded a bufferedimage from file and stored a texture id like you would expect, but I decided to take advantage of Minecraft's resource shiz.
- * There's a slight chance that this is skidded from Huzuni.
- * kek
+ * @author DaPorkchop_
*/
-public class Texture extends PepsiConstants implements AutoCloseable {
- protected static DynamicTexture loadTexture(BufferedImage image) {
+@Getter
+public final class SimpleTexture implements PepsiConstants, Texture {
+ @Getter(AccessLevel.NONE)
+ protected final ResourceLocation location;
+ @Getter(AccessLevel.NONE)
+ protected final PCleaner cleaner;
+
+ protected final int width;
+ protected final int height;
+
+ public SimpleTexture(@NonNull BufferedImage img) {
+ DynamicTexture tex;
try {
- return new DynamicTexture(image);
- } catch (RuntimeException e) {
- if ("No OpenGL context found in the current thread.".equalsIgnoreCase(e.getMessage())) {
+ tex = new DynamicTexture(img);
+ } catch (RuntimeException e) {
+ if ("No OpenGL context found in the current thread.".equalsIgnoreCase(e.getMessage())) {
//load async
try {
- return mc.addScheduledTask(() -> new DynamicTexture(image)).get();
- } catch (InterruptedException | ExecutionException e1) {
+ tex = mc.addScheduledTask(() -> new DynamicTexture(img)).get();
+ } catch (InterruptedException | ExecutionException e1) {
throw new RuntimeException(e1);
}
} else {
throw e;
}
}
- }
-
- public final ResourceLocation texture;
- protected final PCleaner cleaner;
-
- public Texture(byte[] in) throws IOException {
- this(new ByteArrayInputStream(in));
- }
-
- public Texture(InputStream in) throws IOException {
- this(ImageIO.read(in));
- }
-
- public Texture(BufferedImage img) {
- this(mc.getTextureManager().getDynamicTextureLocation(UUID.randomUUID().toString(), loadTexture(img)), true);
- }
+ ResourceLocation location = this.location = mc.getTextureManager().getDynamicTextureLocation(UUID.randomUUID().toString(), tex);
+ this.cleaner = PCleaner.cleaner(this, () -> mc.addScheduledTask(() -> mc.getTextureManager().deleteTexture(location)));
- public Texture(ResourceLocation texture) {
- this(texture, false);
+ this.width = img.getWidth();
+ this.height = img.getHeight();
}
- public Texture(ResourceLocation texture, boolean clean) {
- this.texture = texture;
- this.cleaner = clean ? PCleaner.cleaner(this, () -> mc.addScheduledTask(() -> mc.getTextureManager().deleteTexture(texture))) : null;
- }
+ @Override
+ public void draw(int x, int y, int width, int height) {
+ mc.getTextureManager().bindTexture(this.location);
+ GlStateManager.enableTexture2D();
- public void render(float x, float y, float width, float height) {
- this.bindTexture();
Tessellator tessellator = Tessellator.getInstance();
- BufferBuilder renderer = tessellator.getBuffer();
- renderer.begin(GL_QUADS, DefaultVertexFormats.POSITION_TEX);
- renderer.pos(x, y + height, 0F).tex(0, 1).endVertex();
- renderer.pos(x + width, y + height, 0F).tex(1, 1).endVertex();
- renderer.pos(x + width, y, 0F).tex(1, 0).endVertex();
- renderer.pos(x, y, 0F).tex(0, 0).endVertex();
+ BufferBuilder buffer = tessellator.getBuffer();
+ buffer.begin(GL_QUADS, DefaultVertexFormats.POSITION_TEX);
+ buffer.pos(x, y + height, 0.0d).tex(0.0d, 1.0d).endVertex();
+ buffer.pos(x + width, y + height, 0.0d).tex(1.0d, 1.0d).endVertex();
+ buffer.pos(x + width, y, 0.0d).tex(1.0d, 0.0d).endVertex();
+ buffer.pos(x, y, 0.0d).tex(0.0d, 0.0d).endVertex();
tessellator.draw();
}
- public void bindTexture() {
- mc.getTextureManager().bindTexture(this.texture);
- GlStateManager.enableTexture2D();
- }
-
@Override
public void close() {
- if (this.cleaner != null) {
- this.cleaner.clean();
- }
- }
-
- @Override
- public String toString() {
- return this.texture.getPath();
+ this.cleaner.clean();
}
}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/render/texture/Texture.java b/src/main/java/net/daporkchop/pepsimod/util/render/texture/Texture.java
new file mode 100644
index 0000000..ad13176
--- /dev/null
+++ b/src/main/java/net/daporkchop/pepsimod/util/render/texture/Texture.java
@@ -0,0 +1,105 @@
+/*
+ * Adapted from The MIT License (MIT)
+ *
+ * Copyright (c) 2016-2020 DaPorkchop_
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions:
+ *
+ * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
+ * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+package net.daporkchop.pepsimod.util.render.texture;
+
+/**
+ * A simple container around a texture, that provides methods for drawing the texture at specific locations, etc.
+ *
+ * @author DaPorkchop_
+ */
+public interface Texture extends AutoCloseable {
+ /**
+ * A {@link Texture} that does nothing at all, and can serve as a placeholder instead of {@code null}.
+ */
+ Texture NOOP_TEXTURE = new Texture() {
+ @Override
+ public int width() {
+ return 0;
+ }
+
+ @Override
+ public int height() {
+ return 0;
+ }
+
+ @Override
+ public void draw(int x, int y, int width, int height) {
+ }
+
+ @Override
+ public void close() {
+ }
+ };
+
+ /**
+ * @return this texture's width (in pixels)
+ */
+ int width();
+
+ /**
+ * @return this texture's height (in pixels)
+ */
+ int height();
+
+ /**
+ * Draws this texture in 2d pixel space at the given position with the given width.
+ *
+ * The height will be scaled according to the width.
+ *
+ * @param x the X coordinate (of the left edge)
+ * @param y the Y coordinate (of the top edge)
+ * @param width the width of the image
+ */
+ default void draw(int x, int y, int width) {
+ this.draw(x, y, width, (int) (this.height() * ((float) width / this.width())));
+ }
+
+ /**
+ * Draws this texture in 2d pixel space at the given position and scale.
+ *
+ * @param x the X coordinate (of the left edge)
+ * @param y the Y coordinate (of the top edge)
+ * @param scale the scale factor for the image
+ */
+ default void draw(int x, int y, float scale) {
+ this.draw(x, y, (int) (this.width() * scale), (int) (this.height() * scale));
+ }
+
+ /**
+ * Draws this texture in 2d pixel space at the given position with the given dimensions.
+ *
+ * @param x the X coordinate (of the left edge)
+ * @param y the Y coordinate (of the top edge)
+ * @param width the width of the image
+ * @param height the height of the image
+ */
+ void draw(int x, int y, int width, int height);
+
+ /**
+ * Releases this texture, freeing up any VRAM resources used by it.
+ *
+ * This method will be implicitly invoked when the object is garbage-collected, however this provides a way of forcing it.
+ *
+ * A texture instance is no longer safe to use after invoking this method, and calling any methods will produce undefined behavior.
+ */
+ @Override
+ void close();
+}
diff --git a/src/main/java/net/daporkchop/pepsimod/misc/data/Groups.java b/src/main/java/net/daporkchop/pepsimod/util/resources/Lang.java
similarity index 54%
rename from src/main/java/net/daporkchop/pepsimod/misc/data/Groups.java
rename to src/main/java/net/daporkchop/pepsimod/util/resources/Lang.java
index e56fb20..c997412 100644
--- a/src/main/java/net/daporkchop/pepsimod/misc/data/Groups.java
+++ b/src/main/java/net/daporkchop/pepsimod/util/resources/Lang.java
@@ -18,44 +18,46 @@
*
*/
-package net.daporkchop.pepsimod.misc.data;
+package net.daporkchop.pepsimod.util.resources;
-import net.daporkchop.pepsimod.util.PepsiConstants;
+import com.google.gson.JsonObject;
+import lombok.Getter;
+import lombok.NonNull;
+import lombok.experimental.Accessors;
-import java.util.Collection;
+import java.io.IOException;
import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
import java.util.Map;
-import java.util.UUID;
+import java.util.stream.Collectors;
/**
+ * Locale data because why should I do things the correct way?
+ *
* @author DaPorkchop_
*/
-public class Groups extends PepsiConstants implements AutoCloseable {
- protected Map playerToGroup = Collections.emptyMap();
- protected Collection groups = Collections.emptyList();
-
- public void addGroup(Group group) {
- if (this.groups.isEmpty()) {
- this.groups = new HashSet<>();
- }
- this.groups.add(group);
- group.members.forEach(uuid -> this.addPlayerMapping(uuid, group));
- }
+@Getter
+public final class Lang implements Resource {
+ protected Map translations = Collections.emptyMap();
- public void addPlayerMapping(UUID uuid, Group group) {
- if (this.playerToGroup.isEmpty()) {
- this.playerToGroup = new HashMap<>();
+ @Override
+ public synchronized void load(@NonNull Resources resources, JsonObject obj) throws IOException {
+ if (obj == null) {
+ this.translations = Collections.emptyMap();
+ } else {
+ this.translations = obj.getAsJsonObject("translations").entrySet().stream()
+ .collect(Collectors.toMap(
+ Map.Entry::getKey,
+ entry -> entry.getValue().getAsString()
+ ));
}
- this.playerToGroup.put(uuid, group);
}
- @Override
- public void close() {
- this.groups.forEach(Group::close);
-
- this.playerToGroup.clear();
- this.groups.clear();
+ /**
+ * Injects all pepsimod locale keys into the locale manager.
+ *
+ * @param locale the map containing the locale data
+ */
+ public synchronized void inject(@NonNull Map locale) {
+ locale.putAll(this.translations);
}
}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/resources/MainMenu.java b/src/main/java/net/daporkchop/pepsimod/util/resources/MainMenu.java
new file mode 100644
index 0000000..9a17fc0
--- /dev/null
+++ b/src/main/java/net/daporkchop/pepsimod/util/resources/MainMenu.java
@@ -0,0 +1,71 @@
+/*
+ * Adapted from The MIT License (MIT)
+ *
+ * Copyright (c) 2016-2020 DaPorkchop_
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions:
+ *
+ * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
+ * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+package net.daporkchop.pepsimod.util.resources;
+
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import lombok.Getter;
+import lombok.NonNull;
+import lombok.experimental.Accessors;
+import net.daporkchop.pepsimod.util.render.texture.SimpleTexture;
+import net.daporkchop.pepsimod.util.render.texture.Texture;
+
+import java.io.IOException;
+import java.util.concurrent.ThreadLocalRandom;
+import java.util.stream.StreamSupport;
+
+/**
+ * Contains the resources used for customizing the main menu:
+ * - splash texts
+ * - banner
+ *
+ * @author DaPorkchop_
+ */
+@Getter
+public final class MainMenu implements Resource {
+ protected static final String[] DEFAULT_SPLASHES = {""};
+
+ protected String[] splashes = DEFAULT_SPLASHES;
+ protected Texture banner = Texture.NOOP_TEXTURE;
+
+ @Override
+ public void load(@NonNull Resources resources, JsonObject obj) throws IOException {
+ if (obj == null) {
+ this.splashes = DEFAULT_SPLASHES;
+ this.banner = Texture.NOOP_TEXTURE;
+ } else {
+ this.splashes = StreamSupport.stream(obj.getAsJsonArray("splashes").spliterator(), false)
+ .filter(JsonElement::isJsonPrimitive)
+ .map(JsonElement::getAsString)
+ .toArray(String[]::new);
+ this.banner = new SimpleTexture(resources.getImage(obj.get("banner").getAsString()));
+ }
+ }
+
+ /**
+ * Gets a random splash text from the list of splash texts.
+ *
+ * @return a random splash text
+ */
+ public String randomSplash() {
+ return this.splashes[ThreadLocalRandom.current().nextInt(this.splashes.length)];
+ }
+}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/config/BaseImplTranslator.java b/src/main/java/net/daporkchop/pepsimod/util/resources/Resource.java
similarity index 69%
rename from src/main/java/net/daporkchop/pepsimod/util/config/BaseImplTranslator.java
rename to src/main/java/net/daporkchop/pepsimod/util/resources/Resource.java
index 6b0f3dd..85f6259 100644
--- a/src/main/java/net/daporkchop/pepsimod/util/config/BaseImplTranslator.java
+++ b/src/main/java/net/daporkchop/pepsimod/util/resources/Resource.java
@@ -18,26 +18,25 @@
*
*/
-package net.daporkchop.pepsimod.util.config;
+package net.daporkchop.pepsimod.util.resources;
import com.google.gson.JsonObject;
+import lombok.NonNull;
-public class BaseImplTranslator implements IConfigTranslator {
- public static final BaseImplTranslator INSTANCE = new BaseImplTranslator();
+import java.io.IOException;
- private BaseImplTranslator() {
-
- }
-
- public void encode(JsonObject json) {
-
- }
-
- public void decode(String fieldName, JsonObject json) {
-
- }
-
- public String name() {
- return "delet_this";
- }
+/**
+ * A resource that is loaded at runtime over the network.
+ *
+ * @author DaPorkchop_
+ */
+interface Resource {
+ /**
+ * (Re)loads this resource from the network.
+ *
+ * @param resources the {@link Resources} instance that this is contained by
+ * @param obj the {@link JsonObject} containing this resource's metadata
+ * @throws IOException if an IO exception occurs you dummy
+ */
+ void load(@NonNull Resources resources, JsonObject obj) throws IOException;
}
diff --git a/src/main/java/net/daporkchop/pepsimod/util/resources/Resources.java b/src/main/java/net/daporkchop/pepsimod/util/resources/Resources.java
new file mode 100644
index 0000000..46f4c12
--- /dev/null
+++ b/src/main/java/net/daporkchop/pepsimod/util/resources/Resources.java
@@ -0,0 +1,160 @@
+/*
+ * Adapted from The MIT License (MIT)
+ *
+ * Copyright (c) 2016-2020 DaPorkchop_
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions:
+ *
+ * Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
+ * provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+package net.daporkchop.pepsimod.util.resources;
+
+import com.google.gson.JsonObject;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+import lombok.AccessLevel;
+import lombok.Getter;
+import lombok.NonNull;
+import net.daporkchop.lib.common.misc.file.PFiles;
+import net.daporkchop.pepsimod.Pepsimod.SystemConfig;
+import net.daporkchop.pepsimod.asm.PepsimodMixinLoader;
+import net.daporkchop.pepsimod.util.PepsiConstants;
+
+import javax.imageio.ImageIO;
+import java.awt.image.BufferedImage;
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.net.URL;
+
+/**
+ * Loads pepsimod's resources (such as groups, capes and splash texts).
+ *
+ * @author DaPorkchop_
+ */
+@Getter
+public final class Resources implements PepsiConstants {
+ protected final File cacheDir = PFiles.ensureDirectoryExists(new File(mc.gameDir, "pepsimod/resources/"));
+
+ protected final Lang lang = new Lang();
+ protected final MainMenu mainMenu = new MainMenu();
+
+ @Getter(AccessLevel.NONE)
+ protected final boolean enabled = SystemConfig.resources.enable;
+ @Getter(AccessLevel.NONE)
+ protected String baseUrl;
+
+ /**
+ * Attempts to (re)load all resources, printing a warning to the log in case of failure.
+ */
+ public void tryLoad() {
+ try {
+ this.load();
+ } catch (IOException e) {
+ log.warn("Unable to reload resources!");
+ }
+ }
+
+ /**
+ * (Re)loads all resources.
+ *
+ * @throws IOException if an IO exception occurs you dummy
+ */
+ public void load() throws IOException {
+ if (!this.enabled) {
+ return;
+ }
+ this.baseUrl = "";
+ JsonObject root = this.getJson(PepsimodMixinLoader.OBFUSCATED ? SystemConfig.resources.baseUrl : "resources.json");
+ if (root != null) {
+ this.baseUrl = root.get("baseurl").getAsString();
+ JsonObject data = root.getAsJsonObject("data");
+
+ this.lang.load(this, this.getJson(data.get("lang").getAsString()));
+ this.mainMenu.load(this, this.getJson(data.get("mainmenu").getAsString()));
+ }
+ }
+
+ JsonObject getJson(@NonNull String url) throws IOException {
+ byte[] b = this.getBytes(url);
+ return b == null ? null : JSON_PARSER.parse(new InputStreamReader(new ByteArrayInputStream(b))).getAsJsonObject();
+ }
+
+ BufferedImage getImage(@NonNull String url) throws IOException {
+ byte[] b = this.getBytes(url);
+ return b == null ? null : ImageIO.read(new ByteArrayInputStream(b));
+ }
+
+ byte[] getBytes(@NonNull String url) throws IOException {
+ if (PepsimodMixinLoader.OBFUSCATED) {
+ ByteBuf buf = PooledByteBufAllocator.DEFAULT.ioBuffer();
+ try {
+ File cacheFile = this.baseUrl.isEmpty() ? null : new File(this.cacheDir, url);
+
+ try (InputStream in = new URL(this.baseUrl + url).openStream()) {
+ while (buf.writeBytes(in, (2 << 20) - buf.readableBytes()) >= 0) {
+ ;
+ }
+ } catch (IOException e) {
+ //try to load from cache
+ if (cacheFile != null && cacheFile.exists() && cacheFile.isFile()) {
+ byte[] b = new byte[(int) cacheFile.length()];
+ try (InputStream in = new FileInputStream(cacheFile)) {
+ if (in.read(b) != b.length) {
+ log.warn("Couldn't read entire file from disk!");
+ b = null;
+ }
+ }
+ return b;
+ } else {
+ return null; //couldn't load from cache
+ }
+ }
+
+ byte[] b = new byte[buf.readableBytes()];
+ buf.readBytes(b);
+
+ //check if we should store in cache
+ if (cacheFile != null) {
+ try (OutputStream out = new FileOutputStream(PFiles.ensureFileExists(cacheFile))) {
+ out.write(b);
+ }
+ }
+
+ return b;
+ } finally {
+ buf.release();
+ }
+ } else {
+ //in a dev environment, we just want to read straight from the resources dir
+ File file = new File(mc.gameDir, "../resources/" + url);
+ byte[] b = null;
+ if (file.exists() && file.isFile()) {
+ b = new byte[(int) file.length()];
+ try (InputStream in = new FileInputStream(file)) {
+ if (in.read(b) != b.length) {
+ log.warn("Couldn't read entire file from disk!");
+ b = null;
+ }
+ }
+ }
+ return b;
+ }
+ }
+}
diff --git a/src/main/resources/assets/pepsimod/shaders/frag/rainbow.frag b/src/main/resources/assets/pepsimod/shaders/frag/rainbow.frag
new file mode 100644
index 0000000..f4c9fdd
--- /dev/null
+++ b/src/main/resources/assets/pepsimod/shaders/frag/rainbow.frag
@@ -0,0 +1,22 @@
+#version 120
+
+const float OFFSET = 0.5;
+const float PI = 3.1415926535897932384626433832795;
+const float TWO_PI = 6.2831853071795864769252867665590;
+const vec3 BASE = PI * vec3(0., 0.66666666666666, 1.33333333333333);
+
+//uniform float speed;
+uniform float scale;
+uniform vec2 rotation;
+uniform float time; //pre-multiplied by TWO_PI
+
+uniform sampler2D texSampler;
+
+void main() {
+ if (gl_Color.a == 0.0) {
+ float pos = (gl_FragCoord.x * rotation.x + gl_FragCoord.y * rotation.y) * scale;
+ gl_FragColor = vec4(OFFSET + sin(BASE + pos + time), 1.) * texture2D(texSampler, gl_TexCoord[0].xy);
+ } else {
+ gl_FragColor = gl_Color * texture2D(texSampler, gl_TexCoord[0].xy);
+ }
+}
diff --git a/src/main/resources/assets/pepsimod/shaders/frag/rainbow.frag.json b/src/main/resources/assets/pepsimod/shaders/frag/rainbow.frag.json
new file mode 100644
index 0000000..f39d335
--- /dev/null
+++ b/src/main/resources/assets/pepsimod/shaders/frag/rainbow.frag.json
@@ -0,0 +1,23 @@
+{
+ "uniforms": [
+ {
+ "name": "speed",
+ "type": "float"
+ },
+ {
+ "name": "scale",
+ "type": "float"
+ },
+ {
+ "name": "rotation",
+ "type": "vec2"
+ },
+ {
+ "name": "time",
+ "type": "float"
+ }
+ ],
+ "requires": [
+ "gl_TexCoord"
+ ]
+}
diff --git a/src/main/resources/assets/pepsimod/shaders/prog/rainbow.json b/src/main/resources/assets/pepsimod/shaders/prog/rainbow.json
new file mode 100644
index 0000000..84f9776
--- /dev/null
+++ b/src/main/resources/assets/pepsimod/shaders/prog/rainbow.json
@@ -0,0 +1,4 @@
+{
+ "vert": "dummy",
+ "frag": "rainbow"
+}
diff --git a/src/main/resources/assets/pepsimod/shaders/vert/dummy.vert b/src/main/resources/assets/pepsimod/shaders/vert/dummy.vert
new file mode 100644
index 0000000..58d0524
--- /dev/null
+++ b/src/main/resources/assets/pepsimod/shaders/vert/dummy.vert
@@ -0,0 +1,8 @@
+#version 120
+
+void main(){
+ gl_TexCoord[0] = gl_MultiTexCoord0;
+ gl_Position = ftransform();
+ gl_FrontColor = gl_Color;
+ gl_BackColor = gl_Color;
+}
diff --git a/src/main/resources/assets/pepsimod/shaders/vert/dummy.vert.json b/src/main/resources/assets/pepsimod/shaders/vert/dummy.vert.json
new file mode 100644
index 0000000..0ab6b77
--- /dev/null
+++ b/src/main/resources/assets/pepsimod/shaders/vert/dummy.vert.json
@@ -0,0 +1,7 @@
+{
+ "uniforms": [
+ ],
+ "provides": [
+ "gl_TexCoord"
+ ]
+}
diff --git a/src/main/resources/assets/pepsimod/textures/gui/pepsibuttons.png b/src/main/resources/assets/pepsimod/textures/gui/pepsibuttons.png
index fb2b23f..9e834bb 100644
Binary files a/src/main/resources/assets/pepsimod/textures/gui/pepsibuttons.png and b/src/main/resources/assets/pepsimod/textures/gui/pepsibuttons.png differ
diff --git a/src/main/resources/assets/pepsimod/textures/gui/widgets.png b/src/main/resources/assets/pepsimod/textures/gui/widgets.png
new file mode 100644
index 0000000..e3c152c
Binary files /dev/null and b/src/main/resources/assets/pepsimod/textures/gui/widgets.png differ
diff --git a/src/main/resources/assets/pepsimod/textures/icon/pepsilogo-128.png b/src/main/resources/assets/pepsimod/textures/icon/pepsilogo-128.png
new file mode 100644
index 0000000..9e67f48
Binary files /dev/null and b/src/main/resources/assets/pepsimod/textures/icon/pepsilogo-128.png differ
diff --git a/src/main/resources/assets/pepsimod/textures/icon/pepsilogo-16.png b/src/main/resources/assets/pepsimod/textures/icon/pepsilogo-16.png
new file mode 100644
index 0000000..51ede9b
Binary files /dev/null and b/src/main/resources/assets/pepsimod/textures/icon/pepsilogo-16.png differ
diff --git a/src/main/resources/assets/pepsimod/textures/icon/pepsilogo-256.png b/src/main/resources/assets/pepsimod/textures/icon/pepsilogo-256.png
new file mode 100644
index 0000000..45ab896
Binary files /dev/null and b/src/main/resources/assets/pepsimod/textures/icon/pepsilogo-256.png differ
diff --git a/src/main/resources/assets/pepsimod/textures/icon/pepsilogo-32.png b/src/main/resources/assets/pepsimod/textures/icon/pepsilogo-32.png
new file mode 100644
index 0000000..1b34a86
Binary files /dev/null and b/src/main/resources/assets/pepsimod/textures/icon/pepsilogo-32.png differ
diff --git a/src/main/resources/assets/pepsimod/textures/icon/pepsilogo-64.png b/src/main/resources/assets/pepsimod/textures/icon/pepsilogo-64.png
new file mode 100644
index 0000000..a4b960b
Binary files /dev/null and b/src/main/resources/assets/pepsimod/textures/icon/pepsilogo-64.png differ
diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info
index ac85bc9..e660b97 100644
--- a/src/main/resources/mcmod.info
+++ b/src/main/resources/mcmod.info
@@ -2,7 +2,7 @@
{
"modid": "pepsimod",
"name": "pepsimod",
- "description": "A hacked client for Forge\nMade by DaPorkchop_, for Team Pepsi",
+ "description": "A utility mod for Forge.\nMade by DaPorkchop_ for Team Pepsi.\nSince nobody except me uses this, I could basically say \"Made by DaPorkchop_ for himself\".",
"version": "${version}",
"mcversion": "${mcversion}",
"url": "https://github.com/Team-Pepsi/pepsimod",
@@ -11,7 +11,7 @@
"DaPorkchop_"
],
"credits": "Pepsi, for being amazing",
- "logoFile": "assets/pepsimod/textures/gui/pepsimod.png",
+ "logoFile": "",
"screenshots": [],
"dependencies": []
}
diff --git a/src/main/resources/mixin/pepsimod/mixins.core.json b/src/main/resources/mixin/pepsimod/mixins.core.json
new file mode 100644
index 0000000..e1cf421
--- /dev/null
+++ b/src/main/resources/mixin/pepsimod/mixins.core.json
@@ -0,0 +1,14 @@
+{
+ "required": true,
+ "compatibilityLevel": "JAVA_8",
+ "package": "net.daporkchop.pepsimod.asm.core",
+ "refmap": "mixins.pepsimod.refmap.json",
+ "client": [
+ "minecraft.client.gui.MixinGuiBossOverlay",
+ "minecraft.client.gui.MixinGuiMainMenu",
+ "minecraft.client.gui.MixinScaledResolution",
+ "minecraft.client.renderer.MixinOpenGlHelper",
+ "minecraft.client.resources.MixinLocale",
+ "minecraft.client.MixinMinecraft"
+ ]
+}
diff --git a/src/main/resources/mixin/pepsimod/mixins.event.json b/src/main/resources/mixin/pepsimod/mixins.event.json
new file mode 100644
index 0000000..340e4b9
--- /dev/null
+++ b/src/main/resources/mixin/pepsimod/mixins.event.json
@@ -0,0 +1,10 @@
+{
+ "required": true,
+ "compatibilityLevel": "JAVA_8",
+ "package": "net.daporkchop.pepsimod.asm.event",
+ "refmap": "mixins.pepsimod.refmap.json",
+ "client": [
+ "forge.client.MixinGuiIngameForge",
+ "minecraft.client.MixinMinecraft"
+ ]
+}
diff --git a/src/main/resources/mixin/pepsimod/mixins.feature.json b/src/main/resources/mixin/pepsimod/mixins.feature.json
new file mode 100644
index 0000000..8058165
--- /dev/null
+++ b/src/main/resources/mixin/pepsimod/mixins.feature.json
@@ -0,0 +1,8 @@
+{
+ "required": true,
+ "compatibilityLevel": "JAVA_8",
+ "package": "net.daporkchop.pepsimod.asm.feature",
+ "refmap": "mixins.pepsimod.refmap.json",
+ "client": [
+ ]
+}
diff --git a/src/main/resources/mixin/pepsimod/mixins.optimization.json b/src/main/resources/mixin/pepsimod/mixins.optimization.json
new file mode 100644
index 0000000..6a72e27
--- /dev/null
+++ b/src/main/resources/mixin/pepsimod/mixins.optimization.json
@@ -0,0 +1,10 @@
+{
+ "required": false,
+ "compatibilityLevel": "JAVA_8",
+ "package": "net.daporkchop.pepsimod.asm.optimization",
+ "refmap": "mixins.pepsimod.refmap.json",
+ "client": [
+ "forge.client.MixinGuiIngameForge",
+ "minecraft.client.MixinMinecraft"
+ ]
+}
diff --git a/src/main/resources/mixins.pepsimod.json b/src/main/resources/mixins.pepsimod.json
deleted file mode 100644
index 6d85967..0000000
--- a/src/main/resources/mixins.pepsimod.json
+++ /dev/null
@@ -1,51 +0,0 @@
-{
- "required": true,
- "compatibilityLevel": "JAVA_8",
- "package": "net.daporkchop.pepsimod.mixin",
- "refmap": "mixins.pepsimod.refmap.json",
- "mixins": [
- "client.gui.MixinGuiMainMenu",
- "client.network.MixinNetHandlerLoginClient",
- "client.gui.MixinGuiMultiplayer",
- "network.play.client.MixinCPacketPlayer",
- "client.gui.MixinGuiChat",
- "client.MixinMinecraft",
- "client.gui.MixinGuiBossOverlay",
- "network.MixinNetworkManager",
- "util.MixinTabCompleter",
- "entity.MixinEntity",
- "util.MixinTimer",
- "block.MixinBlock",
- "client.renderer.MixinBlockFluidRenderer",
- "client.renderer.MixinBlockModelRenderer",
- "client.renderer.chunk.MixinVisGraph",
- "block.MixinBlockLiquid",
- "entity.MixinEntityLivingBase",
- "client.renderer.MixinEntityRenderer",
- "block.MixinBlockSlab",
- "client.multiplayer.MixinWorldClient",
- "client.entity.MixinAbstractClientPlayer",
- "client.renderer.entity.MixinRender",
- "client.gui.MixinGuiIngame",
- "client.renderer.MixinItemRenderer",
- "world.MixinWorld",
- "client.network.MixinNetHandlerPlayClient",
- "client.settings.MixinGameSettings",
- "client.gui.MixinGuiDisconnected",
- "client.gui.MixinGuiIngameMenu",
- "item.MixinItemStack",
- "scoreboard.MixinScoreboard",
- "block.MixinBlockSoulSand",
- "client.entity.MixinEntityPlayerSP",
- "util.MixinMovementInputFromOptions",
- "entity.passive.MixinEntityPig",
- "entity.passive.MixinAbstractHorse",
- "client.gui.MixinGuiConnecting",
- "client.resources.MixinLocale",
- "world.storage.MixinWorldInfo",
- "client.settings.MixinKeyBinding",
- "entity.MixinEntityAgeable",
- "util.text.translation.MixinLanguageMap",
- "client.gui.MixinGuiPlayerTabOverlay"
- ]
-}
\ No newline at end of file
diff --git a/src/main/resources/pepsilogo.png b/src/main/resources/pepsilogo.png
deleted file mode 100644
index 7843905..0000000
Binary files a/src/main/resources/pepsilogo.png and /dev/null differ
diff --git a/src/main/resources/pepsimod_at.cfg b/src/main/resources/pepsimod_at.cfg
new file mode 100644
index 0000000..2baea39
--- /dev/null
+++ b/src/main/resources/pepsimod_at.cfg
@@ -0,0 +1,4 @@
+# FontRenderer
+public net.minecraft.client.gui.FontRenderer field_78295_j # posX
+public net.minecraft.client.gui.FontRenderer field_78296_k # posY
+public net.minecraft.client.gui.FontRenderer func_181559_a(CZ)F # renderChar
diff --git a/update.json b/update.json
new file mode 100644
index 0000000..97c2ddc
--- /dev/null
+++ b/update.json
@@ -0,0 +1,11 @@
+{
+ "homepage": "https://github.com/Team-Pepsi/pepsimod",
+ "promos": {
+ "1.12.2-latest": "12.0-1.12.2",
+ "1.12.2-recommended": "11.1-1.12.2"
+ },
+ "1.12.2": {
+ "12.0-1.12.2": "Delete the whole and rewrite!",
+ "11.1-1.12.2": "Fix up a lot of things"
+ }
+}