Skip to content

Commit

Permalink
No Render Improve
Browse files Browse the repository at this point in the history
  • Loading branch information
Nekiplay committed Dec 28, 2024
1 parent 64c4f18 commit 5a22408
Show file tree
Hide file tree
Showing 11 changed files with 276 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/dev_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ jobs:
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: '${{ secrets.GITHUB_TOKEN }}'
automatic_release_tag: "1.21.3_1.0.9.2"
automatic_release_tag: "1.21.3_1.0.9.3"
prerelease: true
title: "1.21.3 | 1.0.9.2"
title: "1.21.3 | 1.0.9.3"
files: |
./build/libs/*.jar
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ yarn_mappings=1.21.3+build.2
loader_version=0.16.9

# Mod Properties
mod_version=1.21.3_1.0.9.2
mod_version=1.21.3_1.0.9.3
maven_group=nekiplay.meteorplus
archives_base_name=meteor-plus

Expand Down
23 changes: 23 additions & 0 deletions src/main/java/nekiplay/main/events/hud/RenderArmorBarEvent.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package nekiplay.main.events.hud;
import nekiplay.main.events.Cancellable;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.entity.player.PlayerEntity;

public class RenderArmorBarEvent extends Cancellable {
private static final RenderArmorBarEvent INSTANCE = new RenderArmorBarEvent();
private DrawContext context;
private PlayerEntity player;
private int i;
private int j;
private int k;
private int x;
public static RenderArmorBarEvent get(DrawContext context, PlayerEntity player, int i, int j, int k, int x) {
INSTANCE.context = context;
INSTANCE.player = player;
INSTANCE.i = i;
INSTANCE.j = j;
INSTANCE.k = k;
INSTANCE.x = x;
return INSTANCE;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package nekiplay.main.events.hud;
import nekiplay.main.events.Cancellable;
import net.minecraft.client.gui.DrawContext;

public class RenderExperienceBarEvent extends Cancellable {
private static final RenderExperienceBarEvent INSTANCE = new RenderExperienceBarEvent();
private DrawContext context;
private int x;
public static RenderExperienceBarEvent get(DrawContext context, int x) {
INSTANCE.context = context;
INSTANCE.x = x;
return INSTANCE;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package nekiplay.main.events.hud;
import nekiplay.main.events.Cancellable;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.render.RenderTickCounter;
import net.minecraft.entity.player.PlayerEntity;

public class RenderExperienceLevelEvent extends Cancellable {
private static final RenderExperienceLevelEvent INSTANCE = new RenderExperienceLevelEvent();
private DrawContext context;
private RenderTickCounter tickCounter;
public static RenderExperienceLevelEvent get(DrawContext context, RenderTickCounter tickCounter) {
INSTANCE.context = context;
INSTANCE.tickCounter = tickCounter;
return INSTANCE;
}
}
20 changes: 20 additions & 0 deletions src/main/java/nekiplay/main/events/hud/RenderFoodBarEvent.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package nekiplay.main.events.hud;
import nekiplay.main.events.Cancellable;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.render.RenderTickCounter;
import net.minecraft.entity.player.PlayerEntity;

public class RenderFoodBarEvent extends Cancellable {
private static final RenderFoodBarEvent INSTANCE = new RenderFoodBarEvent();
private DrawContext context;
private PlayerEntity player;
private int top;
private int right;
public static RenderFoodBarEvent get(DrawContext context, PlayerEntity player, int top, int right) {
INSTANCE.context = context;
INSTANCE.player = player;
INSTANCE.top = top;
INSTANCE.right = right;
return INSTANCE;
}
}
33 changes: 33 additions & 0 deletions src/main/java/nekiplay/main/events/hud/RenderHealthBarEvent.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package nekiplay.main.events.hud;
import nekiplay.main.events.Cancellable;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.entity.player.PlayerEntity;

public class RenderHealthBarEvent extends Cancellable {
private static final RenderHealthBarEvent INSTANCE = new RenderHealthBarEvent();
private DrawContext context;
private PlayerEntity player;
private int x;
private int y;
private int lines;
private int regeneratingHeartIndex;
private float maxHealth;
private int lastHealth;
private int health;
private int absorption;
private boolean blinking;
public static RenderHealthBarEvent get(DrawContext context, PlayerEntity player, int x, int y, int lines, int regeneratingHeartIndex, float maxHealth, int lastHealth, int health, int absorption, boolean blinking) {
INSTANCE.context = context;
INSTANCE.player = player;
INSTANCE.x = x;
INSTANCE.y = y;
INSTANCE.lines = lines;
INSTANCE.regeneratingHeartIndex = regeneratingHeartIndex;
INSTANCE.maxHealth = maxHealth;
INSTANCE.lastHealth = lastHealth;
INSTANCE.health = health;
INSTANCE.absorption = absorption;
INSTANCE.blinking = blinking;
return INSTANCE;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package nekiplay.main.events.hud;
import nekiplay.main.events.Cancellable;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.entity.player.PlayerEntity;

public class RenderMountHealthBarEvent extends Cancellable {
private static final RenderMountHealthBarEvent INSTANCE = new RenderMountHealthBarEvent();
private DrawContext context;
public static RenderMountHealthBarEvent get(DrawContext context) {
INSTANCE.context = context;
return INSTANCE;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
import meteordevelopment.meteorclient.systems.modules.Module;
import meteordevelopment.meteorclient.systems.modules.render.NoRender;
import meteordevelopment.orbit.EventHandler;
import nekiplay.main.events.hud.DebugDrawTextEvent;
import nekiplay.main.events.hud.*;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import java.util.List;

Expand All @@ -17,44 +18,123 @@ public NoRenderMixin(Category category, String name, String description) {
}

@Unique
private final NoRender noRender = (NoRender)(Object) this;
@Unique
private final SettingGroup noRenderMeteorPlusSetting = noRender.settings.createGroup("F3");
private final SettingGroup noRenderMeteorPlusSetting = settings.createGroup("F3");

@Shadow
private final SettingGroup sgHUD = settings.getGroup("HUD");


@Unique
private final Setting<Boolean> noPosition = noRenderMeteorPlusSetting.add(new BoolSetting.Builder()
.name("remove-position")
.name("position")
.defaultValue(false)
.build()
);
@Unique
private final Setting<Boolean> noPositionBlock = noRenderMeteorPlusSetting.add(new BoolSetting.Builder()
.name("remove-position-block")
.name("position-block")
.defaultValue(false)
.build()
);
@Unique
private final Setting<Boolean> noPositionChunk = noRenderMeteorPlusSetting.add(new BoolSetting.Builder()
.name("remove-position-chunk")
.name("position-chunk")
.defaultValue(false)
.build()
);

@Unique
private final Setting<Boolean> noTargetBlockPosition = noRenderMeteorPlusSetting.add(new BoolSetting.Builder()
.name("remove-target-block-position")
.name("target-block-position")
.defaultValue(false)
.build()
);

@Unique
private final Setting<Boolean> noTargetFluidPosition = noRenderMeteorPlusSetting.add(new BoolSetting.Builder()
.name("remove-target-fluid-position")
.name("target-fluid-position")
.defaultValue(false)
.build()
);

@Unique
private final Setting<Boolean> experienceBar = sgHUD.add(new BoolSetting.Builder()
.name("experience-bar")
.defaultValue(false)
.build()
);
@Unique
private final Setting<Boolean> experienceLevel = sgHUD.add(new BoolSetting.Builder()
.name("experience-level")
.defaultValue(false)
.build()
);
@Unique
private final Setting<Boolean> healthBar = sgHUD.add(new BoolSetting.Builder()
.name("health-bar")
.defaultValue(false)
.build()
);
@Unique
private final Setting<Boolean> mountHealthBar = sgHUD.add(new BoolSetting.Builder()
.name("mount-health-bar")
.defaultValue(false)
.build()
);
@Unique
private final Setting<Boolean> foodBar = sgHUD.add(new BoolSetting.Builder()
.name("food-bar")
.defaultValue(false)
.build()
);
@Unique
private final Setting<Boolean> armorBar = sgHUD.add(new BoolSetting.Builder()
.name("armor-bar")
.defaultValue(false)
.build()
);
@Unique
@EventHandler
private void onMountHealthBarRender(RenderMountHealthBarEvent event) {
if (mountHealthBar.get()) {
event.setCancelled(true);
}
}
@Unique
@EventHandler
private void onArmorBarRender(RenderArmorBarEvent event) {
if (armorBar.get()) {
event.setCancelled(true);
}
}
@Unique
@EventHandler
private void onFoodBarRender(RenderFoodBarEvent event) {
if (foodBar.get()) {
event.setCancelled(true);
}
}
@Unique
@EventHandler
private void onHealthBarRender(RenderHealthBarEvent event) {
if (healthBar.get()) {
event.setCancelled(true);
}
}
@Unique
@EventHandler
private void onExperienceBarRender(RenderExperienceBarEvent event) {
if (experienceBar.get()) {
event.setCancelled(true);
}
}
@Unique
@EventHandler
private void onExperienceLevelRender(RenderExperienceLevelEvent event) {
if (experienceLevel.get()) {
event.setCancelled(true);
}
}

@Unique
@EventHandler
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@

package nekiplay.meteorplus.mixin.minecraft.hud;
import meteordevelopment.meteorclient.MeteorClient;
import nekiplay.main.events.hud.*;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.hud.InGameHud;
import net.minecraft.client.render.RenderTickCounter;
import net.minecraft.entity.player.PlayerEntity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(InGameHud.class)
public class InGameHudMixin {
@Inject(method = "renderHealthBar", at = @At("HEAD"), cancellable = true)
private void onRenderHealthBar(DrawContext context, PlayerEntity player, int x, int y, int lines, int regeneratingHeartIndex, float maxHealth, int lastHealth, int health, int absorption, boolean blinking, CallbackInfo ci) {
RenderHealthBarEvent healthBarRenderEvent = RenderHealthBarEvent.get(context, player, x, y, lines, regeneratingHeartIndex, maxHealth, lastHealth, health, absorption, blinking);
MeteorClient.EVENT_BUS.post(healthBarRenderEvent);
if (healthBarRenderEvent.isCancelled()) {
ci.cancel();
}
}
@Inject(method = "renderExperienceBar", at = @At("HEAD"), cancellable = true)
private void onRenderExperienceBar(DrawContext context, int x, CallbackInfo ci) {
RenderExperienceBarEvent renderExperienceBarEvent = RenderExperienceBarEvent.get(context, x);
MeteorClient.EVENT_BUS.post(renderExperienceBarEvent);
if (renderExperienceBarEvent.isCancelled()) {
ci.cancel();
}
}
@Inject(method = "renderExperienceLevel", at = @At("HEAD"), cancellable = true)
private void onRenderExperienceBar(DrawContext context, RenderTickCounter tickCounter, CallbackInfo ci) {
RenderExperienceLevelEvent renderExperienceLevelEvent = RenderExperienceLevelEvent.get(context, tickCounter);
MeteorClient.EVENT_BUS.post(renderExperienceLevelEvent);
if (renderExperienceLevelEvent.isCancelled()) {
ci.cancel();
}
}
@Inject(method = "renderFood", at = @At("HEAD"), cancellable = true)
private void onRenderFoodBar(DrawContext context, PlayerEntity player, int top, int right, CallbackInfo ci) {
RenderFoodBarEvent renderFoodBarEvent = RenderFoodBarEvent.get(context, player, top, right);
MeteorClient.EVENT_BUS.post(renderFoodBarEvent);
if (renderFoodBarEvent.isCancelled()) {
ci.cancel();
}
}
@Inject(method = "renderArmor", at = @At("HEAD"), cancellable = true)
private static void onRenderArmor(DrawContext context, PlayerEntity player, int i, int j, int k, int x, CallbackInfo ci) {
RenderArmorBarEvent renderArmorBarEvent = RenderArmorBarEvent.get(context, player, i, j, k, x);
MeteorClient.EVENT_BUS.post(renderArmorBarEvent);
if (renderArmorBarEvent.isCancelled()) {
ci.cancel();
}
}
@Inject(method = "renderMountHealth", at = @At("HEAD"), cancellable = true)
private void onRenderMountHealth(DrawContext context, CallbackInfo ci) {
RenderMountHealthBarEvent renderMountHealthBarEvent = RenderMountHealthBarEvent.get(context);
MeteorClient.EVENT_BUS.post(renderMountHealthBarEvent);
if (renderMountHealthBarEvent.isCancelled()) {
ci.cancel();
}
}
}
3 changes: 2 additions & 1 deletion src/main/resources/meteorplus.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"minecraft.ClientConnectionAccessor",
"minecraft.ShapelessRecipeAccessor",
"minecraft.entity.ShulkerEntityAccessor",
"minecraft.hud.DebugHudMixin"
"minecraft.hud.DebugHudMixin",
"minecraft.hud.InGameHudMixin"
],
"injectors": {
"defaultRequire": 1
Expand Down

0 comments on commit 5a22408

Please sign in to comment.