From 644e0df687233df0d19a15c30910973bf3f1532d Mon Sep 17 00:00:00 2001 From: XiaoMoMi Date: Tue, 1 Jul 2025 02:34:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=B5=84=E6=BA=90=E5=8C=85?= =?UTF-8?q?=E9=AA=8C=E8=AF=81=E6=95=88=E7=8E=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BukkitCompatibilityManager.java | 1 - .../furniture/BukkitFurnitureElement.java | 2 - .../item/factory/BukkitItemFactory.java | 2 +- .../factory/ComponentItemFactory1_20_5.java | 5 +- .../block/custom/pickaxe_block_back.png | Bin 0 -> 386 bytes .../block/custom/pickaxe_block_down.png | Bin 0 -> 327 bytes .../block/custom/pickaxe_block_front.png | Bin 0 -> 547 bytes .../block/custom/pickaxe_block_side.png | Bin 0 -> 421 bytes .../block/custom/pickaxe_block_top.png | Bin 0 -> 347 bytes .../block/custom/place_block_back.png | Bin 0 -> 455 bytes .../block/custom/place_block_down.png | Bin 0 -> 337 bytes .../block/custom/place_block_front.png | Bin 0 -> 371 bytes .../block/custom/place_block_side.png | Bin 0 -> 397 bytes .../textures/block/custom/place_block_top.png | Bin 0 -> 275 bytes .../src/main/resources/translations/en.yml | 2 +- .../src/main/resources/translations/zh_cn.yml | 2 +- core/build.gradle.kts | 1 - .../entity/furniture/FurnitureElement.java | 2 - .../core/item/modifier/TrimModifier.java | 5 +- .../function/ApplyBonusCountFunction.java | 2 +- .../core/pack/AbstractPackManager.java | 43 ++++++++++-------- .../condition/EnchantmentCondition.java | 2 +- .../condition/TableBonusCondition.java | 2 +- gradle.properties | 4 +- 24 files changed, 41 insertions(+), 34 deletions(-) create mode 100644 common-files/src/main/resources/resources/default/resourcepack/assets/minecraft/textures/block/custom/pickaxe_block_back.png create mode 100644 common-files/src/main/resources/resources/default/resourcepack/assets/minecraft/textures/block/custom/pickaxe_block_down.png create mode 100644 common-files/src/main/resources/resources/default/resourcepack/assets/minecraft/textures/block/custom/pickaxe_block_front.png create mode 100644 common-files/src/main/resources/resources/default/resourcepack/assets/minecraft/textures/block/custom/pickaxe_block_side.png create mode 100644 common-files/src/main/resources/resources/default/resourcepack/assets/minecraft/textures/block/custom/pickaxe_block_top.png create mode 100644 common-files/src/main/resources/resources/default/resourcepack/assets/minecraft/textures/block/custom/place_block_back.png create mode 100644 common-files/src/main/resources/resources/default/resourcepack/assets/minecraft/textures/block/custom/place_block_down.png create mode 100644 common-files/src/main/resources/resources/default/resourcepack/assets/minecraft/textures/block/custom/place_block_front.png create mode 100644 common-files/src/main/resources/resources/default/resourcepack/assets/minecraft/textures/block/custom/place_block_side.png create mode 100644 common-files/src/main/resources/resources/default/resourcepack/assets/minecraft/textures/block/custom/place_block_top.png diff --git a/bukkit/compatibility/src/main/java/net/momirealms/craftengine/bukkit/compatibility/BukkitCompatibilityManager.java b/bukkit/compatibility/src/main/java/net/momirealms/craftengine/bukkit/compatibility/BukkitCompatibilityManager.java index 0d6f63e8e..a3c2eb4dd 100644 --- a/bukkit/compatibility/src/main/java/net/momirealms/craftengine/bukkit/compatibility/BukkitCompatibilityManager.java +++ b/bukkit/compatibility/src/main/java/net/momirealms/craftengine/bukkit/compatibility/BukkitCompatibilityManager.java @@ -210,7 +210,6 @@ public class BukkitCompatibilityManager implements CompatibilityManager { Plugin fastAsyncWorldEdit = Bukkit.getPluginManager().getPlugin("FastAsyncWorldEdit"); String version = VersionHelper.isPaper() ? fastAsyncWorldEdit.getPluginMeta().getVersion() : fastAsyncWorldEdit.getDescription().getVersion(); if (!this.fastAsyncWorldEditVersionCheck(version)) { - if (VersionHelper.isOrAbove1_20_3()) { this.plugin.logger().severe(""); if (Locale.getDefault() == Locale.SIMPLIFIED_CHINESE) { diff --git a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/entity/furniture/BukkitFurnitureElement.java b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/entity/furniture/BukkitFurnitureElement.java index 4970c0467..b0ffeb3d9 100644 --- a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/entity/furniture/BukkitFurnitureElement.java +++ b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/entity/furniture/BukkitFurnitureElement.java @@ -14,8 +14,6 @@ import net.momirealms.craftengine.core.entity.furniture.FurnitureElement; import net.momirealms.craftengine.core.item.Item; import net.momirealms.craftengine.core.item.data.FireworkExplosion; import net.momirealms.craftengine.core.plugin.CraftEngine; -import net.momirealms.craftengine.core.util.AdventureHelper; -import net.momirealms.craftengine.core.util.GsonHelper; import net.momirealms.craftengine.core.util.Key; import net.momirealms.craftengine.core.world.WorldPosition; import org.bukkit.Material; diff --git a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/item/factory/BukkitItemFactory.java b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/item/factory/BukkitItemFactory.java index f5ad7bf9c..6eddbfb58 100644 --- a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/item/factory/BukkitItemFactory.java +++ b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/item/factory/BukkitItemFactory.java @@ -40,7 +40,7 @@ public abstract class BukkitItemFactory> extend case "1.21.4" -> { return new ComponentItemFactory1_21_4(plugin); } - case "1.21.5", "1.21.6", "1.22", "1.22.1" -> { + case "1.21.5", "1.21.6", "1.21.7", "1.22", "1.22.1" -> { return new ComponentItemFactory1_21_5(plugin); } default -> throw new IllegalStateException("Unsupported server version: " + plugin.serverVersion()); diff --git a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/item/factory/ComponentItemFactory1_20_5.java b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/item/factory/ComponentItemFactory1_20_5.java index ba7ca035c..41461ead5 100644 --- a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/item/factory/ComponentItemFactory1_20_5.java +++ b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/item/factory/ComponentItemFactory1_20_5.java @@ -20,7 +20,10 @@ import net.momirealms.sparrow.nbt.CompoundTag; import net.momirealms.sparrow.nbt.Tag; import org.bukkit.inventory.ItemStack; -import java.util.*; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; public class ComponentItemFactory1_20_5 extends BukkitItemFactory { diff --git a/common-files/src/main/resources/resources/default/resourcepack/assets/minecraft/textures/block/custom/pickaxe_block_back.png b/common-files/src/main/resources/resources/default/resourcepack/assets/minecraft/textures/block/custom/pickaxe_block_back.png new file mode 100644 index 0000000000000000000000000000000000000000..bee2f3c2b30bd5df30fb53376347a586689eba52 GIT binary patch literal 386 zcmV-|0e$|7P)Px$JV``BR5*==l0j?2Koo>0WsSSRSl7K3|3LzZ(DqnLA^4MvH^ocat7$2;(1Y|A zqMMjajSKq94Y|5-*es0 zg3gZcCPY&x1n@j3>el)S2{1G(`!j%E=6b5bKs_b_S_ghAs} zA%vZ2yIibXx5Mo5wBW)s#t0$k%Y|pRr2k4m7%Uen0CK3f@Z?ZYtL0*4@2{$ZGoDPj z@RVvtBT3TI6pVh^eqRtO4X)}Y=iSm2XIQF3K|VRT*6$ymjHX;`Lgi*OqA2lWDe9jX ga~>X_THDuk1n`NTKPx$0ZBwbR5*=|QZa7BFbrf22_l0Su-YjenkOX4|38xs&eXbqj7SET4(Ae%)dIbV zw(pKdle_cfN<>|Z-g~N`s#brEBN4eS#``ejoNIQCW8XXI-cBd@l`?Ng%mK~cZ#N=x z_93N-Ih6dU1u0E!dqAp&We;!WKtwrbi)S@+uwj-CrOYKi)>P|o9|jSDFU#J+c#Zh- zN<_%E`5DZiSwD*iit+QqsP+Z{T1Sw68NwH%Qu_>)CWwuLmU5s#Q+k>jsgL?0c%^Y^;%k`g^hn}vB@vqwka1NnqVf}0r!&5Hm4002ovPDHLkV1n)1jB)?~ literal 0 HcmV?d00001 diff --git a/common-files/src/main/resources/resources/default/resourcepack/assets/minecraft/textures/block/custom/pickaxe_block_front.png b/common-files/src/main/resources/resources/default/resourcepack/assets/minecraft/textures/block/custom/pickaxe_block_front.png new file mode 100644 index 0000000000000000000000000000000000000000..56b8678bffd6f6376873817120e742d56fed7386 GIT binary patch literal 547 zcmV+;0^I$HP)Px$-AP12R5*>5QbB7PQ4s#LyQUkn>Sk+bJk*}{wM`-Gf?CpwoB9L90l_X1@LA&3qf#wH*K{!x;O1$}j)` zh{x9f+}+J7rPkQ@0VpZMC=~NaT}KFw#s>iP`rB}E!ui$Zb#(0ev*~og`Puo!U@$m4 zznE|?8I)2a(a5gt?Crg{>HWFw_obMoX#j)}GEHx7x#iN)QB$F6&arR%{q0N!K%tnI zUtV2a0~mT<&ap`%YHXSSetiE4KvmU3G0&LAn3dFZ#;kYsH>#>ig0X2TrfJ9tImc$q zdf)gc4|Q-@lPv(IX(&OkJU#s^-%X%7t!8`V4XJh9J_hh8n~la|YWQ{|Zy1lSGiH$w z4>Q~0ZY-uM04kOJjYQ()(+L1#w3=<{8tq!GRg=2@)rIi#%Y?SX&Oyf zi21!IPoJgJ53-N5LM+_ZF2&BT&T6%))~Z4*UX@->r#$D__t)0E;Yb0nkw_$U-7S{@ lP$c|Qq<<_@-ml<)@E1fz>kvnQF|7aq002ovPDHLkV1kMo2UP$7 literal 0 HcmV?d00001 diff --git a/common-files/src/main/resources/resources/default/resourcepack/assets/minecraft/textures/block/custom/pickaxe_block_side.png b/common-files/src/main/resources/resources/default/resourcepack/assets/minecraft/textures/block/custom/pickaxe_block_side.png new file mode 100644 index 0000000000000000000000000000000000000000..4b2b7cffe7a20129ba84f07d204b17846a3dc777 GIT binary patch literal 421 zcmV;W0b2fvP)Px$Ur9tkR5*=|Qo&BbKoEV9wzeRpYmG+m-~mwyiAFDmi!uI&;o|T3OMZZQ@&bWq z!hx1pOt#%Ev}`XP78im@e215rd9$;VnaQ1BTmo<(N1VSrziP_&JP$yp+gn?^adsk&oNOscl7mVmO=lbWG0m-zQY}dm%d!BB ze1Ai>f<|`SG?@aZ9oL9creP!n;*(n7Sk21<8_;Yv6bq4QhM_A>maLx68GvaOmf0}$#aQK6rd1Fk zlPu%!9|OezwB?ozLw8*QK(aD~$YdizWO>eGsc|05$*3twSBOkW;~-cp&ay1EliyI% z{FVT;TG!jQ4PfmR0f-svbbH#e5HrRYi*0-50b|Vm3FdBY??OuDdH)CBX)31AD`m;? P00000NkvXXu0mjfHb1p4 literal 0 HcmV?d00001 diff --git a/common-files/src/main/resources/resources/default/resourcepack/assets/minecraft/textures/block/custom/pickaxe_block_top.png b/common-files/src/main/resources/resources/default/resourcepack/assets/minecraft/textures/block/custom/pickaxe_block_top.png new file mode 100644 index 0000000000000000000000000000000000000000..a6c59abed099243e1c04ef0de89d7a0dd6bd88f6 GIT binary patch literal 347 zcmV-h0i^zkP)Px$6-h)vR5*>Ll0i?yAQ*<<8C+p2ZAp#B&4Y>ctl7!zPn-Q7XX3%lXzXZdS6FxP zK*CzKoqP}Q@xlWi@C}}xX8;l*(9w820pAbYq!20Zg0C*-+IQvtx{?SeEFd4BjM;v&vNdubax zUnFtc?&T);0sAt;;iYS3Q37b&y`Ay_qZ_%&8DriZwANko0L{RcT7a6;ac3Wopy002ovPDHLkV1ggtlqUcH literal 0 HcmV?d00001 diff --git a/common-files/src/main/resources/resources/default/resourcepack/assets/minecraft/textures/block/custom/place_block_back.png b/common-files/src/main/resources/resources/default/resourcepack/assets/minecraft/textures/block/custom/place_block_back.png new file mode 100644 index 0000000000000000000000000000000000000000..f1ca41066a4ef0efe04d3e19c15277eb5db024d1 GIT binary patch literal 455 zcmV;&0XY7NP)Px$fk{L`R5*==lFv@tKoEyN(p|@)b{yjqNt9F^TIB?))N<-GAl{(&J`Z!IvxF{;W)9i1)otf3n*8ahJpyT^mYrq%-NL-gOW)a7L z>iGW0!w;V8*3(IrJ#)nT{_Tfa#PK8y^LATY=P^jKY>nn=3Z!WYDB#!cOTf09Kv^yY zDvR5CdAqeOrYee}C<^~oUMBwxU_TqEBEE9~pGUD6<}E!IM{1Su_Vj7{eGUNQ51E9#?aHic~lCfs>)cF_FAj29eVoW=NZtF<6cvI z0jkQVo7t?_@2%e8J+-RqDlyOiZf3Ksx9>*48)wN&y3Ct^IyydDHGN#3`cjA~&OQKY x5{5t+O<(NL@9hGrE!!4Nr<2Kl=-qBt$OntFn9yV0uL%GE002ovPDHLkV1k5I*tY-x literal 0 HcmV?d00001 diff --git a/common-files/src/main/resources/resources/default/resourcepack/assets/minecraft/textures/block/custom/place_block_down.png b/common-files/src/main/resources/resources/default/resourcepack/assets/minecraft/textures/block/custom/place_block_down.png new file mode 100644 index 0000000000000000000000000000000000000000..c220083d781e16f21afae23eb776be684acc3eaf GIT binary patch literal 337 zcmV-X0j~auP)Px$3rR#lR5*=|Qo&BcFbsW6vErarqA-DyR_w#rXHVRRw)V8`&}m8K3kO4#(N5xB z;yCX)&$1srHX8u@L*I8D?!$-BHXgv@KWqSf*X<8I0JGhG#u(q%YXBmW()fqUY>5cK z*KP;E#2EEq7%t2<#p_fs440}}>OTw3iU_j>5M#_Ga?ET+M3Y93l*SaVCAD<#oMZQR zBPdZnzW`8grBbmdFU~m)&ZlFh=H!gv$KG$>*~VQ#SyhcqUCs2MjH&w@0kdVcPj#&$ zSKq4fAPx$ElET{R5*==QcX+4Kop$9CQXwjX3fn;{RxVo9!321>Rk~OOwxKtS+?DLY}{Nt zJiCM{>6{)j13T~SOfD|30K}Z*5H?Z*U@_-6x7SBuIMlXPwZ{-nbulseQ*H_#*Y&KVK{ePXT)brUsW{# zmLyyV>AFtSv~-8Rh&c}eA3&0DW=s#@{OlA!mKUq#YR|n$7o-Xyjp-RB$?{?(k5ygQ zVKmtnyqVwW)>^%pZ&e{AfZs@2UNlWhHzkvW5VC1n+QFEft;>=eLEsZRf^}Ik`m*7P zhP@h+o;U4u`%jmKr68V|TB(=UH%3#f6jkLUP033Au`P;r9h=Px$M@d9MR5*=|l2J>;Fc8Q8ooQ^xIv0zBt;2~-#V18jKgRH5t6xFEN!wv8@He2O605%Zf=JtBe^O~`>lz$WwAMPL7D$nCE zEc<;@d%w^9umS*#%HlUj$X^vzgv;yCgEDlv1j-0mCq{?*qs` zvcu_=b2|znlZ=R95@=n&E*3;G-xpbyyROT*O;>wf4*;!FmH;RO!1u+@^ypY?z1h^s zTk;JHK(StBX{xo(($oS-uat7#E@P}?PPdxp^*FaXThgX5rgcsG*~tt*mgNV-p@F0< zgGoTI0zm7UQCmtWt!vJ0^Ei!v5GLt+l31r_=i65WfX(mbPx#%}GQ-R5*>5Qo#;_FbpkZ3!5i)kVG(Y!L!Ey{}Z`j024fn6Pww^Lrt@Qf!Ryf zcJKAAYjnBZ03cNgwrtcI0GJ<;6~_Vqy0%-wSgO>s@BLJDt_W7&Yrk~JbB2!kAh!?h z+RhiutbJQEQH(NXl1Q+SJ0?V8&9u)lOgZNWOvIdX0C)|95DBC5qiI$~bSg_c#E1?w z&UqYu``ZDXFFgpbX~g)SBSjlCl5*002ovPDHLkV1lEtZs`C3 literal 0 HcmV?d00001 diff --git a/common-files/src/main/resources/translations/en.yml b/common-files/src/main/resources/translations/en.yml index 9df428604..65f820e64 100644 --- a/common-files/src/main/resources/translations/en.yml +++ b/common-files/src/main/resources/translations/en.yml @@ -384,7 +384,7 @@ warning.config.resource_pack.generation.missing_font_texture: "Font 'Texture '' is not listed in the atlas. You need to add the texture path to the atlas or enable 'obfuscation' option in config.yml." warning.config.resource_pack.generation.missing_model_texture: "Model '' is missing texture ''" warning.config.resource_pack.generation.missing_item_model: "Item '' is missing model file: ''" -warning.config.resource_pack.generation.missing_block_model: "Block '' is missing model file: ''" +warning.config.resource_pack.generation.missing_block_model: "Block state '' is missing model file: ''" warning.config.resource_pack.generation.missing_parent_model: "Model '' cannot find parent model: ''" warning.config.resource_pack.generation.malformatted_json: "Json file '' is malformatted." warning.config.resource_pack.invalid_overlay_format: "Issue found in config.yml at 'resource-pack.overlay-format' - Invalid overlay format ''. Overlay format must contain the placeholder '{version}'." \ No newline at end of file diff --git a/common-files/src/main/resources/translations/zh_cn.yml b/common-files/src/main/resources/translations/zh_cn.yml index 2768ad0a4..ba3574bf3 100644 --- a/common-files/src/main/resources/translations/zh_cn.yml +++ b/common-files/src/main/resources/translations/zh_cn.yml @@ -385,7 +385,7 @@ warning.config.resource_pack.generation.missing_font_texture: "字体'模型''缺少纹理''" warning.config.resource_pack.generation.texture_not_in_atlas: "纹理''不在图集内. 你需要将纹理路径或文件夹前缀添加到图集内,或者启用 config.yml 中的 'obfuscation' 选项" warning.config.resource_pack.generation.missing_item_model: "物品''缺少模型文件: ''" -warning.config.resource_pack.generation.missing_block_model: "方块''缺少模型文件: ''" +warning.config.resource_pack.generation.missing_block_model: "方块状态''缺少模型文件: ''" warning.config.resource_pack.generation.missing_parent_model: "模型''找不到父级模型文件: ''" warning.config.resource_pack.generation.malformatted_json: "Json文件 '' 格式错误." warning.config.resource_pack.invalid_overlay_format: "在 config.yml 的 'resource-pack.overlay-format' 处发现问题 - 无效的overlay格式 ''. Overlay格式必须包含占位符 '{version}'." \ No newline at end of file diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 61abe7288..ca1fa6d89 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -25,7 +25,6 @@ dependencies { // Util compileOnly("net.momirealms:sparrow-util:${rootProject.properties["sparrow_util_version"]}") // Adventure - // TODO Create an API module compileOnly("net.kyori:adventure-api:${rootProject.properties["adventure_bundle_version"]}") compileOnly("net.kyori:adventure-text-minimessage:${rootProject.properties["adventure_bundle_version"]}") compileOnly("net.kyori:adventure-text-serializer-gson:${rootProject.properties["adventure_bundle_version"]}") { diff --git a/core/src/main/java/net/momirealms/craftengine/core/entity/furniture/FurnitureElement.java b/core/src/main/java/net/momirealms/craftengine/core/entity/furniture/FurnitureElement.java index 3e1876ff4..e610ec044 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/entity/furniture/FurnitureElement.java +++ b/core/src/main/java/net/momirealms/craftengine/core/entity/furniture/FurnitureElement.java @@ -3,9 +3,7 @@ package net.momirealms.craftengine.core.entity.furniture; import net.momirealms.craftengine.core.entity.Billboard; import net.momirealms.craftengine.core.entity.ItemDisplayContext; import net.momirealms.craftengine.core.util.Key; -import net.momirealms.craftengine.core.world.WorldPosition; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import org.joml.Quaternionf; import org.joml.Vector3f; diff --git a/core/src/main/java/net/momirealms/craftengine/core/item/modifier/TrimModifier.java b/core/src/main/java/net/momirealms/craftengine/core/item/modifier/TrimModifier.java index a86adda9b..39edfe0f5 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/item/modifier/TrimModifier.java +++ b/core/src/main/java/net/momirealms/craftengine/core/item/modifier/TrimModifier.java @@ -1,6 +1,9 @@ package net.momirealms.craftengine.core.item.modifier; -import net.momirealms.craftengine.core.item.*; +import net.momirealms.craftengine.core.item.ComponentKeys; +import net.momirealms.craftengine.core.item.Item; +import net.momirealms.craftengine.core.item.ItemBuildContext; +import net.momirealms.craftengine.core.item.NetworkItemHandler; import net.momirealms.craftengine.core.item.data.Trim; import net.momirealms.craftengine.core.util.VersionHelper; import net.momirealms.sparrow.nbt.CompoundTag; diff --git a/core/src/main/java/net/momirealms/craftengine/core/loot/function/ApplyBonusCountFunction.java b/core/src/main/java/net/momirealms/craftengine/core/loot/function/ApplyBonusCountFunction.java index 734322c73..1e6606081 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/loot/function/ApplyBonusCountFunction.java +++ b/core/src/main/java/net/momirealms/craftengine/core/loot/function/ApplyBonusCountFunction.java @@ -1,7 +1,7 @@ package net.momirealms.craftengine.core.loot.function; -import net.momirealms.craftengine.core.item.data.Enchantment; import net.momirealms.craftengine.core.item.Item; +import net.momirealms.craftengine.core.item.data.Enchantment; import net.momirealms.craftengine.core.loot.LootConditions; import net.momirealms.craftengine.core.loot.LootContext; import net.momirealms.craftengine.core.plugin.context.Condition; diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/AbstractPackManager.java b/core/src/main/java/net/momirealms/craftengine/core/pack/AbstractPackManager.java index feb7a9c9f..2dae3b934 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/AbstractPackManager.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/AbstractPackManager.java @@ -776,7 +776,7 @@ public abstract class AbstractPackManager implements PackManager { for (JsonElement texture : textures) { if (!(texture instanceof JsonPrimitive texturePath)) continue; for (String permutation : permutations) { - included.accept(Key.of(texturePath.getAsString() + separator + permutation)); + unstitch.accept(Key.of(texturePath.getAsString() + separator + permutation)); } } } @@ -787,9 +787,11 @@ public abstract class AbstractPackManager implements PackManager { @SuppressWarnings("DuplicatedCode") private void validateResourcePack(Path path) { - List rootPaths; + + long time1 = System.currentTimeMillis(); + Path[] rootPaths; try { - rootPaths = FileUtils.collectOverlays(path); + rootPaths = FileUtils.collectOverlays(path).toArray(new Path[0]); } catch (IOException e) { plugin.logger().warn("Failed to collect overlays for " + path.toAbsolutePath(), e); return; @@ -797,7 +799,9 @@ public abstract class AbstractPackManager implements PackManager { Multimap imageToFonts = ArrayListMultimap.create(); // 图片到字体的映射 Multimap modelToItems = ArrayListMultimap.create(); // 模型到物品的映射 Multimap modelToBlocks = ArrayListMultimap.create(); // 模型到方块的映射 - Multimap imageToModels = ArrayListMultimap.create(); // 图片到模型的映射 + Multimap imageToModels = ArrayListMultimap.create(); // 纹理到模型的映射 + Set collectedModels = new HashSet<>(); + Set texturesInAtlas = new HashSet<>(); Set unstitchTextures = new HashSet<>(); Map directoryMapper = new HashMap<>(); @@ -915,6 +919,7 @@ public abstract class AbstractPackManager implements PackManager { } } + // 验证font的贴图是否存在 label: for (Map.Entry> entry : imageToFonts.asMap().entrySet()) { Key key = entry.getKey(); if (VANILLA_TEXTURES.contains(key)) continue; @@ -928,9 +933,10 @@ public abstract class AbstractPackManager implements PackManager { } label: for (Map.Entry> entry : modelToItems.asMap().entrySet()) { - Key key = entry.getKey(); - String modelPath = "assets/" + key.namespace() + "/models/" + key.value() + ".json"; - if (VANILLA_MODELS.contains(key)) continue; + Key modelResourceLocation = entry.getKey(); + boolean alreadyChecked = collectedModels.add(modelResourceLocation); + if (alreadyChecked || VANILLA_MODELS.contains(modelResourceLocation)) continue; + String modelPath = "assets/" + modelResourceLocation.namespace() + "/models/" + modelResourceLocation.value() + ".json"; for (Path rootPath : rootPaths) { Path modelJsonPath = rootPath.resolve(modelPath); if (Files.exists(rootPath.resolve(modelPath))) { @@ -941,13 +947,14 @@ public abstract class AbstractPackManager implements PackManager { TranslationManager.instance().log("warning.config.resource_pack.generation.malformatted_json", modelJsonPath.toAbsolutePath().toString()); continue; } - collectModels(key, jsonObject, rootPaths, imageToModels); + collectModels(modelResourceLocation, jsonObject, rootPaths, imageToModels, collectedModels); continue label; } } TranslationManager.instance().log("warning.config.resource_pack.generation.missing_item_model", entry.getValue().stream().distinct().toList().toString(), modelPath); } + label: for (Map.Entry> entry : modelToBlocks.asMap().entrySet()) { Key key = entry.getKey(); String modelPath = "assets/" + key.namespace() + "/models/" + key.value() + ".json"; @@ -962,7 +969,7 @@ public abstract class AbstractPackManager implements PackManager { TranslationManager.instance().log("warning.config.resource_pack.generation.malformatted_json", modelJsonPath.toAbsolutePath().toString()); continue; } - collectModels(key, jsonObject, rootPaths, imageToModels); + collectModels(key, jsonObject, rootPaths, imageToModels, collectedModels); continue label; } } @@ -1003,10 +1010,10 @@ public abstract class AbstractPackManager implements PackManager { } } - private void collectModels(Key model, JsonObject modelJson, List rootPaths, Multimap imageToModels) { - if (modelJson.has("parent")) { - Key parentResourceLocation = Key.from(modelJson.get("parent").getAsString()); - if (!VANILLA_MODELS.contains(parentResourceLocation)) { + private void collectModels(Key sourceModelLocation, JsonObject sourceModelJson, Path[] rootPaths, Multimap imageToModels, Set collected) { + if (sourceModelJson.has("parent")) { + Key parentResourceLocation = Key.from(sourceModelJson.get("parent").getAsString()); + if (collected.add(parentResourceLocation) && !VANILLA_MODELS.contains(parentResourceLocation)) { String parentModelPath = "assets/" + parentResourceLocation.namespace() + "/models/" + parentResourceLocation.value() + ".json"; label: { for (Path rootPath : rootPaths) { @@ -1019,21 +1026,21 @@ public abstract class AbstractPackManager implements PackManager { TranslationManager.instance().log("warning.config.resource_pack.generation.malformatted_json", modelJsonPath.toAbsolutePath().toString()); break label; } - collectModels(parentResourceLocation, jsonObject, rootPaths, imageToModels); + collectModels(parentResourceLocation, jsonObject, rootPaths, imageToModels, collected); break label; } } - TranslationManager.instance().log("warning.config.resource_pack.generation.missing_parent_model", model.asString(), parentModelPath); + TranslationManager.instance().log("warning.config.resource_pack.generation.missing_parent_model", sourceModelLocation.asString(), parentModelPath); } } } - if (modelJson.has("textures")) { - JsonObject textures = modelJson.get("textures").getAsJsonObject(); + if (sourceModelJson.has("textures")) { + JsonObject textures = sourceModelJson.get("textures").getAsJsonObject(); for (Map.Entry entry : textures.entrySet()) { String value = entry.getValue().getAsString(); if (value.charAt(0) == '#') continue; Key textureResourceLocation = Key.from(value); - imageToModels.put(textureResourceLocation, model); + imageToModels.put(textureResourceLocation, sourceModelLocation); } } } diff --git a/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/EnchantmentCondition.java b/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/EnchantmentCondition.java index a27774af1..05bb914e9 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/EnchantmentCondition.java +++ b/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/EnchantmentCondition.java @@ -1,7 +1,7 @@ package net.momirealms.craftengine.core.plugin.context.condition; -import net.momirealms.craftengine.core.item.data.Enchantment; import net.momirealms.craftengine.core.item.Item; +import net.momirealms.craftengine.core.item.data.Enchantment; import net.momirealms.craftengine.core.plugin.context.Condition; import net.momirealms.craftengine.core.plugin.context.Context; import net.momirealms.craftengine.core.plugin.context.parameter.DirectContextParameters; diff --git a/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/TableBonusCondition.java b/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/TableBonusCondition.java index a53ebe386..20c6fd81a 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/TableBonusCondition.java +++ b/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/TableBonusCondition.java @@ -1,7 +1,7 @@ package net.momirealms.craftengine.core.plugin.context.condition; -import net.momirealms.craftengine.core.item.data.Enchantment; import net.momirealms.craftengine.core.item.Item; +import net.momirealms.craftengine.core.item.data.Enchantment; import net.momirealms.craftengine.core.plugin.context.Condition; import net.momirealms.craftengine.core.plugin.context.Context; import net.momirealms.craftengine.core.plugin.context.parameter.DirectContextParameters; diff --git a/gradle.properties b/gradle.properties index f29b46424..9bbc75481 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,7 @@ org.gradle.jvmargs=-Xmx1G # Project settings # Rule: [major update].[feature update].[bug fix] -project_version=0.0.59 +project_version=0.0.59.1 config_version=40 lang_version=21 project_group=net.momirealms @@ -49,7 +49,7 @@ mojang_brigadier_version=1.0.18 byte_buddy_version=1.17.5 ahocorasick_version=0.6.3 snake_yaml_version=2.4 -anti_grief_version=0.17 +anti_grief_version=0.18 nms_helper_version=1.0.18 evalex_version=3.5.0 reactive_streams_version=1.0.4