diff --git a/src/openonyx/features/render/ItemPhysics.java b/src/openonyx/features/render/ItemPhysics.java new file mode 100644 index 0000000..6e05425 --- /dev/null +++ b/src/openonyx/features/render/ItemPhysics.java @@ -0,0 +1,13 @@ +package openonyx.features.render; + +import openonyx.features.Module; +import openonyx.features.ModuleCategory; +import openonyx.history.internal.NumberSetting; + +public final class ItemPhysics extends Module { + public final NumberSetting rotationSpeed = new NumberSetting("Rotation speed", 0.0, 0.0, 3.0, 0.1).withSuffix("x"); + + public ItemPhysics() { + super("ItemPhysics", "Makes dropped items lie and rotate on the ground", ModuleCategory.RENDER); + } +} diff --git a/src/openonyx/features/render/JumpCircles.java b/src/openonyx/features/render/JumpCircles.java new file mode 100644 index 0000000..950b503 --- /dev/null +++ b/src/openonyx/features/render/JumpCircles.java @@ -0,0 +1,162 @@ +package openonyx.features.render; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import meteordevelopment.orbit.EventHandler; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.Vec3; +import openonyx.configuration.internal.TickEndEvent; +import openonyx.configuration.internal.WorldChangeEvent; +import openonyx.features.Module; +import openonyx.features.ModuleCategory; +import openonyx.history.internal.BooleanSetting; +import openonyx.history.internal.ColorSetting; +import openonyx.history.internal.EnumSetting; +import openonyx.history.internal.NumberSetting; +import openonyx.history.internal.TextSetting; +import openonyx.render.group_z.JumpCirclePoint; +import openonyx.render.group_z.JumpCircleRenderer; +import openonyx.render.group_z.JumpCircleStyle; + +public final class JumpCircles extends Module { + private final List jumpCirclePoints; + public final ColorSetting color; + public final NumberSetting radius; + public final EnumSetting mode = new EnumSetting<>("Mode", JumpCirclesMode.RING); + public final BooleanSetting otherPlayers; + public final NumberSetting duration; + public final NumberSetting opacity; + public final BooleanSetting throughWalls; + private static final double l = 0.01; + private final JumpCircleRenderer jumpCircleRenderer; + private final Map vec3Map; + public final TextSetting text = new TextSetting("Text", "ONYX") + .describe("Written around the ring, repeated all the way round") + .visibleWhen(this.mode, jumpCirclesMode -> jumpCirclesMode == JumpCirclesMode.TEXT); + public final NumberSetting spinSpeed; + public final NumberSetting textSize = new NumberSetting("Text size", 0.22, 0.05, 0.6, 0.01) + .describe("How tall the letters stand, in blocks") + .visibleWhen(this.mode, jumpCirclesMode -> jumpCirclesMode == JumpCirclesMode.TEXT); + public final JumpCirclesPart jumpCirclesPart; + + @Override + protected void onEnable() { + this.jumpCirclePoints.clear(); + this.vec3Map.clear(); + } + + @EventHandler + private void onTickEnd(TickEndEvent tickEndEvent) { + JumpCircles jumpCircles1 = this; + if (mc.thePlayer != null && mc.theWorld != null) { + jumpCircles1.h(); + HashSet hashSet = new HashSet(); + Iterator iterator = mc.theWorld.playerEntities.iterator(); + + label41: + while (true) { + Iterator iterator1 = iterator; + + while (iterator1.hasNext()) { + EntityPlayer entityPlayer; + if ((entityPlayer = (EntityPlayer)iterator.next()) == null) { + continue label41; + } + + if (!entityPlayer.isEntityAlive()) { + iterator1 = iterator; + } else if (entityPlayer != mc.thePlayer && !jumpCircles1.otherPlayers.isEnabled()) { + iterator1 = iterator; + } else { + hashSet.add(entityPlayer.getEntityId()); + Vec3 vec3 = new Vec3(entityPlayer.posX, entityPlayer.posY, entityPlayer.posZ); + if (!entityPlayer.onGround) { + if ((vec3 = jumpCircles1.vec3Map.remove(entityPlayer.getEntityId())) != null && L(entityPlayer, vec3)) { + jumpCircles1.jumpCirclePoints.add(new JumpCirclePoint(vec3, System.currentTimeMillis())); + } + continue label41; + } + + iterator1 = iterator; + jumpCircles1.vec3Map.put(entityPlayer.getEntityId(), vec3); + } + } + + jumpCircles1.vec3Map.keySet().retainAll(hashSet); + return; + } + } + } + + private void h() { + long lx = System.currentTimeMillis() - this.L(); + this.jumpCirclePoints.removeIf(jumpCirclePoint -> jumpCirclePoint.time() < lx); + } + + @Override + protected void onDisable() { + this.jumpCirclePoints.clear(); + this.vec3Map.clear(); + this.jumpCircleRenderer.L(); + } + + private JumpCircleStyle L() { + return new JumpCircleStyle( + this.mode.getValue(), + this.color.getOpaque(), + this.opacity.getFloat() / 100.0F, + this.radius.getFloat(), + this.L(), + this.spinSpeed.getFloat(), + this.text.getValue(), + this.textSize.getFloat(), + this.throughWalls.isEnabled(), + this.jumpCirclesPart.isEnabled(), + this.jumpCirclesPart.blur.getFloat() / 100.0F, + this.jumpCirclesPart.warp.getFloat() / 100.0F + ); + } + + public JumpCircles() { + super("JumpCircles", "Draws a circle where a jump started", ModuleCategory.RENDER); + this.spinSpeed = new NumberSetting("Spin speed", 40.0, -360.0, 360.0, 5.0) + .withSuffix("°/s") + .describe("How fast the text travels around the ring") + .visibleWhen(this.mode, jumpCirclesMode -> jumpCirclesMode == JumpCirclesMode.TEXT); + this.color = new ColorSetting("Color", -10178561).D(); + this.radius = new NumberSetting("Radius", 1.5, 0.3, 6.0, 0.1).describe("How wide the circle opens out to"); + this.opacity = new NumberSetting("Opacity", 70.0, 5.0, 100.0, 1.0).withSuffix("%").describe("Overall opacity of the circles"); + this.duration = new NumberSetting("Duration", 2.0, 0.25, 8.0, 0.25).withSuffix(" s").describe("How long a circle lasts before it is gone"); + this.otherPlayers = new BooleanSetting("Other players", false).describe("Leave circles under everyone else's jumps too"); + this.throughWalls = new BooleanSetting("Through walls", false); + this.jumpCirclesPart = new JumpCirclesPart(this); + this.jumpCircleRenderer = new JumpCircleRenderer(); + this.jumpCirclePoints = new ArrayList<>(); + this.vec3Map = new HashMap<>(); + } + + @EventHandler + private void onWorldChange(WorldChangeEvent worldChangeEvent) { + this.jumpCirclePoints.clear(); + this.vec3Map.clear(); + } + + public void L(float f) { + if (this.isEnabled() && mc.theWorld != null && mc.thePlayer != null) { + this.h(); + this.jumpCircleRenderer.L(f, this.jumpCirclePoints, this.L()); + } + } + + private long L() { + return (long)(this.duration.getValue() * 1000.0); + } + + private static boolean L(EntityPlayer entityPlayer, Vec3 vec3) { + return entityPlayer.motionY > 0.0 || entityPlayer.posY > vec3.yCoord + 0.01; + } +} diff --git a/src/openonyx/features/render/JumpCirclesMode.java b/src/openonyx/features/render/JumpCirclesMode.java new file mode 100644 index 0000000..074a2f0 --- /dev/null +++ b/src/openonyx/features/render/JumpCirclesMode.java @@ -0,0 +1,27 @@ +package openonyx.features.render; + +import openonyx.history.DisplayNamed; + +public enum JumpCirclesMode implements DisplayNamed { + TEXT("Text"), + RING("Ring"); + + private final String e; + + private static JumpCirclesMode[] L() { + JumpCirclesMode[] jumpCirclesModes = new JumpCirclesMode[2]; + boolean bl = true; + jumpCirclesModes[0] = RING; + jumpCirclesModes[1] = TEXT; + return jumpCirclesModes; + } + + JumpCirclesMode(String string1) { + this.e = string1; + } + + @Override + public String getDisplayName() { + return this.e; + } +} diff --git a/src/openonyx/features/render/JumpCirclesPart.java b/src/openonyx/features/render/JumpCirclesPart.java new file mode 100644 index 0000000..e11c364 --- /dev/null +++ b/src/openonyx/features/render/JumpCirclesPart.java @@ -0,0 +1,17 @@ +package openonyx.features.render; + +import openonyx.history.SettingGroup; +import openonyx.history.internal.NumberSetting; + +public final class JumpCirclesPart extends SettingGroup { + public final NumberSetting blur = new NumberSetting("Blur", 60.0, 0.0, 100.0, 1.0) + .withSuffix("%") + .describe("How far out of focus the ground inside the ring goes"); + public final NumberSetting warp = new NumberSetting("Warp", 45.0, 0.0, 100.0, 1.0) + .withSuffix("%") + .describe("How hard the view bends outwards at the rim of the lens"); + + private JumpCirclesPart(JumpCircles jumpCircles) { + super("Distortion", true); + } +} diff --git a/src/openonyx/features/render/Mode.java b/src/openonyx/features/render/Mode.java new file mode 100644 index 0000000..9113f87 --- /dev/null +++ b/src/openonyx/features/render/Mode.java @@ -0,0 +1,27 @@ +package openonyx.features.render; + +import openonyx.history.DisplayNamed; + +public enum Mode implements DisplayNamed { + WALL("Wall"), + POINTS("Points"); + + private final String e; + + private static Mode[] L() { + Mode[] modes = new Mode[2]; + boolean bl = true; + modes[0] = WALL; + modes[1] = POINTS; + return modes; + } + + Mode(String string1) { + this.e = string1; + } + + @Override + public String getDisplayName() { + return this.e; + } +}