Skip to content
This repository has been archived by the owner on May 5, 2024. It is now read-only.

Commit

Permalink
update pre9
Browse files Browse the repository at this point in the history
  • Loading branch information
nextdayy authored Dec 29, 2021
1 parent 8660281 commit a954453
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 11 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
org.gradle.jvmargs=-Xmx2G
mod_name = Tabulous
mod_id = tabulous
mod_version = 0.1.0-pre8
mod_version = 0.1.0-pre9
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ public class TabulousConfig extends Vigilant {
)
public static boolean animations = true;

@Property(
type = PropertyType.SELECTOR,
name = "Tab Position",
description = "Change where the tab is in your game.\n\u00a7eExperimental!",
category = "Tab", options = {"Top (Default)", "Top Left", "Top Right", "Left", "Bottom (bit broken)"}
)
public static int position = 0;

@Property(
type = PropertyType.SWITCH,
name = "Show Header",
Expand Down Expand Up @@ -198,7 +206,7 @@ public class TabulousConfig extends Vigilant {
@Property(
type = PropertyType.SWITCH,
name = "Special Custom Name in BedWars",
description = "Make your custom name show your team in BedWars, for example on Green team:\n\u00a7c[\u00a7fYOUTUBE\u00a7c] Bobfish21 \u00a7r--> \u00a7a\u00a7lG \u00a7r\u00a7aBobfish21\n\u00a7eMake sure Hide Custom Name Ingame is off for it to work. Might also be buggy at the moment!",
description = "Make your custom name show your team in BedWars, for example on Green team:\n\u00a7c[\u00a7fYOUTUBE\u00a7c] Bobfish21 \u00a7r--> \u00a7a\u00a7lG \u00a7r\u00a7aBobfish21",
category = "Hypixel", subcategory = "BedWars"
)
public static boolean customNameBW = false;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.nxtdelivery.tabulous.mixin;

import com.nxtdelivery.tabulous.config.TabulousConfig;
import net.minecraftforge.client.GuiIngameForge;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyArg;


@Mixin(GuiIngameForge.class)
public class GuiIngameForgeMixin {
@ModifyArg(method = "renderPlayerList", at = @At(value = "INVOKE",target = "Lnet/minecraft/client/gui/GuiPlayerTabOverlay;renderPlayerlist(ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V"),index = 0)
public int setWidth(int width) {
switch (TabulousConfig.position) {
default:
case 0:
return width;
case 1:
case 3:
return width / 3;
case 2:
case 4:
return width + (width / 2);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiPlayerTabOverlay;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.network.NetworkPlayerInfo;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.settings.KeyBinding;
Expand All @@ -16,6 +17,7 @@
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IChatComponent;
import net.minecraftforge.client.GuiIngameForge;
import org.lwjgl.input.Keyboard;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
Expand All @@ -40,6 +42,7 @@ public abstract class GuiPlayerTabOverlayMixin {
private static final Pattern validMinecraftUsername = Pattern.compile("\\w{1,16}");
private static final Pattern skyblockNameRegex = Pattern.compile("![A-D]-[a-v]");
private NetworkPlayerInfo currentInfo;
private int winTop = TabulousConfig.topPosition;

@Final
@Shadow
Expand Down Expand Up @@ -122,7 +125,19 @@ private int changeWidth(int k) {

@ModifyVariable(method = "renderPlayerlist", at = @At(value = "STORE", ordinal = 0), ordinal = 9)
public int setTop(int top) {
return TabulousConfig.topPosition;
ScaledResolution resolution = new ScaledResolution(mc);
switch (TabulousConfig.position) {
default:
winTop = TabulousConfig.topPosition;
break;
case 3:
winTop = resolution.getScaledHeight() / 3;
break;
case 4:
winTop = (int) (resolution.getScaledHeight() / 1.5);
break;
}
return winTop;
}

@ModifyVariable(method = "renderPlayerlist", at = @At("STORE"))
Expand Down Expand Up @@ -180,7 +195,7 @@ public void cancelUntilReadyAndReRenderHeader(CallbackInfo ci) {
ci.cancel();
} else {
if (headerList != null) {
int top2 = TabulousConfig.topPosition;
int top2 = winTop;
for (String s : headerList) {
int strWidth = this.mc.fontRendererObj.getStringWidth(s);
drawString(mc.fontRendererObj, s, (float) (this.width / 2 - strWidth / 2), (float) top2, -1);
Expand All @@ -190,7 +205,7 @@ public void cancelUntilReadyAndReRenderHeader(CallbackInfo ci) {
}
} else {
if (headerList != null) {
int top2 = TabulousConfig.topPosition;
int top2 = winTop;
for (String s : headerList) {
int strWidth = this.mc.fontRendererObj.getStringWidth(s);
drawString(mc.fontRendererObj, s, (float) (this.width / 2 - strWidth / 2), (float) top2, -1);
Expand All @@ -211,7 +226,7 @@ public void redirectScoreBoardRender(GuiPlayerTabOverlay instance, ScoreObjectiv
public void renderNames(Args args) {
if (args.get(0).toString().contains(mc.getSession().getUsername())) {
if (!TabulousConfig.myNameText.equals("default")) {
if (inGame && !TabulousConfig.hideCustomNameIngame && Tabulous.isBedWars && TabulousConfig.customNameBW) {
if (inGame && Tabulous.isBedWars && TabulousConfig.customNameBW) {
String name = TabulousConfig.myNameText;
if (TabulousConfig.myNameText.startsWith("\u00a7")) {
name = TabulousConfig.myNameText.substring(2);
Expand Down Expand Up @@ -320,7 +335,6 @@ public void renderPing(GuiPlayerTabOverlay instance, int p_175245_1_, int p_1752
}
}


@Inject(method = "renderPlayerlist", at = @At("HEAD"), cancellable = true)
public void renderPlayerlist(int width, Scoreboard scoreboardIn, ScoreObjective scoreObjectiveIn, CallbackInfo ci) {
if (TabulousConfig.disabled) {
Expand All @@ -330,10 +344,9 @@ public void renderPlayerlist(int width, Scoreboard scoreboardIn, ScoreObjective
ci.cancel();
}
percentComplete = clamp(easeOut(percentComplete, retract ? 0f : 1f));
//if (retract && Keyboard.isKeyDown(mc.gameSettings.keyBindPlayerList.getKeyCode())) { // commented out because it caused issues
// retract = false;
// KeyBinding.setKeyBindState(mc.gameSettings.keyBindPlayerList.getKeyCode(), false);
//}
if (retract && Keyboard.isKeyDown(mc.gameSettings.keyBindPlayerList.getKeyCode())) { // im so smart
retract = false;
}
if (retract && percentComplete == 0f) {
retract = false;
KeyBinding.setKeyBindState(mc.gameSettings.keyBindPlayerList.getKeyCode(), false);
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/mixins.tabulous.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
],
"verbose": true,
"client": [
"GuiIngameForgeMixin",
"GuiIngameMixin"
]
}

0 comments on commit a954453

Please sign in to comment.