Generated
+1
-1
@@ -5,7 +5,7 @@
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="gradleJvm" value="liberica-21" />
|
||||
<option name="gradleJvm" value="liberica-21 (2)" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
|
||||
Generated
+1
@@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="liberica-21" project-jdk-type="JavaSDK">
|
||||
|
||||
+1
-1
@@ -12,5 +12,5 @@
|
||||
|
||||
</envs>
|
||||
<shortenClasspath name="ARGS_FILE"/>
|
||||
<classpathModifications><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\org.apache.commons\commons-compress\1.27.1\a19151084758e2fbb6b41eddaa88e7b8ff4e6599\commons-compress-1.27.1.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\org.lwjgl\lwjgl-jemalloc\3.3.3\b543467b7ff3c6920539a88ee602d34098628be5\lwjgl-jemalloc-3.3.3.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\com.mojang\text2speech\1.18.11\e853a12cdd6ba4f4836e8f4bf3b37844a13482b6\text2speech-1.18.11.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\org.apache.httpcomponents\httpclient\4.5.14\1194890e6f56ec29177673f2f12d0b8e627dec98\httpclient-4.5.14.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\com.ibm.icu\icu4j\76.1\215f3a8e936d4069344bd75f2b1368fd58112894\icu4j-76.1.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\org.apache.httpcomponents\httpcore\4.4.16\51cf043c87253c9f58b539c9f7e44c8894223850\httpcore-4.4.16.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\org.lwjgl\lwjgl-stb\3.3.3\25dd6161988d7e65f71d5065c99902402ee32746\lwjgl-stb-3.3.3.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\org.lwjgl\lwjgl\3.3.3\29589b5f87ed335a6c7e7ee6a5775f81f97ecb84\lwjgl-3.3.3.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\commons-codec\commons-codec\1.17.1\973638b7149d333563584137ebf13a691bb60579\commons-codec-1.17.1.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\org.lwjgl\lwjgl-freetype\3.3.3\a0db6c84a8becc8ca05f9dbfa985edc348a824c7\lwjgl-freetype-3.3.3.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\org.lwjgl\lwjgl-opengl\3.3.3\2f6b0147078396a58979125a4c947664e98293a\lwjgl-opengl-3.3.3.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\org.lwjgl\lwjgl-tinyfd\3.3.3\82d755ca94b102e9ca77283b9e2dc46d1b15fbe5\lwjgl-tinyfd-3.3.3.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\org.lwjgl\lwjgl-openal\3.3.3\daada81ceb5fc0c291fbfdd4433cb8d9423577f2\lwjgl-openal-3.3.3.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\com.mojang\patchy\2.2.10\da05971b07cbb379d002cf7eaec6a2048211fefc\patchy-2.2.10.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\commons-logging\commons-logging\1.3.4\b9fc14968d63a8b8a8a2c1885fe3e90564239708\commons-logging-1.3.4.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\com.mojang\blocklist\1.0.10\5c685c5ffa94c4cd39496c7184c1d122e515ecef\blocklist-1.0.10.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\org.jcraft\jorbis\0.0.17\8872d22b293e8f5d7d56ff92be966e6dc28ebdc6\jorbis-0.0.17.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\org.lwjgl\lwjgl-glfw\3.3.3\efa1eb78c5ccd840e9f329717109b5e892d72f8e\lwjgl-glfw-3.3.3.jar"/></classpathModifications></configuration>
|
||||
<classpathModifications><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\org.jcraft\jorbis\0.0.17\8872d22b293e8f5d7d56ff92be966e6dc28ebdc6\jorbis-0.0.17.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\org.lwjgl\lwjgl-glfw\3.3.3\efa1eb78c5ccd840e9f329717109b5e892d72f8e\lwjgl-glfw-3.3.3.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\org.lwjgl\lwjgl-opengl\3.3.3\2f6b0147078396a58979125a4c947664e98293a\lwjgl-opengl-3.3.3.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\com.mojang\patchy\2.2.10\da05971b07cbb379d002cf7eaec6a2048211fefc\patchy-2.2.10.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\com.mojang\blocklist\1.0.10\5c685c5ffa94c4cd39496c7184c1d122e515ecef\blocklist-1.0.10.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\org.apache.commons\commons-compress\1.27.1\a19151084758e2fbb6b41eddaa88e7b8ff4e6599\commons-compress-1.27.1.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\com.mojang\text2speech\1.18.11\e853a12cdd6ba4f4836e8f4bf3b37844a13482b6\text2speech-1.18.11.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\org.apache.httpcomponents\httpclient\4.5.14\1194890e6f56ec29177673f2f12d0b8e627dec98\httpclient-4.5.14.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\org.lwjgl\lwjgl-tinyfd\3.3.3\82d755ca94b102e9ca77283b9e2dc46d1b15fbe5\lwjgl-tinyfd-3.3.3.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\commons-logging\commons-logging\1.3.4\b9fc14968d63a8b8a8a2c1885fe3e90564239708\commons-logging-1.3.4.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\com.ibm.icu\icu4j\76.1\215f3a8e936d4069344bd75f2b1368fd58112894\icu4j-76.1.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\org.apache.httpcomponents\httpcore\4.4.16\51cf043c87253c9f58b539c9f7e44c8894223850\httpcore-4.4.16.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\org.lwjgl\lwjgl-jemalloc\3.3.3\b543467b7ff3c6920539a88ee602d34098628be5\lwjgl-jemalloc-3.3.3.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\org.lwjgl\lwjgl-stb\3.3.3\25dd6161988d7e65f71d5065c99902402ee32746\lwjgl-stb-3.3.3.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\org.lwjgl\lwjgl\3.3.3\29589b5f87ed335a6c7e7ee6a5775f81f97ecb84\lwjgl-3.3.3.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\org.lwjgl\lwjgl-openal\3.3.3\daada81ceb5fc0c291fbfdd4433cb8d9423577f2\lwjgl-openal-3.3.3.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\org.lwjgl\lwjgl-freetype\3.3.3\a0db6c84a8becc8ca05f9dbfa985edc348a824c7\lwjgl-freetype-3.3.3.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\commons-codec\commons-codec\1.17.1\973638b7149d333563584137ebf13a691bb60579\commons-codec-1.17.1.jar"/></classpathModifications></configuration>
|
||||
</component>
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
plugins {
|
||||
id 'fabric-loom' version '1.6-SNAPSHOT'
|
||||
id 'fabric-loom' version '1.11-SNAPSHOT'
|
||||
id 'maven-publish'
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -3,12 +3,12 @@ org.gradle.jvmargs=-Xmx2G
|
||||
|
||||
# Fabric Properties
|
||||
# check these on https://modmuss50.me/fabric.html
|
||||
minecraft_version=1.21.5
|
||||
yarn_mappings=1.21.5+build.1
|
||||
loader_version=0.16.12
|
||||
minecraft_version=1.21.10
|
||||
yarn_mappings=1.21.10+build.2
|
||||
loader_version=0.17.3
|
||||
|
||||
#Fabric api
|
||||
fabric_version=0.119.9+1.21.5
|
||||
fabric_version=0.135.0+1.21.10
|
||||
|
||||
# Mod Properties
|
||||
mod_version = 1.0
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
@@ -11,4 +11,5 @@ public class FeaturesSettings {
|
||||
public final BooleanSetting autoToolIncludePlayer = new BooleanSetting();
|
||||
public final BooleanSetting autoFish = new BooleanSetting();
|
||||
public final BooleanSetting noFallPacket = new BooleanSetting();
|
||||
|
||||
}
|
||||
|
||||
@@ -3,24 +3,16 @@ package com.expvintl.mctools;
|
||||
import com.expvintl.mctools.commands.*;
|
||||
import com.expvintl.mctools.modules.BetterTooltip;
|
||||
import com.expvintl.mctools.modules.CameraZoom;
|
||||
import com.expvintl.mctools.modules.PlayerListTextLatency;
|
||||
import com.expvintl.mctools.texthud.MCInfo;
|
||||
import com.expvintl.mctools.texthud.PotionInfo;
|
||||
import com.expvintl.mctools.utils.Utils;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback;
|
||||
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
|
||||
import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.font.TextRenderer;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.network.ClientPlayerEntity;
|
||||
import net.minecraft.client.render.RenderTickCounter;
|
||||
import net.fabricmc.fabric.api.client.rendering.v1.hud.HudElementRegistry;
|
||||
import net.fabricmc.fabric.api.client.rendering.v1.hud.VanillaHudElements;
|
||||
import net.minecraft.command.CommandRegistryAccess;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Colors;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
|
||||
public class MCToolsClient implements ClientModInitializer {
|
||||
@@ -28,13 +20,13 @@ public class MCToolsClient implements ClientModInitializer {
|
||||
public void onInitializeClient() {
|
||||
//初始化命令注册回调
|
||||
ClientCommandRegistrationCallback.EVENT.register(MCToolsClient::registerCommands);
|
||||
HudRenderCallback.EVENT.register(MCInfo::drawHUD);
|
||||
HudRenderCallback.EVENT.register(PotionInfo::drawHUD);
|
||||
HudElementRegistry.attachElementBefore(VanillaHudElements.CROSSHAIR, Identifier.of("mctools","DrawInfo"),MCInfo::drawHUD);
|
||||
HudElementRegistry.attachElementBefore(VanillaHudElements.CROSSHAIR, Identifier.of("mctools","DrawPotionInfo"),PotionInfo::drawHUD);
|
||||
|
||||
InitModules();
|
||||
}
|
||||
public void InitModules(){
|
||||
BetterTooltip.INSTANCE.init();
|
||||
PlayerListTextLatency.INSTANCE.init();
|
||||
CameraZoom.INSTANCE.init();
|
||||
}
|
||||
|
||||
|
||||
@@ -136,14 +136,15 @@ public class CAutoToolCommand {
|
||||
}
|
||||
}
|
||||
public boolean isSwordItem(Item item){
|
||||
return item==Items.STONE_SWORD||item==Items.DIAMOND_SWORD||item==Items.GOLDEN_SWORD||item==Items.IRON_SWORD||item==Items.NETHERITE_SWORD||item==Items.WOODEN_SWORD;
|
||||
return item==Items.STONE_SWORD||item==Items.DIAMOND_SWORD||item==Items.GOLDEN_SWORD||item==Items.IRON_SWORD||item==Items.NETHERITE_SWORD||item==Items.WOODEN_SWORD||item==Items.COPPER_SWORD;
|
||||
}
|
||||
public boolean isToolItem(Item item){
|
||||
return item == Items.WOODEN_PICKAXE || item == Items.STONE_PICKAXE || item == Items.IRON_PICKAXE || item == Items.GOLDEN_PICKAXE || item == Items.DIAMOND_PICKAXE || item == Items.NETHERITE_PICKAXE
|
||||
|| item == Items.WOODEN_AXE || item == Items.STONE_AXE || item == Items.IRON_AXE || item == Items.GOLDEN_AXE || item == Items.DIAMOND_AXE || item == Items.NETHERITE_AXE
|
||||
|| item == Items.WOODEN_SHOVEL || item == Items.STONE_SHOVEL || item == Items.IRON_SHOVEL || item == Items.GOLDEN_SHOVEL || item == Items.DIAMOND_SHOVEL || item == Items.NETHERITE_SHOVEL
|
||||
|| item == Items.WOODEN_HOE || item == Items.STONE_HOE || item == Items.IRON_HOE || item == Items.GOLDEN_HOE || item == Items.DIAMOND_HOE || item == Items.NETHERITE_HOE
|
||||
|| item == Items.WOODEN_SWORD || item == Items.STONE_SWORD || item == Items.IRON_SWORD || item == Items.GOLDEN_SWORD || item == Items.DIAMOND_SWORD || item == Items.NETHERITE_SWORD;
|
||||
|| item == Items.WOODEN_SWORD || item == Items.STONE_SWORD || item == Items.IRON_SWORD || item == Items.GOLDEN_SWORD || item == Items.DIAMOND_SWORD || item == Items.NETHERITE_SWORD
|
||||
|| item == Items.COPPER_SWORD || item == Items.COPPER_AXE || item == Items.COPPER_HOE ||item == Items.COPPER_SHOVEL ||item == Items.COPPER_PICKAXE;
|
||||
}
|
||||
public boolean isOreBlock(Item item) {
|
||||
return item == Items.COAL_ORE || // 煤矿石
|
||||
@@ -253,19 +254,12 @@ public class CAutoToolCommand {
|
||||
damageScore += Utils.GetEnchantLevel(Enchantments.KNOCKBACK, item);
|
||||
return damageScore;
|
||||
}
|
||||
private boolean hasEnchants(ItemStack item){
|
||||
return !item.getEnchantments().getEnchantmentEntries().isEmpty();
|
||||
}
|
||||
//停用低耐久度
|
||||
private boolean isLowDurability(ItemStack itemStack) {
|
||||
Item item = itemStack.getItem();
|
||||
boolean isWooden = item == Items.WOODEN_SWORD || item == Items.WOODEN_PICKAXE ||
|
||||
item == Items.WOODEN_AXE || item == Items.WOODEN_SHOVEL ||
|
||||
item == Items.WOODEN_HOE;
|
||||
boolean isStone = item == Items.STONE_SWORD || item == Items.STONE_PICKAXE ||
|
||||
item == Items.STONE_AXE || item == Items.STONE_SHOVEL ||
|
||||
item == Items.STONE_HOE;
|
||||
boolean isIron = item == Items.IRON_SWORD || item == Items.IRON_PICKAXE ||
|
||||
item == Items.IRON_AXE || item == Items.IRON_SHOVEL ||
|
||||
item == Items.IRON_HOE;
|
||||
return !(isWooden||isStone||isIron) //忽略木/石/铁工具
|
||||
&&(itemStack.getMaxDamage() - itemStack.getDamage()) < (itemStack.getMaxDamage() * 10 / 100);
|
||||
return !hasEnchants(itemStack) //忽略没有附魔的
|
||||
&&(itemStack.getMaxDamage() - itemStack.getDamage()) <= (itemStack.getMaxDamage() * 10 / 100);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,9 +31,9 @@ public class CNoFallPacketCommand {
|
||||
private static int execute(CommandContext<FabricClientCommandSource> context) {
|
||||
FeaturesSettings.INSTANCE.noFallPacket.setValue(context.getArgument("开关", Boolean.class));
|
||||
if(FeaturesSettings.INSTANCE.noFallPacket.getValue()){
|
||||
context.getSource().getPlayer().sendMessage(Text.literal("已启用摔落伤害!"),false);
|
||||
context.getSource().getPlayer().sendMessage(Text.literal("已启用无摔落伤害!"),false);
|
||||
}else{
|
||||
context.getSource().getPlayer().sendMessage(Text.literal("已禁用摔落伤害!"),false);
|
||||
context.getSource().getPlayer().sendMessage(Text.literal("已禁用无摔落伤害!"),false);
|
||||
}
|
||||
return Command.SINGLE_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
package com.expvintl.mctools.events.hud;
|
||||
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.network.PlayerListEntry;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
public class RenderLatencyIconEvent {
|
||||
public static RenderLatencyIconEvent INSTANCE=new RenderLatencyIconEvent();
|
||||
public DrawContext draw;
|
||||
public PlayerListEntry entry;
|
||||
public CallbackInfo callback;
|
||||
public int x,y,width;
|
||||
public static RenderLatencyIconEvent get(DrawContext draw,int width,int x,int y,PlayerListEntry entry,CallbackInfo callback){
|
||||
INSTANCE.draw=draw;
|
||||
INSTANCE.callback=callback;
|
||||
INSTANCE.entry=entry;
|
||||
INSTANCE.y=y;
|
||||
INSTANCE.x=x;
|
||||
INSTANCE.width=width;
|
||||
return INSTANCE;
|
||||
}
|
||||
}
|
||||
@@ -7,12 +7,12 @@ import net.minecraft.client.sound.SoundSystem;
|
||||
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;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(SoundSystem.class)
|
||||
public class SoundSystemMixin {
|
||||
@Inject(method = "play(Lnet/minecraft/client/sound/SoundInstance;)V",at=@At("HEAD"))
|
||||
private void onPlaySound(SoundInstance instance, CallbackInfo ci){
|
||||
@Inject(method = "play(Lnet/minecraft/client/sound/SoundInstance;)Lnet/minecraft/client/sound/SoundSystem$PlayResult;",at=@At("HEAD"))
|
||||
private void onPlaySound(SoundInstance instance, CallbackInfoReturnable<SoundSystem.PlayResult> cir){
|
||||
MCEventBus.INSTANCE.post(PlaySoundEvent.get(instance));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,23 +1,34 @@
|
||||
package com.expvintl.mctools.mixin.hud;
|
||||
|
||||
import com.expvintl.mctools.utils.Utils;
|
||||
import com.llamalad7.mixinextras.injector.ModifyReceiver;
|
||||
import com.llamalad7.mixinextras.sugar.Local;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import net.minecraft.client.font.TextRenderer;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.hud.ChatHud;
|
||||
import net.minecraft.client.gui.hud.ChatHudLine;
|
||||
import net.minecraft.text.OrderedText;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyVariable;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(ChatHud.class)
|
||||
public class ChatHudMixin {
|
||||
@ModifyReceiver(method = "render",at=@At(value = "INVOKE",target = "Lnet/minecraft/client/gui/DrawContext;drawTextWithShadow(Lnet/minecraft/client/font/TextRenderer;Lnet/minecraft/text/OrderedText;III)I"))
|
||||
private DrawContext onRenderDrawTextWithShadow(DrawContext context, TextRenderer renderer, OrderedText text, int x, int y, int color, @Local ChatHudLine.Visible line){
|
||||
Utils.DrawHeadIcon(context,line,y);
|
||||
return context;
|
||||
public abstract class ChatHudMixin {
|
||||
/* 1.21.6 起 mojang将这玩意塞到了一个函数里
|
||||
int p = this.forEachVisibleLine(i, currentTick, focused, m, (x1, y1, y2, line, messageIndex, backgroundOpacity) -> { <- method_71991
|
||||
int j = y2 + o;
|
||||
context.drawTextWithShadow(this.client.textRenderer, line.content(), x1, j, ColorHelper.withAlpha(backgroundOpacity * g, -1));
|
||||
});
|
||||
*/
|
||||
@Inject(method = "method_71991",at= @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawTextWithShadow(Lnet/minecraft/client/font/TextRenderer;Lnet/minecraft/text/OrderedText;III)V"))
|
||||
private void onRenderDrawTextWithShadow(int i, DrawContext draw, float f, int x1, int y1, int y2, ChatHudLine.Visible line, int messageIndex, float backgroundOpacity, CallbackInfo ci){
|
||||
double d = MinecraftClient.getInstance().options.getChatLineSpacing().getValue();
|
||||
int o = (int)Math.round(-8.0 * (d + 1.0) + 4.0 * d);
|
||||
int j = y2 + o; //计算消息实际高度
|
||||
Utils.DrawHeadIcon(draw,line, j);
|
||||
draw.getMatrices().pushMatrix();
|
||||
draw.getMatrices().translate(10, 0);
|
||||
}
|
||||
@Inject(method = "method_71991",at=@At(value = "TAIL"))
|
||||
private void method71991Tail(int i, DrawContext drawContext, float f, int x1, int y1, int y2, ChatHudLine.Visible line, int messageIndex, float backgroundOpacity, CallbackInfo ci){
|
||||
drawContext.getMatrices().popMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
package com.expvintl.mctools.mixin.hud;
|
||||
|
||||
import com.expvintl.mctools.events.MCEventBus;
|
||||
import com.expvintl.mctools.events.hud.RenderLatencyIconEvent;
|
||||
import com.expvintl.mctools.utils.Utils;
|
||||
import com.llamalad7.mixinextras.injector.ModifyReceiver;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.font.TextRenderer;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.hud.PlayerListHud;
|
||||
import net.minecraft.client.network.PlayerListEntry;
|
||||
import net.minecraft.scoreboard.Scoreboard;
|
||||
import net.minecraft.scoreboard.ScoreboardObjective;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.math.ColorHelper;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyArg;
|
||||
@@ -18,24 +21,38 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(PlayerListHud.class)
|
||||
public class PlayerListHudMixin {
|
||||
@Unique
|
||||
private int calcLatencyColor(int latency){
|
||||
if(latency>=0&&latency<=60){ //0-60
|
||||
return ColorHelper.withAlpha(255,0x00FF00); //绿色
|
||||
}else if(latency>60&&latency<=100){ //60-100
|
||||
return ColorHelper.withAlpha(255,0xFFFF00); //黄色
|
||||
}else if(latency>100&&latency<=200){//100-200
|
||||
return ColorHelper.withAlpha(255,0xFFA500); //橙色
|
||||
}else if(latency>200){ //>200
|
||||
return ColorHelper.withAlpha(255,0xFF0000); //红色
|
||||
}
|
||||
return ColorHelper.withAlpha(255,0xFFFFFF); //默认白色
|
||||
}
|
||||
@ModifyArg(method = "render",at=@At(value = "INVOKE",target = "Ljava/lang/Math;min(II)I"),index = 0)
|
||||
private int fixWidth(int width){
|
||||
return width+25;
|
||||
}
|
||||
@Inject(method = "getPlayerName",at=@At("HEAD"),cancellable = true)
|
||||
private void getPlayerName(PlayerListEntry entry, CallbackInfoReturnable<Text> info){
|
||||
if(Utils.isReady()){
|
||||
Text name=entry.getDisplayName();
|
||||
if(MinecraftClient.getInstance().player==null||name==null) return;
|
||||
if(entry.getProfile().getId().toString().equals(MinecraftClient.getInstance().player.getGameProfile().getId().toString())){
|
||||
info.setReturnValue(Text.literal(name.getString()).setStyle(name.getStyle().withColor(0xff0000)));
|
||||
}
|
||||
private void getPlayerName(PlayerListEntry entry, CallbackInfoReturnable<Text> info) {
|
||||
Text name = entry.getDisplayName();
|
||||
if (MinecraftClient.getInstance().player == null || name == null) return;
|
||||
if (entry.getProfile().id().toString().equals(MinecraftClient.getInstance().player.getGameProfile().id().toString())) {
|
||||
info.setReturnValue(Text.literal(name.getString()).setStyle(name.getStyle().withColor(0xff0000)));
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "renderLatencyIcon",at=@At("HEAD"),cancellable = true)
|
||||
private void onRenderLatencyIcon(DrawContext draw, int width, int x, int y, PlayerListEntry entry, CallbackInfo info){
|
||||
MCEventBus.INSTANCE.post(RenderLatencyIconEvent.get(draw,width,x,y,entry,info));
|
||||
TextRenderer renderer=MinecraftClient.getInstance().textRenderer;
|
||||
int latency=Math.clamp(entry.getLatency(),0,999);
|
||||
String text=latency+" ms";
|
||||
draw.drawTextWithShadow(renderer,text,x+width-renderer.getWidth(text),y,calcLatencyColor(latency));
|
||||
info.cancel();
|
||||
}
|
||||
|
||||
//强制启用Tab列表玩家头像
|
||||
|
||||
@@ -13,7 +13,7 @@ public class PlayerEntityMixin {
|
||||
@Inject(method = "clipAtLedge",at = @At("HEAD"), cancellable = true)
|
||||
private void onLedge(CallbackInfoReturnable<Boolean> cir){
|
||||
if(MinecraftClient.getInstance().world!=null&&MinecraftClient.getInstance().player!=null) {
|
||||
if (!MinecraftClient.getInstance().world.isClient) return;
|
||||
if (!MinecraftClient.getInstance().world.isClient()) return;
|
||||
//挂住边缘
|
||||
if (FeaturesSettings.INSTANCE.safeWalk.getValue() && !MinecraftClient.getInstance().player.isSneaking()) cir.setReturnValue(true);
|
||||
}
|
||||
|
||||
@@ -2,16 +2,16 @@ package com.expvintl.mctools.modules;
|
||||
|
||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
||||
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.option.KeyBinding;
|
||||
import net.minecraft.client.util.InputUtil;
|
||||
import net.minecraft.util.Identifier;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
public class CameraZoom {
|
||||
public static CameraZoom INSTANCE=new CameraZoom();
|
||||
public boolean isZoom=false;
|
||||
public void init(){
|
||||
KeyBinding zoom= KeyBindingHelper.registerKeyBinding(new KeyBinding("镜头放大", InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_C,"MyTools"));
|
||||
KeyBinding zoom= KeyBindingHelper.registerKeyBinding(new KeyBinding("镜头放大", InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_C, KeyBinding.Category.create(Identifier.of("MyTools"))));
|
||||
ClientTickEvents.END_CLIENT_TICK.register(client -> {
|
||||
isZoom=zoom.isPressed();
|
||||
});
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
package com.expvintl.mctools.modules;
|
||||
|
||||
import com.expvintl.mctools.events.MCEventBus;
|
||||
import com.expvintl.mctools.events.hud.RenderLatencyIconEvent;
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.font.TextRenderer;
|
||||
|
||||
public class PlayerListTextLatency {
|
||||
public static PlayerListTextLatency INSTANCE=new PlayerListTextLatency();
|
||||
public void init(){
|
||||
MCEventBus.INSTANCE.register(INSTANCE);
|
||||
}
|
||||
private int calcLatencyColor(int latency){
|
||||
if(latency>=0&&latency<=60){ //0-60
|
||||
return 0x00FF00; //绿色
|
||||
}else if(latency>60&&latency<=100){ //60-100
|
||||
return 0xFFFF00; //黄色
|
||||
}else if(latency>100&&latency<=200){//100-200
|
||||
return 0xFFA500; //橙色
|
||||
}else if(latency>200){ //>200
|
||||
return 0xFF0000; //红色
|
||||
}
|
||||
return 0xFFFFFF; //默认白色
|
||||
}
|
||||
@Subscribe
|
||||
public void onRenderLatencyIcon(RenderLatencyIconEvent event){
|
||||
TextRenderer renderer=MinecraftClient.getInstance().textRenderer;
|
||||
int latency=Math.clamp(event.entry.getLatency(),0,999);
|
||||
String text=latency+" ms";
|
||||
event.draw.drawTextWithShadow(renderer,text, event.x+event.width-renderer.getWidth(text),event.y,calcLatencyColor(latency));
|
||||
event.callback.cancel();
|
||||
}
|
||||
}
|
||||
@@ -52,10 +52,10 @@ public class MCInfo {
|
||||
DrawUtils.leftTextY =1;
|
||||
int selfPing=0;
|
||||
ClientPlayerEntity p=mc.player;
|
||||
if(mc.getNetworkHandler()!=null&&mc.getNetworkHandler().getPlayerListEntry(mc.player.getGameProfile().getId())!=null) {
|
||||
selfPing=mc.getNetworkHandler().getPlayerListEntry(mc.player.getGameProfile().getId()).getLatency();
|
||||
if(mc.getNetworkHandler()!=null&&mc.getNetworkHandler().getPlayerListEntry(mc.player.getGameProfile().id())!=null) {
|
||||
selfPing=mc.getNetworkHandler().getPlayerListEntry(mc.player.getGameProfile().id()).getLatency();
|
||||
}
|
||||
Vec3d playerPos=p.getPos();
|
||||
Vec3d playerPos=p.getEntityPos();
|
||||
DrawUtils.AddLeftText(drawContext,String.format("%d FPS",mc.getCurrentFps()));
|
||||
DrawUtils.AddLeftText(drawContext,String.format("Ping: %d 毫秒",selfPing));
|
||||
DrawUtils.AddLeftText(drawContext,String.format("亮度:%d",mc.world.getLightLevel(p.getBlockPos())));
|
||||
|
||||
@@ -2,9 +2,7 @@ package com.expvintl.mctools.utils;
|
||||
|
||||
import com.expvintl.mctools.mixin.interfaces.MinecraftClientAccessor;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
@@ -12,28 +10,20 @@ import net.minecraft.client.gui.PlayerSkinDrawer;
|
||||
import net.minecraft.client.gui.hud.ChatHudLine;
|
||||
import net.minecraft.client.network.ClientPlayerEntity;
|
||||
import net.minecraft.client.network.PlayerListEntry;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.enchantment.Enchantments;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.registry.RegistryKey;
|
||||
import net.minecraft.registry.entry.RegistryEntry;
|
||||
import net.minecraft.text.MutableText;
|
||||
import net.minecraft.text.OrderedText;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.Timer;
|
||||
import java.util.function.Function;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@@ -243,10 +233,9 @@ public class Utils {
|
||||
String txt=buf.toString();
|
||||
GameProfile sender=getChatSender(txt);
|
||||
if(sender==null) return;
|
||||
PlayerListEntry entry = mc.getNetworkHandler().getPlayerListEntry(sender.getId());
|
||||
PlayerListEntry entry = mc.getNetworkHandler().getPlayerListEntry(sender.id());
|
||||
if (entry == null) return;
|
||||
PlayerSkinDrawer.draw(draw,entry.getSkinTextures(),0,y,8);
|
||||
draw.getMatrices().translate(10, 0, 0);
|
||||
}
|
||||
public static GameProfile getChatSender(String text){
|
||||
Matcher usernameMatcher=usernameRegex.matcher(text);
|
||||
|
||||
Reference in New Issue
Block a user