修复聊天头像颜色问题,移除查找方块(太低效了),对时运附魔添加判断
All checks were successful
Build / build (push) Successful in 2m44s
All checks were successful
Build / build (push) Successful in 2m44s
This commit is contained in:
@ -47,7 +47,6 @@ public class MCToolsClient implements ClientModInitializer {
|
||||
CAutoToolCommand.register(dispatcher);
|
||||
CQServerPluginsCommand.register(dispatcher);
|
||||
CNoFallPacketCommand.register(dispatcher);
|
||||
CFindBlockCommand.register(dispatcher);
|
||||
CFastDropCommand.register(dispatcher,registryAccess);
|
||||
}
|
||||
}
|
||||
|
@ -14,9 +14,7 @@ import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.arguments.BoolArgumentType;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
|
||||
import net.minecraft.block.BambooBlock;
|
||||
import net.minecraft.block.BambooShootBlock;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.component.DataComponentTypes;
|
||||
import net.minecraft.component.type.AttributeModifiersComponent;
|
||||
@ -109,7 +107,7 @@ public class CAutoToolCommand {
|
||||
for(int i=0;i<9;i++){
|
||||
ItemStack item = mc.player.getInventory().getStack(i);
|
||||
float score= getToolsScore(item,state);
|
||||
if(score<0) continue;
|
||||
if(score<=0) continue;
|
||||
//选出最好分数的工具
|
||||
if(score>bestScore){
|
||||
bestScore=score;
|
||||
@ -137,11 +135,61 @@ public class CAutoToolCommand {
|
||||
|| 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;
|
||||
}
|
||||
public boolean isOreBlock(Item item) {
|
||||
return item == Items.COAL_ORE || // 煤矿石
|
||||
item == Items.DEEPSLATE_COAL_ORE || // 深层煤矿石
|
||||
item == Items.IRON_ORE || // 铁矿石
|
||||
item == Items.DEEPSLATE_IRON_ORE || // 深层铁矿石
|
||||
item == Items.COPPER_ORE || // 铜矿石
|
||||
item == Items.DEEPSLATE_COPPER_ORE || // 深层铜矿石
|
||||
item == Items.GOLD_ORE || // 金矿石
|
||||
item == Items.DEEPSLATE_GOLD_ORE || // 深层金矿石
|
||||
item == Items.REDSTONE_ORE || // 红石矿石
|
||||
item == Items.DEEPSLATE_REDSTONE_ORE ||// 深层红石矿石
|
||||
item == Items.EMERALD_ORE || // 绿宝石矿石
|
||||
item == Items.DEEPSLATE_EMERALD_ORE ||// 深层绿宝石矿石
|
||||
item == Items.LAPIS_ORE || // 青金石矿石
|
||||
item == Items.DEEPSLATE_LAPIS_ORE || // 深层青金石矿石
|
||||
item == Items.DIAMOND_ORE || // 钻石矿石
|
||||
item == Items.DEEPSLATE_DIAMOND_ORE ||// 深层钻石矿石
|
||||
item == Items.NETHER_GOLD_ORE || // 下界金矿石
|
||||
item == Items.NETHER_QUARTZ_ORE; // 下界石英矿石
|
||||
}
|
||||
private boolean isBlockFortune(Block block) {
|
||||
if (block == Blocks.COAL_ORE || block == Blocks.DEEPSLATE_COAL_ORE ||
|
||||
block == Blocks.COPPER_ORE || block == Blocks.DEEPSLATE_COPPER_ORE ||
|
||||
block == Blocks.IRON_ORE || block == Blocks.DEEPSLATE_IRON_ORE ||
|
||||
block == Blocks.GOLD_ORE || block == Blocks.DEEPSLATE_GOLD_ORE ||
|
||||
block == Blocks.REDSTONE_ORE || block == Blocks.DEEPSLATE_REDSTONE_ORE ||
|
||||
block == Blocks.LAPIS_ORE || block == Blocks.DEEPSLATE_LAPIS_ORE ||
|
||||
block == Blocks.DIAMOND_ORE || block == Blocks.DEEPSLATE_DIAMOND_ORE ||
|
||||
block == Blocks.EMERALD_ORE || block == Blocks.DEEPSLATE_EMERALD_ORE ||
|
||||
block == Blocks.NETHER_QUARTZ_ORE || block == Blocks.NETHER_GOLD_ORE ||
|
||||
block == Blocks.AMETHYST_CLUSTER) { // 紫水晶簇也受时运影响
|
||||
return true;
|
||||
}
|
||||
|
||||
if (block == Blocks.WHEAT || // 小麦
|
||||
block == Blocks.CARROTS || // 胡萝卜
|
||||
block == Blocks.POTATOES || // 马铃薯
|
||||
block == Blocks.BEETROOTS || // 甜菜根
|
||||
block == Blocks.NETHER_WART) { // 下界疣
|
||||
return true;
|
||||
}
|
||||
|
||||
if (block == Blocks.GLOWSTONE || // 荧石
|
||||
block == Blocks.MELON || // 西瓜
|
||||
block == Blocks.GRAVEL || // 沙砾 (影响燧石掉落概率)
|
||||
block == Blocks.SEA_LANTERN){ // 海晶灯
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public float getToolsScore(ItemStack item, BlockState state){
|
||||
float score=0;
|
||||
if(isToolItem(item.getItem())||item.getItem() instanceof ShearsItem){
|
||||
//根据挖掘速度提升评分
|
||||
score+=item.getMiningSpeedMultiplier(state)*30;
|
||||
score+=item.getMiningSpeedMultiplier(state)*2;
|
||||
//附魔加分
|
||||
//耐久
|
||||
score+= Utils.GetEnchantLevel(Enchantments.UNBREAKING, item);
|
||||
@ -149,10 +197,15 @@ public class CAutoToolCommand {
|
||||
score+=Utils.GetEnchantLevel(Enchantments.EFFICIENCY,item);
|
||||
//经验修补
|
||||
score+=Utils.GetEnchantLevel(Enchantments.MENDING,item);
|
||||
|
||||
if(isBlockFortune(state.getBlock())){
|
||||
score+=Utils.GetEnchantLevel(Enchantments.FORTUNE,item);//时运
|
||||
}
|
||||
|
||||
if (isSwordItem(item.getItem()) && (state.getBlock() instanceof BambooBlock|| state.getBlock() instanceof BambooShootBlock)) {
|
||||
if((item.getItem().getComponents().get(DataComponentTypes.TOOL)!=null)){
|
||||
//根据挖掘等级加分
|
||||
score += 90 + (item.getItem().getComponents().get(DataComponentTypes.TOOL).getSpeed(state) * 10);
|
||||
score += 90 + (item.getItem().getComponents().get(DataComponentTypes.TOOL).getSpeed(state));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -171,7 +224,7 @@ public class CAutoToolCommand {
|
||||
damageHolder [0]= (float)modify.value();
|
||||
}
|
||||
};
|
||||
comp.applyModifiers(EquipmentSlot.MAINHAND,baseDamage);
|
||||
comp.applyModifiers(EquipmentSlot.MAINHAND,baseDamage);//计算主手时的伤害
|
||||
damageScore+=damageHolder[0];
|
||||
//节肢杀手
|
||||
EntityType<?> id=ent.getType();
|
||||
|
@ -1,34 +0,0 @@
|
||||
package com.expvintl.mctools.commands;
|
||||
|
||||
import com.expvintl.mctools.events.MCEventBus;
|
||||
import com.expvintl.mctools.events.client.RenderWorldEvent;
|
||||
import com.expvintl.mctools.utils.Utils;
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
import com.mojang.brigadier.Command;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
|
||||
import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.argument;
|
||||
import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.literal;
|
||||
|
||||
public class CFindBlockCommand {
|
||||
private static final MinecraftClient mc=MinecraftClient.getInstance();
|
||||
private static final CFindBlockCommand INSTANCE=new CFindBlockCommand();
|
||||
|
||||
public static void register(CommandDispatcher<FabricClientCommandSource> dispatcher){
|
||||
MCEventBus.INSTANCE.register(INSTANCE);
|
||||
dispatcher.register(literal("cfindblock").then(argument("方块名字", StringArgumentType.string()).executes(CFindBlockCommand::execute)));
|
||||
}
|
||||
private static int execute(CommandContext<FabricClientCommandSource> context) {
|
||||
String blockName=context.getArgument("方块名字", String.class);
|
||||
Utils.findBlock(mc.player,blockName,10);
|
||||
return Command.SINGLE_SUCCESS;
|
||||
}
|
||||
@Subscribe
|
||||
private void onRenderWorld(RenderWorldEvent event){
|
||||
|
||||
}
|
||||
}
|
@ -14,9 +14,9 @@ public class PlayerListTextLatency {
|
||||
private int calcLatencyColor(int latency){
|
||||
if(latency>=0&&latency<=60){ //0-60
|
||||
return 0x00FF00; //绿色
|
||||
}else if(latency>60&&latency<=120){ //60-120
|
||||
}else if(latency>60&&latency<=100){ //60-100
|
||||
return 0xFFFF00; //黄色
|
||||
}else if(latency>120&&latency<=200){//120-200
|
||||
}else if(latency>100&&latency<=200){//100-200
|
||||
return 0xFFA500; //橙色
|
||||
}else if(latency>200){ //>200
|
||||
return 0xFF0000; //红色
|
||||
|
@ -69,7 +69,7 @@ public class MCInfo {
|
||||
DrawUtils.AddLeftText(drawContext,String.format("X:%.2f Y:%.2f Z:%.2f",playerPos.x,playerPos.y,playerPos.z));
|
||||
}
|
||||
DrawUtils.AddLeftText(drawContext,String.format("世界时间: %d天 (%s)",mc.world.getTimeOfDay()/24000,gameDayToRealTimeFormat(mc.world.getTimeOfDay()/24000)));
|
||||
DrawUtils.AddLeftText(drawContext,String.format("当前区块: [%d,%d]",mc.player.getChunkPos().x,mc.player.getChunkPos().z));
|
||||
DrawUtils.AddLeftText(drawContext,String.format("当前区块: %d,%d 方块:[%d,%d]",mc.player.getChunkPos().x,mc.player.getChunkPos().z,mc.player.getBlockX()&0xf,mc.player.getBlockZ()&0xf));
|
||||
DrawUtils.AddLeftText(drawContext,String.format("本地难度:%.2f",mc.world.getLocalDifficulty(mc.player.getBlockPos()).getLocalDifficulty()));
|
||||
ItemStack currentItem=p.getMainHandStack();
|
||||
if(Objects.nonNull(currentItem)&¤tItem.isDamageable()){
|
||||
|
@ -8,6 +8,7 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
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;
|
||||
@ -244,9 +245,7 @@ public class Utils {
|
||||
if(sender==null) return;
|
||||
PlayerListEntry entry = mc.getNetworkHandler().getPlayerListEntry(sender.getId());
|
||||
if (entry == null) return;
|
||||
|
||||
Identifier skin = entry.getSkinTextures().texture();
|
||||
draw.drawTexture(RenderLayer::getGuiTextured, skin,0, y, 8, 8, 8, 8, 8, 8, 64, 64);
|
||||
PlayerSkinDrawer.draw(draw,entry.getSkinTextures(),0,y,8);
|
||||
draw.getMatrices().translate(10, 0, 0);
|
||||
}
|
||||
public static GameProfile getChatSender(String text){
|
||||
|
Reference in New Issue
Block a user