-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New MultiLineInputBox (WIP), Better rotations, fixed a few issues wit…
…h scaffold and auto-totem. And fixed compatibility with meteor. New ScaffoldCount, and basically a whole lot of changes.
- Loading branch information
1 parent
ee2f3e9
commit dcb61ec
Showing
49 changed files
with
2,083 additions
and
697 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
src/main/java/dev/heliosclient/event/events/player/SendMovementPacketEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package dev.heliosclient.event.events.player; | ||
|
||
import dev.heliosclient.event.Event; | ||
|
||
public class SendMovementPacketEvent extends Event { | ||
public static class PRE extends SendMovementPacketEvent{} | ||
public static class POST extends SendMovementPacketEvent{} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92 changes: 92 additions & 0 deletions
92
src/main/java/dev/heliosclient/hud/hudelements/ScaffoldCount.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
package dev.heliosclient.hud.hudelements; | ||
|
||
import dev.heliosclient.hud.HudElement; | ||
import dev.heliosclient.hud.HudElementData; | ||
import dev.heliosclient.managers.ColorManager; | ||
import dev.heliosclient.module.settings.DoubleSetting; | ||
import dev.heliosclient.module.settings.SettingGroup; | ||
import dev.heliosclient.util.render.Renderer2D; | ||
import dev.heliosclient.util.timer.TimerUtils; | ||
import net.minecraft.client.font.TextRenderer; | ||
import net.minecraft.client.gui.DrawContext; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.util.math.MathHelper; | ||
|
||
public class ScaffoldCount extends HudElement { | ||
public static HudElementData<ScaffoldCount> DATA = new HudElementData<>("ScaffoldCount", "Shows block counts in your main hand/scaffold hand", ScaffoldCount::new); | ||
private static ItemStack SCAFFOLD_STACK = ItemStack.EMPTY; | ||
private static final TimerUtils timer = new TimerUtils(); | ||
private static boolean isVisible = false; | ||
private static float animationProgress = 0.0f; | ||
private static final float ANIMATION_DURATION = 0.5f; // Duration of the pop-in/out animation in seconds | ||
private static final float DISPLAY_DURATION = 2f; // Duration to display the item before popping out. Currently it is 2s | ||
private final SettingGroup sgSettings = new SettingGroup("Settings"); | ||
private final DoubleSetting scale = sgSettings.add(new DoubleSetting.Builder() | ||
.name("Scale") | ||
.description("Change the scale") | ||
.min(0.3d) | ||
.max(5d) | ||
.value(1D) | ||
.defaultValue(1D) | ||
.onSettingChange(this) | ||
.roundingPlace(2) | ||
.build() | ||
); | ||
public ScaffoldCount() { | ||
super(DATA); | ||
addSettingGroup(sgSettings); | ||
setSize(40, 20); | ||
} | ||
|
||
@Override | ||
public void renderElement(DrawContext drawContext, TextRenderer textRenderer) { | ||
if (!SCAFFOLD_STACK.isEmpty()) { | ||
if (!isVisible) { | ||
isVisible = true; | ||
timer.startTimer(); | ||
} | ||
|
||
// Update animation progress | ||
if(timer.getElapsedTime() < DISPLAY_DURATION) { | ||
updateProgress(false); | ||
} | ||
|
||
// Render the element with animation | ||
if (isVisible) { | ||
float scale = Math.min(animationProgress, 1.0f); | ||
Renderer2D.scaleAndPosition(drawContext.getMatrices(), x, y, width, height, scale); | ||
super.renderElement(drawContext, textRenderer); | ||
drawContext.drawItem(SCAFFOLD_STACK, x + 2, y + 2); | ||
Renderer2D.drawString(drawContext.getMatrices(), String.valueOf(SCAFFOLD_STACK.getCount()), x + 20, y + 10 - Renderer2D.getStringHeight() / 2.0f, ColorManager.INSTANCE.hudColor); | ||
Renderer2D.stopScaling(drawContext.getMatrices()); | ||
} | ||
|
||
this.width = (int) (24 + Renderer2D.getStringWidth(String.valueOf(SCAFFOLD_STACK.getCount()))); | ||
} | ||
|
||
if (isVisible && timer.getElapsedTime() > DISPLAY_DURATION) { | ||
updateProgress(true); | ||
if (animationProgress <= 0.0f) { | ||
SCAFFOLD_STACK = ItemStack.EMPTY; | ||
isVisible = false; | ||
} | ||
} | ||
} | ||
|
||
public void updateProgress(boolean out) { | ||
if (out) { | ||
animationProgress -= 1.0f / (ANIMATION_DURATION * 20); | ||
} else { | ||
animationProgress += 1.0f / (ANIMATION_DURATION * 20); | ||
} | ||
|
||
animationProgress = MathHelper.clamp(animationProgress, 0, scale.getFloat()); | ||
} | ||
|
||
public static void setScaffoldStack(ItemStack stack) { | ||
SCAFFOLD_STACK = stack; | ||
timer.restartTimer(); | ||
isVisible = true; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.