From 01e92cf9426d5401ef9b41e19d2880fd3f90a9da Mon Sep 17 00:00:00 2001 From: Ossian Winter Date: Sun, 2 Oct 2022 15:20:19 +0200 Subject: [PATCH] Clean up imports and entry order --- .../rigamortis/seppuku/api/camera/Camera.java | 34 +- .../seppuku/api/event/world/EventChunk.java | 4 +- .../gui/hud/component/BlocksComponent.java | 4 +- .../gui/hud/component/CarouselComponent.java | 3 +- .../api/gui/hud/component/ColorComponent.java | 7 +- .../hud/component/DraggableHudComponent.java | 16 +- .../api/gui/hud/component/HudComponent.java | 11 +- .../api/gui/hud/component/ItemsComponent.java | 4 +- .../hud/component/ResizableHudComponent.java | 6 +- .../gui/hud/component/SliderComponent.java | 13 +- .../api/gui/hud/component/TextComponent.java | 27 +- .../api/gui/hud/particle/Particle.java | 4 +- .../seppuku/api/gui/menu/GuiAddAlt.java | 2 +- .../seppuku/api/gui/menu/GuiEntryAlt.java | 4 +- .../seppuku/api/gui/menu/GuiListAlt.java | 8 +- .../api/gui/menu/GuiPasswordField.java | 46 +- .../rigamortis/seppuku/api/module/Module.java | 10 +- .../seppuku/api/module/notebot/Note.java | 32 +- .../api/notification/Notification.java | 15 +- .../api/task/basic/BasicTaskFactory.java | 4 +- .../api/task/hand/HandSwapContext.java | 8 +- .../seppuku/api/util/EntityUtil.java | 2 +- .../seppuku/api/util/GLUProjection.java | 511 +++++++++-------- .../api/util/shader/ShaderProgram.java | 39 +- .../seppuku/api/util/shader/UniformUtil.java | 531 +++++++++--------- .../rigamortis/seppuku/api/value/Regex.java | 8 +- .../rigamortis/seppuku/api/value/Shader.java | 8 +- .../rigamortis/seppuku/api/value/Value.java | 2 +- .../impl/command/CalcStrongholdCommand.java | 4 +- .../seppuku/impl/command/EnchantCommand.java | 4 +- .../impl/command/LocateFeatureCommand.java | 4 +- .../impl/gui/hud/anchor/AnchorPoint.java | 8 +- .../hud/component/BattleInfoComponent.java | 3 +- .../gui/hud/component/ColorsComponent.java | 15 +- .../hud/component/EntityListComponent.java | 4 +- .../impl/gui/hud/component/HubComponent.java | 7 +- .../impl/gui/hud/component/TrayComponent.java | 6 +- .../component/graph/FpsGraphComponent.java | 5 +- .../component/module/ModuleListComponent.java | 19 +- .../seppuku/impl/gui/menu/GuiAltManager.java | 2 +- .../seppuku/impl/management/CapeManager.java | 4 +- .../seppuku/impl/management/ChatManager.java | 4 +- .../impl/management/ConfigManager.java | 5 +- .../seppuku/impl/management/HudManager.java | 3 +- .../impl/management/ModuleManager.java | 8 +- .../impl/management/NotificationManager.java | 4 +- .../impl/management/ShaderManager.java | 4 +- .../impl/management/TickRateManager.java | 2 +- .../impl/module/combat/AutoTrapModule.java | 6 +- .../impl/module/combat/BurrowModule.java | 12 +- .../impl/module/combat/ChestFarmerModule.java | 4 +- .../impl/module/combat/CrystalAuraModule.java | 57 +- .../impl/module/combat/KillAuraModule.java | 6 +- .../impl/module/combat/NoCrystalModule.java | 5 +- .../module/combat/TotemNotifierModule.java | 3 +- .../impl/module/hidden/ArrayListModule.java | 2 +- .../impl/module/hidden/IgnoreModule.java | 2 +- .../impl/module/misc/AutoIgnoreModule.java | 8 +- .../impl/module/misc/AutoSignModule.java | 5 +- .../module/misc/ChatTimeStampsModule.java | 8 +- .../impl/module/misc/CoordLoggerModule.java | 10 +- .../impl/module/misc/DonkeyAlertModule.java | 8 +- .../impl/module/misc/FakePlayerModule.java | 3 +- .../impl/module/misc/GreeterModule.java | 8 +- .../impl/module/misc/LaggerModule.java | 10 +- .../impl/module/misc/NoBiomeColorModule.java | 11 +- .../impl/module/misc/PacketLoggerModule.java | 5 +- .../impl/module/misc/ReconnectModule.java | 5 +- .../impl/module/misc/StorageAlertModule.java | 8 +- .../impl/module/misc/VisualRangeModule.java | 9 +- .../impl/module/movement/ElytraFlyModule.java | 12 +- .../impl/module/movement/FlightModule.java | 14 +- .../impl/module/movement/GuiMoveModule.java | 9 +- .../impl/module/movement/JesusModule.java | 121 ++-- .../impl/module/movement/ScaffoldModule.java | 4 +- .../impl/module/movement/SneakModule.java | 8 +- .../impl/module/movement/SpeedModule.java | 11 +- .../impl/module/movement/SprintModule.java | 8 +- .../impl/module/movement/StepModule.java | 12 +- .../impl/module/player/AutoEatModule.java | 5 +- .../impl/module/player/BlinkModule.java | 2 +- .../impl/module/player/FreeCamModule.java | 9 +- .../impl/module/player/GodModeModule.java | 10 +- .../impl/module/player/InteractModule.java | 4 +- .../impl/module/player/ItemSpoofModule.java | 5 +- .../impl/module/player/NoHungerModule.java | 6 +- .../module/render/BlockHighlightModule.java | 8 +- .../impl/module/render/BrightnessModule.java | 10 +- .../impl/module/render/ChamsModule.java | 72 ++- .../impl/module/render/HolesModule.java | 5 +- .../impl/module/render/NewChunksModule.java | 12 +- .../impl/module/render/NoLagModule.java | 1 - .../module/render/PortalFinderModule.java | 13 +- .../impl/module/render/ProjectilesModule.java | 5 +- .../impl/module/render/SearchModule.java | 10 +- .../module/render/ShulkerPreviewModule.java | 2 +- .../impl/module/render/StorageESPModule.java | 18 +- .../impl/module/render/TracersModule.java | 16 +- .../impl/module/render/WallHackModule.java | 41 +- .../impl/module/world/AmbianceModule.java | 11 +- .../impl/module/world/AutoFarmModule.java | 4 +- .../impl/module/world/AutoToolModule.java | 4 +- .../impl/module/world/AutoWitherModule.java | 5 +- .../impl/module/world/BridgeModule.java | 2 +- .../impl/module/world/NoteBotModule.java | 24 +- .../impl/module/world/NukerModule.java | 12 +- .../impl/module/world/PhaseModule.java | 9 +- .../impl/module/world/SlimeChunksModule.java | 4 +- .../impl/module/world/SpeedMineModule.java | 21 +- .../impl/module/world/WaypointsModule.java | 11 +- .../impl/patch/AbstractHorsePatch.java | 58 +- .../impl/patch/ActiveRenderInfoPatch.java | 12 +- .../seppuku/impl/patch/BlockFencePatch.java | 16 +- .../seppuku/impl/patch/BlockLiquidPatch.java | 106 ++-- .../seppuku/impl/patch/BlockPanePatch.java | 16 +- .../seppuku/impl/patch/BlockPatch.java | 31 +- .../patch/BlockRendererDispatcherPatch.java | 12 +- .../seppuku/impl/patch/BlockSlimePatch.java | 52 +- .../impl/patch/BlockSoulSandPatch.java | 26 +- .../seppuku/impl/patch/BlockStairsPatch.java | 16 +- .../seppuku/impl/patch/ChunkPatch.java | 12 +- .../seppuku/impl/patch/EntityLlamaPatch.java | 28 +- .../seppuku/impl/patch/EntityPigPatch.java | 44 +- .../seppuku/impl/patch/EntityPlayerPatch.java | 54 +- .../impl/patch/EntityPlayerSPPatch.java | 256 ++++----- .../impl/patch/EntityRendererPatch.java | 372 ++++++------ .../impl/patch/GuiBossOverlayPatch.java | 14 +- .../seppuku/impl/patch/GuiChatPatch.java | 12 +- .../impl/patch/GuiIngameForgePatch.java | 106 ++-- .../impl/patch/GuiPlayerTabOverlayPatch.java | 14 +- .../impl/patch/GuiScreenBookPatch.java | 60 +- .../seppuku/impl/patch/GuiToastPatch.java | 12 +- .../seppuku/impl/patch/ItemRendererPatch.java | 42 +- .../seppuku/impl/patch/MinecraftPatch.java | 120 ++-- .../impl/patch/NetHandlerPlayClientPatch.java | 14 +- .../impl/patch/NetworkManagerPatch.java | 70 +-- .../impl/patch/ParticleManagerPatch.java | 12 +- .../impl/patch/PlayerControllerMPPatch.java | 160 +++--- .../seppuku/impl/patch/RenderGlobalPatch.java | 42 +- .../impl/patch/RenderLivingBasePatch.java | 82 +-- .../impl/patch/RenderManagerPatch.java | 44 +- .../seppuku/impl/patch/VisGraphPatch.java | 26 +- .../seppuku/impl/patch/WorldPatch.java | 102 ++-- .../pomelo/handler/ListenerPriority.java | 2 +- .../annotated/handler/MethodEventHandler.java | 2 +- .../handler/annotation/Listener.java | 2 +- .../handler/scan/MethodHandlerScanner.java | 6 +- .../assets/seppukumod/shaders/chams.json | 207 ++++--- .../assets/seppukumod/shaders/default.json | 4 +- 149 files changed, 2180 insertions(+), 2319 deletions(-) diff --git a/src/main/java/me/rigamortis/seppuku/api/camera/Camera.java b/src/main/java/me/rigamortis/seppuku/api/camera/Camera.java index f54bc9b..04f285b 100644 --- a/src/main/java/me/rigamortis/seppuku/api/camera/Camera.java +++ b/src/main/java/me/rigamortis/seppuku/api/camera/Camera.java @@ -23,32 +23,20 @@ import static org.lwjgl.opengl.GL11.GL_QUADS; */ public class Camera { - private Vec3d pos; - - private Vec3d prevPos; - - private float yaw; - - private float pitch; - - private boolean recording; - - private boolean valid; - - private boolean rendering; - - private boolean firstUpdate; - - private float farPlaneDistance; - - private Framebuffer frameBuffer; - private final int WIDTH_RESOLUTION = 420; private final int HEIGHT_RESOLUTION = 420; - - private int frameCount; - private final Minecraft mc = Minecraft.getMinecraft(); + private Vec3d pos; + private Vec3d prevPos; + private float yaw; + private float pitch; + private boolean recording; + private boolean valid; + private boolean rendering; + private boolean firstUpdate; + private float farPlaneDistance; + private Framebuffer frameBuffer; + private int frameCount; public Camera() { this.pos = new Vec3d(0, 0, 0); diff --git a/src/main/java/me/rigamortis/seppuku/api/event/world/EventChunk.java b/src/main/java/me/rigamortis/seppuku/api/event/world/EventChunk.java index 03b7f7a..fd34bc4 100644 --- a/src/main/java/me/rigamortis/seppuku/api/event/world/EventChunk.java +++ b/src/main/java/me/rigamortis/seppuku/api/event/world/EventChunk.java @@ -24,10 +24,10 @@ public class EventChunk { return chunk; } - public static enum ChunkType { + public enum ChunkType { LOAD, UNLOAD; - private ChunkType() { + ChunkType() { } } diff --git a/src/main/java/me/rigamortis/seppuku/api/gui/hud/component/BlocksComponent.java b/src/main/java/me/rigamortis/seppuku/api/gui/hud/component/BlocksComponent.java index bace975..d704bc4 100644 --- a/src/main/java/me/rigamortis/seppuku/api/gui/hud/component/BlocksComponent.java +++ b/src/main/java/me/rigamortis/seppuku/api/gui/hud/component/BlocksComponent.java @@ -29,9 +29,9 @@ public final class BlocksComponent extends HudComponent { private final TextComponent searchBox; private final List blocks = new ArrayList<>(); - private List displayedBlocks; + private final List displayedBlocks; - private Value> value; + private final Value> value; public BlocksComponent(Value> value) { super(value.getName()); diff --git a/src/main/java/me/rigamortis/seppuku/api/gui/hud/component/CarouselComponent.java b/src/main/java/me/rigamortis/seppuku/api/gui/hud/component/CarouselComponent.java index 7f2cddf..c045206 100644 --- a/src/main/java/me/rigamortis/seppuku/api/gui/hud/component/CarouselComponent.java +++ b/src/main/java/me/rigamortis/seppuku/api/gui/hud/component/CarouselComponent.java @@ -14,10 +14,9 @@ import java.util.Iterator; */ public final class CarouselComponent extends HudComponent { - private Value value; - public String displayValue; public boolean focused; + private final Value value; public CarouselComponent(String name, Value value) { super(name); diff --git a/src/main/java/me/rigamortis/seppuku/api/gui/hud/component/ColorComponent.java b/src/main/java/me/rigamortis/seppuku/api/gui/hud/component/ColorComponent.java index 93cbafc..82a654a 100644 --- a/src/main/java/me/rigamortis/seppuku/api/gui/hud/component/ColorComponent.java +++ b/src/main/java/me/rigamortis/seppuku/api/gui/hud/component/ColorComponent.java @@ -9,16 +9,13 @@ import java.awt.*; public class ColorComponent extends TextComponent { - private Color currentColor; - // space occupied from left to right: border, color box, spacing, text, spacing, check, spacing, gear, border private static final int COLOR_SIZE = 7; private static final int GEAR_WIDTH = 8; - - private String customDisplayValue; - private final Texture gearTexture; private final Texture gearTextureEnabled; + private Color currentColor; + private String customDisplayValue; public ColorComponent(String name, int defaultColor) { super(name, String.valueOf(defaultColor), false); diff --git a/src/main/java/me/rigamortis/seppuku/api/gui/hud/component/DraggableHudComponent.java b/src/main/java/me/rigamortis/seppuku/api/gui/hud/component/DraggableHudComponent.java index 2907a59..d26298e 100644 --- a/src/main/java/me/rigamortis/seppuku/api/gui/hud/component/DraggableHudComponent.java +++ b/src/main/java/me/rigamortis/seppuku/api/gui/hud/component/DraggableHudComponent.java @@ -15,23 +15,19 @@ import org.lwjgl.input.Keyboard; */ public class DraggableHudComponent extends HudComponent { + private static final double ANCHOR_THRESHOLD = 80; + protected final Minecraft mc = Minecraft.getMinecraft(); private boolean rclicked; private boolean snappable; private boolean dragging; private boolean locked; private float deltaX; private float deltaY; - private AnchorPoint anchorPoint; - private DraggableHudComponent glued; private GlueSide glueSide; private boolean parent; - private static final double ANCHOR_THRESHOLD = 80; - - protected final Minecraft mc = Minecraft.getMinecraft(); - public DraggableHudComponent(String name) { this.setName(name); this.setVisible(false); @@ -360,10 +356,6 @@ public class DraggableHudComponent extends HudComponent { this.glueSide = glueSide; } - public enum GlueSide { - TOP, BOTTOM - } - public boolean isParent() { return parent; } @@ -371,4 +363,8 @@ public class DraggableHudComponent extends HudComponent { public void setParent(boolean parent) { this.parent = parent; } + + public enum GlueSide { + TOP, BOTTOM + } } diff --git a/src/main/java/me/rigamortis/seppuku/api/gui/hud/component/HudComponent.java b/src/main/java/me/rigamortis/seppuku/api/gui/hud/component/HudComponent.java index 38ec447..7a7aabb 100644 --- a/src/main/java/me/rigamortis/seppuku/api/gui/hud/component/HudComponent.java +++ b/src/main/java/me/rigamortis/seppuku/api/gui/hud/component/HudComponent.java @@ -11,23 +11,18 @@ import java.util.List; */ public class HudComponent { + public ComponentListener mouseClickListener, rightClickListener; + public boolean rightClickEnabled; + public int subComponents = 0; private float x; private float y; private float w; private float h; - private float emptyH; - private String name; private String displayName; private String tooltipText = ""; - private boolean visible; - - public ComponentListener mouseClickListener, rightClickListener; - public boolean rightClickEnabled; - public int subComponents = 0; - private List valueList = new ArrayList(); public HudComponent() { diff --git a/src/main/java/me/rigamortis/seppuku/api/gui/hud/component/ItemsComponent.java b/src/main/java/me/rigamortis/seppuku/api/gui/hud/component/ItemsComponent.java index 8f0043d..fc32a22 100644 --- a/src/main/java/me/rigamortis/seppuku/api/gui/hud/component/ItemsComponent.java +++ b/src/main/java/me/rigamortis/seppuku/api/gui/hud/component/ItemsComponent.java @@ -24,9 +24,9 @@ public final class ItemsComponent extends HudComponent { private final TextComponent searchBox; private final List items = new ArrayList<>(); - private List displayedItems; + private final List displayedItems; - private Value> value; + private final Value> value; public ItemsComponent(Value> value) { super(value.getName()); diff --git a/src/main/java/me/rigamortis/seppuku/api/gui/hud/component/ResizableHudComponent.java b/src/main/java/me/rigamortis/seppuku/api/gui/hud/component/ResizableHudComponent.java index 7c3d022..cfbc953 100644 --- a/src/main/java/me/rigamortis/seppuku/api/gui/hud/component/ResizableHudComponent.java +++ b/src/main/java/me/rigamortis/seppuku/api/gui/hud/component/ResizableHudComponent.java @@ -11,17 +11,15 @@ import net.minecraft.client.Minecraft; */ public class ResizableHudComponent extends DraggableHudComponent { + protected final float CLICK_ZONE = 2; private boolean resizeDragging; private float resizeDeltaX; private float resizeDeltaY; - private float initialWidth; private float initialHeight; private float maxWidth; private float maxHeight; - protected final float CLICK_ZONE = 2; - public ResizableHudComponent(String name, float initialWidth, float initialHeight, float maxWidth, float maxHeight) { super(name); this.initialWidth = initialWidth; @@ -58,7 +56,7 @@ public class ResizableHudComponent extends DraggableHudComponent { } if (Minecraft.getMinecraft().currentScreen instanceof GuiHudEditor) { - RenderUtil.drawRect(this.getX() + this.getW() - CLICK_ZONE, this.getY() + this.getH() - CLICK_ZONE, this.getX() + this.getW() + CLICK_ZONE, this.getY() + this.getH() + CLICK_ZONE, this.isMouseInside(mouseX, mouseY) ? 0x90CCCCCC : 0x90CCCCCC); + RenderUtil.drawRect(this.getX() + this.getW() - CLICK_ZONE, this.getY() + this.getH() - CLICK_ZONE, this.getX() + this.getW() + CLICK_ZONE, this.getY() + this.getH() + CLICK_ZONE, 0x90CCCCCC); } final boolean insideClickZone = mouseX >= this.getX() + this.getW() - CLICK_ZONE && mouseX <= this.getX() + this.getW() + CLICK_ZONE && mouseY >= this.getY() + this.getH() - CLICK_ZONE && mouseY <= this.getY() + this.getH() + CLICK_ZONE; diff --git a/src/main/java/me/rigamortis/seppuku/api/gui/hud/component/SliderComponent.java b/src/main/java/me/rigamortis/seppuku/api/gui/hud/component/SliderComponent.java index 892ecf9..e3c248c 100644 --- a/src/main/java/me/rigamortis/seppuku/api/gui/hud/component/SliderComponent.java +++ b/src/main/java/me/rigamortis/seppuku/api/gui/hud/component/SliderComponent.java @@ -17,15 +17,14 @@ import java.text.DecimalFormat; */ public final class SliderComponent extends HudComponent { - private Value value; - private ComponentListener mouseClickListener; - private final SliderBarComponent sliderBar; - private TextComponent textComponent; - protected final DecimalFormat decimalFormat = new DecimalFormat("#.#"); + private final SliderBarComponent sliderBar; protected boolean sliding; protected float lastPositionX = -1; protected float lastWidth = -1; + private final Value value; + private ComponentListener mouseClickListener; + private TextComponent textComponent; public SliderComponent(String name, Value value) { super(name); @@ -362,7 +361,7 @@ public final class SliderComponent extends HudComponent { if (this.parent.value.getValue() instanceof Integer) { return (int) MathUtil.map(this.getX(), this.parent.getX(), this.parent.getX() + this.parent.getW() - this.getW(), (int) this.parent.value.getMin(), (int) this.parent.value.getMax()) + ""; } else if (this.parent.value.getValue() instanceof Double) { - return this.parent.decimalFormat.format((double) MathUtil.map(this.getX(), this.parent.getX(), this.parent.getX() + this.parent.getW() - this.getW(), (double) this.parent.value.getMin(), (double) this.parent.value.getMax())); + return this.parent.decimalFormat.format(MathUtil.map(this.getX(), this.parent.getX(), this.parent.getX() + this.parent.getW() - this.getW(), (double) this.parent.value.getMin(), (double) this.parent.value.getMax())); } else if (this.parent.value.getValue() instanceof Float) { return this.parent.decimalFormat.format((float) MathUtil.map(this.getX(), this.parent.getX(), this.parent.getX() + this.parent.getW() - this.getW(), (float) this.parent.value.getMin(), (float) this.parent.value.getMax())); } else if (this.parent.value.getValue() instanceof Long) { @@ -379,7 +378,7 @@ public final class SliderComponent extends HudComponent { final int finishedInt = (int) MathUtil.map(this.getX(), this.parent.getX(), this.parent.getX() + this.parent.getW() - this.getW(), (int) this.parent.value.getMin(), (int) this.parent.value.getMax()); this.parent.value.setValue(finishedInt); } else if (this.parent.value.getValue() instanceof Double) { - final double finishedDouble = (double) MathUtil.map(this.getX(), this.parent.getX(), this.parent.getX() + this.parent.getW() - this.getW(), (double) this.parent.value.getMin(), (double) this.parent.value.getMax()); + final double finishedDouble = MathUtil.map(this.getX(), this.parent.getX(), this.parent.getX() + this.parent.getW() - this.getW(), (double) this.parent.value.getMin(), (double) this.parent.value.getMax()); this.parent.value.setValue(Double.valueOf(this.parent.decimalFormat.format(finishedDouble))); } else if (this.parent.value.getValue() instanceof Float) { final float finishedFloat = (float) MathUtil.map(this.getX(), this.parent.getX(), this.parent.getX() + this.parent.getW() - this.getW(), (float) this.parent.value.getMin(), (float) this.parent.value.getMax()); diff --git a/src/main/java/me/rigamortis/seppuku/api/gui/hud/component/TextComponent.java b/src/main/java/me/rigamortis/seppuku/api/gui/hud/component/TextComponent.java index 3146425..532f9f5 100644 --- a/src/main/java/me/rigamortis/seppuku/api/gui/hud/component/TextComponent.java +++ b/src/main/java/me/rigamortis/seppuku/api/gui/hud/component/TextComponent.java @@ -19,21 +19,6 @@ import java.util.logging.Level; */ public class TextComponent extends HudComponent { - private String displayValue; - public boolean focused; - public boolean digitOnly; - public ComponentListener returnListener; - public TextComponentListener textListener; - - protected Texture checkTexture; - - private int textCursor = 0; - private int textCursorOffset = 0; - private int selectCursor = 0; - private int selectCursorOffset = 0; - private int shiftLength = 0; - private boolean dirty = false; - // space occupied from left to right: border, text, spacing, check, border protected static final int BORDER = 1; protected static final int SPACING = 1; @@ -41,6 +26,18 @@ public class TextComponent extends HudComponent { protected static final int CHECK_WIDTH = 8; protected static final int BLOCK_WIDTH = 2; protected static final float ICON_V_OFFSET = 0.5f; + public boolean focused; + public boolean digitOnly; + public ComponentListener returnListener; + public TextComponentListener textListener; + protected Texture checkTexture; + private String displayValue; + private int textCursor = 0; + private int textCursorOffset = 0; + private int selectCursor = 0; + private int selectCursorOffset = 0; + private int shiftLength = 0; + private boolean dirty = false; public TextComponent(String name, String displayValue, boolean digitOnly) { super(name); diff --git a/src/main/java/me/rigamortis/seppuku/api/gui/hud/particle/Particle.java b/src/main/java/me/rigamortis/seppuku/api/gui/hud/particle/Particle.java index 777a18c..578ba09 100644 --- a/src/main/java/me/rigamortis/seppuku/api/gui/hud/particle/Particle.java +++ b/src/main/java/me/rigamortis/seppuku/api/gui/hud/particle/Particle.java @@ -10,13 +10,11 @@ import java.util.concurrent.ThreadLocalRandom; public class Particle { + private final int maxAlpha; private Vector2f pos; private Vector2f velocity; private Vector2f acceleration; - private int alpha; - private final int maxAlpha; - private float size; public Particle(Vector2f pos) { diff --git a/src/main/java/me/rigamortis/seppuku/api/gui/menu/GuiAddAlt.java b/src/main/java/me/rigamortis/seppuku/api/gui/menu/GuiAddAlt.java index fbb4813..4481d3b 100644 --- a/src/main/java/me/rigamortis/seppuku/api/gui/menu/GuiAddAlt.java +++ b/src/main/java/me/rigamortis/seppuku/api/gui/menu/GuiAddAlt.java @@ -16,10 +16,10 @@ import java.io.IOException; */ public final class GuiAddAlt extends GuiScreen { + private final GuiAltManager parent; private GuiTextField usernameField; private GuiTextField emailField; private GuiPasswordField passwordField; - private final GuiAltManager parent; public GuiAddAlt(GuiAltManager parent) { this.parent = parent; diff --git a/src/main/java/me/rigamortis/seppuku/api/gui/menu/GuiEntryAlt.java b/src/main/java/me/rigamortis/seppuku/api/gui/menu/GuiEntryAlt.java index f4b6a8a..dd729e3 100644 --- a/src/main/java/me/rigamortis/seppuku/api/gui/menu/GuiEntryAlt.java +++ b/src/main/java/me/rigamortis/seppuku/api/gui/menu/GuiEntryAlt.java @@ -13,9 +13,9 @@ import net.minecraft.util.ResourceLocation; */ public class GuiEntryAlt implements GuiListExtended.IGuiListEntry { - private GuiListAlt parent; - private ResourceLocation resourceLocation; private final AltData alt; + private final GuiListAlt parent; + private ResourceLocation resourceLocation; public GuiEntryAlt(GuiListAlt parent, AltData alt) { this.parent = parent; diff --git a/src/main/java/me/rigamortis/seppuku/api/gui/menu/GuiListAlt.java b/src/main/java/me/rigamortis/seppuku/api/gui/menu/GuiListAlt.java index d63f134..841d14f 100644 --- a/src/main/java/me/rigamortis/seppuku/api/gui/menu/GuiListAlt.java +++ b/src/main/java/me/rigamortis/seppuku/api/gui/menu/GuiListAlt.java @@ -63,10 +63,6 @@ public final class GuiListAlt extends GuiListExtended { return (index == this.selected); } - public void setSelected(int index) { - this.selected = index; - } - public boolean hasSelected() { return (this.selected >= 0 && this.selected < this.entries.size()); } @@ -75,6 +71,10 @@ public final class GuiListAlt extends GuiListExtended { return this.hasSelected() ? this.entries.get(this.selected) : null; } + public void setSelected(int index) { + this.selected = index; + } + public int getSize() { return this.entries.size(); } diff --git a/src/main/java/me/rigamortis/seppuku/api/gui/menu/GuiPasswordField.java b/src/main/java/me/rigamortis/seppuku/api/gui/menu/GuiPasswordField.java index 3a1a2f3..c0a1431 100644 --- a/src/main/java/me/rigamortis/seppuku/api/gui/menu/GuiPasswordField.java +++ b/src/main/java/me/rigamortis/seppuku/api/gui/menu/GuiPasswordField.java @@ -60,6 +60,10 @@ public class GuiPasswordField extends Gui { ++this.cursorCounter; } + public String getText() { + return this.text; + } + public void setText(String textIn) { if (this.validator.apply(textIn)) { if (textIn.length() > this.maxStringLength) { @@ -73,10 +77,6 @@ public class GuiPasswordField extends Gui { } - public String getText() { - return this.text; - } - public String getSelectedText() { int i = Math.min(this.cursorPosition, this.selectionEnd); int j = Math.max(this.cursorPosition, this.selectionEnd); @@ -212,13 +212,6 @@ public class GuiPasswordField extends Gui { this.setCursorPosition(this.selectionEnd + num); } - public void setCursorPosition(int pos) { - this.cursorPosition = pos; - int i = this.text.length(); - this.cursorPosition = MathHelper.clamp(this.cursorPosition, 0, i); - this.setSelectionPos(this.cursorPosition); - } - public void setCursorPositionZero() { this.setCursorPosition(0); } @@ -433,15 +426,19 @@ public class GuiPasswordField extends Gui { GlStateManager.enableColorLogic(); GlStateManager.colorLogicOp(LogicOp.OR_REVERSE); bufferbuilder.begin(7, DefaultVertexFormats.POSITION); - bufferbuilder.pos((double) startX, (double) endY, 0.0D).endVertex(); - bufferbuilder.pos((double) endX, (double) endY, 0.0D).endVertex(); - bufferbuilder.pos((double) endX, (double) startY, 0.0D).endVertex(); - bufferbuilder.pos((double) startX, (double) startY, 0.0D).endVertex(); + bufferbuilder.pos(startX, endY, 0.0D).endVertex(); + bufferbuilder.pos(endX, endY, 0.0D).endVertex(); + bufferbuilder.pos(endX, startY, 0.0D).endVertex(); + bufferbuilder.pos(startX, startY, 0.0D).endVertex(); tessellator.draw(); GlStateManager.disableColorLogic(); GlStateManager.enableTexture2D(); } + public int getMaxStringLength() { + return this.maxStringLength; + } + public void setMaxStringLength(int length) { this.maxStringLength = length; if (this.text.length() > length) { @@ -450,14 +447,17 @@ public class GuiPasswordField extends Gui { } - public int getMaxStringLength() { - return this.maxStringLength; - } - public int getCursorPosition() { return this.cursorPosition; } + public void setCursorPosition(int pos) { + this.cursorPosition = pos; + int i = this.text.length(); + this.cursorPosition = MathHelper.clamp(this.cursorPosition, 0, i); + this.setSelectionPos(this.cursorPosition); + } + public boolean getEnableBackgroundDrawing() { return this.enableBackgroundDrawing; } @@ -474,6 +474,10 @@ public class GuiPasswordField extends Gui { this.disabledColor = color; } + public boolean isFocused() { + return this.isFocused; + } + public void setFocused(boolean isFocusedIn) { if (isFocusedIn && !this.isFocused) { this.cursorCounter = 0; @@ -486,10 +490,6 @@ public class GuiPasswordField extends Gui { } - public boolean isFocused() { - return this.isFocused; - } - public void setEnabled(boolean enabled) { this.isEnabled = enabled; } diff --git a/src/main/java/me/rigamortis/seppuku/api/module/Module.java b/src/main/java/me/rigamortis/seppuku/api/module/Module.java index 2142751..28b2392 100644 --- a/src/main/java/me/rigamortis/seppuku/api/module/Module.java +++ b/src/main/java/me/rigamortis/seppuku/api/module/Module.java @@ -111,7 +111,7 @@ public class Module { options.append(option.name().toLowerCase() + ((i == size - 1) ? "" : ", ")); } - msg.appendSibling(new TextComponentString(valuePrefix + v.getName() + ChatFormatting.GRAY + " <" + options.toString() + ">" + ChatFormatting.RESET + ": " + ChatFormatting.YELLOW + val.name().toLowerCase()).setStyle(new Style().setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponentString(v.getName() + "\n" + ChatFormatting.GOLD + ((v.getDesc() == null || v.getDesc().equals("")) ? "There is no description for this enum value." : v.getDesc()) + ChatFormatting.RESET + "\n " + ChatFormatting.GRAY + "<" + options.toString() + ">"))))); + msg.appendSibling(new TextComponentString(valuePrefix + v.getName() + ChatFormatting.GRAY + " <" + options + ">" + ChatFormatting.RESET + ": " + ChatFormatting.YELLOW + val.name().toLowerCase()).setStyle(new Style().setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponentString(v.getName() + "\n" + ChatFormatting.GOLD + ((v.getDesc() == null || v.getDesc().equals("")) ? "There is no description for this enum value." : v.getDesc()) + ChatFormatting.RESET + "\n " + ChatFormatting.GRAY + "<" + options + ">"))))); } if (v.getValue() instanceof Regex) { @@ -145,10 +145,6 @@ public class Module { this.valueList.clear(); } - public enum ModuleType { - COMBAT, MOVEMENT, RENDER, PLAYER, WORLD, MISC, HIDDEN, UI - } - public String getDisplayName() { return displayName; } @@ -227,4 +223,8 @@ public class Module { public void setValueList(List valueList) { this.valueList = valueList; } + + public enum ModuleType { + COMBAT, MOVEMENT, RENDER, PLAYER, WORLD, MISC, HIDDEN, UI + } } diff --git a/src/main/java/me/rigamortis/seppuku/api/module/notebot/Note.java b/src/main/java/me/rigamortis/seppuku/api/module/notebot/Note.java index ee7d707..4f00b3d 100644 --- a/src/main/java/me/rigamortis/seppuku/api/module/notebot/Note.java +++ b/src/main/java/me/rigamortis/seppuku/api/module/notebot/Note.java @@ -22,35 +22,35 @@ public class Note { this.pitch = pitch; } - public void setIndex(int index) { - this.index = index; - } - - public void setPosition(BlockPos position) { - this.position = position; - } - - public void setInstrument(int instrument) { - this.instrument = instrument; - } - - public void setPitch(int pitch) { - this.pitch = pitch; - } - public int getIndex() { return this.index; } + public void setIndex(int index) { + this.index = index; + } + public BlockPos getPosition() { return this.position; } + public void setPosition(BlockPos position) { + this.position = position; + } + public int getInstrument() { return this.instrument; } + public void setInstrument(int instrument) { + this.instrument = instrument; + } + public int getPitch() { return this.pitch; } + + public void setPitch(int pitch) { + this.pitch = pitch; + } } diff --git a/src/main/java/me/rigamortis/seppuku/api/notification/Notification.java b/src/main/java/me/rigamortis/seppuku/api/notification/Notification.java index f6da307..77a3149 100644 --- a/src/main/java/me/rigamortis/seppuku/api/notification/Notification.java +++ b/src/main/java/me/rigamortis/seppuku/api/notification/Notification.java @@ -11,20 +11,13 @@ import me.rigamortis.seppuku.impl.gui.hud.component.NotificationsComponent; public final class Notification { private final String title; - - private String text; - - private float x = 0, y = 0, width = 0, height = 0; - private final Type type; - - private int duration; // milliseconds - private final int maxDuration; - - private float transitionX = 0, transitionY = 0; - private final Timer timer = new Timer(); + private String text; + private float x = 0, y = 0, width = 0, height = 0; + private int duration; // milliseconds + private float transitionX = 0, transitionY = 0; public Notification(String title, String text, Type type, int duration) { this.title = title; diff --git a/src/main/java/me/rigamortis/seppuku/api/task/basic/BasicTaskFactory.java b/src/main/java/me/rigamortis/seppuku/api/task/basic/BasicTaskFactory.java index 8692605..8e40bfc 100644 --- a/src/main/java/me/rigamortis/seppuku/api/task/basic/BasicTaskFactory.java +++ b/src/main/java/me/rigamortis/seppuku/api/task/basic/BasicTaskFactory.java @@ -68,9 +68,7 @@ public abstract class BasicTaskFactory implements TaskFacto } public boolean comparePriority(T task) { - if (task.getPriority() < this.currentTask.getPriority()) - return false; - return true; + return task.getPriority() >= this.currentTask.getPriority(); } public boolean isCurrentlyTasking() { diff --git a/src/main/java/me/rigamortis/seppuku/api/task/hand/HandSwapContext.java b/src/main/java/me/rigamortis/seppuku/api/task/hand/HandSwapContext.java index 0a93fc1..78e92ad 100644 --- a/src/main/java/me/rigamortis/seppuku/api/task/hand/HandSwapContext.java +++ b/src/main/java/me/rigamortis/seppuku/api/task/hand/HandSwapContext.java @@ -18,14 +18,14 @@ public final class HandSwapContext { return oldSlot; } - public int getNewSlot() { - return newSlot; - } - public void setOldSlot(int oldSlot) { this.oldSlot = oldSlot; } + public int getNewSlot() { + return newSlot; + } + public void setNewSlot(int newSlot) { this.newSlot = newSlot; } diff --git a/src/main/java/me/rigamortis/seppuku/api/util/EntityUtil.java b/src/main/java/me/rigamortis/seppuku/api/util/EntityUtil.java index f828e26..78e93cb 100644 --- a/src/main/java/me/rigamortis/seppuku/api/util/EntityUtil.java +++ b/src/main/java/me/rigamortis/seppuku/api/util/EntityUtil.java @@ -13,7 +13,7 @@ import net.minecraft.util.math.Vec3d; */ public class EntityUtil { - private static Minecraft mc = Minecraft.getMinecraft(); + private static final Minecraft mc = Minecraft.getMinecraft(); public static Vec3d getInterpolatedPosition(Entity entity, double x, double y, double z) { return new Vec3d(entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * x, entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * y, entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * z); diff --git a/src/main/java/me/rigamortis/seppuku/api/util/GLUProjection.java b/src/main/java/me/rigamortis/seppuku/api/util/GLUProjection.java index dc22dcd..cc1e60c 100644 --- a/src/main/java/me/rigamortis/seppuku/api/util/GLUProjection.java +++ b/src/main/java/me/rigamortis/seppuku/api/util/GLUProjection.java @@ -13,259 +13,11 @@ import java.nio.IntBuffer; * Author TheCyberBrick */ public final class GLUProjection { - public static class Line { - public Vector3D sourcePoint = new Vector3D(0, 0, 0); - public Vector3D direction = new Vector3D(0, 0, 0); - - public Line(double sx, double sy, double sz, double dx, double dy, double dz) { - this.sourcePoint.x = sx; - this.sourcePoint.y = sy; - this.sourcePoint.z = sz; - this.direction.x = dx; - this.direction.y = dy; - this.direction.z = dz; - } - - public Vector3D intersect(Line line) { - double a = this.sourcePoint.x; - double b = this.direction.x; - double c = line.sourcePoint.x; - double d = line.direction.x; - double e = this.sourcePoint.y; - double f = this.direction.y; - double g = line.sourcePoint.y; - double h = line.direction.y; - double te = -(a * h - c * h - d * (e - g)); - double be = b * h - d * f; - if (be == 0) { - return this.intersectXZ(line); - } - double t = te / be; - Vector3D result = new Vector3D(0, 0, 0); - result.x = this.sourcePoint.x + this.direction.x * t; - result.y = this.sourcePoint.y + this.direction.y * t; - result.z = this.sourcePoint.z + this.direction.z * t; - return result; - } - - private Vector3D intersectXZ(Line line) { - double a = this.sourcePoint.x; - double b = this.direction.x; - double c = line.sourcePoint.x; - double d = line.direction.x; - double e = this.sourcePoint.z; - double f = this.direction.z; - double g = line.sourcePoint.z; - double h = line.direction.z; - double te = -(a * h - c * h - d * (e - g)); - double be = b * h - d * f; - if (be == 0) { - return this.intersectYZ(line); - } - double t = te / be; - Vector3D result = new Vector3D(0, 0, 0); - result.x = this.sourcePoint.x + this.direction.x * t; - result.y = this.sourcePoint.y + this.direction.y * t; - result.z = this.sourcePoint.z + this.direction.z * t; - return result; - } - - private Vector3D intersectYZ(Line line) { - double a = this.sourcePoint.y; - double b = this.direction.y; - double c = line.sourcePoint.y; - double d = line.direction.y; - double e = this.sourcePoint.z; - double f = this.direction.z; - double g = line.sourcePoint.z; - double h = line.direction.z; - double te = -(a * h - c * h - d * (e - g)); - double be = b * h - d * f; - if (be == 0) { - return null; - } - double t = te / be; - Vector3D result = new Vector3D(0, 0, 0); - result.x = this.sourcePoint.x + this.direction.x * t; - result.y = this.sourcePoint.y + this.direction.y * t; - result.z = this.sourcePoint.z + this.direction.z * t; - return result; - } - - public Vector3D intersectPlane(Vector3D pointOnPlane, Vector3D planeNormal) { - Vector3D result = new Vector3D(this.sourcePoint.x, this.sourcePoint.y, this.sourcePoint.z); - double d = pointOnPlane.sub(this.sourcePoint).dot(planeNormal) / this.direction.dot(planeNormal); - result.sadd(this.direction.mul(d)); - if (this.direction.dot(planeNormal) == 0.0D) { - return null; - } - return result; - } - } - - public static class Vector3D { - public double x, y, z; - - public Vector3D(double x, double y, double z) { - this.x = x; - this.y = y; - this.z = z; - } - - public Vector3D add(Vector3D v) { - return new Vector3D(this.x + v.x, this.y + v.y, this.z + v.z); - } - - public Vector3D add(double x, double y, double z) { - return new Vector3D(this.x + x, this.y + y, this.z + z); - } - - public Vector3D sub(Vector3D v) { - return new Vector3D(this.x - v.x, this.y - v.y, this.z - v.z); - } - - public Vector3D sub(double x, double y, double z) { - return new Vector3D(this.x - x, this.y - y, this.z - z); - } - - public Vector3D normalized() { - double len = (double) Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z); - return new Vector3D(this.x / len, this.y / len, this.z / len); - } - - public double dot(Vector3D v) { - return this.x * v.x + this.y * v.y + this.z * v.z; - } - - public Vector3D cross(Vector3D v) { - return new Vector3D(this.y * v.z - this.z * v.y, this.z * v.x - this.x * v.z, this.x * v.y - this.y * v.x); - } - - public Vector3D mul(double m) { - return new Vector3D(this.x * m, this.y * m, this.z * m); - } - - public Vector3D div(double d) { - return new Vector3D(this.x / d, this.y / d, this.z / d); - } - - public double length() { - return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z); - } - - public Vector3D sadd(Vector3D v) { - this.x += v.x; - this.y += v.y; - this.z += v.z; - return this; - } - - public Vector3D sadd(double x, double y, double z) { - this.x += x; - this.y += y; - this.z += z; - return this; - } - - public Vector3D ssub(Vector3D v) { - this.x -= v.x; - this.y -= v.y; - this.z -= v.z; - return this; - } - - public Vector3D ssub(double x, double y, double z) { - this.x -= x; - this.y -= y; - this.z -= z; - return this; - } - - public Vector3D snormalize() { - double len = (double) Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z); - this.x /= len; - this.y /= len; - this.z /= len; - return this; - } - - public Vector3D scross(Vector3D v) { - this.x = this.y * v.z - this.z * v.y; - this.y = this.z * v.x - this.x * v.z; - this.z = this.x * v.y - this.y * v.x; - return this; - } - - public Vector3D smul(double m) { - this.x *= m; - this.y *= m; - this.z *= m; - return this; - } - - public Vector3D sdiv(double d) { - this.x /= d; - this.y /= d; - this.z /= d; - return this; - } - - @Override - public String toString() { - return "(X: " + this.x + " Y: " + this.y + " Z: " + this.z + ")"; - } - } - - public static class Projection { - public static enum Type { - INSIDE, OUTSIDE, INVERTED, FAIL - } - - private final double x; - private final double y; - private final Type t; - - public Projection(double x, double y, Type t) { - this.x = x; - this.y = y; - this.t = t; - } - - public double getX() { - return this.x; - } - - public double getY() { - return this.y; - } - - public Type getType() { - return this.t; - } - - public boolean isType(Type type) { - return this.t == type; - } - } - - public static enum ClampMode {ORTHOGONAL, DIRECT, NONE} - - private GLUProjection() { - } - private static GLUProjection instance; - - public static GLUProjection getInstance() { - if (instance == null) { - instance = new GLUProjection(); - } - return instance; - } - private IntBuffer viewport; private FloatBuffer modelview; private FloatBuffer projection; - private FloatBuffer coords = BufferUtils.createFloatBuffer(3); + private final FloatBuffer coords = BufferUtils.createFloatBuffer(3); private Vector3D frustumPos; private Vector3D[] frustum; private Vector3D[] invFrustum; @@ -279,6 +31,15 @@ public final class GLUProjection { private float fovY; private float fovX; private Vector3D lookVec; + private GLUProjection() { + } + + public static GLUProjection getInstance() { + if (instance == null) { + instance = new GLUProjection(); + } + return instance; + } /** * Updates the matrices. Needed whenever the viewport or one of the matrices has changed. @@ -361,14 +122,14 @@ public final class GLUProjection { public Projection project(double x, double y, double z, ClampMode clampModeOutside, boolean extrudeInverted) { if (this.viewport != null && this.modelview != null && this.projection != null) { Vector3D posVec = new Vector3D(x, y, z); - boolean frustum[] = this.doFrustumCheck(this.frustum, this.frustumPos, x, y, z); + boolean[] frustum = this.doFrustumCheck(this.frustum, this.frustumPos, x, y, z); boolean outsideFrustum = frustum[0] || frustum[1] || frustum[2] || frustum[3]; //Check if point is inside frustum if (outsideFrustum) { //Check if point is on opposite side of the near clip plane boolean opposite = posVec.sub(this.frustumPos).dot(this.viewVec) <= 0.0D; //Get inverted frustum check - boolean invFrustum[] = this.doFrustumCheck(this.invFrustum, this.frustumPos, x, y, z); + boolean[] invFrustum = this.doFrustumCheck(this.invFrustum, this.frustumPos, x, y, z); boolean outsideInvertedFrustum = invFrustum[0] || invFrustum[1] || invFrustum[2] || invFrustum[3]; if ((extrudeInverted && !outsideInvertedFrustum) || (outsideInvertedFrustum && clampModeOutside != ClampMode.NONE)) { if ((extrudeInverted && !outsideInvertedFrustum) || @@ -381,10 +142,10 @@ public final class GLUProjection { if (opposite) { //Invert coordinates vecX = this.displayWidth * this.widthScale - (double) this.coords.get(0) * this.widthScale - this.displayWidth * this.widthScale / 2.0F; - vecY = this.displayHeight * this.heightScale - ((double) displayHeight - (double) this.coords.get(1)) * (double) this.heightScale - this.displayHeight * this.heightScale / 2.0F; + vecY = this.displayHeight * this.heightScale - (displayHeight - (double) this.coords.get(1)) * this.heightScale - this.displayHeight * this.heightScale / 2.0F; } else { vecX = (double) this.coords.get(0) * this.widthScale - this.displayWidth * this.widthScale / 2.0F; - vecY = ((double) this.displayHeight - (double) this.coords.get(1)) * (double) this.heightScale - this.displayHeight * this.heightScale / 2.0F; + vecY = (this.displayHeight - (double) this.coords.get(1)) * this.heightScale - this.displayHeight * this.heightScale / 2.0F; } } else { return new Projection(0, 0, Projection.Type.FAIL); @@ -421,7 +182,7 @@ public final class GLUProjection { if (GLU.gluProject((float) x, (float) y, (float) z, this.modelview, this.projection, this.viewport, this.coords)) { //Get projected coordinates double guiX = (double) this.coords.get(0) * this.widthScale; - double guiY = ((double) this.displayHeight - (double) this.coords.get(1)) * (double) this.heightScale; + double guiY = (this.displayHeight - (double) this.coords.get(1)) * this.heightScale; if (opposite) { //Invert coordinates guiX = this.displayWidth * this.widthScale - guiX; @@ -447,7 +208,7 @@ public final class GLUProjection { if (GLU.gluProject((float) x, (float) y, (float) z, this.modelview, this.projection, this.viewport, this.coords)) { //Get projected coordinates double guiX = (double) this.coords.get(0) * this.widthScale; - double guiY = ((double) this.displayHeight - (double) this.coords.get(1)) * (double) this.heightScale; + double guiY = (this.displayHeight - (double) this.coords.get(1)) * this.heightScale; if (opposite) { //Invert coordinates guiX = this.displayWidth * this.widthScale - guiX; @@ -463,7 +224,7 @@ public final class GLUProjection { if (GLU.gluProject((float) x, (float) y, (float) z, this.modelview, this.projection, this.viewport, this.coords)) { //Get projected coordinates double guiX = (double) this.coords.get(0) * this.widthScale; - double guiY = ((double) this.displayHeight - (double) this.coords.get(1)) * (double) this.heightScale; + double guiY = (this.displayHeight - (double) this.coords.get(1)) * this.heightScale; return new Projection(guiX, guiY, Projection.Type.INSIDE); } else { return new Projection(0, 0, Projection.Type.FAIL); @@ -603,6 +364,242 @@ public final class GLUProjection { double s = Math.sin(-rotYaw * 0.017453292F - Math.PI); double nc = -Math.cos(-rotPitch * 0.017453292F); double ns = Math.sin(-rotPitch * 0.017453292F); - return new Vector3D((double) (s * nc), (double) ns, (double) (c * nc)); + return new Vector3D(s * nc, ns, c * nc); + } + + public enum ClampMode {ORTHOGONAL, DIRECT, NONE} + + public static class Line { + public Vector3D sourcePoint = new Vector3D(0, 0, 0); + public Vector3D direction = new Vector3D(0, 0, 0); + + public Line(double sx, double sy, double sz, double dx, double dy, double dz) { + this.sourcePoint.x = sx; + this.sourcePoint.y = sy; + this.sourcePoint.z = sz; + this.direction.x = dx; + this.direction.y = dy; + this.direction.z = dz; + } + + public Vector3D intersect(Line line) { + double a = this.sourcePoint.x; + double b = this.direction.x; + double c = line.sourcePoint.x; + double d = line.direction.x; + double e = this.sourcePoint.y; + double f = this.direction.y; + double g = line.sourcePoint.y; + double h = line.direction.y; + double te = -(a * h - c * h - d * (e - g)); + double be = b * h - d * f; + if (be == 0) { + return this.intersectXZ(line); + } + double t = te / be; + Vector3D result = new Vector3D(0, 0, 0); + result.x = this.sourcePoint.x + this.direction.x * t; + result.y = this.sourcePoint.y + this.direction.y * t; + result.z = this.sourcePoint.z + this.direction.z * t; + return result; + } + + private Vector3D intersectXZ(Line line) { + double a = this.sourcePoint.x; + double b = this.direction.x; + double c = line.sourcePoint.x; + double d = line.direction.x; + double e = this.sourcePoint.z; + double f = this.direction.z; + double g = line.sourcePoint.z; + double h = line.direction.z; + double te = -(a * h - c * h - d * (e - g)); + double be = b * h - d * f; + if (be == 0) { + return this.intersectYZ(line); + } + double t = te / be; + Vector3D result = new Vector3D(0, 0, 0); + result.x = this.sourcePoint.x + this.direction.x * t; + result.y = this.sourcePoint.y + this.direction.y * t; + result.z = this.sourcePoint.z + this.direction.z * t; + return result; + } + + private Vector3D intersectYZ(Line line) { + double a = this.sourcePoint.y; + double b = this.direction.y; + double c = line.sourcePoint.y; + double d = line.direction.y; + double e = this.sourcePoint.z; + double f = this.direction.z; + double g = line.sourcePoint.z; + double h = line.direction.z; + double te = -(a * h - c * h - d * (e - g)); + double be = b * h - d * f; + if (be == 0) { + return null; + } + double t = te / be; + Vector3D result = new Vector3D(0, 0, 0); + result.x = this.sourcePoint.x + this.direction.x * t; + result.y = this.sourcePoint.y + this.direction.y * t; + result.z = this.sourcePoint.z + this.direction.z * t; + return result; + } + + public Vector3D intersectPlane(Vector3D pointOnPlane, Vector3D planeNormal) { + Vector3D result = new Vector3D(this.sourcePoint.x, this.sourcePoint.y, this.sourcePoint.z); + double d = pointOnPlane.sub(this.sourcePoint).dot(planeNormal) / this.direction.dot(planeNormal); + result.sadd(this.direction.mul(d)); + if (this.direction.dot(planeNormal) == 0.0D) { + return null; + } + return result; + } + } + + public static class Vector3D { + public double x, y, z; + + public Vector3D(double x, double y, double z) { + this.x = x; + this.y = y; + this.z = z; + } + + public Vector3D add(Vector3D v) { + return new Vector3D(this.x + v.x, this.y + v.y, this.z + v.z); + } + + public Vector3D add(double x, double y, double z) { + return new Vector3D(this.x + x, this.y + y, this.z + z); + } + + public Vector3D sub(Vector3D v) { + return new Vector3D(this.x - v.x, this.y - v.y, this.z - v.z); + } + + public Vector3D sub(double x, double y, double z) { + return new Vector3D(this.x - x, this.y - y, this.z - z); + } + + public Vector3D normalized() { + double len = Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z); + return new Vector3D(this.x / len, this.y / len, this.z / len); + } + + public double dot(Vector3D v) { + return this.x * v.x + this.y * v.y + this.z * v.z; + } + + public Vector3D cross(Vector3D v) { + return new Vector3D(this.y * v.z - this.z * v.y, this.z * v.x - this.x * v.z, this.x * v.y - this.y * v.x); + } + + public Vector3D mul(double m) { + return new Vector3D(this.x * m, this.y * m, this.z * m); + } + + public Vector3D div(double d) { + return new Vector3D(this.x / d, this.y / d, this.z / d); + } + + public double length() { + return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z); + } + + public Vector3D sadd(Vector3D v) { + this.x += v.x; + this.y += v.y; + this.z += v.z; + return this; + } + + public Vector3D sadd(double x, double y, double z) { + this.x += x; + this.y += y; + this.z += z; + return this; + } + + public Vector3D ssub(Vector3D v) { + this.x -= v.x; + this.y -= v.y; + this.z -= v.z; + return this; + } + + public Vector3D ssub(double x, double y, double z) { + this.x -= x; + this.y -= y; + this.z -= z; + return this; + } + + public Vector3D snormalize() { + double len = Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z); + this.x /= len; + this.y /= len; + this.z /= len; + return this; + } + + public Vector3D scross(Vector3D v) { + this.x = this.y * v.z - this.z * v.y; + this.y = this.z * v.x - this.x * v.z; + this.z = this.x * v.y - this.y * v.x; + return this; + } + + public Vector3D smul(double m) { + this.x *= m; + this.y *= m; + this.z *= m; + return this; + } + + public Vector3D sdiv(double d) { + this.x /= d; + this.y /= d; + this.z /= d; + return this; + } + + @Override + public String toString() { + return "(X: " + this.x + " Y: " + this.y + " Z: " + this.z + ")"; + } + } + + public static class Projection { + private final double x; + private final double y; + private final Type t; + public Projection(double x, double y, Type t) { + this.x = x; + this.y = y; + this.t = t; + } + + public double getX() { + return this.x; + } + + public double getY() { + return this.y; + } + + public Type getType() { + return this.t; + } + + public boolean isType(Type type) { + return this.t == type; + } + + public enum Type { + INSIDE, OUTSIDE, INVERTED, FAIL + } } } \ No newline at end of file diff --git a/src/main/java/me/rigamortis/seppuku/api/util/shader/ShaderProgram.java b/src/main/java/me/rigamortis/seppuku/api/util/shader/ShaderProgram.java index 7a98458..19e88a9 100644 --- a/src/main/java/me/rigamortis/seppuku/api/util/shader/ShaderProgram.java +++ b/src/main/java/me/rigamortis/seppuku/api/util/shader/ShaderProgram.java @@ -28,14 +28,13 @@ public class ShaderProgram { public static final String DEPTH_UNIFORM = "depth"; public static final String DEPTHDIMS_UNIFORM = "depthdims"; public static final String ENTITYBRIGHTNESS_UNIFORM = "entitybrightness"; - - private static int depthTextureCounter = 0; - private static int programBeforeGrab = 0; - private static final LinkedList programStack = new LinkedList(); public static final File shadersFsDir; public static final String SHADER_FS_PATH = "Seppuku/Shaders/"; public static final String SHADER_RES_PATH = "/assets/seppukumod/shaders/"; public static final String SHADER_RES_PATH_FORMATTED = "resource://" + SHADER_RES_PATH; + private static final LinkedList programStack = new LinkedList(); + private static int depthTextureCounter = 0; + private static int programBeforeGrab = 0; static { // make shaders directory if needed @@ -45,21 +44,21 @@ public class ShaderProgram { } } - private final Map files = new HashMap(); - private boolean boundDepth = false; - private boolean triedCompiling = false; - private boolean valid = false; - private int program = 0; - private String name; // user uniforms. these are configurable by the user and are set when the // program is used public final Map userUniforms = new HashMap(); + private final Map files = new HashMap(); // cache uniform locations to minimise number of glGetUniformLocation calls private final Map locations = new HashMap(); // if you are nesting shaders and you want to update the uniform of a shader // not currently in use, it will be queued in one of these depending on the // type of uniform private final Map uniformQueue = new HashMap(); + private boolean boundDepth = false; + private boolean triedCompiling = false; + private boolean valid = false; + private int program = 0; + private String name; public ShaderProgram(String name) { this.name = name; @@ -214,7 +213,7 @@ public class ShaderProgram { throw jsonTypeException("uniform default value type mismatched;", "a number or missing", uDefault); } - if (((String) uType).equals("int")) { + if (uType.equals("int")) { // check that numbers are whole // XXX org.json.simple stores whole numbers as Long (at least it seemed so in testing, if not, my bad -rafern) if (!(uMin instanceof Long)) { @@ -474,7 +473,7 @@ public class ShaderProgram { } this.unbindDepthTexture(); - this.programStack.remove(stackIndex); + programStack.remove(stackIndex); if (programStack.isEmpty()) { OpenGlHelper.glUseProgram(programBeforeGrab); @@ -505,14 +504,14 @@ public class ShaderProgram { locations.put(name, new Integer(fetched)); return fetched; } else { - return (int) cached; + return cached; } } public void flushUniformQueue() { if (this.make()) { for (Map.Entry entry : this.uniformQueue.entrySet()) { - entry.getValue().set((int) entry.getKey()); + entry.getValue().set(entry.getKey()); } } @@ -743,9 +742,9 @@ public class ShaderProgram { // only get depth sample if needed by shader since this is expensive if (depthUniform != -1 && !this.boundDepth) { this.boundDepth = true; - this.depthTextureCounter++; + depthTextureCounter++; - if (this.depthTextureCounter == 1) { + if (depthTextureCounter == 1) { GlStateManager.setActiveTexture(GL_TEXTURE3); // nothing special about texture 3, it's just never used (at least in vanilla) GlStateManager.enableTexture2D(); FramebufferUtil.bindDepthTexture(); @@ -754,7 +753,7 @@ public class ShaderProgram { this.setUniform(depthUniform, 3); this.setUniform(DEPTHDIMS_UNIFORM, (float) FramebufferUtil.getWidth(), (float) FramebufferUtil.getHeight()); - if (this.depthTextureCounter == 1) { + if (depthTextureCounter == 1) { GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); } } @@ -767,11 +766,11 @@ public class ShaderProgram { private void unbindDepthTexture() { if (this.boundDepth) { this.boundDepth = false; - this.depthTextureCounter--; + depthTextureCounter--; - if (this.depthTextureCounter < 0) { + if (depthTextureCounter < 0) { throw new RuntimeException("Too many depth texture unbinds; there's a bug somewhere, report this"); - } else if (this.depthTextureCounter == 0) { + } else if (depthTextureCounter == 0) { GlStateManager.setActiveTexture(GL_TEXTURE3); GlStateManager.bindTexture(0); GlStateManager.disableTexture2D(); diff --git a/src/main/java/me/rigamortis/seppuku/api/util/shader/UniformUtil.java b/src/main/java/me/rigamortis/seppuku/api/util/shader/UniformUtil.java index d8af5ea..25888d5 100644 --- a/src/main/java/me/rigamortis/seppuku/api/util/shader/UniformUtil.java +++ b/src/main/java/me/rigamortis/seppuku/api/util/shader/UniformUtil.java @@ -17,8 +17,268 @@ import static org.lwjgl.opengl.GL21.*; * Util for setting uniforms with any supported type */ public final class UniformUtil { - public static interface UValue { - public void set(int loc); + private static Boolean arbShaders = null; + private static boolean canWarn = true; + + private static boolean usingArbShaders() { + if (arbShaders == null) { + // OpenGlHelper.arbShaders is private :( + ContextCapabilities contextcapabilities = GLContext.getCapabilities(); + arbShaders = new Boolean(contextcapabilities.OpenGL21); + } + + return arbShaders; + } + + private static void showWarning(String message) { + if (canWarn) { + canWarn = false; + Seppuku.INSTANCE.getLogger().log(Level.WARNING, message + ". No further warning will be shown"); + } + } + + // methods for setting regular uniforms + public static void set(int loc, float v0) { + if (usingArbShaders()) { + glUniform1fARB(loc, v0); + } else { + glUniform1f(loc, v0); + } + } + + public static void set(int loc, float v0, float v1) { + if (usingArbShaders()) { + glUniform2fARB(loc, v0, v1); + } else { + glUniform2f(loc, v0, v1); + } + } + + public static void set(int loc, float v0, float v1, float v2) { + if (usingArbShaders()) { + glUniform3fARB(loc, v0, v1, v2); + } else { + glUniform3f(loc, v0, v1, v2); + } + } + + public static void set(int loc, float v0, float v1, float v2, float v3) { + if (usingArbShaders()) { + glUniform4fARB(loc, v0, v1, v2, v3); + } else { + glUniform4f(loc, v0, v1, v2, v3); + } + } + + public static void set(int loc, int v0) { + if (usingArbShaders()) { + glUniform1iARB(loc, v0); + } else { + glUniform1i(loc, v0); + } + } + + public static void set(int loc, int v0, int v1) { + if (usingArbShaders()) { + glUniform2iARB(loc, v0, v1); + } else { + glUniform2i(loc, v0, v1); + } + } + + public static void set(int loc, int v0, int v1, int v2) { + if (usingArbShaders()) { + glUniform3iARB(loc, v0, v1, v2); + } else { + glUniform3i(loc, v0, v1, v2); + } + } + + public static void set(int loc, int v0, int v1, int v2, int v3) { + if (usingArbShaders()) { + glUniform4iARB(loc, v0, v1, v2, v3); + } else { + glUniform4i(loc, v0, v1, v2, v3); + } + } + + public static void set(int loc, boolean v0) { + set(loc, v0 ? 1 : 0); + } + + public static void set(int loc, boolean v0, boolean v1) { + set(loc, v0 ? 1 : 0, v1 ? 1 : 0); + } + + public static void set(int loc, boolean v0, boolean v1, boolean v2) { + set(loc, v0 ? 1 : 0, v1 ? 1 : 0, v2 ? 1 : 0); + } + + public static void set(int loc, boolean v0, boolean v1, boolean v2, boolean v3) { + set(loc, v0 ? 1 : 0, v1 ? 1 : 0, v2 ? 1 : 0, v3 ? 1 : 0); + } + + // methods for setting array uniforms. does no bounds checking; WILL crash on invalid data + public static void set(int loc, int vecSize, FloatBuffer val) { + switch (vecSize) { + case 1: + OpenGlHelper.glUniform1(loc, val); + break; + case 2: + OpenGlHelper.glUniform2(loc, val); + break; + case 3: + OpenGlHelper.glUniform3(loc, val); + break; + case 4: + OpenGlHelper.glUniform4(loc, val); + break; + default: + throw new RuntimeException("Invalid vector size for UniformUtil.set: " + vecSize); + } + } + + public static void set(int loc, int vecSize, IntBuffer val) { + switch (vecSize) { + case 1: + OpenGlHelper.glUniform1(loc, val); + break; + case 2: + OpenGlHelper.glUniform2(loc, val); + break; + case 3: + OpenGlHelper.glUniform3(loc, val); + break; + case 4: + OpenGlHelper.glUniform4(loc, val); + break; + default: + throw new RuntimeException("Invalid vector size for UniformUtil.set: " + vecSize); + } + } + + // methods for setting matrix uniforms. does no bounds checking; WILL crash on invalid data + public static void set(int loc, int matrixSize, boolean transpose, FloatBuffer val) { + switch (matrixSize) { + case 2: + OpenGlHelper.glUniformMatrix2(loc, transpose, val); + break; + case 3: + OpenGlHelper.glUniformMatrix3(loc, transpose, val); + break; + case 4: + OpenGlHelper.glUniformMatrix4(loc, transpose, val); + break; + case 23: // 2x3 not 23 + if (usingArbShaders()) { + showWarning("2x3 matrix uniform with location " + loc + " not set since this feature is not available with ARB shaders; OpenGL 2.1 required"); + } else { + glUniformMatrix2x3(loc, transpose, val); + } + break; + case 32: // 3x2 not 32 + if (usingArbShaders()) { + showWarning("3x2 matrix uniform with location " + loc + " not set since this feature is not available with ARB shaders; OpenGL 2.1 required"); + } else { + glUniformMatrix3x2(loc, transpose, val); + } + break; + case 24: // 2x4 not 24 + if (usingArbShaders()) { + showWarning("2x4 matrix uniform with location " + loc + " not set since this feature is not available with ARB shaders; OpenGL 2.1 required"); + } else { + glUniformMatrix2x4(loc, transpose, val); + } + break; + case 42: // 4x2 not 42 + if (usingArbShaders()) { + showWarning("4x2 matrix uniform with location " + loc + " not set since this feature is not available with ARB shaders; OpenGL 2.1 required"); + } else { + glUniformMatrix4x2(loc, transpose, val); + } + break; + case 34: // 3x4 not 34 + if (usingArbShaders()) { + showWarning("3x4 matrix uniform with location " + loc + " not set since this feature is not available with ARB shaders; OpenGL 2.1 required"); + } else { + glUniformMatrix3x4(loc, transpose, val); + } + break; + case 43: // 4x3 not 43 + if (usingArbShaders()) { + showWarning("4x3 matrix uniform with location " + loc + " not set since this feature is not available with ARB shaders; OpenGL 2.1 required"); + } else { + glUniformMatrix4x3(loc, transpose, val); + } + break; + default: + throw new RuntimeException("Invalid matrix size for UniformUtil.set: " + matrixSize); + } + } + + // methods for turning a uniform value into a single object so it can be set later + public static UFVec1 wrap(float v0) { + return new UFVec1(v0); + } + + public static UFVec2 wrap(float v0, float v1) { + return new UFVec2(v0, v1); + } + + public static UFVec3 wrap(float v0, float v1, float v2) { + return new UFVec3(v0, v1, v2); + } + + public static UFVec4 wrap(float v0, float v1, float v2, float v3) { + return new UFVec4(v0, v1, v2, v3); + } + + public static UIVec1 wrap(int v0) { + return new UIVec1(v0); + } + + public static UIVec2 wrap(int v0, int v1) { + return new UIVec2(v0, v1); + } + + public static UIVec3 wrap(int v0, int v1, int v2) { + return new UIVec3(v0, v1, v2); + } + + public static UIVec4 wrap(int v0, int v1, int v2, int v3) { + return new UIVec4(v0, v1, v2, v3); + } + + public static UIVec1 wrap(boolean v0) { + return wrap(v0 ? 1 : 0); + } + + public static UIVec2 wrap(boolean v0, boolean v1) { + return wrap(v0 ? 1 : 0, v1 ? 1 : 0); + } + + public static UIVec3 wrap(boolean v0, boolean v1, boolean v2) { + return wrap(v0 ? 1 : 0, v1 ? 1 : 0, v2 ? 1 : 0); + } + + public static UIVec4 wrap(boolean v0, boolean v1, boolean v2, boolean v3) { + return wrap(v0 ? 1 : 0, v1 ? 1 : 0, v2 ? 1 : 0, v3 ? 1 : 0); + } + + public static UFArray wrap(int vecSize, FloatBuffer val) { + return new UFArray(vecSize, val); + } + + public static UIArray wrap(int vecSize, IntBuffer val) { + return new UIArray(vecSize, val); + } + + public static UMatrix wrap(int matrixSize, boolean transpose, FloatBuffer val) { + return new UMatrix(matrixSize, transpose, val); + } + + public interface UValue { + void set(int loc); } public static class UIVec1 implements UValue { @@ -147,7 +407,7 @@ public final class UniformUtil { public UIArray(int vecSize, IntBuffer buffer) { if (vecSize < 1 || vecSize > 4) { - throw new RuntimeException("Invalid vector size for UIArray: " + String.valueOf(vecSize)); + throw new RuntimeException("Invalid vector size for UIArray: " + vecSize); } this.vecSize = vecSize; @@ -165,7 +425,7 @@ public final class UniformUtil { public UFArray(int vecSize, FloatBuffer buffer) { if (vecSize < 1 || vecSize > 4) { - throw new RuntimeException("Invalid vector size for UFArray: " + String.valueOf(vecSize)); + throw new RuntimeException("Invalid vector size for UFArray: " + vecSize); } this.vecSize = vecSize; @@ -184,7 +444,7 @@ public final class UniformUtil { public UMatrix(int matrixSize, boolean transpose, FloatBuffer buffer) { if (matrixSize < 2 || matrixSize > 4) { - throw new RuntimeException("Invalid matrix size for UMatrix: " + String.valueOf(matrixSize)); + throw new RuntimeException("Invalid matrix size for UMatrix: " + matrixSize); } this.matrixSize = matrixSize; @@ -196,265 +456,4 @@ public final class UniformUtil { UniformUtil.set(loc, this.matrixSize, this.transpose, this.buffer); } } - - private static Boolean arbShaders = null; - - private static boolean usingArbShaders() { - if (arbShaders == null) { - // OpenGlHelper.arbShaders is private :( - ContextCapabilities contextcapabilities = GLContext.getCapabilities(); - arbShaders = new Boolean(contextcapabilities.OpenGL21); - } - - return (boolean) arbShaders; - } - - private static boolean canWarn = true; - - private static void showWarning(String message) { - if (canWarn) { - canWarn = false; - Seppuku.INSTANCE.getLogger().log(Level.WARNING, message + ". No further warning will be shown"); - } - } - - // methods for setting regular uniforms - public static void set(int loc, float v0) { - if (usingArbShaders()) { - glUniform1fARB(loc, v0); - } else { - glUniform1f(loc, v0); - } - } - - public static void set(int loc, float v0, float v1) { - if (usingArbShaders()) { - glUniform2fARB(loc, v0, v1); - } else { - glUniform2f(loc, v0, v1); - } - } - - public static void set(int loc, float v0, float v1, float v2) { - if (usingArbShaders()) { - glUniform3fARB(loc, v0, v1, v2); - } else { - glUniform3f(loc, v0, v1, v2); - } - } - - public static void set(int loc, float v0, float v1, float v2, float v3) { - if (usingArbShaders()) { - glUniform4fARB(loc, v0, v1, v2, v3); - } else { - glUniform4f(loc, v0, v1, v2, v3); - } - } - - public static void set(int loc, int v0) { - if (usingArbShaders()) { - glUniform1iARB(loc, v0); - } else { - glUniform1i(loc, v0); - } - } - - public static void set(int loc, int v0, int v1) { - if (usingArbShaders()) { - glUniform2iARB(loc, v0, v1); - } else { - glUniform2i(loc, v0, v1); - } - } - - public static void set(int loc, int v0, int v1, int v2) { - if (usingArbShaders()) { - glUniform3iARB(loc, v0, v1, v2); - } else { - glUniform3i(loc, v0, v1, v2); - } - } - - public static void set(int loc, int v0, int v1, int v2, int v3) { - if (usingArbShaders()) { - glUniform4iARB(loc, v0, v1, v2, v3); - } else { - glUniform4i(loc, v0, v1, v2, v3); - } - } - - public static void set(int loc, boolean v0) { - set(loc, v0 ? 1 : 0); - } - - public static void set(int loc, boolean v0, boolean v1) { - set(loc, v0 ? 1 : 0, v1 ? 1 : 0); - } - - public static void set(int loc, boolean v0, boolean v1, boolean v2) { - set(loc, v0 ? 1 : 0, v1 ? 1 : 0, v2 ? 1 : 0); - } - - public static void set(int loc, boolean v0, boolean v1, boolean v2, boolean v3) { - set(loc, v0 ? 1 : 0, v1 ? 1 : 0, v2 ? 1 : 0, v3 ? 1 : 0); - } - - // methods for setting array uniforms. does no bounds checking; WILL crash on invalid data - public static void set(int loc, int vecSize, FloatBuffer val) { - switch (vecSize) { - case 1: - OpenGlHelper.glUniform1(loc, val); - break; - case 2: - OpenGlHelper.glUniform2(loc, val); - break; - case 3: - OpenGlHelper.glUniform3(loc, val); - break; - case 4: - OpenGlHelper.glUniform4(loc, val); - break; - default: - throw new RuntimeException("Invalid vector size for UniformUtil.set: " + String.valueOf(vecSize)); - } - } - - public static void set(int loc, int vecSize, IntBuffer val) { - switch (vecSize) { - case 1: - OpenGlHelper.glUniform1(loc, val); - break; - case 2: - OpenGlHelper.glUniform2(loc, val); - break; - case 3: - OpenGlHelper.glUniform3(loc, val); - break; - case 4: - OpenGlHelper.glUniform4(loc, val); - break; - default: - throw new RuntimeException("Invalid vector size for UniformUtil.set: " + String.valueOf(vecSize)); - } - } - - // methods for setting matrix uniforms. does no bounds checking; WILL crash on invalid data - public static void set(int loc, int matrixSize, boolean transpose, FloatBuffer val) { - switch (matrixSize) { - case 2: - OpenGlHelper.glUniformMatrix2(loc, transpose, val); - break; - case 3: - OpenGlHelper.glUniformMatrix3(loc, transpose, val); - break; - case 4: - OpenGlHelper.glUniformMatrix4(loc, transpose, val); - break; - case 23: // 2x3 not 23 - if (usingArbShaders()) { - showWarning("2x3 matrix uniform with location " + String.valueOf(loc) + " not set since this feature is not available with ARB shaders; OpenGL 2.1 required"); - } else { - glUniformMatrix2x3(loc, transpose, val); - } - break; - case 32: // 3x2 not 32 - if (usingArbShaders()) { - showWarning("3x2 matrix uniform with location " + String.valueOf(loc) + " not set since this feature is not available with ARB shaders; OpenGL 2.1 required"); - } else { - glUniformMatrix3x2(loc, transpose, val); - } - break; - case 24: // 2x4 not 24 - if (usingArbShaders()) { - showWarning("2x4 matrix uniform with location " + String.valueOf(loc) + " not set since this feature is not available with ARB shaders; OpenGL 2.1 required"); - } else { - glUniformMatrix2x4(loc, transpose, val); - } - break; - case 42: // 4x2 not 42 - if (usingArbShaders()) { - showWarning("4x2 matrix uniform with location " + String.valueOf(loc) + " not set since this feature is not available with ARB shaders; OpenGL 2.1 required"); - } else { - glUniformMatrix4x2(loc, transpose, val); - } - break; - case 34: // 3x4 not 34 - if (usingArbShaders()) { - showWarning("3x4 matrix uniform with location " + String.valueOf(loc) + " not set since this feature is not available with ARB shaders; OpenGL 2.1 required"); - } else { - glUniformMatrix3x4(loc, transpose, val); - } - break; - case 43: // 4x3 not 43 - if (usingArbShaders()) { - showWarning("4x3 matrix uniform with location " + String.valueOf(loc) + " not set since this feature is not available with ARB shaders; OpenGL 2.1 required"); - } else { - glUniformMatrix4x3(loc, transpose, val); - } - break; - default: - throw new RuntimeException("Invalid matrix size for UniformUtil.set: " + String.valueOf(matrixSize)); - } - } - - // methods for turning a uniform value into a single object so it can be set later - public static UFVec1 wrap(float v0) { - return new UFVec1(v0); - } - - public static UFVec2 wrap(float v0, float v1) { - return new UFVec2(v0, v1); - } - - public static UFVec3 wrap(float v0, float v1, float v2) { - return new UFVec3(v0, v1, v2); - } - - public static UFVec4 wrap(float v0, float v1, float v2, float v3) { - return new UFVec4(v0, v1, v2, v3); - } - - public static UIVec1 wrap(int v0) { - return new UIVec1(v0); - } - - public static UIVec2 wrap(int v0, int v1) { - return new UIVec2(v0, v1); - } - - public static UIVec3 wrap(int v0, int v1, int v2) { - return new UIVec3(v0, v1, v2); - } - - public static UIVec4 wrap(int v0, int v1, int v2, int v3) { - return new UIVec4(v0, v1, v2, v3); - } - - public static UIVec1 wrap(boolean v0) { - return wrap(v0 ? 1 : 0); - } - - public static UIVec2 wrap(boolean v0, boolean v1) { - return wrap(v0 ? 1 : 0, v1 ? 1 : 0); - } - - public static UIVec3 wrap(boolean v0, boolean v1, boolean v2) { - return wrap(v0 ? 1 : 0, v1 ? 1 : 0, v2 ? 1 : 0); - } - - public static UIVec4 wrap(boolean v0, boolean v1, boolean v2, boolean v3) { - return wrap(v0 ? 1 : 0, v1 ? 1 : 0, v2 ? 1 : 0, v3 ? 1 : 0); - } - - public static UFArray wrap(int vecSize, FloatBuffer val) { - return new UFArray(vecSize, val); - } - - public static UIArray wrap(int vecSize, IntBuffer val) { - return new UIArray(vecSize, val); - } - - public static UMatrix wrap(int matrixSize, boolean transpose, FloatBuffer val) { - return new UMatrix(matrixSize, transpose, val); - } } diff --git a/src/main/java/me/rigamortis/seppuku/api/value/Regex.java b/src/main/java/me/rigamortis/seppuku/api/value/Regex.java index c4bc8e8..c12243e 100644 --- a/src/main/java/me/rigamortis/seppuku/api/value/Regex.java +++ b/src/main/java/me/rigamortis/seppuku/api/value/Regex.java @@ -16,6 +16,10 @@ public class Regex { this.setPatternString(patternString); } + public String getPatternString() { + return this.patternString; + } + public void setPatternString(String patternString) { this.patternString = patternString; if (patternString.equals("")) { @@ -30,10 +34,6 @@ public class Regex { } } - public String getPatternString() { - return this.patternString; - } - @Nullable public Pattern getPattern() { return this.pattern; diff --git a/src/main/java/me/rigamortis/seppuku/api/value/Shader.java b/src/main/java/me/rigamortis/seppuku/api/value/Shader.java index 6b60494..4418c80 100644 --- a/src/main/java/me/rigamortis/seppuku/api/value/Shader.java +++ b/src/main/java/me/rigamortis/seppuku/api/value/Shader.java @@ -16,14 +16,14 @@ public class Shader { this(""); } - public void setShaderID(String id) { - this.id = id; - } - public String getShaderID() { return this.id; } + public void setShaderID(String id) { + this.id = id; + } + @Nullable public ShaderProgram getShaderProgram() { if (this.id.equals("")) { diff --git a/src/main/java/me/rigamortis/seppuku/api/value/Value.java b/src/main/java/me/rigamortis/seppuku/api/value/Value.java index b4629bd..5256be7 100644 --- a/src/main/java/me/rigamortis/seppuku/api/value/Value.java +++ b/src/main/java/me/rigamortis/seppuku/api/value/Value.java @@ -73,7 +73,7 @@ public class Value { } public String getCapitalizedName() { - return Character.toString(this.getName().charAt(0)) + this.getName().toLowerCase().replaceFirst(Character.toString(this.getName().charAt(0)).toLowerCase(), ""); + return this.getName().charAt(0) + this.getName().toLowerCase().replaceFirst(Character.toString(this.getName().charAt(0)).toLowerCase(), ""); } public String getCapitalizedValue() { diff --git a/src/main/java/me/rigamortis/seppuku/impl/command/CalcStrongholdCommand.java b/src/main/java/me/rigamortis/seppuku/impl/command/CalcStrongholdCommand.java index a3670ac..024a25d 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/command/CalcStrongholdCommand.java +++ b/src/main/java/me/rigamortis/seppuku/impl/command/CalcStrongholdCommand.java @@ -26,14 +26,12 @@ import team.stiff.pomelo.impl.annotated.handler.annotation.Listener; */ public final class CalcStrongholdCommand extends Command { + private final String[] resetAlias = new String[]{"Reset", "Res", "R"}; private Vec3d firstStart; private Vec3d firstEnd; - private Vec3d secondStart; private Vec3d secondEnd; - private final String[] resetAlias = new String[]{"Reset", "Res", "R"}; - public CalcStrongholdCommand() { super("CalcStronghold", new String[]{"CS", "FindStronghold", "cstrong"}, "Calculates where the nearest stronghold is", "CalcStronghold\n" + "CalcStronghold Reset"); diff --git a/src/main/java/me/rigamortis/seppuku/impl/command/EnchantCommand.java b/src/main/java/me/rigamortis/seppuku/impl/command/EnchantCommand.java index a226431..bf22402 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/command/EnchantCommand.java +++ b/src/main/java/me/rigamortis/seppuku/impl/command/EnchantCommand.java @@ -67,13 +67,13 @@ public final class EnchantCommand extends Command { // disable curses? (used when doing all enchants) if (split.length > 3) { final String disableCurses = split[3]; - if (disableCurses.toLowerCase().equals("true") && enchant.isCurse()) + if (disableCurses.equalsIgnoreCase("true") && enchant.isCurse()) continue; } final String enchantmentName = enchant.getTranslatedName(0).replaceAll(" ", ""); - if (enchantToApply.toLowerCase().equals("all") || enchantmentName.toLowerCase().startsWith(enchantToApply.toLowerCase())) { + if (enchantToApply.equalsIgnoreCase("all") || enchantmentName.toLowerCase().startsWith(enchantToApply.toLowerCase())) { final NBTTagCompound enchantmentCompound = new NBTTagCompound(); enchantmentCompound.setShort("id", (short) Enchantment.getEnchantmentID(enchant)); // set the enchant id if (levelToApply.toLowerCase().startsWith("max")) { diff --git a/src/main/java/me/rigamortis/seppuku/impl/command/LocateFeatureCommand.java b/src/main/java/me/rigamortis/seppuku/impl/command/LocateFeatureCommand.java index 544f5ee..7c74d90 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/command/LocateFeatureCommand.java +++ b/src/main/java/me/rigamortis/seppuku/impl/command/LocateFeatureCommand.java @@ -54,7 +54,7 @@ public final class LocateFeatureCommand extends Command { Seppuku.INSTANCE.errorChat("Unknown number " + "\247f\"" + split[2] + "\""); return; } - originHint = "to " + String.valueOf(originPos.getX()) + ", " + String.valueOf(originPos.getZ()); + originHint = "to " + originPos.getX() + ", " + originPos.getZ(); } else { originPos = new BlockPos(Minecraft.getMinecraft().player.posX, 64, Minecraft.getMinecraft().player.posZ); originHint = "you"; @@ -69,7 +69,7 @@ public final class LocateFeatureCommand extends Command { if (pos == null) { Seppuku.INSTANCE.errorChat("No structure found " + "\247f\"" + split[1] + "\""); } else { - Seppuku.INSTANCE.logChat(split[1] + " nearest " + originHint + " is at " + String.valueOf(pos.getX()) + ", " + String.valueOf(pos.getZ())); + Seppuku.INSTANCE.logChat(split[1] + " nearest " + originHint + " is at " + pos.getX() + ", " + pos.getZ()); } } else { Seppuku.INSTANCE.errorChat("Seed not set. Use the seed command first"); diff --git a/src/main/java/me/rigamortis/seppuku/impl/gui/hud/anchor/AnchorPoint.java b/src/main/java/me/rigamortis/seppuku/impl/gui/hud/anchor/AnchorPoint.java index 497eb34..4a6965c 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/gui/hud/anchor/AnchorPoint.java +++ b/src/main/java/me/rigamortis/seppuku/impl/gui/hud/anchor/AnchorPoint.java @@ -47,10 +47,6 @@ public class AnchorPoint { this.point = point; } - public enum Point { - TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT, TOP_CENTER, BOTTOM_CENTER - } - public void updatePosition(final ScaledResolution sr) { switch (this.getPoint()) { case TOP_LEFT: @@ -79,4 +75,8 @@ public class AnchorPoint { break; } } + + public enum Point { + TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT, TOP_CENTER, BOTTOM_CENTER + } } diff --git a/src/main/java/me/rigamortis/seppuku/impl/gui/hud/component/BattleInfoComponent.java b/src/main/java/me/rigamortis/seppuku/impl/gui/hud/component/BattleInfoComponent.java index 23391e9..62d11e7 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/gui/hud/component/BattleInfoComponent.java +++ b/src/main/java/me/rigamortis/seppuku/impl/gui/hud/component/BattleInfoComponent.java @@ -21,13 +21,12 @@ import net.minecraft.util.EnumHand; */ public final class BattleInfoComponent extends DraggableHudComponent { + private final Texture donorsTexture; private CrystalAuraModule crystalAuraModule; private KillAuraModule killAuraModule; private AutoTrapModule autoTrapModule; private AbstractClientPlayer currentOpponent; - private final Texture donorsTexture; - public BattleInfoComponent() { super("BattleInfo"); this.setW(117); diff --git a/src/main/java/me/rigamortis/seppuku/impl/gui/hud/component/ColorsComponent.java b/src/main/java/me/rigamortis/seppuku/impl/gui/hud/component/ColorsComponent.java index cb55b2c..f0df814 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/gui/hud/component/ColorsComponent.java +++ b/src/main/java/me/rigamortis/seppuku/impl/gui/hud/component/ColorsComponent.java @@ -28,26 +28,21 @@ import java.util.logging.Level; */ public final class ColorsComponent extends ResizableHudComponent { - private int scroll; - - private int totalHeight; - private final int SCROLL_WIDTH = 5; private final int BORDER = 2; private final int TEXT_GAP = 1; private final int TITLE_BAR_HEIGHT = mc.fontRenderer.FONT_HEIGHT + 1; - - private ColorComponent currentColorComponent = null; private final Texture spectrum; - + public int baseColor = 0xFFFFFFFF; + public int selectedColor = 0xFFFFFFFF; + private int scroll; + private int totalHeight; + private ColorComponent currentColorComponent = null; private int lastGradientMouseX = -1; private int lastGradientMouseY = -1; private int lastSpectrumMouseX = -1; private int lastSpectrumMouseY = -1; - public int baseColor = 0xFFFFFFFF; - public int selectedColor = 0xFFFFFFFF; - public ColorsComponent() { super("Colors", 100, 120, 215, 1000); diff --git a/src/main/java/me/rigamortis/seppuku/impl/gui/hud/component/EntityListComponent.java b/src/main/java/me/rigamortis/seppuku/impl/gui/hud/component/EntityListComponent.java index 07e9553..70e0907 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/gui/hud/component/EntityListComponent.java +++ b/src/main/java/me/rigamortis/seppuku/impl/gui/hud/component/EntityListComponent.java @@ -33,8 +33,8 @@ import java.util.List; */ public final class EntityListComponent extends DraggableHudComponent { - private final List entityGroups; public final List components; + private final List entityGroups; public EntityListComponent() { super("EntityList"); @@ -321,7 +321,7 @@ public final class EntityListComponent extends DraggableHudComponent { } } - final String info = String.format("\n%s\n- Key: %s\n- Enchantments: %s\n- Durability: %s", ChatFormatting.AQUA + itemStack.getDisplayName() + ChatFormatting.RESET, itemStack.getTranslationKey(), enchantStringBuilder.toString(), itemStack.getMaxDamage() - itemStack.getItemDamage()); + final String info = String.format("\n%s\n- Key: %s\n- Enchantments: %s\n- Durability: %s", ChatFormatting.AQUA + itemStack.getDisplayName() + ChatFormatting.RESET, itemStack.getTranslationKey(), enchantStringBuilder, itemStack.getMaxDamage() - itemStack.getItemDamage()); Seppuku.INSTANCE.logChat(info); } else { final String info = String.format("\n%s\n- Key: %s\n- Count: %s\n- Metadata: %s\n- Damage: %s\n- Max Damage: %s\n- Durability: %s", ChatFormatting.GRAY + itemStack.getDisplayName(), itemStack.getTranslationKey(), itemStack.getCount(), itemStack.getMetadata(), itemStack.getItemDamage(), itemStack.getMaxDamage(), itemStack.getMaxDamage() - itemStack.getItemDamage()); diff --git a/src/main/java/me/rigamortis/seppuku/impl/gui/hud/component/HubComponent.java b/src/main/java/me/rigamortis/seppuku/impl/gui/hud/component/HubComponent.java index 140d788..f825230 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/gui/hud/component/HubComponent.java +++ b/src/main/java/me/rigamortis/seppuku/impl/gui/hud/component/HubComponent.java @@ -18,17 +18,14 @@ import org.lwjgl.opengl.GL11; */ public final class HubComponent extends ResizableHudComponent { - private int scroll; - - private int totalHeight; - private final int SCROLL_WIDTH = 5; private final int BORDER = 2; private final int TEXT_GAP = 1; private final int TEXTURE_SIZE = 8; private final int TITLE_BAR_HEIGHT = mc.fontRenderer.FONT_HEIGHT + 1; - private final Texture texture; + private int scroll; + private int totalHeight; public HubComponent() { super("Hub", 100, 120, 125, 1000); diff --git a/src/main/java/me/rigamortis/seppuku/impl/gui/hud/component/TrayComponent.java b/src/main/java/me/rigamortis/seppuku/impl/gui/hud/component/TrayComponent.java index 3e0336b..bf9bb87 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/gui/hud/component/TrayComponent.java +++ b/src/main/java/me/rigamortis/seppuku/impl/gui/hud/component/TrayComponent.java @@ -19,10 +19,8 @@ public class TrayComponent extends DraggableHudComponent { private static final int TEXTURE_WIDTH = 16; private static final int TEXTURE_HEIGHT = 16; - - private ToolTipComponent currentToolTip; - private final List buttons = new ArrayList<>(); + private ToolTipComponent currentToolTip; public TrayComponent() { super("Tray"); @@ -96,9 +94,9 @@ public class TrayComponent extends DraggableHudComponent { public static class TrayButtonComponent extends HudComponent { - private boolean pressed; private final Texture textureOff; private final Texture textureOn; + private boolean pressed; public TrayButtonComponent(String name) { super(name); diff --git a/src/main/java/me/rigamortis/seppuku/impl/gui/hud/component/graph/FpsGraphComponent.java b/src/main/java/me/rigamortis/seppuku/impl/gui/hud/component/graph/FpsGraphComponent.java index d91bbb4..4c7a320 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/gui/hud/component/graph/FpsGraphComponent.java +++ b/src/main/java/me/rigamortis/seppuku/impl/gui/hud/component/graph/FpsGraphComponent.java @@ -8,7 +8,6 @@ import me.rigamortis.seppuku.api.value.Value; import me.rigamortis.seppuku.impl.gui.hud.GuiHudEditor; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.util.math.MathHelper; import org.lwjgl.input.Keyboard; import org.lwjgl.opengl.GL11; @@ -184,9 +183,9 @@ public final class FpsGraphComponent extends ResizableHudComponent { this.speed = speed; this.color = new Color(255, 255, 255); } - + public FpsNode() { - + } } } diff --git a/src/main/java/me/rigamortis/seppuku/impl/gui/hud/component/module/ModuleListComponent.java b/src/main/java/me/rigamortis/seppuku/impl/gui/hud/component/module/ModuleListComponent.java index 198834d..ff9b4a4 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/gui/hud/component/module/ModuleListComponent.java +++ b/src/main/java/me/rigamortis/seppuku/impl/gui/hud/component/module/ModuleListComponent.java @@ -35,26 +35,21 @@ import java.util.List; public final class ModuleListComponent extends ResizableHudComponent { private final Module.ModuleType type; - - private int scroll = 0; - private int oldScroll = 0; - private int totalHeight; - private final int SCROLL_WIDTH = 5; private final int BORDER = 2; private final int TEXT_GAP = 1; private final int TEXTURE_SIZE = 8; private final int TITLE_BAR_HEIGHT = mc.fontRenderer.FONT_HEIGHT + 1; - - private String originalName = ""; - private String title = ""; - private final HudEditorModule hudEditorModule; private final Texture texture; private final Texture gearTexture; - - private ToolTipComponent currentToolTip; public ModuleSettingsComponent currentSettings; + private int scroll = 0; + private int oldScroll = 0; + private int totalHeight; + private String originalName = ""; + private String title = ""; + private ToolTipComponent currentToolTip; public ModuleListComponent(Module.ModuleType type) { super(StringUtils.capitalize(type.name().toLowerCase()), 100, 100, 150, 400); @@ -592,7 +587,7 @@ public final class ModuleListComponent extends ResizableHudComponent { this.addComponentToButtons(valueText);*/ CarouselComponent carouselComponent = new CarouselComponent(value.getName(), value); - carouselComponent.setTooltipText(value.getDesc() + " " + ChatFormatting.GRAY + "(" + options.toString() + ")"); + carouselComponent.setTooltipText(value.getDesc() + " " + ChatFormatting.GRAY + "(" + options + ")"); components.add(carouselComponent); this.addComponentToButtons(carouselComponent); } else if (value.getValue() instanceof String) { diff --git a/src/main/java/me/rigamortis/seppuku/impl/gui/menu/GuiAltManager.java b/src/main/java/me/rigamortis/seppuku/impl/gui/menu/GuiAltManager.java index 0f8e664..aa1354e 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/gui/menu/GuiAltManager.java +++ b/src/main/java/me/rigamortis/seppuku/impl/gui/menu/GuiAltManager.java @@ -77,7 +77,7 @@ public final class GuiAltManager extends GuiScreen implements GuiYesNoCallback { break; case 1: if (this.guiListAlt.hasSelected() && this.guiListAlt.getSelected() != null) { - mc.displayGuiScreen((GuiScreen) new GuiYesNo(this, "Remove account '" + this.guiListAlt.getSelected().getAlt().getUsername() + "'?", "", "Yes", "No", 0)); + mc.displayGuiScreen(new GuiYesNo(this, "Remove account '" + this.guiListAlt.getSelected().getAlt().getUsername() + "'?", "", "Yes", "No", 0)); } break; case 2: diff --git a/src/main/java/me/rigamortis/seppuku/impl/management/CapeManager.java b/src/main/java/me/rigamortis/seppuku/impl/management/CapeManager.java index e99bb99..a929d98 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/management/CapeManager.java +++ b/src/main/java/me/rigamortis/seppuku/impl/management/CapeManager.java @@ -129,9 +129,7 @@ public final class CapeManager { final CapeUser user = this.find(player); if (user != null) { final ResourceLocation res = this.findResource(user.getCape()); - if (res != null) { - return res; - } + return res; } return null; } diff --git a/src/main/java/me/rigamortis/seppuku/impl/management/ChatManager.java b/src/main/java/me/rigamortis/seppuku/impl/management/ChatManager.java index cc87418..66b686d 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/management/ChatManager.java +++ b/src/main/java/me/rigamortis/seppuku/impl/management/ChatManager.java @@ -17,9 +17,9 @@ import java.util.List; */ public final class ChatManager { - private Timer timer = new Timer(); + private final Timer timer = new Timer(); - private List chatBuffer = new ArrayList<>(); + private final List chatBuffer = new ArrayList<>(); private World world; diff --git a/src/main/java/me/rigamortis/seppuku/impl/management/ConfigManager.java b/src/main/java/me/rigamortis/seppuku/impl/management/ConfigManager.java index c7bed0b..277d765 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/management/ConfigManager.java +++ b/src/main/java/me/rigamortis/seppuku/impl/management/ConfigManager.java @@ -15,17 +15,14 @@ import java.util.List; */ public final class ConfigManager { + public static final String CONFIG_PATH = "Seppuku/Config/"; private File configDir; private File moduleConfigDir; private File hudComponentConfigDir; - private boolean firstLaunch = false; private boolean customMainMenuHidden = false; - private List configurableList = new ArrayList<>(); - public static final String CONFIG_PATH = "Seppuku/Config/"; - public ConfigManager() { this.generateDirectories(); } diff --git a/src/main/java/me/rigamortis/seppuku/impl/management/HudManager.java b/src/main/java/me/rigamortis/seppuku/impl/management/HudManager.java index 78e2933..3ab369c 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/management/HudManager.java +++ b/src/main/java/me/rigamortis/seppuku/impl/management/HudManager.java @@ -32,11 +32,10 @@ import java.util.stream.Collectors; */ public final class HudManager { + private final FirstLaunchComponent firstLaunchComponent; private List componentList = new CopyOnWriteArrayList<>(); private List anchorPoints = new ArrayList<>(); - private final FirstLaunchComponent firstLaunchComponent; - public HudManager() { final ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); diff --git a/src/main/java/me/rigamortis/seppuku/impl/management/ModuleManager.java b/src/main/java/me/rigamortis/seppuku/impl/management/ModuleManager.java index 94a28e7..167d85d 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/management/ModuleManager.java +++ b/src/main/java/me/rigamortis/seppuku/impl/management/ModuleManager.java @@ -317,6 +317,10 @@ public final class ModuleManager { return moduleList; } + public void setModuleList(List moduleList) { + this.moduleList = moduleList; + } + public List getModuleList(Module.ModuleType type) { List list = new ArrayList<>(); for (Module module : moduleList) { @@ -326,8 +330,4 @@ public final class ModuleManager { } return list; } - - public void setModuleList(List moduleList) { - this.moduleList = moduleList; - } } diff --git a/src/main/java/me/rigamortis/seppuku/impl/management/NotificationManager.java b/src/main/java/me/rigamortis/seppuku/impl/management/NotificationManager.java index 66fec22..633e64d 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/management/NotificationManager.java +++ b/src/main/java/me/rigamortis/seppuku/impl/management/NotificationManager.java @@ -41,9 +41,7 @@ public final class NotificationManager implements Animation { } public void removeNotification(Notification notification) { - if (this.notifications.contains(notification)) { - this.notifications.remove(notification); - } + this.notifications.remove(notification); } public List getNotifications() { diff --git a/src/main/java/me/rigamortis/seppuku/impl/management/ShaderManager.java b/src/main/java/me/rigamortis/seppuku/impl/management/ShaderManager.java index 40fad67..b91028b 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/management/ShaderManager.java +++ b/src/main/java/me/rigamortis/seppuku/impl/management/ShaderManager.java @@ -13,8 +13,8 @@ import java.util.logging.Level; public final class ShaderManager { // XXX a bimap would be better for this but i didnt want an extra library for a single class -rafern - private Map shaderList = new HashMap(); - private Map programToID = new HashMap(); + private final Map shaderList = new HashMap(); + private final Map programToID = new HashMap(); public ShaderManager() { this.loadShaders(); diff --git a/src/main/java/me/rigamortis/seppuku/impl/management/TickRateManager.java b/src/main/java/me/rigamortis/seppuku/impl/management/TickRateManager.java index 4b340f6..64cb92e 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/management/TickRateManager.java +++ b/src/main/java/me/rigamortis/seppuku/impl/management/TickRateManager.java @@ -14,7 +14,7 @@ import team.stiff.pomelo.impl.annotated.handler.annotation.Listener; public final class TickRateManager { private long prevTime; - private float[] ticks = new float[20]; + private final float[] ticks = new float[20]; private int currentTick; private float lastTick = -1; diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/combat/AutoTrapModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/combat/AutoTrapModule.java index aa08fee..875520c 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/combat/AutoTrapModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/combat/AutoTrapModule.java @@ -288,11 +288,7 @@ public final class AutoTrapModule extends Module { } private boolean checkFilter(Entity entity) { - boolean ret = false; - - if (entity instanceof EntityPlayer && entity != mc.player && Seppuku.INSTANCE.getFriendManager().isFriend(entity) == null && !entity.getName().equals(mc.player.getName())) { - ret = true; - } + boolean ret = entity instanceof EntityPlayer && entity != mc.player && Seppuku.INSTANCE.getFriendManager().isFriend(entity) == null && !entity.getName().equals(mc.player.getName()); if (entity instanceof EntityLivingBase) { final EntityLivingBase entityLivingBase = (EntityLivingBase) entity; diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/combat/BurrowModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/combat/BurrowModule.java index d482e24..ec98614 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/combat/BurrowModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/combat/BurrowModule.java @@ -11,7 +11,6 @@ import me.rigamortis.seppuku.api.util.MathUtil; import me.rigamortis.seppuku.api.util.Timer; import me.rigamortis.seppuku.api.value.Value; import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; @@ -32,26 +31,19 @@ import team.stiff.pomelo.impl.annotated.handler.annotation.Listener; */ public final class BurrowModule extends Module { - public enum Mode { - JUMP, GLITCH, TP, INSTA - } - public final Value mode = new Value<>("Mode", new String[]{"m"}, "The current mode to use.", Mode.JUMP); public final Value glitchY = new Value<>("ModeGlitchY", new String[]{"mgy", "glitchy"}, "Using GLITCH mode, this will be your player's motionY", 0.5f, 0.1f, 1.5f, 0.1f); public final Value tpHeight = new Value<>("ModeTPHeight", new String[]{"mtph", "mth", "tpheight", "tpy"}, "Using TP mode, this will be how many blocks above the player to TP", 20, -30, 30, 1); public final Value delay = new Value<>("ModeDelay", new String[]{"del", "d"}, "Delay(ms) to wait for placing obsidian after the initial jump. Not used in INSTA mode", 200.0f, 1.0f, 500.0f, 1.0f); public final Value smartTp = new Value<>("ModeSmartTp", new String[]{"smart", "adaptivetp", "a", "atp"}, "Searches for an air block to tp to for INSTA mode", true); public final Value noVoid = new Value<>("ModeNoVoid", new String[]{"nonegative", "nv"}, "Doesn't tp you under Y 0", true); - public final Value rotate = new Value<>("Rotate", new String[]{"rot", "r"}, "Rotate the players head to place the block", true); public final Value center = new Value<>("Center", new String[]{"centered", "c", "cen"}, "Centers the player on their current block when beginning to place", false); public final Value offGround = new Value<>("OffGround", new String[]{"offg", "og", "o"}, "Forces player onGround to false when enabled", true); public final Value sneaking = new Value<>("Sneaking", new String[]{"sneak", "s", "fs", "sneaking"}, "Forces player to sneak when enabled", false); - private final Timer timer = new Timer(); private final RotationTask rotationTask = new RotationTask("BurrowTask", 9); // 9 == high priority private BlockPos burrowPos; - public BurrowModule() { super("Burrow", new String[]{"burow", "burro", "brrw"}, "Places obsidian inside yourself", "NONE", -1, ModuleType.COMBAT); } @@ -235,4 +227,8 @@ public final class BurrowModule extends Module { return true; } + + public enum Mode { + JUMP, GLITCH, TP, INSTA + } } diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/combat/ChestFarmerModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/combat/ChestFarmerModule.java index 1c24b10..41a8a86 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/combat/ChestFarmerModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/combat/ChestFarmerModule.java @@ -33,8 +33,6 @@ import team.stiff.pomelo.impl.annotated.handler.annotation.Listener; */ public final class ChestFarmerModule extends Module { - private final Minecraft mc = Minecraft.getMinecraft(); - //public final Value pickOnlyMode = new Value("PickaxeOnly", new String[]{"pickonly", "onlypick", "onlypicks", "onlypickaxes", "pickaxesonly", "po"}, "Only run this module while a pickaxe is being held", true); public final Value visible = new Value("Visible", new String[]{"Visible", "v"}, "Casts a ray to the placement position, forces the placement when disabled", true); public final Value rotate = new Value("Rotate", new String[]{"rotation", "r", "rotate"}, "Rotate to place the chest", true); @@ -44,7 +42,7 @@ public final class ChestFarmerModule extends Module { public final Value range = new Value("Range", new String[]{"MaxRange", "MaximumRange"}, "Range around you to mine ender chests", 3, 1, 6, 1); public final Value placeDelay = new Value("Delay", new String[]{"PlaceDelay", "PlaceDel"}, "The delay(ms) between chests being placed", 100.0f, 0.0f, 500.0f, 1.0f); public final Value safeLimit = new Value("SafeLimit", new String[]{"limit", "sl", "l"}, "The amount of ender chests we will keep and not farm", 16, 0, 128, 1); - + private final Minecraft mc = Minecraft.getMinecraft(); private final Timer placeTimer = new Timer(); private final RotationTask placeRotationTask = new RotationTask("ChestFarmerPlaceTask", 3); private final RotationTask mineRotationTask = new RotationTask("ChestFarmerMineTask", 3); diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/combat/CrystalAuraModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/combat/CrystalAuraModule.java index ab56a18..c05bea7 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/combat/CrystalAuraModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/combat/CrystalAuraModule.java @@ -10,13 +10,14 @@ import me.rigamortis.seppuku.api.event.render.EventRender3D; import me.rigamortis.seppuku.api.event.world.EventAddEntity; import me.rigamortis.seppuku.api.module.Module; import me.rigamortis.seppuku.api.task.rotation.RotationTask; -import me.rigamortis.seppuku.api.util.*; +import me.rigamortis.seppuku.api.util.ColorUtil; +import me.rigamortis.seppuku.api.util.MathUtil; +import me.rigamortis.seppuku.api.util.RenderUtil; import me.rigamortis.seppuku.api.util.Timer; import me.rigamortis.seppuku.api.value.Value; import me.rigamortis.seppuku.impl.module.player.GodModeModule; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.GlStateManager; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -450,11 +451,7 @@ public final class CrystalAuraModule extends Module { return true; } - if (this.ignore.getValue()) { - return true; - } - - return false; + return this.ignore.getValue(); } private boolean canPlaceCrystal(BlockPos pos) { @@ -504,27 +501,6 @@ public final class CrystalAuraModule extends Module { return damage; } - private static final class PlaceLocation extends Vec3i { - - private int alpha = 0xAA; - private boolean placed = false; - private float damage = -1; - - private PlaceLocation(int xIn, int yIn, int zIn, float damage) { - super(xIn, yIn, zIn); - this.damage = damage; - } - - private PlaceLocation(int xIn, int yIn, int zIn) { - super(xIn, yIn, zIn); - } - - private void update() { - if (this.alpha > 0) - this.alpha -= 2; - } - } - public Timer getAttackTimer() { return attackTimer; } @@ -565,11 +541,32 @@ public final class CrystalAuraModule extends Module { return currentAttackEntity; } + public void setCurrentAttackEntity(Entity currentAttackEntity) { + this.currentAttackEntity = currentAttackEntity; + } + public Entity getCurrentAttackPlayer() { return currentAttackPlayer; } - public void setCurrentAttackEntity(Entity currentAttackEntity) { - this.currentAttackEntity = currentAttackEntity; + private static final class PlaceLocation extends Vec3i { + + private int alpha = 0xAA; + private boolean placed = false; + private float damage = -1; + + private PlaceLocation(int xIn, int yIn, int zIn, float damage) { + super(xIn, yIn, zIn); + this.damage = damage; + } + + private PlaceLocation(int xIn, int yIn, int zIn) { + super(xIn, yIn, zIn); + } + + private void update() { + if (this.alpha > 0) + this.alpha -= 2; + } } } diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/combat/KillAuraModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/combat/KillAuraModule.java index 7b58605..759c7f2 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/combat/KillAuraModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/combat/KillAuraModule.java @@ -127,11 +127,7 @@ public final class KillAuraModule extends Module { } private boolean checkFilter(Entity entity) { - boolean ret = false; - - if (this.players.getValue() && entity instanceof EntityPlayer && entity != Minecraft.getMinecraft().player && Seppuku.INSTANCE.getFriendManager().isFriend(entity) == null && !entity.getName().equals(Minecraft.getMinecraft().player.getName())) { - ret = true; - } + boolean ret = this.players.getValue() && entity instanceof EntityPlayer && entity != Minecraft.getMinecraft().player && Seppuku.INSTANCE.getFriendManager().isFriend(entity) == null && !entity.getName().equals(Minecraft.getMinecraft().player.getName()); if (this.mobs.getValue() && entity instanceof IMob) { ret = true; diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/combat/NoCrystalModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/combat/NoCrystalModule.java index c8e6ce7..3a86e9a 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/combat/NoCrystalModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/combat/NoCrystalModule.java @@ -15,7 +15,6 @@ import me.rigamortis.seppuku.api.util.Timer; import me.rigamortis.seppuku.api.value.Value; import me.rigamortis.seppuku.impl.module.player.FreeCamModule; import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.init.Blocks; import net.minecraft.item.ItemChorusFruit; @@ -35,8 +34,6 @@ import java.util.List; */ public final class NoCrystalModule extends Module { - private final Minecraft mc = Minecraft.getMinecraft(); - public final Value extended = new Value("Extended", new String[]{"extend", "e", "big"}, "Enlarges the size of the fortress", false); public final Value visible = new Value("Visible", new String[]{"Visible", "v"}, "Casts a ray to the placement position, forces the placement when disabled", true); public final Value rotate = new Value("Rotate", new String[]{"rotation", "r", "rotate"}, "Rotate to place blocks", true); @@ -46,7 +43,7 @@ public final class NoCrystalModule extends Module { public final Value sneak = new Value("PlaceOnSneak", new String[]{"sneak", "s", "pos", "sneakPlace"}, "When true, NoCrystal will only place while the player is sneaking", false); public final Value range = new Value("Range", new String[]{"MaxRange", "MaximumRange"}, "The maximum block reaching range to continue building in", 6.0f, 1.0f, 10.0f, 0.5f); public final Value placeDelay = new Value("Delay", new String[]{"PlaceDelay", "PlaceDel"}, "The delay(ms) between obsidian blocks being placed", 100.0f, 0.0f, 500.0f, 1.0f); - + private final Minecraft mc = Minecraft.getMinecraft(); private final Timer placeTimer = new Timer(); private final Timer chorusTpTimer = new Timer(); private final RotationTask rotationTask = new RotationTask("NoCrystalTask", 8); diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/combat/TotemNotifierModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/combat/TotemNotifierModule.java index 49b900a..8519c87 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/combat/TotemNotifierModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/combat/TotemNotifierModule.java @@ -24,14 +24,13 @@ import java.util.List; * @since 6/24/20 */ public class TotemNotifierModule extends Module { + public final List entitiesWithTotems = new ArrayList<>(); final Minecraft mc = Minecraft.getMinecraft(); public TotemNotifierModule() { super("TotemNotifier", new String[]{"tm"}, "Notifies you when others pop totems", "NONE", -1, ModuleType.COMBAT); } - public final List entitiesWithTotems = new ArrayList<>(); - @Listener public void runTick(EventRunTick event) { if (event.getStage() == EventStageable.EventStage.PRE) { diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/hidden/ArrayListModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/hidden/ArrayListModule.java index 0ce4d36..2d0f6b8 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/hidden/ArrayListModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/hidden/ArrayListModule.java @@ -19,6 +19,6 @@ public class ArrayListModule extends Module { } public enum Mode { - LENGTH, ALPHABET, UNSORTED; + LENGTH, ALPHABET, UNSORTED } } diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/hidden/IgnoreModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/hidden/IgnoreModule.java index 17a03e4..db59e88 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/hidden/IgnoreModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/hidden/IgnoreModule.java @@ -22,8 +22,8 @@ import java.util.regex.Pattern; */ public final class IgnoreModule extends Module { - private final String REGEX_NAME = "<(\\S+)\\s*(\\S+?)?>\\s(.*)"; public final Value allowFriends = new Value("AllowFriends", new String[]{"AllowF", "Friends", "AF", "F"}, "If enabled, any friend's message will not be auto-ignored", true); + private final String REGEX_NAME = "<(\\S+)\\s*(\\S+?)?>\\s(.*)"; public IgnoreModule() { super("Ignore", new String[]{"Ignor"}, "Allows you to ignore people client-side", "NONE", -1, ModuleType.HIDDEN); diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/misc/AutoIgnoreModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/misc/AutoIgnoreModule.java index ad527a4..bbed236 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/misc/AutoIgnoreModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/misc/AutoIgnoreModule.java @@ -121,10 +121,6 @@ public final class AutoIgnoreModule extends Module { } } - private enum Mode { - CLIENT, SERVER, BOTH - } - public List getBlacklist() { return blacklist; } @@ -132,4 +128,8 @@ public final class AutoIgnoreModule extends Module { public void setBlacklist(List blacklist) { this.blacklist = blacklist; } + + private enum Mode { + CLIENT, SERVER, BOTH + } } diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/misc/AutoSignModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/misc/AutoSignModule.java index ac005fb..0baa9e2 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/misc/AutoSignModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/misc/AutoSignModule.java @@ -22,9 +22,8 @@ import java.util.stream.IntStream; */ public final class AutoSignModule extends Module { - private String[] lines; - public final Value overflow = new Value("Overflow", new String[]{"Ov"}, "Fill the sign with the maximum number of randomly generated characters", false); + private String[] lines; public AutoSignModule() { super("AutoSign", new String[]{"AutomaticSign", "ASign"}, "Automatically writes text on signs for you", "NONE", -1, ModuleType.MISC); @@ -41,7 +40,7 @@ public final class AutoSignModule extends Module { if (event.getScreen() != null && event.getScreen() instanceof GuiEditSign) { final GuiEditSign gui = (GuiEditSign) event.getScreen(); - final boolean shouldCancel = this.overflow.getValue() ? true : this.lines != null; + final boolean shouldCancel = this.overflow.getValue() || this.lines != null; if (gui != null && shouldCancel && gui.tileSign != null) { Minecraft.getMinecraft().player.connection.sendPacket(new CPacketUpdateSign(gui.tileSign.getPos(), new TextComponentString[]{new TextComponentString(""), new TextComponentString(""), new TextComponentString(""), new TextComponentString("")})); diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/misc/ChatTimeStampsModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/misc/ChatTimeStampsModule.java index 7bbbd46..d86cbdb 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/misc/ChatTimeStampsModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/misc/ChatTimeStampsModule.java @@ -19,10 +19,6 @@ public final class ChatTimeStampsModule extends Module { public final Value mode = new Value("Mode", new String[]{"Mode", "M"}, "Time format, 12 hour or 24 hour", Mode.TWELVE); - private enum Mode { - TWELVE, TWENTY_FOUR - } - public ChatTimeStampsModule() { super("ChatTimeStamps", new String[]{"ChatStamp", "ChatStamps"}, "Appends a time stamp on chat messages", "NONE", -1, ModuleType.MISC); } @@ -58,4 +54,8 @@ public final class ChatTimeStampsModule extends Module { } } + private enum Mode { + TWELVE, TWENTY_FOUR + } + } diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/misc/CoordLoggerModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/misc/CoordLoggerModule.java index 3a01288..19b618b 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/misc/CoordLoggerModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/misc/CoordLoggerModule.java @@ -22,17 +22,11 @@ import team.stiff.pomelo.impl.annotated.handler.annotation.Listener; public final class CoordLoggerModule extends Module { public final Value mode = new Value("Mode", new String[]{"Mode", "M"}, "Change between various coord-logger modes", Mode.VANILLA); - - private enum Mode { - VANILLA, SPIGOT - } - public final Value thunder = new Value("Thunder", new String[]{"thund"}, "Logs positions of thunder/lightning sounds", true); public final Value endPortal = new Value("EndPortal", new String[]{"portal"}, "Logs position of end portal creation sound", true); public final Value wither = new Value("Wither", new String[]{"with"}, "Logs positions of wither sounds", true); public final Value endDragon = new Value("EndDragon", new String[]{"dragon"}, "Logs positions of end dragon sounds", true); public final Value slimes = new Value("Slimes", new String[]{"slime"}, "Logs positions of slime spawns", false); - public CoordLoggerModule() { super("CoordLogger", new String[]{"CoordLog", "CLogger", "CLog"}, "Logs useful coordinates", "NONE", -1, ModuleType.MISC); } @@ -111,4 +105,8 @@ public final class CoordLoggerModule extends Module { } } } + + private enum Mode { + VANILLA, SPIGOT + } } diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/misc/DonkeyAlertModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/misc/DonkeyAlertModule.java index f48b3a8..6817ef0 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/misc/DonkeyAlertModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/misc/DonkeyAlertModule.java @@ -31,10 +31,6 @@ public final class DonkeyAlertModule extends Module { private final Timer timer = new Timer(); - private enum Mode { - CHAT, NOTIFICATION, BOTH - } - public DonkeyAlertModule() { super("DonkeyAlert", new String[]{"Donkellama", "Donkeyllama", "DonkeyFinder", "LlamaFinder", "StorageEntityFinder", "Dllama", "Donkelama", "Donkeylama", "Donk", "DonkAlert", "DonkeyAlert", "LlamaAlert"}, "Alerts you about donkeys and llamas!! (horses, mules, too..)", "NONE", -1, ModuleType.MISC); } @@ -81,4 +77,8 @@ public final class DonkeyAlertModule extends Module { } } } + + private enum Mode { + CHAT, NOTIFICATION, BOTH + } } diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/misc/FakePlayerModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/misc/FakePlayerModule.java index 069352a..a737777 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/misc/FakePlayerModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/misc/FakePlayerModule.java @@ -13,9 +13,8 @@ import net.minecraft.client.entity.EntityOtherPlayerMP; public final class FakePlayerModule extends Module { public final Value username = new Value("Username", new String[]{"name", "uname", "u"}, "The username of the fake player", "Notch"); - - private EntityOtherPlayerMP entity; private final Minecraft mc = Minecraft.getMinecraft(); + private EntityOtherPlayerMP entity; public FakePlayerModule() { super("FakePlayer", new String[]{"FakeP", "FPlayer"}, "Adds a fake player to your game", "NONE", -1, Module.ModuleType.MISC); diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/misc/GreeterModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/misc/GreeterModule.java index 7eeffd7..727012a 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/misc/GreeterModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/misc/GreeterModule.java @@ -16,10 +16,6 @@ public final class GreeterModule extends Module { public final Value friends = new Value("Friends", new String[]{"Friend", "F"}, "Will only greet friends", false); public final Value mode = new Value("Mode", new String[]{"Mode", "M"}, "Change between greeter modes: Client mode will only appear for you, Server mode will type the greeting in chat", Mode.CLIENT); - private enum Mode { - CLIENT, SERVER - } - public GreeterModule() { super("Greeter", new String[]{"Greet"}, "Automatically announces when a player joins and leaves", "NONE", -1, ModuleType.MISC); } @@ -54,4 +50,8 @@ public final class GreeterModule extends Module { break; } } + + private enum Mode { + CLIENT, SERVER + } } diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/misc/LaggerModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/misc/LaggerModule.java index bafd76e..f2f1769 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/misc/LaggerModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/misc/LaggerModule.java @@ -31,13 +31,7 @@ import team.stiff.pomelo.impl.annotated.handler.annotation.Listener; public final class LaggerModule extends Module { public final Value mode = new Value("Mode", new String[]{"Mode", "M"}, "Change between various lagger modes, each utilizing a different exploit to cause lag", Mode.BOXER); - - private enum Mode { - BOXER, SWAP, MOVEMENT, SIGN, NBT, CONTAINER, MAP - } - public final Value packets = new Value("Packets", new String[]{"pckts", "packet"}, "Amount of packets to send each tick while running the chosen lag mode", 500, 0, 5000, 1); - private Container lastContainer = null; public LaggerModule() { @@ -148,4 +142,8 @@ public final class LaggerModule extends Module { } } } + + private enum Mode { + BOXER, SWAP, MOVEMENT, SIGN, NBT, CONTAINER, MAP + } } diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/misc/NoBiomeColorModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/misc/NoBiomeColorModule.java index 67858a6..46f7e30 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/misc/NoBiomeColorModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/misc/NoBiomeColorModule.java @@ -19,17 +19,10 @@ import java.awt.*; public final class NoBiomeColorModule extends Module { public final Value mode = new Value("Mode", new String[]{"Mode", "M"}, "Change between NoBiomeColor modes, Default to use vanilla colors, Custom to use specified RGB values", Mode.DEFAULT); - - private enum Mode { - DEFAULT, CUSTOM - } - public final Value color = new Value("CustomColor", new String[]{"customcolor", "color", "c"}, "Edit the custom biome color", new Color(255, 255, 255)); - private float prevRed; private float prevGreen; private float prevBlue; - private Mode prevMode; public NoBiomeColorModule() { @@ -132,4 +125,8 @@ public final class NoBiomeColorModule extends Module { event.setCanceled(true); } + private enum Mode { + DEFAULT, CUSTOM + } + } diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/misc/PacketLoggerModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/misc/PacketLoggerModule.java index 327aa74..246b841 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/misc/PacketLoggerModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/misc/PacketLoggerModule.java @@ -18,15 +18,12 @@ import java.util.logging.Level; */ public final class PacketLoggerModule extends Module { - private Packet[] packets; - public final Value incoming = new Value("Incoming", new String[]{"in"}, "Log incoming packets when enabled", true); public final Value outgoing = new Value("Outgoing", new String[]{"out"}, "Log outgoing packets when enabled", true); - public final Value chat = new Value("Chat", new String[]{"ch"}, "Logs packet traffic to chat", true); public final Value console = new Value("Console", new String[]{"con"}, "Logs packet traffic to console", true); - public final Value data = new Value("Data", new String[]{"dat"}, "Include data about the packet's class in the log when enabled", true); + private Packet[] packets; public PacketLoggerModule() { super("PacketLogger", new String[]{"pktlgr"}, "Log incoming and/or outgoing packets to console", "NONE", -1, ModuleType.MISC); diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/misc/ReconnectModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/misc/ReconnectModule.java index d0ea0db..82dd042 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/misc/ReconnectModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/misc/ReconnectModule.java @@ -20,12 +20,11 @@ import team.stiff.pomelo.impl.annotated.handler.annotation.Listener; */ public final class ReconnectModule extends Module { + public final Value delay = new Value("Delay", new String[]{"Del"}, "Delay in MS (milliseconds) between reconnect attempts", 3000.0f, 0.0f, 10000.0f, 500.0f); private String lastIp; private int lastPort; private boolean reconnect; - private Timer timer = new Timer(); - - public final Value delay = new Value("Delay", new String[]{"Del"}, "Delay in MS (milliseconds) between reconnect attempts", 3000.0f, 0.0f, 10000.0f, 500.0f); + private final Timer timer = new Timer(); public ReconnectModule() { super("Reconnect", new String[]{"Rejoin", "Recon", "AutoReconnect"}, "Automatically reconnects to the last server after being kicked", "NONE", -1, ModuleType.MISC); diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/misc/StorageAlertModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/misc/StorageAlertModule.java index 0c45a78..f757254 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/misc/StorageAlertModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/misc/StorageAlertModule.java @@ -51,10 +51,6 @@ public final class StorageAlertModule extends Module { private final File locationsFile; private CommandsModule commandsModule; - private enum Mode { - CHAT, NOTIFICATION, BOTH - } - public StorageAlertModule() { super("StorageAlert", new String[]{"StorageAlerts", "ChestAlert"}, "Alerts you how many storage blocks are in a chunk when it's loaded", "NONE", -1, ModuleType.MISC); @@ -147,4 +143,8 @@ public final class StorageAlertModule extends Module { FileUtil.write(this.locationsFile, linesToAdd, false); } + + private enum Mode { + CHAT, NOTIFICATION, BOTH + } } diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/misc/VisualRangeModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/misc/VisualRangeModule.java index c6abea4..8e6fbc8 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/misc/VisualRangeModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/misc/VisualRangeModule.java @@ -19,11 +19,6 @@ import team.stiff.pomelo.impl.annotated.handler.annotation.Listener; public final class VisualRangeModule extends Module { public final Value mode = new Value("Mode", new String[]{"Mode", "M"}, "Change between alert modes", Mode.NOTIFICATION); - - private enum Mode { - CHAT, NOTIFICATION, BOTH - } - private int prevPlayer = -1; public VisualRangeModule() { @@ -75,5 +70,9 @@ public final class VisualRangeModule extends Module { } } + private enum Mode { + CHAT, NOTIFICATION, BOTH + } + } diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/movement/ElytraFlyModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/movement/ElytraFlyModule.java index 5608624..806acd6 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/movement/ElytraFlyModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/movement/ElytraFlyModule.java @@ -32,17 +32,11 @@ import team.stiff.pomelo.impl.annotated.handler.annotation.Listener; public final class ElytraFlyModule extends Module { public final Value mode = new Value("Mode", new String[]{"Mode", "M"}, "Mode to use for elytra flight", Mode.LOOK); - - private enum Mode { - VANILLA, PACKET, CONTROL, LOOK - } - public final Value speed = new Value("Speed", new String[]{"Spd", "amount", "s"}, "Speed multiplier for elytra flight, higher values equals more speed", 1.0f, 0.0f, 5.0f, 0.1f); public final Value speedX = new Value("SpeedX", new String[]{"SpdX", "amountX", "sX"}, "The X speed factor (speed * this)", 1.0f, 0.1f, 5.0f, 0.1f); public final Value speedYUp = new Value("SpeedYUp", new String[]{"SpdYUp", "amountYUp", "sYU"}, "The upwards Y speed factor (speed * this)", 1.0f, 0.1f, 5.0f, 0.1f); public final Value speedYDown = new Value("SpeedYDown", new String[]{"SpdYDown", "amountYDown", "sYD"}, "The downwards Y speed factor (speed * this)", 1.0f, 0.1f, 5.0f, 0.1f); public final Value speedZ = new Value("SpeedZ", new String[]{"SpdZ", "amountZ", "sZ"}, "The Z speed factor (speed * this)", 1.0f, 0.1f, 5.0f, 0.1f); - public final Value autoStart = new Value("AutoStart", new String[]{"AutoStart", "Auto-Start", "start", "autojump", "as"}, "Hold down the jump key to have an easy automated lift off", true); public final Value autoStartDelay = new Value("StartDelay", new String[]{"AutoStartDelay", "startdelay", "asd"}, "Delay(ms) between auto-start attempts", 100.0f, 0.0f, 300.0f, 10.0f); public final Value autoStartJumpDelay = new Value("JumpDelay", new String[]{"AutoStartJumpDelay", "jumpdelay", "autojumpdelay", "ajd"}, "Delay(ms) after holding jump key auto-start begins", 500.0f, 0.0f, 1000.0f, 100.0f); @@ -55,12 +49,10 @@ public final class ElytraFlyModule extends Module { public final Value disableNoHunger = new Value("DisableNoHunger", new String[]{"NoHunger", "Hunger", "DNH"}, "Automatically disables the 'NoHunger' module", true); public final Value infiniteDurability = new Value("InfiniteDurability", new String[]{"InfiniteDura", "dura", "inf", "infdura"}, "Enables an old exploit that sends the start elytra-flying packet each tick (will kick you)", false); public final Value noKick = new Value("NoKick", new String[]{"AntiKick", "Kick", "nk"}, "Bypass the server kicking you for flying while in elytra flight (Only works for Packet mode!!)", false); - private final Timer startDelayTimer = new Timer(); private final Timer equipDelayTimer = new Timer(); private final Timer stayAirborneTimer = new Timer(); private final Timer jumpTimer = new Timer(); - public ElytraFlyModule() { super("ElytraFly", new String[]{"Elytra", "ElytraPlus", "Elytra+"}, "Allows you to fly with elytras", "NONE", -1, ModuleType.MOVEMENT); } @@ -366,4 +358,8 @@ public final class ElytraFlyModule extends Module { return elytras; } + + private enum Mode { + VANILLA, PACKET, CONTROL, LOOK + } } diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/movement/FlightModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/movement/FlightModule.java index 38d6def..ca5a69f 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/movement/FlightModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/movement/FlightModule.java @@ -25,18 +25,10 @@ import java.util.List; public final class FlightModule extends Module { public final Value mode = new Value("Mode", new String[]{"Mode", "M"}, "The flight mode to use", Mode.VANILLA); - - private enum Mode { - VANILLA, PACKET - } - public final Value speed = new Value("Speed", new String[]{"Spd"}, "Speed multiplier for flight, higher values equals more speed", 1.0f, 0.0f, 5.0f, 0.01f); - public final Value noKick = new Value("NoKick", new String[]{"AntiKick", "Kick"}, "Bypass the server kicking you for flying while in flight", true); - private int teleportId; - private List packets = new ArrayList<>(); - + private final List packets = new ArrayList<>(); public FlightModule() { super("Flight", new String[]{"Fly"}, "Allows you to fly", "NONE", -1, ModuleType.MOVEMENT); } @@ -225,4 +217,8 @@ public final class FlightModule extends Module { } } + private enum Mode { + VANILLA, PACKET + } + } diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/movement/GuiMoveModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/movement/GuiMoveModule.java index b7ecca7..49bce94 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/movement/GuiMoveModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/movement/GuiMoveModule.java @@ -20,13 +20,8 @@ import team.stiff.pomelo.impl.annotated.handler.annotation.Listener; */ public final class GuiMoveModule extends Module { - public enum Mode { - NEW, OLD - } - public final Value mode = new Value("Mode", new String[]{"mod", "m"}, "Change between modes", Mode.NEW); public final Value allowSignMove = new Value("AllowSignMove", new String[]{"sign", "allowsign", "as"}, "If enabled you will be able to move while in a sign GUI", false); - public GuiMoveModule() { super("GUIMove", new String[]{"InvMove", "InventoryMove", "GUIM"}, "Allows you to move while guis are open", "NONE", -1, ModuleType.MOVEMENT); } @@ -83,4 +78,8 @@ public final class GuiMoveModule extends Module { } } + public enum Mode { + NEW, OLD + } + } diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/movement/JesusModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/movement/JesusModule.java index 4ba8d98..c729f5d 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/movement/JesusModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/movement/JesusModule.java @@ -24,17 +24,67 @@ import team.stiff.pomelo.impl.annotated.handler.annotation.Listener; public final class JesusModule extends Module { public final Value mode = new Value("Mode", new String[]{"Mode", "M"}, "The current Jesus/WaterWalk mode to use", Mode.NCP); - - private enum Mode { - VANILLA, NCP, BOUNCE - } - public final Value offset = new Value("Offset", new String[]{"Off", "O"}, "Amount to offset the player into the water's bounding box", 0.05f, 0.0f, 0.9f, 0.01f); public JesusModule() { super("Jesus", new String[]{"LiquidWalk", "WaterWalk"}, "Allows you to walk on water", "NONE", -1, ModuleType.MOVEMENT); } + public static boolean isInLiquid() { + final Minecraft mc = Minecraft.getMinecraft(); + + if (mc.player.fallDistance >= 3.0f) { + return false; + } + + if (mc.player != null) { + boolean inLiquid = false; + final AxisAlignedBB bb = mc.player.getRidingEntity() != null ? mc.player.getRidingEntity().getEntityBoundingBox() : mc.player.getEntityBoundingBox(); + int y = (int) bb.minY; + for (int x = MathHelper.floor(bb.minX); x < MathHelper.floor(bb.maxX) + 1; x++) { + for (int z = MathHelper.floor(bb.minZ); z < MathHelper.floor(bb.maxZ) + 1; z++) { + final Block block = mc.world.getBlockState(new BlockPos(x, y, z)).getBlock(); + if (!(block instanceof BlockAir)) { + if (!(block instanceof BlockLiquid)) { + return false; + } + inLiquid = true; + } + } + } + return inLiquid; + } + return false; + } + + public static boolean isOnLiquid(double offset) { + final Minecraft mc = Minecraft.getMinecraft(); + + if (mc.player.fallDistance >= 3.0f) { + return false; + } + + if (mc.player != null) { + final AxisAlignedBB bb = mc.player.getRidingEntity() != null ? mc.player.getRidingEntity().getEntityBoundingBox().contract(0.0d, 0.0d, 0.0d).offset(0.0d, -offset, 0.0d) : mc.player.getEntityBoundingBox().contract(0.0d, 0.0d, 0.0d).offset(0.0d, -offset, 0.0d); + boolean onLiquid = false; + int y = (int) bb.minY; + for (int x = MathHelper.floor(bb.minX); x < MathHelper.floor(bb.maxX + 1.0D); x++) { + for (int z = MathHelper.floor(bb.minZ); z < MathHelper.floor(bb.maxZ + 1.0D); z++) { + final Block block = mc.world.getBlockState(new BlockPos(x, y, z)).getBlock(); + if (block != Blocks.AIR) { + if (!(block instanceof BlockLiquid)) { + return false; + } + onLiquid = true; + } + } + } + return onLiquid; + } + + return false; + } + @Override public String getMetaData() { return this.mode.getValue().name(); @@ -95,66 +145,11 @@ public final class JesusModule extends Module { } } - if (mc.player.fallDistance >= 3.0f) { - return false; - } - - return true; + return !(mc.player.fallDistance >= 3.0f); } - public static boolean isInLiquid() { - final Minecraft mc = Minecraft.getMinecraft(); - - if (mc.player.fallDistance >= 3.0f) { - return false; - } - - if (mc.player != null) { - boolean inLiquid = false; - final AxisAlignedBB bb = mc.player.getRidingEntity() != null ? mc.player.getRidingEntity().getEntityBoundingBox() : mc.player.getEntityBoundingBox(); - int y = (int) bb.minY; - for (int x = MathHelper.floor(bb.minX); x < MathHelper.floor(bb.maxX) + 1; x++) { - for (int z = MathHelper.floor(bb.minZ); z < MathHelper.floor(bb.maxZ) + 1; z++) { - final Block block = mc.world.getBlockState(new BlockPos(x, y, z)).getBlock(); - if (!(block instanceof BlockAir)) { - if (!(block instanceof BlockLiquid)) { - return false; - } - inLiquid = true; - } - } - } - return inLiquid; - } - return false; - } - - public static boolean isOnLiquid(double offset) { - final Minecraft mc = Minecraft.getMinecraft(); - - if (mc.player.fallDistance >= 3.0f) { - return false; - } - - if (mc.player != null) { - final AxisAlignedBB bb = mc.player.getRidingEntity() != null ? mc.player.getRidingEntity().getEntityBoundingBox().contract(0.0d, 0.0d, 0.0d).offset(0.0d, -offset, 0.0d) : mc.player.getEntityBoundingBox().contract(0.0d, 0.0d, 0.0d).offset(0.0d, -offset, 0.0d); - boolean onLiquid = false; - int y = (int) bb.minY; - for (int x = MathHelper.floor(bb.minX); x < MathHelper.floor(bb.maxX + 1.0D); x++) { - for (int z = MathHelper.floor(bb.minZ); z < MathHelper.floor(bb.maxZ + 1.0D); z++) { - final Block block = mc.world.getBlockState(new BlockPos(x, y, z)).getBlock(); - if (block != Blocks.AIR) { - if (!(block instanceof BlockLiquid)) { - return false; - } - onLiquid = true; - } - } - } - return onLiquid; - } - - return false; + private enum Mode { + VANILLA, NCP, BOUNCE } } \ No newline at end of file diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/movement/ScaffoldModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/movement/ScaffoldModule.java index a982b55..639b815 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/movement/ScaffoldModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/movement/ScaffoldModule.java @@ -35,12 +35,10 @@ public final class ScaffoldModule extends Module { //public final Value destroy = new Value("Destroy", new String[]{"Dest"}, "When enabled, after placing the block, forces the player to swing/destroy at the same position.", false); private final int[] blackList = new int[]{145, 130, 12, 252, 54, 146, 122, 13, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 50}; - + private final RotationTask rotationTask = new RotationTask("ScaffoldTask", 3); //private final List blocks = new CopyOnWriteArrayList(); private BlockPos currentPlaceBlock = null; - private final RotationTask rotationTask = new RotationTask("ScaffoldTask", 3); - public ScaffoldModule() { super("Scaffold", new String[]{"Scaff"}, "Automatically places blocks where you are walking", "NONE", -1, ModuleType.MOVEMENT); } diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/movement/SneakModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/movement/SneakModule.java index 6d64a00..364542e 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/movement/SneakModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/movement/SneakModule.java @@ -19,10 +19,6 @@ public final class SneakModule extends Module { public final Value mode = new Value("Mode", new String[]{"Mode", "M"}, "The sneak mode to use", Mode.VANILLA); - private enum Mode { - VANILLA, NCP - } - public SneakModule() { super("Sneak", new String[]{"Sneek"}, "Allows you to sneak at full speed", "NONE", -1, ModuleType.MOVEMENT); } @@ -81,4 +77,8 @@ public final class SneakModule extends Module { return GameSettings.isKeyDown(Minecraft.getMinecraft().gameSettings.keyBindForward) || GameSettings.isKeyDown(Minecraft.getMinecraft().gameSettings.keyBindLeft) || GameSettings.isKeyDown(Minecraft.getMinecraft().gameSettings.keyBindRight) || GameSettings.isKeyDown(Minecraft.getMinecraft().gameSettings.keyBindBack); } + private enum Mode { + VANILLA, NCP + } + } diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/movement/SpeedModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/movement/SpeedModule.java index b8cbd71..29c9c0f 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/movement/SpeedModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/movement/SpeedModule.java @@ -19,17 +19,10 @@ import team.stiff.pomelo.impl.annotated.handler.annotation.Listener; public final class SpeedModule extends Module { public final Value mode = new Value("Mode", new String[]{"Mode", "M"}, "The speed mode to use", Mode.VANILLA); - - private enum Mode { - VANILLA, BHOP - } - public final Value speed = new Value("Speed", new String[]{"Spd", "Amount", "A", "S"}, "Speed multiplier, higher numbers equal faster motion", 0.1f, 0.0f, 10.0f, 0.1f); - private int tick; private double prevDistance; private double movementSpeed; - public SpeedModule() { super("Speed", new String[]{"Spd"}, "Allows you to move faster", "NONE", -1, ModuleType.MOVEMENT); } @@ -140,4 +133,8 @@ public final class SpeedModule extends Module { } } } + + private enum Mode { + VANILLA, BHOP + } } diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/movement/SprintModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/movement/SprintModule.java index 2ab8f1d..6b535d2 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/movement/SprintModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/movement/SprintModule.java @@ -15,10 +15,6 @@ public final class SprintModule extends Module { public final Value mode = new Value("Mode", new String[]{"Mode", "M"}, "The sprint mode to use", Mode.RAGE); - private enum Mode { - RAGE, LEGIT - } - public SprintModule() { super("Sprint", new String[]{"AutoSprint", "Spr"}, "Automatically sprints for you", "NONE", -1, ModuleType.MOVEMENT); } @@ -57,4 +53,8 @@ public final class SprintModule extends Module { } } + private enum Mode { + RAGE, LEGIT + } + } diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/movement/StepModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/movement/StepModule.java index defac9d..db04766 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/movement/StepModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/movement/StepModule.java @@ -22,17 +22,9 @@ import team.stiff.pomelo.impl.annotated.handler.annotation.Listener; public final class StepModule extends Module { public final Value mode = new Value("Mode", new String[]{"Mode", "M"}, "The step block-height mode to use", Mode.ONE); - - private enum Mode { - ONE, TWO - } - private final double[] oneblockPositions = {0.42D, 0.75D}; - private final double[] twoblockPositions = {0.4D, 0.75D, 0.5D, 0.41D, 0.83D, 1.16D, 1.41D, 1.57D, 1.58D, 1.42D}; - private double[] selectedPositions = new double[0]; - private int packets; public StepModule() { @@ -84,5 +76,9 @@ public final class StepModule extends Module { } } + private enum Mode { + ONE, TWO + } + } diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/player/AutoEatModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/player/AutoEatModule.java index 53e8e6c..9814dad 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/player/AutoEatModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/player/AutoEatModule.java @@ -120,9 +120,6 @@ public final class AutoEatModule extends Module { if (!(item instanceof ItemFood)) return false; // is not of ItemFood class - if (item == Items.GOLDEN_APPLE || item == Items.CHORUS_FRUIT || item == Items.ROTTEN_FLESH || item == Items.POISONOUS_POTATO || item == Items.SPIDER_EYE) - return false; - - return true; + return item != Items.GOLDEN_APPLE && item != Items.CHORUS_FRUIT && item != Items.ROTTEN_FLESH && item != Items.POISONOUS_POTATO && item != Items.SPIDER_EYE; } } diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/player/BlinkModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/player/BlinkModule.java index 88c7795..c8b4201 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/player/BlinkModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/player/BlinkModule.java @@ -18,8 +18,8 @@ import java.util.concurrent.ConcurrentLinkedQueue; */ public final class BlinkModule extends Module { - private EntityOtherPlayerMP entity; private final Queue packets = new ConcurrentLinkedQueue(); + private EntityOtherPlayerMP entity; public BlinkModule() { super("Blink", new String[]{"FakeLag"}, "Holds packets until disabled", "NONE", -1, ModuleType.PLAYER); diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/player/FreeCamModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/player/FreeCamModule.java index fcfed5d..df82e7c 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/player/FreeCamModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/player/FreeCamModule.java @@ -28,17 +28,16 @@ import team.stiff.pomelo.impl.annotated.handler.annotation.Listener; */ public final class FreeCamModule extends Module { + public final Value speed = new Value("Speed", new String[]{"Spd"}, "Speed of freecam flight, higher number equals quicker motion", 1.0f, 0.0f, 10.0f, 0.1f); + public final Value view = new Value("3D", new String[]{"View"}, "The old Nodus client style free-cam, kind of like an elytra. (Hold forward key & move the mouse to turn)", false); + public final Value packet = new Value("Packet", new String[]{"Pack"}, "Disables any player position or rotation packets from being sent during free-cam if enabled", true); + public final Value allowDismount = new Value("AllowDismount", new String[]{"Dismount", "Dis", "AllowDis"}, "Allow dismounting of the riding entity", true); private Entity riding; private EntityOtherPlayerMP entity; private Vec3d position; private float yaw; private float pitch; - public final Value speed = new Value("Speed", new String[]{"Spd"}, "Speed of freecam flight, higher number equals quicker motion", 1.0f, 0.0f, 10.0f, 0.1f); - public final Value view = new Value("3D", new String[]{"View"}, "The old Nodus client style free-cam, kind of like an elytra. (Hold forward key & move the mouse to turn)", false); - public final Value packet = new Value("Packet", new String[]{"Pack"}, "Disables any player position or rotation packets from being sent during free-cam if enabled", true); - public final Value allowDismount = new Value("AllowDismount", new String[]{"Dismount", "Dis", "AllowDis"}, "Allow dismounting of the riding entity", true); - public FreeCamModule() { super("FreeCam", new String[]{"FreeCamera"}, "Out of body experience", "NONE", -1, ModuleType.PLAYER); } diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/player/GodModeModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/player/GodModeModule.java index d6f59b7..f45777b 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/player/GodModeModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/player/GodModeModule.java @@ -21,13 +21,7 @@ import team.stiff.pomelo.impl.annotated.handler.annotation.Listener; public final class GodModeModule extends Module { public final Value mode = new Value("Mode", new String[]{"Mode", "M"}, "The mode of the god-mode exploit", Mode.PORTAL); - - private enum Mode { - PORTAL, RIDING, LOCK, PACKET - } - public final Value footsteps = new Value("FootSteps", new String[]{"Foot"}, "If enabled, others will be able to see your foot-steps during god-mode. (Disable if having trouble getting god-mode to work)", false); - private Entity riding; public GodModeModule() { @@ -148,4 +142,8 @@ public final class GodModeModule extends Module { } } + private enum Mode { + PORTAL, RIDING, LOCK, PACKET + } + } diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/player/InteractModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/player/InteractModule.java index ba02d21..805d8ed 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/player/InteractModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/player/InteractModule.java @@ -21,12 +21,12 @@ import team.stiff.pomelo.impl.annotated.handler.annotation.Listener; */ public final class InteractModule extends Module { + private boolean clicked; + public InteractModule() { super("Interact", new String[]{"GhostHand"}, "Allows you to access entities and blocks through walls", "NONE", -1, ModuleType.PLAYER); } - private boolean clicked; - @Listener public void sendPacket(EventSendPacket event) { if (event.getStage() == EventStageable.EventStage.PRE) { diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/player/ItemSpoofModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/player/ItemSpoofModule.java index d8c321a..96b302a 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/player/ItemSpoofModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/player/ItemSpoofModule.java @@ -20,15 +20,14 @@ import team.stiff.pomelo.impl.annotated.handler.annotation.Listener; */ public final class ItemSpoofModule extends Module { - private boolean send; - private Entity entity; - public BlockPos position; public EnumFacing placedBlockDirection; public EnumHand hand; public float facingX; public float facingY; public float facingZ; + private boolean send; + private Entity entity; public ItemSpoofModule() { super("ItemSpoof", new String[]{"ItemS"}, "Allows you to display a different item server-side (Use the top left slot in your inventory)", "NONE", -1, ModuleType.PLAYER); diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/player/NoHungerModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/player/NoHungerModule.java index 0df45ea..e63ad09 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/player/NoHungerModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/player/NoHungerModule.java @@ -26,11 +26,7 @@ public final class NoHungerModule extends Module { if (event.getStage() == EventStageable.EventStage.PRE) { if (event.getPacket() instanceof CPacketPlayer) { final CPacketPlayer packet = (CPacketPlayer) event.getPacket(); - if (Minecraft.getMinecraft().player.fallDistance > 0 || Minecraft.getMinecraft().playerController.isHittingBlock) { - packet.onGround = true; - } else { - packet.onGround = false; - } + packet.onGround = Minecraft.getMinecraft().player.fallDistance > 0 || Minecraft.getMinecraft().playerController.isHittingBlock; } if (event.getPacket() instanceof CPacketEntityAction) { final CPacketEntityAction packet = (CPacketEntityAction) event.getPacket(); diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/render/BlockHighlightModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/render/BlockHighlightModule.java index e9ee75d..79fc650 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/render/BlockHighlightModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/render/BlockHighlightModule.java @@ -30,10 +30,6 @@ public final class BlockHighlightModule extends Module { public final Value width = new Value("Width", new String[]{"W", "size", "s"}, "Width value of the highlight visual", 1.5f, 0.1f, 5.0f, 0.1f); public final Value breaking = new Value("Breaking", new String[]{"Break", "block", "brk"}, "Sizes the highlight visual based on the block breaking damage", false); - public enum Mode { - BOX, OUTLINE, CROSS - } - public BlockHighlightModule() { super("BlockHighlight", new String[]{"BHighlight", "BlockHigh"}, "Highlights the block at your cross-hair", "NONE", -1, ModuleType.RENDER); } @@ -88,4 +84,8 @@ public final class BlockHighlightModule extends Module { RenderUtil.end3D(); } } + + public enum Mode { + BOX, OUTLINE, CROSS + } } diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/render/BrightnessModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/render/BrightnessModule.java index f89349d..8ae98b5 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/render/BrightnessModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/render/BrightnessModule.java @@ -18,13 +18,7 @@ public final class BrightnessModule extends Module { public final Value mode = new Value("Mode", new String[]{"Mode", "M"}, "The brightness mode to use", Mode.GAMMA); public final Value disablePotion = new Value("DisablePotion", new String[]{"AutoDisablePotion", "dp", "adp"}, "Automatically remove the night vision effect if using a different mode", true); - - private enum Mode { - GAMMA, POTION, TABLE - } - private float lastGamma; - private World world; public BrightnessModule() { @@ -94,4 +88,8 @@ public final class BrightnessModule extends Module { } } } + + private enum Mode { + GAMMA, POTION, TABLE + } } diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/render/ChamsModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/render/ChamsModule.java index 0b3eb0a..98963f1 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/render/ChamsModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/render/ChamsModule.java @@ -66,47 +66,10 @@ public final class ChamsModule extends Module { public final Value sneakingColor = new Value("SneakingColor", new String[]{"sneakingcolor", "sneakcolor", "sc"}, "Change the color of sneaking players on esp", new Color(238, 153, 0)); public final Value shader = new Value("Shader", new String[]{"shader", "program", "shaderprogram", "sp"}, "Change the shader to use when in shader mode", new Shader("resource:///assets/seppukumod/shaders/chams.json")); - - private enum Mode { - NORMAL, COLOR, TEXTURE, FLAT, WIREFRAME, SHADER - } - - private enum EntityType { - SKIP, UNKNOWN, ANIMAL, MOB, VEHICLE, ITEM, CRYSTAL, NORMAL_PLAYER, FRIENDLY_PLAYER, SNEAKING_PLAYER - } - - private class QueuedEntity { - public final double x; - public final double y; - public final double z; - public final float yaw; - public final float partialTicks; - public final EntityType entityType; - public final boolean hasShadow; - public final Render render; - - public QueuedEntity(Entity entity, double x, double y, double z, float yaw, float partialTicks, EntityType entityType, boolean hasShadow) { - this.x = x; - this.y = y; - this.z = z; - this.yaw = yaw; - this.partialTicks = partialTicks; - this.entityType = entityType; - this.hasShadow = hasShadow; - this.render = Minecraft.getMinecraft().getRenderManager().getEntityRenderObject(entity); - this.render.setRenderOutlines(false); - } - - public QueuedEntity(EventRenderEntity event, EntityType entityType, boolean hasShadow) { - this(event.getEntity(), event.getX(), event.getY(), event.getZ(), event.getYaw(), event.getPartialTicks(), entityType, hasShadow); - } - } - private final HashMap queuedEntities = new HashMap(); private final ArrayList queuedNameplates = new ArrayList(); private boolean renderShadow = false; private boolean renderingShaded = false; - public ChamsModule() { super("Chams", new String[]{"Cham", "Chameleon"}, "Allows you to see entities through walls", "NONE", -1, ModuleType.RENDER); } @@ -360,4 +323,39 @@ public final class ChamsModule extends Module { } } + private enum Mode { + NORMAL, COLOR, TEXTURE, FLAT, WIREFRAME, SHADER + } + + private enum EntityType { + SKIP, UNKNOWN, ANIMAL, MOB, VEHICLE, ITEM, CRYSTAL, NORMAL_PLAYER, FRIENDLY_PLAYER, SNEAKING_PLAYER + } + + private class QueuedEntity { + public final double x; + public final double y; + public final double z; + public final float yaw; + public final float partialTicks; + public final EntityType entityType; + public final boolean hasShadow; + public final Render render; + + public QueuedEntity(Entity entity, double x, double y, double z, float yaw, float partialTicks, EntityType entityType, boolean hasShadow) { + this.x = x; + this.y = y; + this.z = z; + this.yaw = yaw; + this.partialTicks = partialTicks; + this.entityType = entityType; + this.hasShadow = hasShadow; + this.render = Minecraft.getMinecraft().getRenderManager().getEntityRenderObject(entity); + this.render.setRenderOutlines(false); + } + + public QueuedEntity(EventRenderEntity event, EntityType entityType, boolean hasShadow) { + this(event.getEntity(), event.getX(), event.getY(), event.getZ(), event.getYaw(), event.getPartialTicks(), entityType, hasShadow); + } + } + } diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/render/HolesModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/render/HolesModule.java index 2d52536..eab2671 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/render/HolesModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/render/HolesModule.java @@ -139,10 +139,7 @@ public final class HolesModule extends Module { } } - if (validHorizontalBlocks < 4) - return false; - - return true; + return validHorizontalBlocks >= 4; } private class Hole extends Vec3i { diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/render/NewChunksModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/render/NewChunksModule.java index 13be3e5..767523e 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/render/NewChunksModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/render/NewChunksModule.java @@ -30,15 +30,9 @@ public final class NewChunksModule extends Module { public final Value alpha = new Value("Alpha", new String[]{"Alp", "Opacity", "a", "o"}, "Edit the alpha of the chunk visual", 127, 1, 255, 1); public final Value lineWidth = new Value("LineWidth", new String[]{"Width", "Line-Width", "line", "size", "s", "l"}, "Edit the line width chunk visual", 1.5f, 0.1f, 5.0f, 0.1f); public final Value height = new Value("Height", new String[]{"H"}, "Edit the height of the chunk visual", 3f, 1f, 25f, 1f); - - public enum Mode { - BOX, OUTLINE, PLANE - } - - private Color currentColor; private final ICamera frustum = new Frustum(); - private final List chunkDataList = new ArrayList<>(); + private Color currentColor; public NewChunksModule() { super("NewChunks", new String[]{"ChunkGen"}, "Highlights newly generated chunks", "NONE", -1, ModuleType.RENDER); @@ -119,6 +113,10 @@ public final class NewChunksModule extends Module { return temp; } + public enum Mode { + BOX, OUTLINE, PLANE + } + public static class ChunkData { private int x; private int z; diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/render/NoLagModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/render/NoLagModule.java index e01f98f..2a7ca62 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/render/NoLagModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/render/NoLagModule.java @@ -1,6 +1,5 @@ package me.rigamortis.seppuku.impl.module.render; -import me.rigamortis.seppuku.Seppuku; import me.rigamortis.seppuku.api.event.EventStageable; import me.rigamortis.seppuku.api.event.gui.hud.EventUIValueChanged; import me.rigamortis.seppuku.api.event.gui.hud.modulelist.EventUIListValueChanged; diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/render/PortalFinderModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/render/PortalFinderModule.java index a74a7e7..ceabd40 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/render/PortalFinderModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/render/PortalFinderModule.java @@ -37,24 +37,15 @@ import java.util.concurrent.CopyOnWriteArrayList; public final class PortalFinderModule extends Module { public final Value mode = new Value("Mode", new String[]{"Mode"}, "Rendering mode to use for drawing found portals", Mode.TWO_D); - - private enum Mode { - TWO_D, THREE_D // TWO_ DIMENSIONAL, THREE_ DIMENSIONAL - } - public final Value chat = new Value("Chat", new String[]{"Chat", "ChatMessages", "ChatNotifications"}, "Display a message in chat when a portal is found (Hover the message for more info)", true); - public final Value remove = new Value("Remove", new String[]{"R", "Delete"}, "Removes a portal from being drawn if the player is a distance aways from it", true); public final Value removeDistance = new Value("RemoveDistance", new String[]{"RemoveDistance", "RD", "RemoveRange"}, "Minimum distance in blocks the player must be from a portal for it to stop being drawn", 200, 1, 2000, 1); - public final Value showInfo = new Value("Info", new String[]{"SI", "DrawInfo", "DrawText"}, "Draws information about the portal at it's location", true); public final Value infoScale = new Value("InfoScale", new String[]{"InfoScale", "IS", "Scale", "TextScale"}, "Scale of the text size on the drawn information", 1.0f, 0.1f, 3.0f, 0.25f); - public final Value tracer = new Value("Tracer", new String[]{"TracerLine", "trace", "line"}, "Display a tracer line to each found portal", true); public final Value color = new Value("TracerColor", new String[]{"TracerColor", "Color", "c"}, "Edit the portal tracer color", new Color(255, 255, 255)); public final Value width = new Value("TracerWidth", new String[]{"TracerWidth", "W", "Width"}, "Width of each line that is drawn to indicate a portal's location", 0.5f, 0.1f, 5.0f, 0.1f); public final Value alpha = new Value("TracerAlpha", new String[]{"TracerAlpha", "A", "Opacity", "Op"}, "Alpha value for each drawn line", 255, 1, 255, 1); - private final List portals = new CopyOnWriteArrayList<>(); public PortalFinderModule() { @@ -247,4 +238,8 @@ public final class PortalFinderModule extends Module { public List getPortals() { return portals; } + + private enum Mode { + TWO_D, THREE_D // TWO_ DIMENSIONAL, THREE_ DIMENSIONAL + } } \ No newline at end of file diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/render/ProjectilesModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/render/ProjectilesModule.java index e0468a8..af20f48 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/render/ProjectilesModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/render/ProjectilesModule.java @@ -43,11 +43,10 @@ import static org.lwjgl.opengl.GL11.*; */ public final class ProjectilesModule extends Module { - private final Queue flightPoint = new ConcurrentLinkedQueue<>(); - public final Value width = new Value("Width", new String[]{"W", "Width"}, "Pixel width of the projectile path", 1.0f, 0.1f, 5.0f, 0.1f); public final Value color = new Value("PathColor", new String[]{"color", "c", "pc"}, "Change the color of the predicted path", new Color(255, 255, 255)); public final Value alpha = new Value("PathAlpha", new String[]{"opacity", "a", "o", "pa", "po"}, "Alpha value for the predicted path", 255, 1, 255, 1); + private final Queue flightPoint = new ConcurrentLinkedQueue<>(); public ProjectilesModule() { super("Projectiles", new String[]{"Proj"}, "Projects the possible path of an entity that was fired", "NONE", -1, ModuleType.RENDER); @@ -225,6 +224,7 @@ public final class ProjectilesModule extends Module { */ private final class FlightPath { private final EntityPlayerSP shooter; + private final ThrowableType throwableType; private Vec3d position; private Vec3d motion; private float yaw; @@ -232,7 +232,6 @@ public final class ProjectilesModule extends Module { private AxisAlignedBB boundingBox; private boolean collided; private RayTraceResult target; - private final ThrowableType throwableType; FlightPath(EntityPlayerSP player, ThrowableType throwableType) { this.shooter = player; diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/render/SearchModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/render/SearchModule.java index 6e6d248..f35cbe9 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/render/SearchModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/render/SearchModule.java @@ -49,17 +49,11 @@ public final class SearchModule extends Module { public final Value width = new Value("Width", new String[]{"size"}, "Line width of the search bounding box", 1.0f, 0.1f, 5.0f, 0.1f); public final Value renderTime = new Value("RenderDelay", new String[]{"rendelay", "delay", "rd"}, "Delay(ms) between render updates if chunks are queued", 4000.0f, 500f, 8000f, 100f); public final Value tracer = new Value("Tracer", new String[]{"trace", "line"}, "Draw a tracer line to each search result", false); - - public enum Mode { - BOX, OUTLINE, OUTLINE_BOX, PLANE - } - private final Value> blockIds = new Value<>("Ids", new String[]{"id", "i", "blocks"}, "Blocks to search for"); private final List blocks = new CopyOnWriteArrayList<>(); private final List renderQueue = new CopyOnWriteArrayList<>(); private final Timer renderTimer = new Timer(); private final ICamera frustum = new Frustum(); - public SearchModule() { super("Search", new String[]{"srch", "src"}, "Search for different types of blocks. Enter the \"search\" command", "NONE", -1, ModuleType.RENDER); @@ -368,4 +362,8 @@ public final class SearchModule extends Module { public Value> getBlockIds() { return blockIds; } + + public enum Mode { + BOX, OUTLINE, OUTLINE_BOX, PLANE + } } diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/render/ShulkerPreviewModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/render/ShulkerPreviewModule.java index cc0824e..e274081 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/render/ShulkerPreviewModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/render/ShulkerPreviewModule.java @@ -47,7 +47,7 @@ public final class ShulkerPreviewModule extends Module { if (blockEntityTag.hasKey("Items", 9)) { event.setCanceled(true); // cancel rendering the old tooltip - NonNullList nonnulllist = NonNullList.withSize(27, ItemStack.EMPTY); + NonNullList nonnulllist = NonNullList.withSize(27, ItemStack.EMPTY); ItemStackHelper.loadAllItems(blockEntityTag, nonnulllist); // load the itemstacks from the tag to the list // store mouse/event coords diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/render/StorageESPModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/render/StorageESPModule.java index b5a89ab..8ec2d0b 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/render/StorageESPModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/render/StorageESPModule.java @@ -25,11 +25,6 @@ import java.awt.*; public final class StorageESPModule extends Module { public final Value mode = new Value("Mode", new String[]{"Mode", "M"}, "Rendering mode", Mode.THREE_D); - - private enum Mode { - TWO_D, THREE_D // TWO_DIMENSIONAL, THREE_DIMENSIONAL - } - public final Value nametag = new Value("Nametag", new String[]{"Nametag", "Tag", "Tags", "Ntag", "name", "names"}, "Renders the name of the drawn storage object", false); public final Value opacity = new Value("Opacity", new String[]{"Opacity", "Transparency", "Alpha"}, "Opacity of the rendered esp", 128, 0, 255, 1); public final Value tracer = new Value("Tracer", new String[]{"TracerLine", "trace", "line"}, "Display a tracer line to each storage object", false); @@ -37,7 +32,6 @@ public final class StorageESPModule extends Module { public final Value tracerStorageColor = new Value("TracerStorageColor", new String[]{"TracerStorageColor", "TStorageColor", "TSColor", "TStorageC", "TSC"}, "Use the storage object's color as the tracer color", false); public final Value tracerWidth = new Value("TracerWidth", new String[]{"TracerWidth", "TWidth", "TW"}, "Pixel width of each tracer-line", 0.5f, 0.1f, 5.0f, 0.1f); public final Value tracerAlpha = new Value("TracerAlpha", new String[]{"TracerAlpha", "TAlpha", "TA", "TracerOpacity", "TOpacity", "TO"}, "Alpha value for each drawn line", 255, 1, 255, 1); - private final ICamera camera = new Frustum(); public StorageESPModule() { @@ -149,10 +143,7 @@ public final class StorageESPModule extends Module { if (te instanceof TileEntityHopper) { return true; } - if (te instanceof TileEntityShulkerBox) { - return true; - } - return false; + return te instanceof TileEntityShulkerBox; } private AxisAlignedBB boundingBoxForEnt(TileEntity te) { @@ -213,7 +204,6 @@ public final class StorageESPModule extends Module { return null; } - private int getBaseColor(TileEntity te) { if (te instanceof TileEntityChest) { return 0xFFFFC417; @@ -275,7 +265,7 @@ public final class StorageESPModule extends Module { return null; } - final Vec3d corners[] = { + final Vec3d[] corners = { new Vec3d(bb.minX, bb.minY, bb.minZ), new Vec3d(bb.maxX, bb.maxY, bb.maxZ), new Vec3d(bb.minX, bb.maxY, bb.maxZ), @@ -303,4 +293,8 @@ public final class StorageESPModule extends Module { return null; } + private enum Mode { + TWO_D, THREE_D // TWO_DIMENSIONAL, THREE_DIMENSIONAL + } + } diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/render/TracersModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/render/TracersModule.java index c5ff860..19315b8 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/render/TracersModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/render/TracersModule.java @@ -46,14 +46,8 @@ public final class TracersModule extends Module { public final Value mode = new Value("Mode", new String[]{"Mode"}, "The rendering mode to use for drawing the tracer-line", Mode.TWO_D); public final Value friendsColor = new Value("FriendsColor", new String[]{"friendscolor", "fc"}, "Change the color of added friends tracer lines", new Color(153, 0, 238)); - - private enum Mode { - TWO_D, THREE_D // TWO_DIMENSIONAL, THREE_DIMENSIONAL - } - public final Value width = new Value("Width", new String[]{"Wid"}, "Pixel width of each tracer-line", 0.5f, 0.0f, 5.0f, 0.1f); public final Value alpha = new Value("Alpha", new String[]{"Alpha", "A", "Opacity", "Op"}, "Alpha value for each drawn line", 255, 1, 255, 1); - public TracersModule() { super("Tracers", new String[]{"Trace", "Tracer", "Snapline", "Snaplines"}, "Draws a line to entities", "NONE", -1, ModuleType.RENDER); } @@ -103,11 +97,7 @@ public final class TracersModule extends Module { } private boolean checkFilter(Entity entity) { - boolean ret = false; - - if (this.players.getValue() && entity instanceof EntityPlayer && entity != Minecraft.getMinecraft().player) { - ret = true; - } + boolean ret = this.players.getValue() && entity instanceof EntityPlayer && entity != Minecraft.getMinecraft().player; if (this.mobs.getValue() && entity instanceof IMob) { ret = true; @@ -158,4 +148,8 @@ public final class TracersModule extends Module { return ColorUtil.changeAlpha(ret, this.alpha.getValue()); } + private enum Mode { + TWO_D, THREE_D // TWO_DIMENSIONAL, THREE_DIMENSIONAL + } + } diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/render/WallHackModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/render/WallHackModule.java index 19d9917..55cdc85 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/render/WallHackModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/render/WallHackModule.java @@ -62,64 +62,37 @@ public final class WallHackModule extends Module { public final Value mode = new Value("Mode", new String[]{"Mode", "M"}, "The mode of the drawn esp/wallhack", Mode.OPAQUE); public final Value hpMode = new Value("Hp", new String[]{"Health", "HpMode"}, "Rendering mode for the health bar", HealthMode.NONE); public final Value potionsMode = new Value("Potions", new String[]{"Pot", "Pots", "PotsMode"}, "Rendering mode for active potion-effects on the entity", PotionsMode.NONE); - - private enum Mode { - OPAQUE, BOX - } - public final Value players = new Value("Players", new String[]{"Player"}, "Choose to enable on players", true); public final Value playersColor = new Value("PlayersColor", new String[]{"playerscolor", "pc"}, "Change the color of players on esp", new Color(255, 68, 68)); - public final Value mobs = new Value("Mobs", new String[]{"Mob"}, "Choose to enable on mobs", true); public final Value mobsColor = new Value("MobsColor", new String[]{"mobscolor", "mc"}, "Change the color of mobs on esp", new Color(255, 170, 0)); - public final Value animals = new Value("Animals", new String[]{"Animal"}, "Choose to enable on animals", true); public final Value animalsColor = new Value("AnimalsColor", new String[]{"animalscolor", "ac"}, "Change the color of animals on esp", new Color(0, 255, 68)); - public final Value vehicles = new Value("Vehicles", new String[]{"Vehic", "Vehicle"}, "Choose to enable on vehicles", true); public final Value vehiclesColor = new Value("VehiclesColor", new String[]{"vehiclescolor", "vc"}, "Change the color of vehicles on esp", new Color(213, 255, 0)); - public final Value items = new Value("Items", new String[]{"Item"}, "Choose to enable on items", true); public final Value itemsColor = new Value("ItemsColor", new String[]{"itemscolor", "ic"}, "Change the color of items on esp", new Color(0, 255, 170)); - public final Value local = new Value("Local", new String[]{"Self"}, "Choose to enable on self/local-player", true); - public final Value crystals = new Value("Crystals", new String[]{"crystal", "crystals", "endcrystal", "endcrystals"}, "Choose to enable on end crystals", true); public final Value crystalsColor = new Value("CrystalsColor", new String[]{"endercrystalscolor", "endercrystalcolor", "crystalscolor", "crystalcolor", "ecc"}, "Change the color of ender crystals on esp", new Color(205, 0, 205)); - public final Value pearls = new Value("Pearls", new String[]{"Pearl"}, "Choose to enable on ender pearls.", true); public final Value pearlsColor = new Value("PearlsColor", new String[]{"enderpearlscolor", "enderpearlcolor", "pearlscolor", "pearlcolor", "epc"}, "Change the color of ender pearls on esp", new Color(151, 255, 252)); - public final Value armorStand = new Value("ArmorStands", new String[]{"ArmorStand", "ArmourStand", "ArmourStands", "ArmStand"}, "Choose to enable on armor-stands", true); public final Value footsteps = new Value("FootSteps", new String[]{"FootStep", "Steps"}, "Choose to draw entity footsteps", false); public final Value owner = new Value("Owner", new String[]{"Owners", "MobOwner"}, "Choose to draw entity (tame-able or horse) owner name", false); - public final Value nametag = new Value("Nametag", new String[]{"tag", "tags", "names", "name"}, "Draw the entity's name tag", true); public final Value ping = new Value("Ping", new String[]{"Ms"}, "Draw the entity's ping (only works on players)", true); public final Value armor = new Value("Armor", new String[]{"Arm"}, "Draw the entity's equipped armor", true); public final Value hearts = new Value("Hearts", new String[]{"Hrts"}, "Draw the entity's hearts in decimal format", true); public final Value absorption = new Value("Absorption", new String[]{"Abs", "GappleHearts"}, "Adds absorption value to heart display", true); public final Value enchants = new Value("Enchants", new String[]{"Ench"}, "Draw enchant names above the entity's equipped armor. (requires Armor value to be enabled", true); - public final Value friendsColor = new Value("FriendsColor", new String[]{"friendscolor", "friendcolor", "fc"}, "Change the color of friendly players on esp", new Color(153, 0, 238)); public final Value sneakingColor = new Value("SneakingColor", new String[]{"sneakingcolor", "sneakcolor", "sc"}, "Change the color of sneaking players on esp", new Color(238, 153, 0)); - + public final Value background = new Value("Background", new String[]{"Bg"}, "Draw a transparent black background behind any text or icon drawn", true); private final Map cachedMobOwners = Maps.newHashMap(); private final Timer uuidTimer = new Timer(); - - private enum PotionsMode { - NONE, ICON, TEXT - } - - public final Value background = new Value("Background", new String[]{"Bg"}, "Draw a transparent black background behind any text or icon drawn", true); - - private enum HealthMode { - NONE, BAR, BARTEXT - } - private final ICamera camera = new Frustum(); private final ResourceLocation inventory = new ResourceLocation("textures/gui/container/inventory.png"); - //i cba private final List footstepDataList = new CopyOnWriteArrayList<>(); @@ -672,6 +645,18 @@ public final class WallHackModule extends Module { return null; } + private enum Mode { + OPAQUE, BOX + } + + private enum PotionsMode { + NONE, ICON, TEXT + } + + private enum HealthMode { + NONE, BAR, BARTEXT + } + public static class FootstepData { private double x; private double y; diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/world/AmbianceModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/world/AmbianceModule.java index b08db63..aa16ad2 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/world/AmbianceModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/world/AmbianceModule.java @@ -20,10 +20,7 @@ import java.awt.*; */ public class AmbianceModule extends Module { - public enum SkyMode { - NORMAL, COLOR, SEPPUKU, RAINBOW, END, NONE - } - + private static final ResourceLocation END_SKY_TEXTURES = new ResourceLocation("textures/environment/end_sky.png"); public final Value skyMode = new Value("SkyMode", new String[]{"Sky", "Sm", "SkieMode", "Skie", "Skies"}, "Edit the skybox", SkyMode.SEPPUKU); public final Value skyColor = new Value("SkyColor", new String[]{"SkyCol", "Sc", "SkieColor", "SkieCol", "Color", "C"}, "Edit the skybox color (COLOR mode only)", new Color(0, 127, 255)); public final Value skyGamma = new Value("SkyGamma", new String[]{"SkyGam", "SkyG", "Sg", "Gamma", "G"}, "Edit the skybox gamma", 128, 1, 255, 1); @@ -32,8 +29,6 @@ public class AmbianceModule extends Module { private final Minecraft mc = Minecraft.getMinecraft(); private final Texture seppukuSkyTexture; private final Texture rainbowSkyTexture; - private static final ResourceLocation END_SKY_TEXTURES = new ResourceLocation("textures/environment/end_sky.png"); - public AmbianceModule() { super("Ambiance", new String[]{"Ambience", "CustomSky", "CustomSound", "CustomSounds"}, "Edit ambient parts of the game. (Sky, sounds, etc.)", "NONE", -1, ModuleType.WORLD); this.seppukuSkyTexture = new Texture("seppuku_sky.jpg"); @@ -147,4 +142,8 @@ public class AmbianceModule extends Module { GlStateManager.enableTexture2D(); GlStateManager.enableAlpha(); } + + public enum SkyMode { + NORMAL, COLOR, SEPPUKU, RAINBOW, END, NONE + } } diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/world/AutoFarmModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/world/AutoFarmModule.java index 1f84817..5b77e39 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/world/AutoFarmModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/world/AutoFarmModule.java @@ -30,10 +30,8 @@ public final class AutoFarmModule extends Module { public final Value range = new Value("Range", new String[]{"Range", "Reach", "r"}, "The range in blocks your player should reach to farm", 4.0f, 1.0f, 9.0f, 0.1f); public final Value rotate = new Value("Rotate", new String[]{"rot"}, "Should we rotate the player's head when Auto-Farming?", true); - - private BlockPos currentBlockPos; - private final RotationTask rotationTask = new RotationTask("AutoFarmTask", 3); + private BlockPos currentBlockPos; public AutoFarmModule() { super("AutoFarm", new String[]{"AutoFarm", "Farm", "AutoHoe", "AutoBoneMeal", "AutoPlant"}, "Good ol' farming, just change the \"Mode\" value", "NONE", -1, ModuleType.WORLD); diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/world/AutoToolModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/world/AutoToolModule.java index 54037fd..af59f0e 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/world/AutoToolModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/world/AutoToolModule.java @@ -28,11 +28,9 @@ import java.util.Objects; public final class AutoToolModule extends Module { public final Value silent = new Value<>("Silent", new String[]{"Sil"}, "Hold any item and spoof your mining tool. (Best tool must be in inventory)", false); - - private boolean send; - public BlockPos position; public EnumFacing facing; + private boolean send; public AutoToolModule() { super("AutoTool", new String[]{"Tool"}, "Automatically switches to the best tool", "NONE", -1, ModuleType.WORLD); diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/world/AutoWitherModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/world/AutoWitherModule.java index e1e30b3..9942313 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/world/AutoWitherModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/world/AutoWitherModule.java @@ -16,7 +16,6 @@ import me.rigamortis.seppuku.api.value.Value; import me.rigamortis.seppuku.impl.module.player.FreeCamModule; import net.minecraft.block.Block; import net.minecraft.block.BlockSoulSand; -import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.entity.player.InventoryPlayer; @@ -41,8 +40,6 @@ import java.util.List; */ public final class AutoWitherModule extends Module { - private final Minecraft mc = Minecraft.getMinecraft(); - public final Value rotate = new Value("Rotate", new String[]{"rotation", "r", "rotate"}, "Rotate to place blocks", true); public final Value disable = new Value("Disable", new String[]{"dis", "autodisable", "autodis", "d"}, "Automatically disable after wither is placed", false); public final Value sneak = new Value("PlaceOnSneak", new String[]{"sneak", "s", "pos", "sneakPlace"}, "When true, AutoWither will only place while the player is sneaking", false); @@ -50,7 +47,7 @@ public final class AutoWitherModule extends Module { public final Value range = new Value("Range", new String[]{"MaxRange", "MaximumRange"}, "The maximum block reaching range to continue building in", 6.0f, 1.0f, 10.0f, 0.5f); public final Value placeDelay = new Value("Delay", new String[]{"PlaceDelay", "PlaceDel"}, "The delay(ms) between blocks being placed", 100.0f, 0.0f, 500.0f, 1.0f); public final Value waitDelay = new Value("WaitDelay", new String[]{"RightClickDelay", "wd"}, "The delay(ms) between withers being created on right click", 750.0f, 0.0f, 1000.0f, 1.0f); - + private final Minecraft mc = Minecraft.getMinecraft(); private final Timer placeTimer = new Timer(); private final Timer waitTimer = new Timer(); private final RotationTask rotationTask = new RotationTask("AutoWitherTask", 2); diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/world/BridgeModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/world/BridgeModule.java index f0b7c15..eb60ebe 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/world/BridgeModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/world/BridgeModule.java @@ -48,7 +48,7 @@ public final class BridgeModule extends Module { } private Vec3i getNextBlock(Vec3i direction, final Minecraft mc) { - for (int i = 0; i <= (int) reach.getValue(); i++) { + for (int i = 0; i <= reach.getValue(); i++) { Vec3i position = new Vec3i(mc.player.posX + direction.getX() * i, mc.player.posY - 1, mc.player.posZ + direction.getZ() * i); Vec3i before = new Vec3i(mc.player.posX + direction.getX() * (i - 1), mc.player.posY - 1, mc.player.posZ + direction.getZ() * (i - 1)); if ((mc.world.getBlockState(new BlockPos(position.getX(), position.getY(), position.getZ())).getMaterial() == Material.AIR) && (mc.world.getBlockState(new BlockPos(before.getX(), before.getY(), before.getZ())).getMaterial() != Material.AIR)) { diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/world/NoteBotModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/world/NoteBotModule.java index a7d87ef..52f4826 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/world/NoteBotModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/world/NoteBotModule.java @@ -47,24 +47,18 @@ public final class NoteBotModule extends Module { private final Value tuneDelay = new Value("TuneDelay", new String[]{"Tune Delay", "tune-delay", "tdelay", "tdel", "td"}, "Delay(ms) to wait between right clicks", 200.0f, 0.0f, 1000.0f, 1.0f); private final RotationTask rotationTask = new RotationTask("NoteBot", 2); - - private BlockPos currentBlock; - private final int[] positionOffsets = new int[]{2, 1, 2}; - private final NotePlayer notePlayer = new NotePlayer(); private final NoteReceiver receiver = new NoteReceiver(); - private final Timer discoverTimer = new Timer(); private final Timer tuneTimer = new Timer(); private final Timer stateTimer = new Timer(); - private final List blocks = new ArrayList<>(); private final List tunedBlocks = new ArrayList<>(); private final Map discoveredBlocks = new HashMap<>(); - private final int BLOCK_AREA = 25; private final Minecraft mc = Minecraft.getMinecraft(); + private BlockPos currentBlock; public NoteBotModule() { super("NoteBot", new String[]{"NoteBot+", "MusicBot", "MusicPlayer", "MidiPlayer", "MidiBot"}, "Play .midi files on a 5x5 grid of note-blocks", "NONE", -1, ModuleType.WORLD); @@ -321,14 +315,6 @@ public final class NoteBotModule extends Module { this.notePlayer.end(); } - public enum BotState { - IDLE, DISCOVERING, TUNING, PLAYING; - } - - public enum Mode { - NORMAL, DEBUG - } - public Value getState() { return state; } @@ -341,6 +327,14 @@ public final class NoteBotModule extends Module { return receiver; } + public enum BotState { + IDLE, DISCOVERING, TUNING, PLAYING + } + + public enum Mode { + NORMAL, DEBUG + } + public class NoteReceiver implements Receiver { @Override public void send(MidiMessage midiMessage, long l) { diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/world/NukerModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/world/NukerModule.java index 647347e..b483bb1 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/world/NukerModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/world/NukerModule.java @@ -27,21 +27,13 @@ import team.stiff.pomelo.impl.annotated.handler.annotation.Listener; public final class NukerModule extends Module { public final Value mode = new Value("Mode", new String[]{"Mode", "M"}, "The nuker mode to use.", Mode.SELECTION); - - private enum Mode { - SELECTION, ALL, CREATIVE - } - public final Value distance = new Value("Distance", new String[]{"Dist", "D"}, "Maximum distance in blocks the nuker will reach", 4.5f, 0.0f, 5.0f, 0.1f); public final Value fixed = new Value("FixedDistance", new String[]{"Fixed", "fdist", "F"}, "Use vertical and horizontal distances in blocks instead of distances relative to the camera", false); public final Value vDistance = new Value("VerticalDistance", new String[]{"Vertical", "vdist", "VD"}, "Maximum vertical distance in blocks the nuker will reach", 4.5f, 0.0f, 5.0f, 0.1f); public final Value hDistance = new Value("HorizontalDistance", new String[]{"Horizontal", "hist", "HD"}, "Maximum horizontal distance in blocks the nuker will reach", 3f, 0.0f, 5.0f, 0.1f); - private final RotationTask rotationTask = new RotationTask("NukerTask", 2); - private Block selected = null; private BlockPos currentPos = null; - public NukerModule() { super("Nuker", new String[]{"Nuke"}, "Automatically mines blocks within reach", "NONE", -1, ModuleType.WORLD); } @@ -234,4 +226,8 @@ public final class NukerModule extends Module { return ret; } + private enum Mode { + SELECTION, ALL, CREATIVE + } + } diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/world/PhaseModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/world/PhaseModule.java index 72274a4..b69d9dc 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/world/PhaseModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/world/PhaseModule.java @@ -23,11 +23,6 @@ import team.stiff.pomelo.impl.annotated.handler.annotation.Listener; public final class PhaseModule extends Module { public final Value mode = new Value("Mode", new String[]{"Mode", "M"}, "The phase mode to use", Mode.SAND); - - private enum Mode { - SAND, PACKET, SKIP, NOCLIP - } - public final Value floor = new Value("Floor", new String[]{"Fl"}, "Prevents falling out of the world if enabled", true); public PhaseModule() { @@ -197,4 +192,8 @@ public final class PhaseModule extends Module { } } + private enum Mode { + SAND, PACKET, SKIP, NOCLIP + } + } diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/world/SlimeChunksModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/world/SlimeChunksModule.java index 936146e..fb52985 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/world/SlimeChunksModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/world/SlimeChunksModule.java @@ -25,9 +25,9 @@ import java.util.Random; */ public final class SlimeChunksModule extends Module { - private ICamera frustum = new Frustum(); + private final ICamera frustum = new Frustum(); - private List slimeChunkList = new ArrayList<>(); + private final List slimeChunkList = new ArrayList<>(); public SlimeChunksModule() { super("SlimeChunks", new String[]{"SlimesChunks", "SlimeC"}, "Highlights slime chunks(Requires world seed with .seed)", "NONE", -1, ModuleType.WORLD); diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/world/SpeedMineModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/world/SpeedMineModule.java index 0f95f6c..9c47632 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/world/SpeedMineModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/world/SpeedMineModule.java @@ -30,22 +30,14 @@ import java.awt.*; */ public final class SpeedMineModule extends Module { - public final Value mode = new Value("Mode", new String[]{"Mode", "M"}, "The speed-mine mode to use", Mode.DAMAGE); - - private enum Mode { - PACKET, DAMAGE, INSTANT, SEQUENTIAL - } - public static BlockPos autoPos; - - public BlockPos seqPos; - public EnumFacing seqDir; + public final Value mode = new Value("Mode", new String[]{"Mode", "M"}, "The speed-mine mode to use", Mode.DAMAGE); public final Minecraft mc = Minecraft.getMinecraft(); - public final Value reset = new Value("Reset", new String[]{"Res"}, "Stops current block destroy damage from resetting if enabled", true); public final Value doubleBreak = new Value("DoubleBreak", new String[]{"DoubleBreak", "Double", "DB"}, "Mining a block will also mine the block above it, if enabled", false); public final Value auto = new Value("Auto", new String[]{"MultiMine", "MM"}, "When enabled, allows for multi-mining blocks", false); - + public BlockPos seqPos; + public EnumFacing seqDir; public SpeedMineModule() { super("SpeedMine", new String[]{"FastMine"}, "Allows you to break blocks faster", "NONE", -1, ModuleType.WORLD); } @@ -104,7 +96,6 @@ public final class SpeedMineModule extends Module { } } - @Listener public void damageBlock(EventPlayerDamageBlock event) { if (canBreak(event.getPos())) { @@ -167,7 +158,6 @@ public final class SpeedMineModule extends Module { } } - private boolean canBreak(BlockPos pos) { final IBlockState blockState = mc.world.getBlockState(pos); final Block block = blockState.getBlock(); @@ -175,4 +165,9 @@ public final class SpeedMineModule extends Module { return block.getBlockHardness(blockState, mc.world, pos) != -1; } + + private enum Mode { + PACKET, DAMAGE, INSTANT, SEQUENTIAL + } + } diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/world/WaypointsModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/world/WaypointsModule.java index 678ff6a..23e4f63 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/world/WaypointsModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/world/WaypointsModule.java @@ -43,16 +43,9 @@ public final class WaypointsModule extends Module { public final Value pointSize = new Value("PointSize", new String[]{"psize", "pscale", "ps", "size", "scale", "s"}, "Size of the 3D rendered object", 0.5f, 0.1f, 3.0f, 0.1f); public final Value pointYOffset = new Value("PointYOffset", new String[]{"pyoffset", "pyoff", "pyo"}, "Y-level offset of the 3D rendered object", 0.0f, -1.0f, 1.0f, 0.1f); public final Value pointDiamondHeight = new Value("PointDiamondHeight", new String[]{"diamondheight", "diamondh", "pdh", "dh"}, "Extra height added to the top of the diamond object", 0.5f, 0.1f, 3.0f, 0.1f); - - public enum Shape { - CUBE, PYRAMID, DIAMOND, SPHERE - } - - private final Minecraft mc = Minecraft.getMinecraft(); private String host = ""; private float angle = 0; - public WaypointsModule() { super("Waypoints", new String[]{"Wp", "Waypoint"}, "Highlights waypoints", "NONE", -1, ModuleType.WORLD); } @@ -164,6 +157,10 @@ public final class WaypointsModule extends Module { } } + public enum Shape { + CUBE, PYRAMID, DIAMOND, SPHERE + } + public static final class WaypointData { private String host; private String name; diff --git a/src/main/java/me/rigamortis/seppuku/impl/patch/AbstractHorsePatch.java b/src/main/java/me/rigamortis/seppuku/impl/patch/AbstractHorsePatch.java index 531447a..66855f5 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/patch/AbstractHorsePatch.java +++ b/src/main/java/me/rigamortis/seppuku/impl/patch/AbstractHorsePatch.java @@ -21,6 +21,35 @@ public final class AbstractHorsePatch extends ClassPatch { super("net.minecraft.entity.passive.AbstractHorse", "aao"); } + /** + * Our canBeSteered hook + * Used to allow us to steer and control horses without a saddle + * + * @return + */ + public static boolean canBeSteeredHook() { + //dispatch our event + final EventSteerEntity event = new EventSteerEntity(); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + + return event.isCanceled(); + } + + /** + * Our isHorseSaddled hook + * Allows us to control and ride horses without actually + * having a saddle + * + * @return + */ + public static boolean isHorseSaddledHook() { + //dispatch our event + final EventHorseSaddled event = new EventHorseSaddled(); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + + return event.isCanceled(); + } + /** * This is where minecraft checks if you can steer horses * @@ -50,20 +79,6 @@ public final class AbstractHorsePatch extends ClassPatch { methodNode.instructions.insert(insnList); } - /** - * Our canBeSteered hook - * Used to allow us to steer and control horses without a saddle - * - * @return - */ - public static boolean canBeSteeredHook() { - //dispatch our event - final EventSteerEntity event = new EventSteerEntity(); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - - return event.isCanceled(); - } - /** * This is where minecraft handles steering horses if they have a saddle on * @@ -93,19 +108,4 @@ public final class AbstractHorsePatch extends ClassPatch { methodNode.instructions.insert(insnList); } - /** - * Our isHorseSaddled hook - * Allows us to control and ride horses without actually - * having a saddle - * - * @return - */ - public static boolean isHorseSaddledHook() { - //dispatch our event - final EventHorseSaddled event = new EventHorseSaddled(); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - - return event.isCanceled(); - } - } diff --git a/src/main/java/me/rigamortis/seppuku/impl/patch/ActiveRenderInfoPatch.java b/src/main/java/me/rigamortis/seppuku/impl/patch/ActiveRenderInfoPatch.java index 625d289..6555c8e 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/patch/ActiveRenderInfoPatch.java +++ b/src/main/java/me/rigamortis/seppuku/impl/patch/ActiveRenderInfoPatch.java @@ -21,6 +21,12 @@ public final class ActiveRenderInfoPatch extends ClassPatch { super("net.minecraft.client.renderer.ActiveRenderInfo", "bhv"); } + public static void updateRenderInfoHook() { + //update our model view projection matrix used to converting 3D world coordinates + //to 2D screen coordinates + RenderUtil.updateModelViewProjectionMatrix(); + } + /** * This is where minecraft updates the ModelViewProjection matrix * @@ -41,10 +47,4 @@ public final class ActiveRenderInfoPatch extends ClassPatch { methodNode.instructions.insert(insnList); } - public static void updateRenderInfoHook() { - //update our model view projection matrix used to converting 3D world coordinates - //to 2D screen coordinates - RenderUtil.updateModelViewProjectionMatrix(); - } - } diff --git a/src/main/java/me/rigamortis/seppuku/impl/patch/BlockFencePatch.java b/src/main/java/me/rigamortis/seppuku/impl/patch/BlockFencePatch.java index 654d4fe..f050885 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/patch/BlockFencePatch.java +++ b/src/main/java/me/rigamortis/seppuku/impl/patch/BlockFencePatch.java @@ -22,6 +22,14 @@ public final class BlockFencePatch extends ClassPatch { super("net.minecraft.block.BlockFence", "aqo"); } + public static boolean addCollisionBoxToListHook(BlockPos pos, Entity entity) { + //dispatch our event and pass the block and entity in + final EventAddCollisionBox event = new EventAddCollisionBox(pos, entity); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + + return event.isCanceled(); + } + @MethodPatch( mcpName = "addCollisionBoxToList", notchName = "a", @@ -48,12 +56,4 @@ public final class BlockFencePatch extends ClassPatch { methodNode.instructions.insert(insnList); } - public static boolean addCollisionBoxToListHook(BlockPos pos, Entity entity) { - //dispatch our event and pass the block and entity in - final EventAddCollisionBox event = new EventAddCollisionBox(pos, entity); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - - return event.isCanceled(); - } - } \ No newline at end of file diff --git a/src/main/java/me/rigamortis/seppuku/impl/patch/BlockLiquidPatch.java b/src/main/java/me/rigamortis/seppuku/impl/patch/BlockLiquidPatch.java index 8327be7..e85d639 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/patch/BlockLiquidPatch.java +++ b/src/main/java/me/rigamortis/seppuku/impl/patch/BlockLiquidPatch.java @@ -22,6 +22,59 @@ public final class BlockLiquidPatch extends ClassPatch { super("net.minecraft.block.BlockLiquid", "aru"); } + public static boolean canCollideCheckHook() { + final EventCanCollide event = new EventCanCollide(); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + return event.isCanceled(); + } + +// @MethodPatch( +// mcpName = "shouldSideBeRendered", +// notchName = "a", +// mcpDesc = "(Lnet/minecraft/block/state/IBlockState;Lnet/minecraft/world/IBlockAccess;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/EnumFacing;)Z", +// notchDesc = "(Lawt;Lamy;Let;Lfa;)Z") +// public void shouldSideBeRendered(MethodNode methodNode, PatchManager.Environment env) { +////create a list of instructions +// final InsnList insnList = new InsnList(); +// //create a new instance of "EventRenderBlockSide" and dupe the top value on the stack +// insnList.add(new TypeInsnNode(NEW, Type.getInternalName(EventRenderBlockSide.class))); +// insnList.add(new InsnNode(DUP)); +// //add ALOAD 0 to pass "this" into the event +// insnList.add(new VarInsnNode(ALOAD, 0)); +// //call "EventRenderBlockSide" constructor +// insnList.add(new MethodInsnNode(INVOKESPECIAL, Type.getInternalName(EventRenderBlockSide.class), "", env == PatchManager.Environment.IDE ? "(Lnet/minecraft/block/Block;)V" : "(Laow;)V", false)); +// //store our event in the local vars +// insnList.add(new VarInsnNode(ASTORE, 5)); +// //Seppuku.INSTANCE +// insnList.add(new FieldInsnNode(GETSTATIC, Type.getInternalName(Seppuku.class), "INSTANCE", "Lme/rigamortis/seppuku/Seppuku;")); +// //getEventManager +// insnList.add(new MethodInsnNode(INVOKEVIRTUAL, Type.getInternalName(Seppuku.class), "getEventManager", "()Lteam/stiff/pomelo/EventManager;", false)); +// //add ALOAD to access our event +// insnList.add(new VarInsnNode(ALOAD, 5)); +// //call EventManager.dispatchEvent and pass our event in +// insnList.add(new MethodInsnNode(INVOKEINTERFACE, Type.getInternalName(EventManager.class), "dispatchEvent", "(Ljava/lang/Object;)Ljava/lang/Object;", true)); +// //remove the top value on the stack +// insnList.add(new InsnNode(POP)); +// //add ALOAD to access our event +// insnList.add(new VarInsnNode(ALOAD, 5)); +// //call EventRenderBlockSide.isCanceled +// insnList.add(new MethodInsnNode(INVOKEVIRTUAL, Type.getInternalName(EventRenderBlockSide.class), "isCanceled", "()Z", false)); +// //create a label to jump to +// final LabelNode jmp = new LabelNode(); +// //add "if equals" +// insnList.add(new JumpInsnNode(IFEQ, jmp)); +// //add ALOAD to access our event +// insnList.add(new VarInsnNode(ALOAD, 5)); +// //call EventRenderBlockSide.isRenderable +// insnList.add(new MethodInsnNode(INVOKEVIRTUAL, Type.getInternalName(EventRenderBlockSide.class), "isRenderable", "()Z", false)); +// //return the value of isRenderable +// insnList.add(new InsnNode(IRETURN)); +// //add our label +// insnList.add(jmp); +// //add our instructions at the top of the function +// methodNode.instructions.insert(insnList); +// } + /** * This is where minecraft handles the collision boundingboxes for liquids * @@ -74,53 +127,6 @@ public final class BlockLiquidPatch extends ClassPatch { methodNode.instructions.insert(insnList); } -// @MethodPatch( -// mcpName = "shouldSideBeRendered", -// notchName = "a", -// mcpDesc = "(Lnet/minecraft/block/state/IBlockState;Lnet/minecraft/world/IBlockAccess;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/EnumFacing;)Z", -// notchDesc = "(Lawt;Lamy;Let;Lfa;)Z") -// public void shouldSideBeRendered(MethodNode methodNode, PatchManager.Environment env) { -////create a list of instructions -// final InsnList insnList = new InsnList(); -// //create a new instance of "EventRenderBlockSide" and dupe the top value on the stack -// insnList.add(new TypeInsnNode(NEW, Type.getInternalName(EventRenderBlockSide.class))); -// insnList.add(new InsnNode(DUP)); -// //add ALOAD 0 to pass "this" into the event -// insnList.add(new VarInsnNode(ALOAD, 0)); -// //call "EventRenderBlockSide" constructor -// insnList.add(new MethodInsnNode(INVOKESPECIAL, Type.getInternalName(EventRenderBlockSide.class), "", env == PatchManager.Environment.IDE ? "(Lnet/minecraft/block/Block;)V" : "(Laow;)V", false)); -// //store our event in the local vars -// insnList.add(new VarInsnNode(ASTORE, 5)); -// //Seppuku.INSTANCE -// insnList.add(new FieldInsnNode(GETSTATIC, Type.getInternalName(Seppuku.class), "INSTANCE", "Lme/rigamortis/seppuku/Seppuku;")); -// //getEventManager -// insnList.add(new MethodInsnNode(INVOKEVIRTUAL, Type.getInternalName(Seppuku.class), "getEventManager", "()Lteam/stiff/pomelo/EventManager;", false)); -// //add ALOAD to access our event -// insnList.add(new VarInsnNode(ALOAD, 5)); -// //call EventManager.dispatchEvent and pass our event in -// insnList.add(new MethodInsnNode(INVOKEINTERFACE, Type.getInternalName(EventManager.class), "dispatchEvent", "(Ljava/lang/Object;)Ljava/lang/Object;", true)); -// //remove the top value on the stack -// insnList.add(new InsnNode(POP)); -// //add ALOAD to access our event -// insnList.add(new VarInsnNode(ALOAD, 5)); -// //call EventRenderBlockSide.isCanceled -// insnList.add(new MethodInsnNode(INVOKEVIRTUAL, Type.getInternalName(EventRenderBlockSide.class), "isCanceled", "()Z", false)); -// //create a label to jump to -// final LabelNode jmp = new LabelNode(); -// //add "if equals" -// insnList.add(new JumpInsnNode(IFEQ, jmp)); -// //add ALOAD to access our event -// insnList.add(new VarInsnNode(ALOAD, 5)); -// //call EventRenderBlockSide.isRenderable -// insnList.add(new MethodInsnNode(INVOKEVIRTUAL, Type.getInternalName(EventRenderBlockSide.class), "isRenderable", "()Z", false)); -// //return the value of isRenderable -// insnList.add(new InsnNode(IRETURN)); -// //add our label -// insnList.add(jmp); -// //add our instructions at the top of the function -// methodNode.instructions.insert(insnList); -// } - @MethodPatch( mcpName = "canCollideCheck", notchName = "a", @@ -137,10 +143,4 @@ public final class BlockLiquidPatch extends ClassPatch { methodNode.instructions.insert(preInsn); } - public static boolean canCollideCheckHook() { - final EventCanCollide event = new EventCanCollide(); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - return event.isCanceled(); - } - } diff --git a/src/main/java/me/rigamortis/seppuku/impl/patch/BlockPanePatch.java b/src/main/java/me/rigamortis/seppuku/impl/patch/BlockPanePatch.java index 93b843c..d0d8383 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/patch/BlockPanePatch.java +++ b/src/main/java/me/rigamortis/seppuku/impl/patch/BlockPanePatch.java @@ -22,6 +22,14 @@ public final class BlockPanePatch extends ClassPatch { super("net.minecraft.block.BlockPane", "auo"); } + public static boolean addCollisionBoxToListHook(BlockPos pos, Entity entity) { + //dispatch our event and pass the block and entity in + final EventAddCollisionBox event = new EventAddCollisionBox(pos, entity); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + + return event.isCanceled(); + } + @MethodPatch( mcpName = "addCollisionBoxToList", notchName = "a", @@ -48,12 +56,4 @@ public final class BlockPanePatch extends ClassPatch { methodNode.instructions.insert(insnList); } - public static boolean addCollisionBoxToListHook(BlockPos pos, Entity entity) { - //dispatch our event and pass the block and entity in - final EventAddCollisionBox event = new EventAddCollisionBox(pos, entity); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - - return event.isCanceled(); - } - } diff --git a/src/main/java/me/rigamortis/seppuku/impl/patch/BlockPatch.java b/src/main/java/me/rigamortis/seppuku/impl/patch/BlockPatch.java index fccd8a0..b7b23fe 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/patch/BlockPatch.java +++ b/src/main/java/me/rigamortis/seppuku/impl/patch/BlockPatch.java @@ -1,9 +1,7 @@ package me.rigamortis.seppuku.impl.patch; import me.rigamortis.seppuku.Seppuku; -import me.rigamortis.seppuku.api.event.render.EventRenderBlockSide; import me.rigamortis.seppuku.api.event.world.EventAddCollisionBox; -import me.rigamortis.seppuku.api.event.world.EventGetBlockLayer; import me.rigamortis.seppuku.api.patch.ClassPatch; import me.rigamortis.seppuku.api.patch.MethodPatch; import me.rigamortis.seppuku.impl.management.PatchManager; @@ -11,7 +9,6 @@ import net.minecraft.entity.Entity; import net.minecraft.util.math.BlockPos; import org.objectweb.asm.Type; import org.objectweb.asm.tree.*; -import team.stiff.pomelo.EventManager; import static org.objectweb.asm.Opcodes.*; @@ -132,6 +129,20 @@ public final class BlockPatch extends ClassPatch { } */ + /** + * Our addCollisionBoxToList hook used to disable block collision + * + * @param entity + * @return + */ + public static boolean addCollisionBoxToListHook(BlockPos pos, Entity entity) { + //dispatch our event and pass the block and entity in + final EventAddCollisionBox event = new EventAddCollisionBox(pos, entity); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + + return event.isCanceled(); + } + /** * This is where minecraft adds aabb's for block collision * @@ -163,18 +174,4 @@ public final class BlockPatch extends ClassPatch { //insert our instructions methodNode.instructions.insert(insnList); } - - /** - * Our addCollisionBoxToList hook used to disable block collision - * - * @param entity - * @return - */ - public static boolean addCollisionBoxToListHook(BlockPos pos, Entity entity) { - //dispatch our event and pass the block and entity in - final EventAddCollisionBox event = new EventAddCollisionBox(pos, entity); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - - return event.isCanceled(); - } } diff --git a/src/main/java/me/rigamortis/seppuku/impl/patch/BlockRendererDispatcherPatch.java b/src/main/java/me/rigamortis/seppuku/impl/patch/BlockRendererDispatcherPatch.java index bb20a72..445d912 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/patch/BlockRendererDispatcherPatch.java +++ b/src/main/java/me/rigamortis/seppuku/impl/patch/BlockRendererDispatcherPatch.java @@ -23,6 +23,12 @@ public final class BlockRendererDispatcherPatch extends ClassPatch { super("net.minecraft.client.renderer.BlockRendererDispatcher", "bvm"); } + public static boolean renderBlockHook(IBlockState state, BlockPos pos, IBlockAccess access, BufferBuilder bufferBuilder) { + final EventRenderBlock event = new EventRenderBlock(state, pos, access, bufferBuilder); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + return event.isCanceled(); + } + //public boolean renderBlock(IBlockState state, BlockPos pos, IBlockAccess blockAccess, BufferBuilder bufferBuilderIn)Z //public boolean a(awt , et et1, amy amy1, buk buk1)Z { @MethodPatch( @@ -55,10 +61,4 @@ public final class BlockRendererDispatcherPatch extends ClassPatch { //insert instructions methodNode.instructions.insert(insnList); } - - public static boolean renderBlockHook(IBlockState state, BlockPos pos, IBlockAccess access, BufferBuilder bufferBuilder) { - final EventRenderBlock event = new EventRenderBlock(state, pos, access, bufferBuilder); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - return event.isCanceled(); - } } diff --git a/src/main/java/me/rigamortis/seppuku/impl/patch/BlockSlimePatch.java b/src/main/java/me/rigamortis/seppuku/impl/patch/BlockSlimePatch.java index 3d386b9..55f0e5b 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/patch/BlockSlimePatch.java +++ b/src/main/java/me/rigamortis/seppuku/impl/patch/BlockSlimePatch.java @@ -21,6 +21,32 @@ public final class BlockSlimePatch extends ClassPatch { super("net.minecraft.block.BlockSlime", "atu"); } + /** + * Our onEntityWalk hook + * Used to stop minecraft from slowing us down while + * walking on slime blocks + * + * @return + */ + public static boolean onEntityWalkHook() { + final EventWalkOnSlime event = new EventWalkOnSlime(); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + + return event.isCanceled(); + } + + /** + * Our onLanded hook used to remove slime bouncing + * + * @return + */ + public static boolean onLanded() { + final EventLandOnSlime event = new EventLandOnSlime(); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + + return event.isCanceled(); + } + /** * This is where minecraft slows us down while walking on slime blocks * @@ -49,20 +75,6 @@ public final class BlockSlimePatch extends ClassPatch { methodNode.instructions.insert(insnList); } - /** - * Our onEntityWalk hook - * Used to stop minecraft from slowing us down while - * walking on slime blocks - * - * @return - */ - public static boolean onEntityWalkHook() { - final EventWalkOnSlime event = new EventWalkOnSlime(); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - - return event.isCanceled(); - } - /** * This is where minecraft makes us bounce when we land on a slime * @@ -91,16 +103,4 @@ public final class BlockSlimePatch extends ClassPatch { methodNode.instructions.insert(insnList); } - /** - * Our onLanded hook used to remove slime bouncing - * - * @return - */ - public static boolean onLanded() { - final EventLandOnSlime event = new EventLandOnSlime(); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - - return event.isCanceled(); - } - } diff --git a/src/main/java/me/rigamortis/seppuku/impl/patch/BlockSoulSandPatch.java b/src/main/java/me/rigamortis/seppuku/impl/patch/BlockSoulSandPatch.java index 42a6d24..3e8b3b3 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/patch/BlockSoulSandPatch.java +++ b/src/main/java/me/rigamortis/seppuku/impl/patch/BlockSoulSandPatch.java @@ -20,6 +20,19 @@ public final class BlockSoulSandPatch extends ClassPatch { super("net.minecraft.block.BlockSoulSand", "atx"); } + /** + * Our onEntityCollidedWithBlock hook used to disable + * the slowing of movement while on soul sand + * + * @return + */ + public static boolean onEntityCollidedWithBlockHook() { + final EventCollideSoulSand event = new EventCollideSoulSand(); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + + return event.isCanceled(); + } + /** * This is where minecraft slows you down when moving on soul sand * @@ -48,17 +61,4 @@ public final class BlockSoulSandPatch extends ClassPatch { methodNode.instructions.insert(insnList); } - /** - * Our onEntityCollidedWithBlock hook used to disable - * the slowing of movement while on soul sand - * - * @return - */ - public static boolean onEntityCollidedWithBlockHook() { - final EventCollideSoulSand event = new EventCollideSoulSand(); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - - return event.isCanceled(); - } - } diff --git a/src/main/java/me/rigamortis/seppuku/impl/patch/BlockStairsPatch.java b/src/main/java/me/rigamortis/seppuku/impl/patch/BlockStairsPatch.java index 96876d9..5c195ca 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/patch/BlockStairsPatch.java +++ b/src/main/java/me/rigamortis/seppuku/impl/patch/BlockStairsPatch.java @@ -22,6 +22,14 @@ public final class BlockStairsPatch extends ClassPatch { super("net.minecraft.block.BlockStairs", "aud"); } + public static boolean addCollisionBoxToListHook(BlockPos pos, Entity entity) { + //dispatch our event and pass the block and entity in + final EventAddCollisionBox event = new EventAddCollisionBox(pos, entity); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + + return event.isCanceled(); + } + @MethodPatch( mcpName = "" + "addCollisionBoxToList", @@ -49,12 +57,4 @@ public final class BlockStairsPatch extends ClassPatch { methodNode.instructions.insert(insnList); } - public static boolean addCollisionBoxToListHook(BlockPos pos, Entity entity) { - //dispatch our event and pass the block and entity in - final EventAddCollisionBox event = new EventAddCollisionBox(pos, entity); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - - return event.isCanceled(); - } - } diff --git a/src/main/java/me/rigamortis/seppuku/impl/patch/ChunkPatch.java b/src/main/java/me/rigamortis/seppuku/impl/patch/ChunkPatch.java index a6fb59b..e2deaf6 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/patch/ChunkPatch.java +++ b/src/main/java/me/rigamortis/seppuku/impl/patch/ChunkPatch.java @@ -23,6 +23,12 @@ public final class ChunkPatch extends ClassPatch { super("net.minecraft.world.chunk.Chunk", "axw"); } + public static boolean onEntityAddedHook(Entity entity) { + final EventAddEntity eventAddEntity = new EventAddEntity(entity); + Seppuku.INSTANCE.getEventManager().dispatchEvent(eventAddEntity); + return eventAddEntity.isCanceled(); + } + @MethodPatch( mcpName = "onUnload", notchName = "d", @@ -65,12 +71,6 @@ public final class ChunkPatch extends ClassPatch { methodNode.instructions.insert(insnList); } - public static boolean onEntityAddedHook(Entity entity) { - final EventAddEntity eventAddEntity = new EventAddEntity(entity); - Seppuku.INSTANCE.getEventManager().dispatchEvent(eventAddEntity); - return eventAddEntity.isCanceled(); - } - /** * // access flags 0x9 * public static handleChunkDataHook(Lnet/minecraft/world/chunk/Chunk;)V diff --git a/src/main/java/me/rigamortis/seppuku/impl/patch/EntityLlamaPatch.java b/src/main/java/me/rigamortis/seppuku/impl/patch/EntityLlamaPatch.java index c554e44..c0c3c39 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/patch/EntityLlamaPatch.java +++ b/src/main/java/me/rigamortis/seppuku/impl/patch/EntityLlamaPatch.java @@ -20,6 +20,20 @@ public final class EntityLlamaPatch extends ClassPatch { super("net.minecraft.entity.passive.EntityLlama", "aas"); } + /** + * Our canBeSteered hook + * Used to allow us to steer and control llamas + * + * @return + */ + public static boolean canBeSteeredHook() { + //dispatch our event + final EventSteerEntity event = new EventSteerEntity(); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + + return event.isCanceled(); + } + /** * This is where minecraft checks if you can steer llamas * @@ -48,18 +62,4 @@ public final class EntityLlamaPatch extends ClassPatch { //insert the list of instructions at the top of the function methodNode.instructions.insert(insnList); } - - /** - * Our canBeSteered hook - * Used to allow us to steer and control llamas - * - * @return - */ - public static boolean canBeSteeredHook() { - //dispatch our event - final EventSteerEntity event = new EventSteerEntity(); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - - return event.isCanceled(); - } } diff --git a/src/main/java/me/rigamortis/seppuku/impl/patch/EntityPigPatch.java b/src/main/java/me/rigamortis/seppuku/impl/patch/EntityPigPatch.java index cbc8ec8..6d7cd76 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/patch/EntityPigPatch.java +++ b/src/main/java/me/rigamortis/seppuku/impl/patch/EntityPigPatch.java @@ -22,6 +22,28 @@ public final class EntityPigPatch extends ClassPatch { super("net.minecraft.entity.passive.EntityPig", "aad"); } + public static boolean travelHook() { + final EventPigTravel event = new EventPigTravel(); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + + return event.isCanceled(); + } + + /** + * Our canBeSteered hook + * Used to allow us to steer and control pigs + * without a "carrot on a stick" + * + * @return + */ + public static boolean canBeSteeredHook() { + //dispatch our event + final EventSteerEntity event = new EventSteerEntity(); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + + return event.isCanceled(); + } + /** * This is where minecraft checks if you can steer pigs * @@ -75,26 +97,4 @@ public final class EntityPigPatch extends ClassPatch { } } - public static boolean travelHook() { - final EventPigTravel event = new EventPigTravel(); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - - return event.isCanceled(); - } - - /** - * Our canBeSteered hook - * Used to allow us to steer and control pigs - * without a "carrot on a stick" - * - * @return - */ - public static boolean canBeSteeredHook() { - //dispatch our event - final EventSteerEntity event = new EventSteerEntity(); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - - return event.isCanceled(); - } - } diff --git a/src/main/java/me/rigamortis/seppuku/impl/patch/EntityPlayerPatch.java b/src/main/java/me/rigamortis/seppuku/impl/patch/EntityPlayerPatch.java index 40e9c9d..10c2118 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/patch/EntityPlayerPatch.java +++ b/src/main/java/me/rigamortis/seppuku/impl/patch/EntityPlayerPatch.java @@ -21,6 +21,33 @@ public final class EntityPlayerPatch extends ClassPatch { super("net.minecraft.entity.player.EntityPlayer", "aed"); } + /** + * Our isPushedByWater hook + * + * @return + */ + public static boolean isPushedByWaterHook() { + //dispatch our event + final EventPushedByWater event = new EventPushedByWater(); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + + return event.isCanceled(); + } + + /** + * Our applyEntityCollision hook + * Used to cancel entity collision + * + * @return + */ + public static boolean applyEntityCollisionHook() { + //dispatch our event + final EventApplyCollision event = new EventApplyCollision(); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + + return event.isCanceled(); + } + /** * This is where minecraft handles * water pushing @@ -53,19 +80,6 @@ public final class EntityPlayerPatch extends ClassPatch { methodNode.instructions.insert(insnList); } - /** - * Our isPushedByWater hook - * - * @return - */ - public static boolean isPushedByWaterHook() { - //dispatch our event - final EventPushedByWater event = new EventPushedByWater(); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - - return event.isCanceled(); - } - /** * This is where minecraft handles entities * colliding with each other @@ -95,18 +109,4 @@ public final class EntityPlayerPatch extends ClassPatch { methodNode.instructions.insert(insnList); } - /** - * Our applyEntityCollision hook - * Used to cancel entity collision - * - * @return - */ - public static boolean applyEntityCollisionHook() { - //dispatch our event - final EventApplyCollision event = new EventApplyCollision(); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - - return event.isCanceled(); - } - } diff --git a/src/main/java/me/rigamortis/seppuku/impl/patch/EntityPlayerSPPatch.java b/src/main/java/me/rigamortis/seppuku/impl/patch/EntityPlayerSPPatch.java index 64d81aa..1c13279 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/patch/EntityPlayerSPPatch.java +++ b/src/main/java/me/rigamortis/seppuku/impl/patch/EntityPlayerSPPatch.java @@ -25,6 +25,134 @@ public final class EntityPlayerSPPatch extends ClassPatch { super("net.minecraft.client.entity.EntityPlayerSP", "bud"); } + /** + * Our onUpdate hook + * This is where minecraft runs movement related code and + * sends movement packets + * + * @param stage + * @return + */ + public static boolean onUpdateHook(EventStageable.EventStage stage) { + //dispatch our event and pass the stage in + final EventPlayerUpdate event = new EventPlayerUpdate(stage); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + + if (stage == EventStageable.EventStage.PRE) { + //update all camera fbos after we render + Seppuku.INSTANCE.getCameraManager().update(); + } + + return event.isCanceled(); + } + + /** + * Our onUpdate hook + * This is where minecraft runs non vehicle movement related code and + * sends movement packets + * + * @param stage + * @return + */ + public static boolean onUpdateWalkingPlayerHook(EventStageable.EventStage stage) { + if (stage == EventStageable.EventStage.PRE) { + Seppuku.INSTANCE.getRotationManager().updateRotations(); + Seppuku.INSTANCE.getPositionManager().updatePosition(); + } + + //dispatch our event and pass the stage in + final EventUpdateWalkingPlayer event = new EventUpdateWalkingPlayer(stage); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + + if (stage == EventStageable.EventStage.POST) { + Seppuku.INSTANCE.getRotationManager().restoreRotations(); + Seppuku.INSTANCE.getPositionManager().restorePosition(); + } + + return event.isCanceled(); + } + + /** + * Our sendChatMessage hook + * It allows us to intercept outgoing chat messages + * + * @param message + * @return + */ + public static boolean sendChatMessageHook(String message) { + //dispatch our event and pass the message in + final EventSendChatMessage event = new EventSendChatMessage(message); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + + return event.isCanceled(); + } + + /** + * This is our swingArm hook + * We can cancel to stop our swing animation + * It's useful for older servers that dont support + * swinging the OFF_HAND + * + * @param hand + * @return + */ + public static boolean swingArmHook(EnumHand hand) { + //dispatch our event and pass the EnumHand in + final EventSwingArm event = new EventSwingArm(hand); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + + return event.isCanceled(); + } + + /** + * Our closeScreen hook + * Useful for some mods i.e MoreInv + * + * @return + */ + public static boolean closeScreenHook() { + //dispatch our event + final EventCloseScreen event = new EventCloseScreen(); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + + return event.isCanceled(); + } + + /** + * Our pushOutOfBlocks hook used to disable being pushed out of blocks + * + * @return + */ + public static boolean pushOutOfBlocksHook() { + //dispatch our event + final EventPushOutOfBlocks event = new EventPushOutOfBlocks(); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + + return event.isCanceled(); + } + + /** + * Our onLivingUpdate mid function hook + * Used to negate slowing down while hands are active + */ + public static void onLivingUpdateHook() { + //dispatch our event + final EventUpdateInput event = new EventUpdateInput(); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + } + + /** + * Our isHandActive hook used to override hand activity + * + * @return + */ + public static boolean isHandActiveHook() { + //dispatch our event + final EventHandActive event = new EventHandActive(); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + return event.isCanceled(); + } + /** * This is where minecraft handles player updates and movement * @@ -63,27 +191,6 @@ public final class EntityPlayerSPPatch extends ClassPatch { methodNode.instructions.insertBefore(ASMUtil.bottom(methodNode), postInsn); } - /** - * Our onUpdate hook - * This is where minecraft runs movement related code and - * sends movement packets - * - * @param stage - * @return - */ - public static boolean onUpdateHook(EventStageable.EventStage stage) { - //dispatch our event and pass the stage in - final EventPlayerUpdate event = new EventPlayerUpdate(stage); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - - if (stage == EventStageable.EventStage.PRE) { - //update all camera fbos after we render - Seppuku.INSTANCE.getCameraManager().update(); - } - - return event.isCanceled(); - } - /** * This is where minecraft handles player updates and movement * while not in a vehicle @@ -123,32 +230,6 @@ public final class EntityPlayerSPPatch extends ClassPatch { methodNode.instructions.insertBefore(ASMUtil.bottom(methodNode), postInsn); } - /** - * Our onUpdate hook - * This is where minecraft runs non vehicle movement related code and - * sends movement packets - * - * @param stage - * @return - */ - public static boolean onUpdateWalkingPlayerHook(EventStageable.EventStage stage) { - if (stage == EventStageable.EventStage.PRE) { - Seppuku.INSTANCE.getRotationManager().updateRotations(); - Seppuku.INSTANCE.getPositionManager().updatePosition(); - } - - //dispatch our event and pass the stage in - final EventUpdateWalkingPlayer event = new EventUpdateWalkingPlayer(stage); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - - if (stage == EventStageable.EventStage.POST) { - Seppuku.INSTANCE.getRotationManager().restoreRotations(); - Seppuku.INSTANCE.getPositionManager().restorePosition(); - } - - return event.isCanceled(); - } - /** * This is where minecraft handles sending chat messages * @@ -178,21 +259,6 @@ public final class EntityPlayerSPPatch extends ClassPatch { methodNode.instructions.insert(insnList); } - /** - * Our sendChatMessage hook - * It allows us to intercept outgoing chat messages - * - * @param message - * @return - */ - public static boolean sendChatMessageHook(String message) { - //dispatch our event and pass the message in - final EventSendChatMessage event = new EventSendChatMessage(message); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - - return event.isCanceled(); - } - @MethodPatch( mcpName = "swingArm", notchName = "a", @@ -217,23 +283,6 @@ public final class EntityPlayerSPPatch extends ClassPatch { methodNode.instructions.insert(insnList); } - /** - * This is our swingArm hook - * We can cancel to stop our swing animation - * It's useful for older servers that dont support - * swinging the OFF_HAND - * - * @param hand - * @return - */ - public static boolean swingArmHook(EnumHand hand) { - //dispatch our event and pass the EnumHand in - final EventSwingArm event = new EventSwingArm(hand); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - - return event.isCanceled(); - } - /** * This happens when you exit an inventory * @@ -261,20 +310,6 @@ public final class EntityPlayerSPPatch extends ClassPatch { methodNode.instructions.insert(insnList); } - /** - * Our closeScreen hook - * Useful for some mods i.e MoreInv - * - * @return - */ - public static boolean closeScreenHook() { - //dispatch our event - final EventCloseScreen event = new EventCloseScreen(); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - - return event.isCanceled(); - } - @MethodPatch( mcpName = "pushOutOfBlocks", notchName = "i", @@ -298,19 +333,6 @@ public final class EntityPlayerSPPatch extends ClassPatch { methodNode.instructions.insert(insnList); } - /** - * Our pushOutOfBlocks hook used to disable being pushed out of blocks - * - * @return - */ - public static boolean pushOutOfBlocksHook() { - //dispatch our event - final EventPushOutOfBlocks event = new EventPushOutOfBlocks(); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - - return event.isCanceled(); - } - /** * This is where minecraft slows you down while your hand is active * @@ -329,16 +351,6 @@ public final class EntityPlayerSPPatch extends ClassPatch { } } - /** - * Our onLivingUpdate mid function hook - * Used to negate slowing down while hands are active - */ - public static void onLivingUpdateHook() { - //dispatch our event - final EventUpdateInput event = new EventUpdateInput(); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - } - @MethodPatch( mcpName = "move", notchName = "a", @@ -404,17 +416,5 @@ public final class EntityPlayerSPPatch extends ClassPatch { //insert the list of instructs at the top of the function methodNode.instructions.insert(insnList); } - - /** - * Our isHandActive hook used to override hand activity - * - * @return - */ - public static boolean isHandActiveHook() { - //dispatch our event - final EventHandActive event = new EventHandActive(); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - return event.isCanceled(); - } } diff --git a/src/main/java/me/rigamortis/seppuku/impl/patch/EntityRendererPatch.java b/src/main/java/me/rigamortis/seppuku/impl/patch/EntityRendererPatch.java index b35d7c3..ce1ec39 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/patch/EntityRendererPatch.java +++ b/src/main/java/me/rigamortis/seppuku/impl/patch/EntityRendererPatch.java @@ -42,32 +42,6 @@ public final class EntityRendererPatch extends ClassPatch { super("net.minecraft.client.renderer.EntityRenderer", "buq"); } - /** - * This is where we place our 2d rendering context - * - * @param methodNode - * @param env - */ - @MethodPatch( - mcpName = "updateCameraAndRender", - notchName = "a", - mcpDesc = "(FJ)V") - public void updateCameraAndRender(MethodNode methodNode, PatchManager.Environment env) { - //find the instruction that calls renderGameOverlay - final AbstractInsnNode target = ASMUtil.findMethodInsn(methodNode, INVOKEVIRTUAL, env == PatchManager.Environment.IDE ? "net/minecraft/client/gui/GuiIngame" : "biq", env == PatchManager.Environment.IDE ? "renderGameOverlay" : "a", "(F)V"); - - if (target != null) { - //create a list of instructions - final InsnList insnList = new InsnList(); - //add FLOAD to pass partialTicks param into our hook function - insnList.add(new VarInsnNode(FLOAD, 1)); - //call our hook function - insnList.add(new MethodInsnNode(INVOKESTATIC, Type.getInternalName(this.getClass()), "updateCameraAndRenderHook", "(F)V", false)); - //insert our instructions after the renderGameOverlay call - methodNode.instructions.insert(target, insnList); - } - } - /** * This is our 2d render context * Anything rendered here will be in screen space @@ -80,34 +54,6 @@ public final class EntityRendererPatch extends ClassPatch { Seppuku.INSTANCE.getEventManager().dispatchEvent(new EventRender2D(partialTicks, new ScaledResolution(Minecraft.getMinecraft()))); } - /** - * This is where we place our 3d rendering context - * - * @param methodNode - * @param env - */ - @MethodPatch( - mcpName = "renderWorldPass", - notchName = "a", - mcpDesc = "(IFJ)V") - public void renderWorldPass(MethodNode methodNode, PatchManager.Environment env) { - //find the LDC instruction with the value "hand" - //there is only 1 in this function and its passed into the call - //mc.mcProfiler.endStartSection("hand"); - final AbstractInsnNode target = ASMUtil.findInsnLdc(methodNode, "hand"); - - if (target != null) { - //make a list of instructions - final InsnList list = new InsnList(); - //add FLOAD to pass the partialTicks param into our hook function - list.add(new VarInsnNode(FLOAD, 2)); - //call our hook function - list.add(new MethodInsnNode(INVOKESTATIC, Type.getInternalName(this.getClass()), "renderWorldPassHook", "(F)V", false)); - //insert the list of instructions 1 instruction after the LDC - methodNode.instructions.insert(target.getNext(), list); - } - } - /** * This is our 3d render context * Anything rendered here will be rendered in world space @@ -123,34 +69,6 @@ public final class EntityRendererPatch extends ClassPatch { Seppuku.INSTANCE.getEventManager().dispatchEvent(new EventRender3D(partialTicks)); } - /** - * This is where minecraft rotates and shakes your screen - * while taking damage - * - * @param methodNode - * @param env - */ - @MethodPatch( - mcpName = "hurtCameraEffect", - notchName = "d", - mcpDesc = "(F)V") - public void hurtCameraEffect(MethodNode methodNode, PatchManager.Environment env) { - //create a list of instructions and add the needed instructions to call our hook function - final InsnList insnList = new InsnList(); - //call our hook function - insnList.add(new MethodInsnNode(INVOKESTATIC, Type.getInternalName(this.getClass()), "hurtCameraEffectHook", "()Z", false)); - //add a label to jump to - final LabelNode jmp = new LabelNode(); - //add if equals and pass the label - insnList.add(new JumpInsnNode(IFEQ, jmp)); - //add return so the rest of the function doesn't get called - insnList.add(new InsnNode(RETURN)); - //add our label - insnList.add(jmp); - //insert the list of instructions at the top of the function - methodNode.instructions.insert(insnList); - } - /** * Our hurtCameraEffect hook * Used to disable the screen shaking effect while taking damage @@ -165,89 +83,12 @@ public final class EntityRendererPatch extends ClassPatch { return event.isCanceled(); } - @MethodPatch( - mcpName = "orientCamera", - notchName = "f", - mcpDesc = "(F)V") - public void orientCamera(MethodNode methodNode, PatchManager.Environment env) { - final AbstractInsnNode target = ASMUtil.findMethodInsn(methodNode, INVOKEVIRTUAL, env == PatchManager.Environment.IDE ? "net/minecraft/client/multiplayer/WorldClient" : "bsb", env == PatchManager.Environment.IDE ? "rayTraceBlocks" : "a", env == PatchManager.Environment.IDE ? "(Lnet/minecraft/util/math/Vec3d;Lnet/minecraft/util/math/Vec3d;)Lnet/minecraft/util/math/RayTraceResult;" : "(Lbhe;Lbhe;)Lbhc;"); - - if (target != null) { - final InsnList insnList = new InsnList(); - insnList.add(new MethodInsnNode(INVOKESTATIC, Type.getInternalName(this.getClass()), "orientCameraHook", "()Z", false)); - final LabelNode jmp = new LabelNode(); - insnList.add(new JumpInsnNode(IFEQ, jmp)); - insnList.add(new InsnNode(ACONST_NULL)); - insnList.add(new VarInsnNode(ASTORE, 24)); - insnList.add(jmp); - methodNode.instructions.insert(target.getNext(), insnList); - } - } - public static boolean orientCameraHook() { final EventOrientCamera event = new EventOrientCamera(); Seppuku.INSTANCE.getEventManager().dispatchEvent(event); return event.isCanceled(); } - @MethodPatch( - mcpName = "getFOVModifier", - notchName = "a", - mcpDesc = "(FZ)F") - public void getFovModifier(MethodNode methodNode, PatchManager.Environment env) { - final InsnList insnList = new InsnList(); - insnList.add(new TypeInsnNode(NEW, Type.getInternalName(EventFovModifier.class))); - insnList.add(new InsnNode(DUP)); - insnList.add(new MethodInsnNode(INVOKESPECIAL, Type.getInternalName(EventFovModifier.class), "", "()V", false)); - insnList.add(new VarInsnNode(ASTORE, 5)); - - insnList.add(new FieldInsnNode(GETSTATIC, Type.getInternalName(Seppuku.class), "INSTANCE", "Lme/rigamortis/seppuku/Seppuku;")); - insnList.add(new MethodInsnNode(INVOKEVIRTUAL, Type.getInternalName(Seppuku.class), "getEventManager", "()Lteam/stiff/pomelo/EventManager;", false)); - insnList.add(new VarInsnNode(ALOAD, 5)); - insnList.add(new MethodInsnNode(INVOKEINTERFACE, Type.getInternalName(EventManager.class), "dispatchEvent", "(Ljava/lang/Object;)Ljava/lang/Object;", true)); - insnList.add(new InsnNode(POP)); - - insnList.add(new VarInsnNode(ALOAD, 5)); - insnList.add(new MethodInsnNode(INVOKEVIRTUAL, Type.getInternalName(EventFovModifier.class), "isCanceled", "()Z", false)); - final LabelNode label = new LabelNode(); - insnList.add(new JumpInsnNode(IFEQ, label)); - insnList.add(new VarInsnNode(ALOAD, 5)); - insnList.add(new MethodInsnNode(INVOKEVIRTUAL, Type.getInternalName(EventFovModifier.class), "getFov", "()F", false)); - insnList.add(new InsnNode(FRETURN)); - insnList.add(label); - methodNode.instructions.insert(insnList); - } - - @MethodPatch( - mcpName = "getMouseOver", - notchName = "a", - mcpDesc = "(F)V") - public void getMouseOver(MethodNode methodNode, PatchManager.Environment env) { - final InsnList insnList = new InsnList(); - insnList.add(new VarInsnNode(FLOAD, 1)); - insnList.add(new MethodInsnNode(INVOKESTATIC, Type.getInternalName(this.getClass()), "getMouseOverHook", "(F)V", false)); - insnList.add(new InsnNode(RETURN)); - methodNode.instructions.insert(insnList); - } - -//private void setupFog(int startCoords, float partialTicks) { -// @MethodPatch( -// mcpName = "setupFog", -// notchName = "a", -// mcpDesc = "(IF)V") -// public void setupFog(MethodNode methodNode, PatchManager.Environment env) { -// final InsnList insnList = new InsnList(); -// insnList.add(new VarInsnNode(ILOAD, 1)); -// insnList.add(new MethodInsnNode(INVOKESTATIC, Type.getInternalName(this.getClass()), "setupFogHook", "(I)V", false)); -// //insnList.add(new InsnNode(RETURN)); -// methodNode.instructions.insert(insnList); -// } -// -// public static void setupFogHook(int startCoords) { -// final EventSetupFog event = new EventSetupFog(startCoords); -// Seppuku.INSTANCE.getEventManager().dispatchEvent(event); -// } - /** * getMouseOver (original game function with modified event handling) * @@ -299,8 +140,8 @@ public final class EntityRendererPatch extends ClassPatch { double d2 = d1; for (int j = 0; j < list.size(); ++j) { - Entity entity1 = (Entity) list.get(j); - AxisAlignedBB axisalignedbb = entity1.getEntityBoundingBox().grow((double) entity1.getCollisionBorderSize()); + Entity entity1 = list.get(j); + AxisAlignedBB axisalignedbb = entity1.getEntityBoundingBox().grow(entity1.getCollisionBorderSize()); RayTraceResult raytraceresult = axisalignedbb.calculateIntercept(vec3d, vec3d2); if (axisalignedbb.contains(vec3d)) { if (d2 >= 0.0D) { @@ -342,6 +183,190 @@ public final class EntityRendererPatch extends ClassPatch { } + /** + * This is our renderName hook + * Used to disable rendering minecrafts default + * name tags on certain entities + * + * @param fontRenderer + * @param str + * @param x + * @param y + * @param z + * @param verticalShift + * @param viewerYaw + * @param viewerPitch + * @param isThirdPersonFrontal + * @param isSneaking + * @return + */ + public static boolean drawNameplateHook(FontRenderer fontRenderer, String str, float x, float y, float z, int verticalShift, float viewerYaw, float viewerPitch, boolean isThirdPersonFrontal, boolean isSneaking) { + //dispatch our event and pass the entity in + final EventDrawNameplate event = new EventDrawNameplate(fontRenderer, str, x, y, z, verticalShift, viewerYaw, viewerPitch, isThirdPersonFrontal, isSneaking); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + + return event.isCanceled(); + } + + /** + * This is where we place our 2d rendering context + * + * @param methodNode + * @param env + */ + @MethodPatch( + mcpName = "updateCameraAndRender", + notchName = "a", + mcpDesc = "(FJ)V") + public void updateCameraAndRender(MethodNode methodNode, PatchManager.Environment env) { + //find the instruction that calls renderGameOverlay + final AbstractInsnNode target = ASMUtil.findMethodInsn(methodNode, INVOKEVIRTUAL, env == PatchManager.Environment.IDE ? "net/minecraft/client/gui/GuiIngame" : "biq", env == PatchManager.Environment.IDE ? "renderGameOverlay" : "a", "(F)V"); + + if (target != null) { + //create a list of instructions + final InsnList insnList = new InsnList(); + //add FLOAD to pass partialTicks param into our hook function + insnList.add(new VarInsnNode(FLOAD, 1)); + //call our hook function + insnList.add(new MethodInsnNode(INVOKESTATIC, Type.getInternalName(this.getClass()), "updateCameraAndRenderHook", "(F)V", false)); + //insert our instructions after the renderGameOverlay call + methodNode.instructions.insert(target, insnList); + } + } + + /** + * This is where we place our 3d rendering context + * + * @param methodNode + * @param env + */ + @MethodPatch( + mcpName = "renderWorldPass", + notchName = "a", + mcpDesc = "(IFJ)V") + public void renderWorldPass(MethodNode methodNode, PatchManager.Environment env) { + //find the LDC instruction with the value "hand" + //there is only 1 in this function and its passed into the call + //mc.mcProfiler.endStartSection("hand"); + final AbstractInsnNode target = ASMUtil.findInsnLdc(methodNode, "hand"); + + if (target != null) { + //make a list of instructions + final InsnList list = new InsnList(); + //add FLOAD to pass the partialTicks param into our hook function + list.add(new VarInsnNode(FLOAD, 2)); + //call our hook function + list.add(new MethodInsnNode(INVOKESTATIC, Type.getInternalName(this.getClass()), "renderWorldPassHook", "(F)V", false)); + //insert the list of instructions 1 instruction after the LDC + methodNode.instructions.insert(target.getNext(), list); + } + } + + /** + * This is where minecraft rotates and shakes your screen + * while taking damage + * + * @param methodNode + * @param env + */ + @MethodPatch( + mcpName = "hurtCameraEffect", + notchName = "d", + mcpDesc = "(F)V") + public void hurtCameraEffect(MethodNode methodNode, PatchManager.Environment env) { + //create a list of instructions and add the needed instructions to call our hook function + final InsnList insnList = new InsnList(); + //call our hook function + insnList.add(new MethodInsnNode(INVOKESTATIC, Type.getInternalName(this.getClass()), "hurtCameraEffectHook", "()Z", false)); + //add a label to jump to + final LabelNode jmp = new LabelNode(); + //add if equals and pass the label + insnList.add(new JumpInsnNode(IFEQ, jmp)); + //add return so the rest of the function doesn't get called + insnList.add(new InsnNode(RETURN)); + //add our label + insnList.add(jmp); + //insert the list of instructions at the top of the function + methodNode.instructions.insert(insnList); + } + + @MethodPatch( + mcpName = "orientCamera", + notchName = "f", + mcpDesc = "(F)V") + public void orientCamera(MethodNode methodNode, PatchManager.Environment env) { + final AbstractInsnNode target = ASMUtil.findMethodInsn(methodNode, INVOKEVIRTUAL, env == PatchManager.Environment.IDE ? "net/minecraft/client/multiplayer/WorldClient" : "bsb", env == PatchManager.Environment.IDE ? "rayTraceBlocks" : "a", env == PatchManager.Environment.IDE ? "(Lnet/minecraft/util/math/Vec3d;Lnet/minecraft/util/math/Vec3d;)Lnet/minecraft/util/math/RayTraceResult;" : "(Lbhe;Lbhe;)Lbhc;"); + + if (target != null) { + final InsnList insnList = new InsnList(); + insnList.add(new MethodInsnNode(INVOKESTATIC, Type.getInternalName(this.getClass()), "orientCameraHook", "()Z", false)); + final LabelNode jmp = new LabelNode(); + insnList.add(new JumpInsnNode(IFEQ, jmp)); + insnList.add(new InsnNode(ACONST_NULL)); + insnList.add(new VarInsnNode(ASTORE, 24)); + insnList.add(jmp); + methodNode.instructions.insert(target.getNext(), insnList); + } + } + +//private void setupFog(int startCoords, float partialTicks) { +// @MethodPatch( +// mcpName = "setupFog", +// notchName = "a", +// mcpDesc = "(IF)V") +// public void setupFog(MethodNode methodNode, PatchManager.Environment env) { +// final InsnList insnList = new InsnList(); +// insnList.add(new VarInsnNode(ILOAD, 1)); +// insnList.add(new MethodInsnNode(INVOKESTATIC, Type.getInternalName(this.getClass()), "setupFogHook", "(I)V", false)); +// //insnList.add(new InsnNode(RETURN)); +// methodNode.instructions.insert(insnList); +// } +// +// public static void setupFogHook(int startCoords) { +// final EventSetupFog event = new EventSetupFog(startCoords); +// Seppuku.INSTANCE.getEventManager().dispatchEvent(event); +// } + + @MethodPatch( + mcpName = "getFOVModifier", + notchName = "a", + mcpDesc = "(FZ)F") + public void getFovModifier(MethodNode methodNode, PatchManager.Environment env) { + final InsnList insnList = new InsnList(); + insnList.add(new TypeInsnNode(NEW, Type.getInternalName(EventFovModifier.class))); + insnList.add(new InsnNode(DUP)); + insnList.add(new MethodInsnNode(INVOKESPECIAL, Type.getInternalName(EventFovModifier.class), "", "()V", false)); + insnList.add(new VarInsnNode(ASTORE, 5)); + + insnList.add(new FieldInsnNode(GETSTATIC, Type.getInternalName(Seppuku.class), "INSTANCE", "Lme/rigamortis/seppuku/Seppuku;")); + insnList.add(new MethodInsnNode(INVOKEVIRTUAL, Type.getInternalName(Seppuku.class), "getEventManager", "()Lteam/stiff/pomelo/EventManager;", false)); + insnList.add(new VarInsnNode(ALOAD, 5)); + insnList.add(new MethodInsnNode(INVOKEINTERFACE, Type.getInternalName(EventManager.class), "dispatchEvent", "(Ljava/lang/Object;)Ljava/lang/Object;", true)); + insnList.add(new InsnNode(POP)); + + insnList.add(new VarInsnNode(ALOAD, 5)); + insnList.add(new MethodInsnNode(INVOKEVIRTUAL, Type.getInternalName(EventFovModifier.class), "isCanceled", "()Z", false)); + final LabelNode label = new LabelNode(); + insnList.add(new JumpInsnNode(IFEQ, label)); + insnList.add(new VarInsnNode(ALOAD, 5)); + insnList.add(new MethodInsnNode(INVOKEVIRTUAL, Type.getInternalName(EventFovModifier.class), "getFov", "()F", false)); + insnList.add(new InsnNode(FRETURN)); + insnList.add(label); + methodNode.instructions.insert(insnList); + } + + @MethodPatch( + mcpName = "getMouseOver", + notchName = "a", + mcpDesc = "(F)V") + public void getMouseOver(MethodNode methodNode, PatchManager.Environment env) { + final InsnList insnList = new InsnList(); + insnList.add(new VarInsnNode(FLOAD, 1)); + insnList.add(new MethodInsnNode(INVOKESTATIC, Type.getInternalName(this.getClass()), "getMouseOverHook", "(F)V", false)); + insnList.add(new InsnNode(RETURN)); + methodNode.instructions.insert(insnList); + } + /** * This is where minecraft renders name plates * @@ -381,29 +406,4 @@ public final class EntityRendererPatch extends ClassPatch { //insert the list of instructions at the top of the function methodNode.instructions.insert(insnList); } - - /** - * This is our renderName hook - * Used to disable rendering minecrafts default - * name tags on certain entities - * - * @param fontRenderer - * @param str - * @param x - * @param y - * @param z - * @param verticalShift - * @param viewerYaw - * @param viewerPitch - * @param isThirdPersonFrontal - * @param isSneaking - * @return - */ - public static boolean drawNameplateHook(FontRenderer fontRenderer, String str, float x, float y, float z, int verticalShift, float viewerYaw, float viewerPitch, boolean isThirdPersonFrontal, boolean isSneaking) { - //dispatch our event and pass the entity in - final EventDrawNameplate event = new EventDrawNameplate(fontRenderer, str, x, y, z, verticalShift, viewerYaw, viewerPitch, isThirdPersonFrontal, isSneaking); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - - return event.isCanceled(); - } } diff --git a/src/main/java/me/rigamortis/seppuku/impl/patch/GuiBossOverlayPatch.java b/src/main/java/me/rigamortis/seppuku/impl/patch/GuiBossOverlayPatch.java index 2a990dd..e6a160c 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/patch/GuiBossOverlayPatch.java +++ b/src/main/java/me/rigamortis/seppuku/impl/patch/GuiBossOverlayPatch.java @@ -19,6 +19,13 @@ public final class GuiBossOverlayPatch extends ClassPatch { super("net.minecraft.client.gui.GuiBossOverlay", "biz"); } + public static boolean renderBossHealthHook() { + final EventRenderBossHealth event = new EventRenderBossHealth(); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + + return event.isCanceled(); + } + @MethodPatch( mcpName = "renderBossHealth", notchName = "a", @@ -40,11 +47,4 @@ public final class GuiBossOverlayPatch extends ClassPatch { //insert the list of instructs at the top of the function methodNode.instructions.insert(insnList); } - - public static boolean renderBossHealthHook() { - final EventRenderBossHealth event = new EventRenderBossHealth(); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - - return event.isCanceled(); - } } diff --git a/src/main/java/me/rigamortis/seppuku/impl/patch/GuiChatPatch.java b/src/main/java/me/rigamortis/seppuku/impl/patch/GuiChatPatch.java index 7b83a68..6862b2c 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/patch/GuiChatPatch.java +++ b/src/main/java/me/rigamortis/seppuku/impl/patch/GuiChatPatch.java @@ -20,6 +20,12 @@ public final class GuiChatPatch extends ClassPatch { super("net.minecraft.client.gui.GuiChat", "bkn"); } + public static boolean keyTypedHook(char typedChar, int keyCode) { + final EventChatKeyTyped event = new EventChatKeyTyped(typedChar, keyCode); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + return event.isCanceled(); + } + @MethodPatch( mcpName = "keyTyped", notchName = "a", @@ -35,10 +41,4 @@ public final class GuiChatPatch extends ClassPatch { insnList.add(jmp); methodNode.instructions.insert(insnList); } - - public static boolean keyTypedHook(char typedChar, int keyCode) { - final EventChatKeyTyped event = new EventChatKeyTyped(typedChar, keyCode); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - return event.isCanceled(); - } } \ No newline at end of file diff --git a/src/main/java/me/rigamortis/seppuku/impl/patch/GuiIngameForgePatch.java b/src/main/java/me/rigamortis/seppuku/impl/patch/GuiIngameForgePatch.java index 0369980..1f4cc7f 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/patch/GuiIngameForgePatch.java +++ b/src/main/java/me/rigamortis/seppuku/impl/patch/GuiIngameForgePatch.java @@ -23,6 +23,59 @@ public final class GuiIngameForgePatch extends ClassPatch { super("net.minecraftforge.client.GuiIngameForge"); } + /** + * Our renderPortal hook to remove the portal overlay + * + * @return + */ + public static boolean renderPortalHook() { + //dispatch our event + final EventRenderPortal event = new EventRenderPortal(); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + + return event.isCanceled(); + } + + /** + * Our renderPotionIcons hook used to remove potion + * status icons + * + * @return + */ + public static boolean renderPotionIconsHook() { + //dispatch our event + final EventRenderPotions event = new EventRenderPotions(); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + + return event.isCanceled(); + } + + /** + * Our renderHelmet hook to remove overlay effects + * + * @return + */ + public static boolean renderHelmetHook() { + //dispatch our event + final EventRenderHelmet event = new EventRenderHelmet(); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + + return event.isCanceled(); + } + + /** + * Our renderCrosshairs hook to remove the crosshair + * + * @return + */ + public static boolean renderCrosshairsHook() { + //dispatch our event + final EventRenderCrosshairs event = new EventRenderCrosshairs(); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + + return event.isCanceled(); + } + /** * This is where minecraft renders a * portal overlay effect on your screen @@ -51,19 +104,6 @@ public final class GuiIngameForgePatch extends ClassPatch { methodNode.instructions.insert(insnList); } - /** - * Our renderPortal hook to remove the portal overlay - * - * @return - */ - public static boolean renderPortalHook() { - //dispatch our event - final EventRenderPortal event = new EventRenderPortal(); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - - return event.isCanceled(); - } - /** * This is where minecraft renders potion icons * on the top right of your screen @@ -92,20 +132,6 @@ public final class GuiIngameForgePatch extends ClassPatch { methodNode.instructions.insert(insnList); } - /** - * Our renderPotionIcons hook used to remove potion - * status icons - * - * @return - */ - public static boolean renderPotionIconsHook() { - //dispatch our event - final EventRenderPotions event = new EventRenderPotions(); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - - return event.isCanceled(); - } - /** * This is where minecraft renders overlay effects * like pumpkins @@ -134,19 +160,6 @@ public final class GuiIngameForgePatch extends ClassPatch { methodNode.instructions.insert(insnList); } - /** - * Our renderHelmet hook to remove overlay effects - * - * @return - */ - public static boolean renderHelmetHook() { - //dispatch our event - final EventRenderHelmet event = new EventRenderHelmet(); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - - return event.isCanceled(); - } - /** * This is where minecraft renders the game's crosshair * @@ -173,17 +186,4 @@ public final class GuiIngameForgePatch extends ClassPatch { //insert the list of instructs at the top of the function methodNode.instructions.insert(insnList); } - - /** - * Our renderCrosshairs hook to remove the crosshair - * - * @return - */ - public static boolean renderCrosshairsHook() { - //dispatch our event - final EventRenderCrosshairs event = new EventRenderCrosshairs(); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - - return event.isCanceled(); - } } diff --git a/src/main/java/me/rigamortis/seppuku/impl/patch/GuiPlayerTabOverlayPatch.java b/src/main/java/me/rigamortis/seppuku/impl/patch/GuiPlayerTabOverlayPatch.java index 468ef50..a86d20c 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/patch/GuiPlayerTabOverlayPatch.java +++ b/src/main/java/me/rigamortis/seppuku/impl/patch/GuiPlayerTabOverlayPatch.java @@ -20,6 +20,13 @@ public final class GuiPlayerTabOverlayPatch extends ClassPatch { super("net.minecraft.client.gui.GuiPlayerTabOverlay", "bjq"); } + public static String getPlayerNameHook(NetworkPlayerInfo networkPlayerInfo) { + final EventGetGuiTabName event = new EventGetGuiTabName(networkPlayerInfo.getDisplayName() != null ? networkPlayerInfo.getDisplayName().getUnformattedComponentText() : networkPlayerInfo.getGameProfile().getName()); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + + return event.getName(); + } + @MethodPatch( mcpName = "getPlayerName", notchName = "a", @@ -34,12 +41,5 @@ public final class GuiPlayerTabOverlayPatch extends ClassPatch { methodNode.instructions.insert(insnList); } - public static String getPlayerNameHook(NetworkPlayerInfo networkPlayerInfo) { - final EventGetGuiTabName event = new EventGetGuiTabName(networkPlayerInfo.getDisplayName() != null ? networkPlayerInfo.getDisplayName().getUnformattedComponentText() : networkPlayerInfo.getGameProfile().getName()); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - - return event.getName(); - } - } diff --git a/src/main/java/me/rigamortis/seppuku/impl/patch/GuiScreenBookPatch.java b/src/main/java/me/rigamortis/seppuku/impl/patch/GuiScreenBookPatch.java index 39f4aeb..ce77b58 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/patch/GuiScreenBookPatch.java +++ b/src/main/java/me/rigamortis/seppuku/impl/patch/GuiScreenBookPatch.java @@ -21,6 +21,36 @@ public final class GuiScreenBookPatch extends ClassPatch { super("net.minecraft.client.gui.GuiScreenBook", "bmj"); } + /** + * This is our pageInsertIntoCurrent hook + * We can use it to modify book pages + * + * @param page + * @return + */ + public static String pageInsertIntoCurrentHook(String page) { + //dispatch our event and pass in the page + final EventBookPage event = new EventBookPage(page); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + + return event.getPage(); + } + + /** + * This is our keyTypedInTitle + * We can use it to modify the title text of a book + * + * @param title + * @return + */ + public static String keyTypedInTitleHook(String title) { + //dispatch our event and pass in the title which can be null + final EventBookTitle event = new EventBookTitle(title); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + + return event.getTitle(); + } + /** * This is where minecraft appends your text * to a page in books @@ -45,21 +75,6 @@ public final class GuiScreenBookPatch extends ClassPatch { methodNode.instructions.insert(insnList); } - /** - * This is our pageInsertIntoCurrent hook - * We can use it to modify book pages - * - * @param page - * @return - */ - public static String pageInsertIntoCurrentHook(String page) { - //dispatch our event and pass in the page - final EventBookPage event = new EventBookPage(page); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - - return event.getPage(); - } - /** * This is where minecraft handles * typing in the title of a book @@ -88,19 +103,4 @@ public final class GuiScreenBookPatch extends ClassPatch { methodNode.instructions.insert(insnList); } - /** - * This is our keyTypedInTitle - * We can use it to modify the title text of a book - * - * @param title - * @return - */ - public static String keyTypedInTitleHook(String title) { - //dispatch our event and pass in the title which can be null - final EventBookTitle event = new EventBookTitle(title); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - - return event.getTitle(); - } - } diff --git a/src/main/java/me/rigamortis/seppuku/impl/patch/GuiToastPatch.java b/src/main/java/me/rigamortis/seppuku/impl/patch/GuiToastPatch.java index 1bc4165..fd8f4ef 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/patch/GuiToastPatch.java +++ b/src/main/java/me/rigamortis/seppuku/impl/patch/GuiToastPatch.java @@ -16,6 +16,12 @@ public class GuiToastPatch extends ClassPatch { super("net.minecraft.client.gui.toasts.GuiToast", "bkc"); } + public static boolean drawToastHook() { + final EventDrawToast event = new EventDrawToast(); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + return event.isCanceled(); + } + @MethodPatch( mcpName = "drawToast", notchName = "a", @@ -37,10 +43,4 @@ public class GuiToastPatch extends ClassPatch { //insert the list of instructs at the top of the function methodNode.instructions.insert(insnList); } - - public static boolean drawToastHook() { - final EventDrawToast event = new EventDrawToast(); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - return event.isCanceled(); - } } diff --git a/src/main/java/me/rigamortis/seppuku/impl/patch/ItemRendererPatch.java b/src/main/java/me/rigamortis/seppuku/impl/patch/ItemRendererPatch.java index ecbaee2..c248994 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/patch/ItemRendererPatch.java +++ b/src/main/java/me/rigamortis/seppuku/impl/patch/ItemRendererPatch.java @@ -20,6 +20,27 @@ public final class ItemRendererPatch extends ClassPatch { super("net.minecraft.client.renderer.ItemRenderer", "buu"); } + public static boolean renderSuffocationOverlayHook() { + final EventRenderOverlay event = new EventRenderOverlay(EventRenderOverlay.OverlayType.BLOCK); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + + return event.isCanceled(); + } + + public static boolean renderWaterOverlayTextureHook() { + final EventRenderOverlay event = new EventRenderOverlay(EventRenderOverlay.OverlayType.LIQUID); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + + return event.isCanceled(); + } + + public static boolean renderFireInFirstPersonHook() { + final EventRenderOverlay event = new EventRenderOverlay(EventRenderOverlay.OverlayType.FIRE); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + + return event.isCanceled(); + } + @MethodPatch( mcpName = "renderSuffocationOverlay", notchName = "a", @@ -42,13 +63,6 @@ public final class ItemRendererPatch extends ClassPatch { methodNode.instructions.insert(insnList); } - public static boolean renderSuffocationOverlayHook() { - final EventRenderOverlay event = new EventRenderOverlay(EventRenderOverlay.OverlayType.BLOCK); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - - return event.isCanceled(); - } - @MethodPatch( mcpName = "renderWaterOverlayTexture", notchName = "e", @@ -70,13 +84,6 @@ public final class ItemRendererPatch extends ClassPatch { methodNode.instructions.insert(insnList); } - public static boolean renderWaterOverlayTextureHook() { - final EventRenderOverlay event = new EventRenderOverlay(EventRenderOverlay.OverlayType.LIQUID); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - - return event.isCanceled(); - } - @MethodPatch( mcpName = "renderFireInFirstPerson", notchName = "d", @@ -97,11 +104,4 @@ public final class ItemRendererPatch extends ClassPatch { //insert the list of instructions at the top of the function methodNode.instructions.insert(insnList); } - - public static boolean renderFireInFirstPersonHook() { - final EventRenderOverlay event = new EventRenderOverlay(EventRenderOverlay.OverlayType.FIRE); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - - return event.isCanceled(); - } } diff --git a/src/main/java/me/rigamortis/seppuku/impl/patch/MinecraftPatch.java b/src/main/java/me/rigamortis/seppuku/impl/patch/MinecraftPatch.java index dac0013..ebc24cf 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/patch/MinecraftPatch.java +++ b/src/main/java/me/rigamortis/seppuku/impl/patch/MinecraftPatch.java @@ -31,6 +31,66 @@ public final class MinecraftPatch extends ClassPatch { super("net.minecraft.client.Minecraft", "bib"); } + /** + * This is called when we resize our game + */ + public static void updateFramebufferSizeHook() { + //dispatch our event "EventUpdateFramebufferSize" + Seppuku.INSTANCE.getEventManager().dispatchEvent(new EventUpdateFramebufferSize()); + } + + /** + * This is twice called every tick + */ + public static void runTickHook(EventStageable.EventStage stage) { + //dispatch our event "EventRunTick" and pass in the stage(pre, post) + Seppuku.INSTANCE.getEventManager().dispatchEvent(new EventRunTick(stage)); + } + + /** + * This is a hacky way to intercept key presses + */ + public static void runTickKeyboardHook(int key) { + //check if the key was just pressed + if (Keyboard.getEventKeyState()) { + //dispatch our event for key presses and pass in the keycode + Seppuku.INSTANCE.getEventManager().dispatchEvent(new EventKeyPress(key)); + } + } + + /** + * Our display gui hook called when we open a gui + * + * @param screen can be null! + * @return + */ + public static boolean displayGuiScreenHook(GuiScreen screen) { + //dispatch our event and pass the gui + final EventDisplayGui event = new EventDisplayGui(screen); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + + //return event.isCanceled() to allow us to cancel the original function + return event.isCanceled(); + } + + public static boolean loadWorldHook(WorldClient worldClient) { + final EventLoadWorld event = new EventLoadWorld(worldClient); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + return event.isCanceled(); + } + + public static boolean clickMouseHook() { + final EventMouseLeftClick event = new EventMouseLeftClick(); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + return event.isCanceled(); + } + + public static boolean rightClickMouseHook() { + final EventMouseRightClick event = new EventMouseRightClick(); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + return event.isCanceled(); + } + /** * Patch the method "updateFramebufferSize" * Mainly used for shaders @@ -46,14 +106,6 @@ public final class MinecraftPatch extends ClassPatch { methodNode.instructions.insert(new MethodInsnNode(INVOKESTATIC, Type.getInternalName(this.getClass()), "updateFramebufferSizeHook", "()V", false)); } - /** - * This is called when we resize our game - */ - public static void updateFramebufferSizeHook() { - //dispatch our event "EventUpdateFramebufferSize" - Seppuku.INSTANCE.getEventManager().dispatchEvent(new EventUpdateFramebufferSize()); - } - /** * Patch the method "runTick" * The bytecode we are inserting here replicates this call @@ -86,14 +138,6 @@ public final class MinecraftPatch extends ClassPatch { methodNode.instructions.insertBefore(ASMUtil.bottom(methodNode), postInsn); } - /** - * This is twice called every tick - */ - public static void runTickHook(EventStageable.EventStage stage) { - //dispatch our event "EventRunTick" and pass in the stage(pre, post) - Seppuku.INSTANCE.getEventManager().dispatchEvent(new EventRunTick(stage)); - } - /** * This is where key input is handled * @@ -120,17 +164,6 @@ public final class MinecraftPatch extends ClassPatch { } } - /** - * This is a hacky way to intercept key presses - */ - public static void runTickKeyboardHook(int key) { - //check if the key was just pressed - if (Keyboard.getEventKeyState()) { - //dispatch our event for key presses and pass in the keycode - Seppuku.INSTANCE.getEventManager().dispatchEvent(new EventKeyPress(key)); - } - } - /** * This is used to tell if we just opened a gui screen * It can be cancelled @@ -163,21 +196,6 @@ public final class MinecraftPatch extends ClassPatch { methodNode.instructions.insert(insnList); } - /** - * Our display gui hook called when we open a gui - * - * @param screen can be null! - * @return - */ - public static boolean displayGuiScreenHook(GuiScreen screen) { - //dispatch our event and pass the gui - final EventDisplayGui event = new EventDisplayGui(screen); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - - //return event.isCanceled() to allow us to cancel the original function - return event.isCanceled(); - } - @MethodPatch( mcpName = "loadWorld", notchName = "a", @@ -194,12 +212,6 @@ public final class MinecraftPatch extends ClassPatch { methodNode.instructions.insert(insnList); } - public static boolean loadWorldHook(WorldClient worldClient) { - final EventLoadWorld event = new EventLoadWorld(worldClient); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - return event.isCanceled(); - } - @MethodPatch( mcpName = "clickMouse", notchName = "aA", @@ -215,12 +227,6 @@ public final class MinecraftPatch extends ClassPatch { methodNode.instructions.insert(insnList); } - public static boolean clickMouseHook() { - final EventMouseLeftClick event = new EventMouseLeftClick(); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - return event.isCanceled(); - } - @MethodPatch( mcpName = "rightClickMouse", notchName = "aB", @@ -235,10 +241,4 @@ public final class MinecraftPatch extends ClassPatch { insnList.add(jmp); methodNode.instructions.insert(insnList); } - - public static boolean rightClickMouseHook() { - final EventMouseRightClick event = new EventMouseRightClick(); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - return event.isCanceled(); - } } diff --git a/src/main/java/me/rigamortis/seppuku/impl/patch/NetHandlerPlayClientPatch.java b/src/main/java/me/rigamortis/seppuku/impl/patch/NetHandlerPlayClientPatch.java index 1582b11..b131f6f 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/patch/NetHandlerPlayClientPatch.java +++ b/src/main/java/me/rigamortis/seppuku/impl/patch/NetHandlerPlayClientPatch.java @@ -26,6 +26,13 @@ public final class NetHandlerPlayClientPatch extends ClassPatch { super("net.minecraft.client.network.NetHandlerPlayClient", "brz"); } + public static void handleChunkDataHook(SPacketChunkData chunkData) { + if (chunkData != null) { + final EventChunk event = new EventChunk(EventChunk.ChunkType.LOAD, Minecraft.getMinecraft().world.getChunk(chunkData.getChunkX(), chunkData.getChunkZ())); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + } + } + @MethodPatch( mcpName = "handleChunkData", notchName = "a", @@ -37,11 +44,4 @@ public final class NetHandlerPlayClientPatch extends ClassPatch { insnList.add(new MethodInsnNode(INVOKESTATIC, Type.getInternalName(this.getClass()), "handleChunkDataHook", env == PatchManager.Environment.IDE ? "(Lnet/minecraft/network/play/server/SPacketChunkData;)V" : "(Lje;)V", false)); methodNode.instructions.insertBefore(ASMUtil.bottom(methodNode), insnList); } - - public static void handleChunkDataHook(SPacketChunkData chunkData) { - if (chunkData != null) { - final EventChunk event = new EventChunk(EventChunk.ChunkType.LOAD, Minecraft.getMinecraft().world.getChunk(chunkData.getChunkX(), chunkData.getChunkZ())); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - } - } } diff --git a/src/main/java/me/rigamortis/seppuku/impl/patch/NetworkManagerPatch.java b/src/main/java/me/rigamortis/seppuku/impl/patch/NetworkManagerPatch.java index 2e0e0c4..d6f7abe 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/patch/NetworkManagerPatch.java +++ b/src/main/java/me/rigamortis/seppuku/impl/patch/NetworkManagerPatch.java @@ -24,6 +24,41 @@ public final class NetworkManagerPatch extends ClassPatch { super("net.minecraft.network.NetworkManager", "gw"); } + /** + * This is our sendPacket hook + * It allows us to intercept outgoing unencrypted packets and modify the data + * It also allows us to cancel sending certain packets + * + * @param packet + * @param stage + * @return + */ + public static boolean sendPacketHook(Packet packet, EventStageable.EventStage stage) { + final EventSendPacket event = new EventSendPacket(stage, packet); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + + return event.isCanceled(); + } + + /** + * This is our channelRead0 hook + * It allows us to cancel processing incoming packets or modify the unencrypted data + * + * @param packet + * @param stage + * @return + */ + public static boolean channelRead0Hook(Packet packet, EventStageable.EventStage stage) { + if (packet != null) { + final EventReceivePacket event = new EventReceivePacket(stage, packet); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + + return event.isCanceled(); + } + + return false; + } + /** * This is where minecraft sends packets before they are compressed and encrypted * @@ -68,22 +103,6 @@ public final class NetworkManagerPatch extends ClassPatch { methodNode.instructions.insertBefore(ASMUtil.bottom(methodNode), postInsn); } - /** - * This is our sendPacket hook - * It allows us to intercept outgoing unencrypted packets and modify the data - * It also allows us to cancel sending certain packets - * - * @param packet - * @param stage - * @return - */ - public static boolean sendPacketHook(Packet packet, EventStageable.EventStage stage) { - final EventSendPacket event = new EventSendPacket(stage, packet); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - - return event.isCanceled(); - } - /** * This is where minecraft handles received packets * @@ -128,24 +147,5 @@ public final class NetworkManagerPatch extends ClassPatch { methodNode.instructions.insertBefore(ASMUtil.bottom(methodNode), postInsn); } - /** - * This is our channelRead0 hook - * It allows us to cancel processing incoming packets or modify the unencrypted data - * - * @param packet - * @param stage - * @return - */ - public static boolean channelRead0Hook(Packet packet, EventStageable.EventStage stage) { - if (packet != null) { - final EventReceivePacket event = new EventReceivePacket(stage, packet); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - - return event.isCanceled(); - } - - return false; - } - } diff --git a/src/main/java/me/rigamortis/seppuku/impl/patch/ParticleManagerPatch.java b/src/main/java/me/rigamortis/seppuku/impl/patch/ParticleManagerPatch.java index acd27d7..f69b638 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/patch/ParticleManagerPatch.java +++ b/src/main/java/me/rigamortis/seppuku/impl/patch/ParticleManagerPatch.java @@ -20,6 +20,12 @@ public class ParticleManagerPatch extends ClassPatch { super("net.minecraft.client.particle.ParticleManager", "btg"); } + public static boolean addEffectHook(Particle particle) { + final EventAddEffect event = new EventAddEffect(particle); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + return event.isCanceled(); + } + /* * public void a(btf ) { * this.h.add(); @@ -49,12 +55,6 @@ public class ParticleManagerPatch extends ClassPatch { methodNode.instructions.insert(insnList); } - public static boolean addEffectHook(Particle particle) { - final EventAddEffect event = new EventAddEffect(particle); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - return event.isCanceled(); - } - /* // access flags 0x1 public emitParticleAtEntity(Lnet/minecraft/entity/Entity;Lnet/minecraft/util/EnumParticleTypes;)V diff --git a/src/main/java/me/rigamortis/seppuku/impl/patch/PlayerControllerMPPatch.java b/src/main/java/me/rigamortis/seppuku/impl/patch/PlayerControllerMPPatch.java index 6f73f17..dd5ea65 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/patch/PlayerControllerMPPatch.java +++ b/src/main/java/me/rigamortis/seppuku/impl/patch/PlayerControllerMPPatch.java @@ -23,6 +23,86 @@ public final class PlayerControllerMPPatch extends ClassPatch { super("net.minecraft.client.multiplayer.PlayerControllerMP", "bsa"); } + /** + * Our onPlayerDestroyBlock hook used to get block coordinates + * of what we just broke + * + * @param pos + * @return + */ + public static boolean onPlayerDestroyBlockHook(BlockPos pos) { + //dispatch our event and pass the BlockPos + final EventDestroyBlock event = new EventDestroyBlock(pos); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + + return event.isCanceled(); + } + + /** + * Our clickBlock hook used to detect when we first + * click on a block + * + * @param pos + * @param face + * @return + */ + public static boolean clickBlockHook(BlockPos pos, EnumFacing face) { + //dispatch our event and pass the BlockPos and EnumFacing + final EventClickBlock event = new EventClickBlock(pos, face); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + + return event.isCanceled(); + } + + /** + * Our resetBlockRemoving used to detect when we stop mining + * It is cancellable so we can save break progress + * + * @return + */ + public static boolean resetBlockRemovingHook() { + //dispatch the event + final EventResetBlockRemoving event = new EventResetBlockRemoving(); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + + return event.isCanceled(); + } + + /** + * Our onPlayerDamageBlock hook used to detect if we are + * currently mining a block + * + * @param pos + * @param face + * @return + */ + public static boolean onPlayerDamageBlockHook(BlockPos pos, EnumFacing face) { + //dispatch the event + final EventPlayerDamageBlock event = new EventPlayerDamageBlock(pos, face); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + + return event.isCanceled(); + } + + public static boolean isHittingPositionHook(BlockPos pos) { + final EventHittingPosition event = new EventHittingPosition(pos); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + + return event.isCanceled(); + } + + /** + * Our getIsHittingBlockHook hook used to override block-hitting hand activity + * + * @return true if the event is cancelled + */ + public static boolean getIsHittingBlockHook() { + //dispatch our event + final EventHittingBlock event = new EventHittingBlock(); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + return event.isCanceled(); + } + /** * This is called when we finish mining a block * @@ -55,21 +135,6 @@ public final class PlayerControllerMPPatch extends ClassPatch { methodNode.instructions.insert(insnList); } - /** - * Our onPlayerDestroyBlock hook used to get block coordinates - * of what we just broke - * - * @param pos - * @return - */ - public static boolean onPlayerDestroyBlockHook(BlockPos pos) { - //dispatch our event and pass the BlockPos - final EventDestroyBlock event = new EventDestroyBlock(pos); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - - return event.isCanceled(); - } - /** * This is where minecraft starts mining * @@ -104,22 +169,6 @@ public final class PlayerControllerMPPatch extends ClassPatch { methodNode.instructions.insert(insnList); } - /** - * Our clickBlock hook used to detect when we first - * click on a block - * - * @param pos - * @param face - * @return - */ - public static boolean clickBlockHook(BlockPos pos, EnumFacing face) { - //dispatch our event and pass the BlockPos and EnumFacing - final EventClickBlock event = new EventClickBlock(pos, face); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - - return event.isCanceled(); - } - /** * This is where minecraft handles abort destroying blocks * and resetting break progress @@ -147,20 +196,6 @@ public final class PlayerControllerMPPatch extends ClassPatch { methodNode.instructions.insert(insnList); } - /** - * Our resetBlockRemoving used to detect when we stop mining - * It is cancellable so we can save break progress - * - * @return - */ - public static boolean resetBlockRemovingHook() { - //dispatch the event - final EventResetBlockRemoving event = new EventResetBlockRemoving(); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - - return event.isCanceled(); - } - /** * This is where minecraft handles breaking blocks and calculates * block hit delay/current damage @@ -196,22 +231,6 @@ public final class PlayerControllerMPPatch extends ClassPatch { methodNode.instructions.insert(insnList); } - /** - * Our onPlayerDamageBlock hook used to detect if we are - * currently mining a block - * - * @param pos - * @param face - * @return - */ - public static boolean onPlayerDamageBlockHook(BlockPos pos, EnumFacing face) { - //dispatch the event - final EventPlayerDamageBlock event = new EventPlayerDamageBlock(pos, face); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - - return event.isCanceled(); - } - /** * This is where minecraft handles right clicking * on blocks @@ -351,13 +370,6 @@ public final class PlayerControllerMPPatch extends ClassPatch { methodNode.instructions.insert(insnList); } - public static boolean isHittingPositionHook(BlockPos pos) { - final EventHittingPosition event = new EventHittingPosition(pos); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - - return event.isCanceled(); - } - @MethodPatch( mcpName = "getIsHittingBlock", notchName = "m", @@ -381,18 +393,6 @@ public final class PlayerControllerMPPatch extends ClassPatch { methodNode.instructions.insert(insnList); } - /** - * Our getIsHittingBlockHook hook used to override block-hitting hand activity - * - * @return true if the event is cancelled - */ - public static boolean getIsHittingBlockHook() { - //dispatch our event - final EventHittingBlock event = new EventHittingBlock(); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - return event.isCanceled(); - } - @MethodPatch( mcpName = "getBlockReachDistance", notchName = "d", diff --git a/src/main/java/me/rigamortis/seppuku/impl/patch/RenderGlobalPatch.java b/src/main/java/me/rigamortis/seppuku/impl/patch/RenderGlobalPatch.java index a81b918..692707f 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/patch/RenderGlobalPatch.java +++ b/src/main/java/me/rigamortis/seppuku/impl/patch/RenderGlobalPatch.java @@ -22,6 +22,27 @@ public final class RenderGlobalPatch extends ClassPatch { super("net.minecraft.client.renderer.RenderGlobal", "buy"); } + public static boolean isRenderEntityOutlinesHook() { + final EventRenderEntityOutlines event = new EventRenderEntityOutlines(); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + + return event.isCanceled(); + } + + public static boolean renderSkyHook() { + final EventRenderSky event = new EventRenderSky(); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + + return event.isCanceled(); + } + + public static boolean drawBlockDamageTextureHook() { + final EventRenderBlockDamage event = new EventRenderBlockDamage(); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + + return event.isCanceled(); + } + @MethodPatch( mcpName = "isRenderEntityOutlines", notchName = "d", @@ -37,13 +58,6 @@ public final class RenderGlobalPatch extends ClassPatch { methodNode.instructions.insert(insnList); } - public static boolean isRenderEntityOutlinesHook() { - final EventRenderEntityOutlines event = new EventRenderEntityOutlines(); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - - return event.isCanceled(); - } - @MethodPatch( mcpName = "renderSky", notchName = "a", @@ -59,13 +73,6 @@ public final class RenderGlobalPatch extends ClassPatch { methodNode.instructions.insert(insnList); } - public static boolean renderSkyHook() { - final EventRenderSky event = new EventRenderSky(); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - - return event.isCanceled(); - } - @MethodPatch( mcpName = "drawBlockDamageTexture", notchName = "a", @@ -81,11 +88,4 @@ public final class RenderGlobalPatch extends ClassPatch { methodNode.instructions.insert(insnList); } - public static boolean drawBlockDamageTextureHook() { - final EventRenderBlockDamage event = new EventRenderBlockDamage(); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - - return event.isCanceled(); - } - } diff --git a/src/main/java/me/rigamortis/seppuku/impl/patch/RenderLivingBasePatch.java b/src/main/java/me/rigamortis/seppuku/impl/patch/RenderLivingBasePatch.java index 6762d82..f737a46 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/patch/RenderLivingBasePatch.java +++ b/src/main/java/me/rigamortis/seppuku/impl/patch/RenderLivingBasePatch.java @@ -27,6 +27,47 @@ public final class RenderLivingBasePatch extends ClassPatch { super("net.minecraft.client.renderer.entity.RenderLivingBase", "caa"); } + /** + * This is our renderName hook + * Used to disable rendering minecrafts default + * name tags on certain entities + * + * @param entity + * @return + */ + public static boolean renderNameHook(EntityLivingBase entity) { + //dispatch our event and pass the entity in + final EventRenderName event = new EventRenderName(entity); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + + return event.isCanceled(); + } + + /** + * This is our setBrightness hook. Used to set custom shader uniforms + * + * @param buf + * @return + */ + public static void setBrightnessHook(Buffer buf) { + FloatBuffer brightness = (FloatBuffer) buf; + for (Iterator it = ShaderProgram.getProgramsInUse(); it.hasNext(); ) { + it.next().setEntityBrightnessUniform(brightness.get(), brightness.get(), brightness.get(), brightness.get()); + brightness.position(0); + } + } + + /** + * This is our unsetBrightness hook. Used to set custom shader uniforms + * + * @return + */ + public static void unsetBrightnessHook() { + for (Iterator it = ShaderProgram.getProgramsInUse(); it.hasNext(); ) { + it.next().setEntityBrightnessUniform(0.0f, 0.0f, 0.0f, 0.0f); + } + } + /** * This is where minecraft renders name plates * @@ -57,22 +98,6 @@ public final class RenderLivingBasePatch extends ClassPatch { methodNode.instructions.insert(insnList); } - /** - * This is our renderName hook - * Used to disable rendering minecrafts default - * name tags on certain entities - * - * @param entity - * @return - */ - public static boolean renderNameHook(EntityLivingBase entity) { - //dispatch our event and pass the entity in - final EventRenderName event = new EventRenderName(entity); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - - return event.isCanceled(); - } - /** * Used to keep track of entity brightness colors (like the flash on primed * TNT/creepers and the red color from hurting mobs) @@ -101,20 +126,6 @@ public final class RenderLivingBasePatch extends ClassPatch { } } - /** - * This is our setBrightness hook. Used to set custom shader uniforms - * - * @param buf - * @return - */ - public static void setBrightnessHook(Buffer buf) { - FloatBuffer brightness = (FloatBuffer) buf; - for (Iterator it = ShaderProgram.getProgramsInUse(); it.hasNext(); ) { - it.next().setEntityBrightnessUniform(brightness.get(), brightness.get(), brightness.get(), brightness.get()); - brightness.position(0); - } - } - /** * Used to keep track of entity brightness colors (like the flash on primed * TNT/creepers and the red color from hurting mobs). This one clears the @@ -133,17 +144,6 @@ public final class RenderLivingBasePatch extends ClassPatch { methodNode.instructions.insert(new MethodInsnNode(INVOKESTATIC, Type.getInternalName(this.getClass()), "unsetBrightnessHook", "()V", false)); } - /** - * This is our unsetBrightness hook. Used to set custom shader uniforms - * - * @return - */ - public static void unsetBrightnessHook() { - for (Iterator it = ShaderProgram.getProgramsInUse(); it.hasNext(); ) { - it.next().setEntityBrightnessUniform(0.0f, 0.0f, 0.0f, 0.0f); - } - } - // /** // * This is where minecraft renders living entity models // * @param methodNode diff --git a/src/main/java/me/rigamortis/seppuku/impl/patch/RenderManagerPatch.java b/src/main/java/me/rigamortis/seppuku/impl/patch/RenderManagerPatch.java index 92fc3f0..4282a69 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/patch/RenderManagerPatch.java +++ b/src/main/java/me/rigamortis/seppuku/impl/patch/RenderManagerPatch.java @@ -23,6 +23,28 @@ public final class RenderManagerPatch extends ClassPatch { super("net.minecraft.client.renderer.entity.RenderManager", "bzf"); } + /** + * Our renderEntity hook + * Used to disable rendering of certain entities or modify the + * way they render + * + * @param entity + * @param x + * @param y + * @param z + * @param yaw + * @param partialTicks + * @param stage + * @return + */ + public static boolean renderEntityHook(Entity entity, double x, double y, double z, float yaw, float partialTicks, EventStageable.EventStage stage) { + //dispatch our event and pass the render information into it along with the event stage + final EventRenderEntity event = new EventRenderEntity(stage, entity, x, y, z, yaw, partialTicks); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + + return event.isCanceled(); + } + /** * This is where minecraft handles rendering of entities * @@ -86,26 +108,4 @@ public final class RenderManagerPatch extends ClassPatch { methodNode.instructions.insertBefore(ASMUtil.bottom(methodNode), postInsn); } - /** - * Our renderEntity hook - * Used to disable rendering of certain entities or modify the - * way they render - * - * @param entity - * @param x - * @param y - * @param z - * @param yaw - * @param partialTicks - * @param stage - * @return - */ - public static boolean renderEntityHook(Entity entity, double x, double y, double z, float yaw, float partialTicks, EventStageable.EventStage stage) { - //dispatch our event and pass the render information into it along with the event stage - final EventRenderEntity event = new EventRenderEntity(stage, entity, x, y, z, yaw, partialTicks); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - - return event.isCanceled(); - } - } diff --git a/src/main/java/me/rigamortis/seppuku/impl/patch/VisGraphPatch.java b/src/main/java/me/rigamortis/seppuku/impl/patch/VisGraphPatch.java index 5f1606e..3ccb5cd 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/patch/VisGraphPatch.java +++ b/src/main/java/me/rigamortis/seppuku/impl/patch/VisGraphPatch.java @@ -20,6 +20,19 @@ public final class VisGraphPatch extends ClassPatch { super("net.minecraft.client.renderer.chunk.VisGraph", "bxu"); } + /** + * Our setOpaqueCube hook + * Cancel to prevent culling(this may cost a few frames) + * + * @return + */ + public static boolean setOpaqueCubeHook() { + final EventSetOpaqueCube event = new EventSetOpaqueCube(); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + + return event.isCanceled(); + } + /** * This is where minecraft handles culling * @@ -48,17 +61,4 @@ public final class VisGraphPatch extends ClassPatch { methodNode.instructions.insert(insnList); } - /** - * Our setOpaqueCube hook - * Cancel to prevent culling(this may cost a few frames) - * - * @return - */ - public static boolean setOpaqueCubeHook() { - final EventSetOpaqueCube event = new EventSetOpaqueCube(); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - - return event.isCanceled(); - } - } diff --git a/src/main/java/me/rigamortis/seppuku/impl/patch/WorldPatch.java b/src/main/java/me/rigamortis/seppuku/impl/patch/WorldPatch.java index b420b03..d43dad9 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/patch/WorldPatch.java +++ b/src/main/java/me/rigamortis/seppuku/impl/patch/WorldPatch.java @@ -21,6 +21,57 @@ public final class WorldPatch extends ClassPatch { super("net.minecraft.world.World", "amu"); } + public static boolean checkLightForHook() { + final EventLightUpdate event = new EventLightUpdate(); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + return event.isCanceled(); + } + + public static boolean getRainStrengthHook() { + final EventRainStrength event = new EventRainStrength(); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + return event.isCanceled(); + } + + /* @MethodPatch( + mcpName = "checkLight", + notchName = "w", + mcpDesc = "(Lnet/minecraft/util/math/BlockPos;)Z", + notchDesc = "(Let;)Z") + public void checkLight(MethodNode methodNode, PatchManager.Environment env) { + final InsnList list = new InsnList(); + list.add(new MethodInsnNode(INVOKESTATIC, Type.getInternalName(this.getClass()), "checkLightHook", "()Z", false)); + final LabelNode jmp = new LabelNode(); + list.add(new JumpInsnNode(IFEQ, jmp)); + // by default, this function will return false if the area is not loaded or checked for light + list.add(new InsnNode(ICONST_0)); + list.add(new InsnNode(IRETURN)); + list.add(jmp); + methodNode.instructions.insert(list); + } + + public static boolean checkLightHook() { + final EventLightUpdate event = new EventLightUpdate(); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + return event.isCanceled(); + }*/ + + public static boolean onEntityAddedHook(Entity entity) { + final EventAddEntity eventAddEntity = new EventAddEntity(entity); + Seppuku.INSTANCE.getEventManager().dispatchEvent(eventAddEntity); + return eventAddEntity.isCanceled(); + } + + public static void onEntityRemovedHook(Entity entity) { + Seppuku.INSTANCE.getEventManager().dispatchEvent(new EventRemoveEntity(entity)); + } + + public static boolean spawnParticleHook() { + final EventSpawnParticle event = new EventSpawnParticle(); + Seppuku.INSTANCE.getEventManager().dispatchEvent(event); + return event.isCanceled(); + } + /** * This function is used to update light for blocks * It is VERY unoptimized and in some cases it's @@ -53,35 +104,6 @@ public final class WorldPatch extends ClassPatch { methodNode.instructions.insert(list); } - public static boolean checkLightForHook() { - final EventLightUpdate event = new EventLightUpdate(); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - return event.isCanceled(); - } - - /* @MethodPatch( - mcpName = "checkLight", - notchName = "w", - mcpDesc = "(Lnet/minecraft/util/math/BlockPos;)Z", - notchDesc = "(Let;)Z") - public void checkLight(MethodNode methodNode, PatchManager.Environment env) { - final InsnList list = new InsnList(); - list.add(new MethodInsnNode(INVOKESTATIC, Type.getInternalName(this.getClass()), "checkLightHook", "()Z", false)); - final LabelNode jmp = new LabelNode(); - list.add(new JumpInsnNode(IFEQ, jmp)); - // by default, this function will return false if the area is not loaded or checked for light - list.add(new InsnNode(ICONST_0)); - list.add(new InsnNode(IRETURN)); - list.add(jmp); - methodNode.instructions.insert(list); - } - - public static boolean checkLightHook() { - final EventLightUpdate event = new EventLightUpdate(); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - return event.isCanceled(); - }*/ - @MethodPatch( mcpName = "getRainStrength", notchName = "j", @@ -98,12 +120,6 @@ public final class WorldPatch extends ClassPatch { methodNode.instructions.insert(list); } - public static boolean getRainStrengthHook() { - final EventRainStrength event = new EventRainStrength(); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - return event.isCanceled(); - } - @MethodPatch( mcpName = "onEntityAdded", notchName = "b", @@ -120,12 +136,6 @@ public final class WorldPatch extends ClassPatch { methodNode.instructions.insert(list); } - public static boolean onEntityAddedHook(Entity entity) { - final EventAddEntity eventAddEntity = new EventAddEntity(entity); - Seppuku.INSTANCE.getEventManager().dispatchEvent(eventAddEntity); - return eventAddEntity.isCanceled(); - } - @MethodPatch( mcpName = "onEntityRemoved", notchName = "c", @@ -138,10 +148,6 @@ public final class WorldPatch extends ClassPatch { methodNode.instructions.insert(list); } - public static void onEntityRemovedHook(Entity entity) { - Seppuku.INSTANCE.getEventManager().dispatchEvent(new EventRemoveEntity(entity)); - } - @MethodPatch( mcpName = "spawnParticle", notchName = "a", @@ -156,10 +162,4 @@ public final class WorldPatch extends ClassPatch { list.add(jmp); methodNode.instructions.insert(list); } - - public static boolean spawnParticleHook() { - final EventSpawnParticle event = new EventSpawnParticle(); - Seppuku.INSTANCE.getEventManager().dispatchEvent(event); - return event.isCanceled(); - } } diff --git a/src/main/java/team/stiff/pomelo/handler/ListenerPriority.java b/src/main/java/team/stiff/pomelo/handler/ListenerPriority.java index 3e1bf28..5ccb381 100644 --- a/src/main/java/team/stiff/pomelo/handler/ListenerPriority.java +++ b/src/main/java/team/stiff/pomelo/handler/ListenerPriority.java @@ -4,7 +4,7 @@ package team.stiff.pomelo.handler; * Designates the order within a listener of event distribution. This * is not globally sorted as the current structure of stored event listeners is * too complex to properly sort without major code refactoring. - * + *

* todo: hint hint... */ public enum ListenerPriority { diff --git a/src/main/java/team/stiff/pomelo/impl/annotated/handler/MethodEventHandler.java b/src/main/java/team/stiff/pomelo/impl/annotated/handler/MethodEventHandler.java index a96303c..32c24e4 100644 --- a/src/main/java/team/stiff/pomelo/impl/annotated/handler/MethodEventHandler.java +++ b/src/main/java/team/stiff/pomelo/impl/annotated/handler/MethodEventHandler.java @@ -39,7 +39,7 @@ public final class MethodEventHandler implements EventHandler { private final Listener listenerAnnotation; public MethodEventHandler(final Object listenerParent, final Method method, - final Set eventFilters) { + final Set eventFilters) { this.listenerParent = listenerParent; if (!method.isAccessible()) method.setAccessible(true); diff --git a/src/main/java/team/stiff/pomelo/impl/annotated/handler/annotation/Listener.java b/src/main/java/team/stiff/pomelo/impl/annotated/handler/annotation/Listener.java index 1ecb46e..a695aaf 100644 --- a/src/main/java/team/stiff/pomelo/impl/annotated/handler/annotation/Listener.java +++ b/src/main/java/team/stiff/pomelo/impl/annotated/handler/annotation/Listener.java @@ -26,7 +26,7 @@ public @interface Listener { * * @return array of filters */ - Class[] filters() default { }; + Class[] filters() default {}; /** * The priority of the event listener in the container. diff --git a/src/main/java/team/stiff/pomelo/impl/annotated/handler/scan/MethodHandlerScanner.java b/src/main/java/team/stiff/pomelo/impl/annotated/handler/scan/MethodHandlerScanner.java index ce0aae2..06ee699 100644 --- a/src/main/java/team/stiff/pomelo/impl/annotated/handler/scan/MethodHandlerScanner.java +++ b/src/main/java/team/stiff/pomelo/impl/annotated/handler/scan/MethodHandlerScanner.java @@ -30,9 +30,9 @@ public final class MethodHandlerScanner implements EventHandlerScanner { final Map, Set> eventHandlers = new HashMap<>(); Stream.of(listenerContainer.getClass().getDeclaredMethods()) .filter(annotatedListenerPredicate).forEach(method -> eventHandlers - .computeIfAbsent(method.getParameterTypes()[0], obj -> new TreeSet<>()) - .add(new MethodEventHandler(listenerContainer, method, - filterScanner.scan(method)))); + .computeIfAbsent(method.getParameterTypes()[0], obj -> new TreeSet<>()) + .add(new MethodEventHandler(listenerContainer, method, + filterScanner.scan(method)))); return eventHandlers; } } diff --git a/src/main/resources/assets/seppukumod/shaders/chams.json b/src/main/resources/assets/seppukumod/shaders/chams.json index 5d6f139..60fe12d 100644 --- a/src/main/resources/assets/seppukumod/shaders/chams.json +++ b/src/main/resources/assets/seppukumod/shaders/chams.json @@ -1,67 +1,146 @@ { - "name": "Default chams shader", - "files": [ - "resource:///assets/seppukumod/shaders/func_applyColor_default.frag", - "resource:///assets/seppukumod/shaders/func_applyTexture_default.frag", - "resource:///assets/seppukumod/shaders/func_applyLighting_default.frag", - "resource:///assets/seppukumod/shaders/func_applyEntityBrightness_default.frag", - "resource:///assets/seppukumod/shaders/func_applyShading_default.frag", - "resource:///assets/seppukumod/shaders/chams.frag" - ], - "uniforms": { - "visibletint": { - "displayname": "VisibleTint", - "alias": ["vistint", "vist", "vtint", "vt"], - "description": "The entity color tint percentage used when an entity is visible", - "type": "float", - "default": 0.2, - "min": 0, - "max": 1, - "increments": 0.05 - }, - "occludedtint": { - "displayname": "OccludedTint", - "alias": ["occtint", "occt", "otint", "ot", "hiddentint", "hidtint", "hidt", "htint", "ht", "invisibletint", "invistint", "invist", "itint", "it"], - "description": "The entity color tint percentage used when an entity is not visible", - "type": "float", - "default": 0.5, - "min": 0, - "max": 1, - "increments": 0.05 - }, - "visibletintvariation": { - "displayname": "VisibleTintVariation", - "alias": ["visibletvariation", "visibletintv", "visibletintvar", "visibletvar", "visibletv", "vistvariation", "vistintv", "vistintvar", "vistvar", "vistv", "vtvariation", "vtintv", "vtintvar", "vtvar", "vtv"], - "description": "How much the tint percentage can vary when an entity is visible", - "type": "float", - "default": 0.1, - "min": 0, - "max": 1, - "increments": 0.05 - }, - "occludedtintvariation": { - "displayname": "OccludedTintVariation", - "alias": ["occludedtvariation", "occludedtintv", "occludedtintvar", "occludedtvar", "occludedtv", "occtvariation", "occtintv", "occtintvar", "occtvar", "occtv", "otvariation", "otintv", "otintvar", "otvar", "otv", "invisibletvariation", "invisibletintv", "invisibletintvar", "invisibletvar", "invisibletv", "invistvariation", "invistintv", "invistintvar", "invistvar", "invistv", "itvariation", "itintv", "itintvar", "itvar", "itv"], - "description": "How much the tint percentage can vary when an entity is not visible", - "type": "float", - "default": 0.1, - "min": 0, - "max": 1, - "increments": 0.05 - }, - "lightvisible": { - "displayname": "LightVisible", - "alias": ["lvisible", "lightv", "lightvis", "lvis", "lv"], - "description": "Should light level be applied when the entity is visible?", - "type": "bool", - "default": false - }, - "lightoccluded": { - "displayname": "LightOccluded", - "alias": ["loccluded", "lighto", "lightocc", "locc", "lo"], - "description": "Should light level be applied when the entity is not visible?", - "type": "bool", - "default": false - } + "name": "Default chams shader", + "files": [ + "resource:///assets/seppukumod/shaders/func_applyColor_default.frag", + "resource:///assets/seppukumod/shaders/func_applyTexture_default.frag", + "resource:///assets/seppukumod/shaders/func_applyLighting_default.frag", + "resource:///assets/seppukumod/shaders/func_applyEntityBrightness_default.frag", + "resource:///assets/seppukumod/shaders/func_applyShading_default.frag", + "resource:///assets/seppukumod/shaders/chams.frag" + ], + "uniforms": { + "visibletint": { + "displayname": "VisibleTint", + "alias": [ + "vistint", + "vist", + "vtint", + "vt" + ], + "description": "The entity color tint percentage used when an entity is visible", + "type": "float", + "default": 0.2, + "min": 0, + "max": 1, + "increments": 0.05 + }, + "occludedtint": { + "displayname": "OccludedTint", + "alias": [ + "occtint", + "occt", + "otint", + "ot", + "hiddentint", + "hidtint", + "hidt", + "htint", + "ht", + "invisibletint", + "invistint", + "invist", + "itint", + "it" + ], + "description": "The entity color tint percentage used when an entity is not visible", + "type": "float", + "default": 0.5, + "min": 0, + "max": 1, + "increments": 0.05 + }, + "visibletintvariation": { + "displayname": "VisibleTintVariation", + "alias": [ + "visibletvariation", + "visibletintv", + "visibletintvar", + "visibletvar", + "visibletv", + "vistvariation", + "vistintv", + "vistintvar", + "vistvar", + "vistv", + "vtvariation", + "vtintv", + "vtintvar", + "vtvar", + "vtv" + ], + "description": "How much the tint percentage can vary when an entity is visible", + "type": "float", + "default": 0.1, + "min": 0, + "max": 1, + "increments": 0.05 + }, + "occludedtintvariation": { + "displayname": "OccludedTintVariation", + "alias": [ + "occludedtvariation", + "occludedtintv", + "occludedtintvar", + "occludedtvar", + "occludedtv", + "occtvariation", + "occtintv", + "occtintvar", + "occtvar", + "occtv", + "otvariation", + "otintv", + "otintvar", + "otvar", + "otv", + "invisibletvariation", + "invisibletintv", + "invisibletintvar", + "invisibletvar", + "invisibletv", + "invistvariation", + "invistintv", + "invistintvar", + "invistvar", + "invistv", + "itvariation", + "itintv", + "itintvar", + "itvar", + "itv" + ], + "description": "How much the tint percentage can vary when an entity is not visible", + "type": "float", + "default": 0.1, + "min": 0, + "max": 1, + "increments": 0.05 + }, + "lightvisible": { + "displayname": "LightVisible", + "alias": [ + "lvisible", + "lightv", + "lightvis", + "lvis", + "lv" + ], + "description": "Should light level be applied when the entity is visible?", + "type": "bool", + "default": false + }, + "lightoccluded": { + "displayname": "LightOccluded", + "alias": [ + "loccluded", + "lighto", + "lightocc", + "locc", + "lo" + ], + "description": "Should light level be applied when the entity is not visible?", + "type": "bool", + "default": false } + } } \ No newline at end of file diff --git a/src/main/resources/assets/seppukumod/shaders/default.json b/src/main/resources/assets/seppukumod/shaders/default.json index eefc11a..ea31c48 100644 --- a/src/main/resources/assets/seppukumod/shaders/default.json +++ b/src/main/resources/assets/seppukumod/shaders/default.json @@ -1,4 +1,4 @@ { - "name": "Default 3D shader", - "files": [] + "name": "Default 3D shader", + "files": [] } \ No newline at end of file