-
-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
堆叠物品疑似并不检查粘液id #912
Comments
问题溯源Slimefun4/src/main/java/me/mrCookieSlime/Slimefun/api/inventory/DirtyChestMenu.java Lines 178 to 183 in 226af9b
Slimefun4/src/main/java/io/github/thebusybiscuit/slimefun4/utils/SlimefunUtils.java Lines 306 to 322 in 226af9b
Slimefun4/src/main/java/io/github/thebusybiscuit/slimefun4/utils/SlimefunUtils.java Lines 348 to 387 in 226af9b
前半部分乍一看没啥毛病,检查了粘液科技的id,那么问题肯定出在后半部分上的 Slimefun4/src/main/java/io/github/thebusybiscuit/slimefun4/utils/SlimefunUtils.java Lines 459 to 501 in 226af9b
这里有一说一这个传入的 这段代码就是检查Lore和Name然后就过了,问题就来了 Slimefun4/src/main/java/io/github/thebusybiscuit/slimefun4/utils/SlimefunUtils.java Lines 364 to 386 in 226af9b
这里检查是不是忽略了一种情况,它是粘液物品并且两个物品并不是同一种粘液物品 if (id != null) {
if (id.equals(possibleItemId)) {
Debug.log(TestCase.CARGO_INPUT_TESTING, " Item IDs matched!");
/*
* PR #3417
*
* Some items can't rely on just IDs matching and will implement Distinctive Item
* in which case we want to use the method provided to compare
*/
Optional<DistinctiveItem> optionalDistinctive = getDistinctiveItem(id);
if (optionalDistinctive.isPresent()) {
return optionalDistinctive.get().canStack(possibleSfItemMeta, itemMeta);
}
return true;
}
return false;
} else { 后面的Debug输出的内容也许要改下? |
发现了个问题,在这里,这里传入的变量名是sfItem,也就意味着默认sfItem是粘液物品了。在id==null(即item不是粘液科技物品的情况下),是否有必要继续判断呢,在一个是粘液物品一个不是的情况下直接返回false就行了吧,最后应该这样修改 if (id != null && id.equals(possibleItemId)) {
Debug.log(TestCase.CARGO_INPUT_TESTING, " Item IDs matched!");
/*
* PR #3417
*
* Some items can't rely on just IDs matching and will implement Distinctive Item
* in which case we want to use the method provided to compare
*/
Optional<DistinctiveItem> optionalDistinctive = getDistinctiveItem(id);
if (optionalDistinctive.isPresent()) {
return optionalDistinctive.get().canStack(possibleSfItemMeta, itemMeta);
}
return true;
}
return false; 还有,既然已经判断 |
但是在视频中,我给出的光源方块都是粘液物品,从nbt里就可以看出 |
反馈上游的话我可能得另外录制一个视频 |
不,我发现这个 |
问题是汉化版的问题,但汉化版出问题又可以通过改上游进行解决 |
SlimeCustomizer 物品配置发一个,我没怎么用过附属 |
SLIMEFUN_ITEM_1: #id不同
category: slime_customizer
item-type: CUSTOM
item-name: "&b名称相同"
item-lore:
- "LORE相同"
item-id: STICK
item-amount: 1
placeable: false
crafting-recipe-type: NONE
crafting-recipe:
1:
type: NONE
id: N/A
amount: 1
2:
type: NONE
id: N/A
amount: 1
3:
type: NONE
id: N/A
amount: 1
4:
type: NONE
id: N/A
amount: 1
5:
type: NONE
id: N/A
amount: 1
6:
type: NONE
id: N/A
amount: 1
7:
type: NONE
id: N/A
amount: 1
8:
type: NONE
id: N/A
amount: 1
9:
type: NONE
id: N/A
amount: 1
SLIMEFUN_ITEM_2: #id不同
category: slime_customizer
item-type: CUSTOM
item-name: "&b名称相同"
item-lore:
- "LORE相同"
item-id: STICK
item-amount: 1
placeable: false
crafting-recipe-type: NONE
crafting-recipe:
1:
type: NONE
id: N/A
amount: 1
2:
type: NONE
id: N/A
amount: 1
3:
type: NONE
id: N/A
amount: 1
4:
type: NONE
id: N/A
amount: 1
5:
type: NONE
id: N/A
amount: 1
6:
type: NONE
id: N/A
amount: 1
7:
type: NONE
id: N/A
amount: 1
8:
type: NONE
id: N/A
amount: 1
9:
type: NONE
id: N/A
amount: 1 大致就这样,事实上这个问题出自汉化版自己加的检测(说实话这个检测本来就有问题) |
对了,通过仔细阅读代码发现理论上这种符合name相同lore相同的粘液物品在其使用的原版物品不同的情况下也会堆叠 |
尝试新 Insider 版 |
对了,由此延伸出去可以发现不同使用次数的元素拐杖可以堆叠 |
问题描述
如题
对于特定物品,粘液会直接让他们堆叠,即使他们粘液id不同
特定物品:名字相同,lore相同,但粘液id不同(即nbt存在不同,修复bug不需要考虑完整的nbt,只考虑粘液id就够了)
问题复现率
必现
复现步骤
QQ2024627-205635.mp4
服务端类型
Purpur
Minecraft 版本
1.20.x
Slimefun 版本
构建 180
https://builds.guizhanss.com/StarWishsama/Slimefun4/master/builds/180
其他插件信息
同name同lore但nbt不同的物品使用SlimeCustomizer生成
nbt使用InfinityExpansion查看
补充信息
No response
The text was updated successfully, but these errors were encountered: