mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-19 15:09:15 +00:00
改进调用库的方法
This commit is contained in:
@@ -104,9 +104,9 @@ public abstract class BukkitItemFactory<W extends ItemWrapper<ItemStack>> extend
|
||||
}
|
||||
if (this.hasExternalRecipeSource) {
|
||||
for (Provider<ItemStack, Player> source : this.recipeIngredientSources) {
|
||||
Optional<String> id = source.id(item.getItem());
|
||||
if (id.isPresent()) {
|
||||
return UniqueKey.create(Key.of(source.plugin(), StringUtils.toLowerCase(id.get())));
|
||||
String id = source.idOrNull(item.getItem());
|
||||
if (id != null) {
|
||||
return UniqueKey.create(Key.of(source.plugin(), StringUtils.toLowerCase(id)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,12 +62,12 @@ public class ExternalModifier<I> implements ItemDataModifier<I> {
|
||||
try {
|
||||
ItemManager<I> itemManager = CraftEngine.instance().itemManager();
|
||||
Player player = context.player();
|
||||
Optional<I> another = this.provider.build(this.id, player == null ? null : player.platformPlayer(), adapt(context));
|
||||
if (another.isEmpty()) {
|
||||
I another = this.provider.buildOrNull(this.id, player == null ? null : player.platformPlayer(), adapt(context));
|
||||
if (another == null) {
|
||||
CraftEngine.instance().logger().warn("'" + this.id + "' could not be found in " + provider.plugin());
|
||||
return item;
|
||||
}
|
||||
Item<I> anotherWrapped = itemManager.wrap(another.get());
|
||||
Item<I> anotherWrapped = itemManager.wrap(another);
|
||||
item.merge(anotherWrapped);
|
||||
return item;
|
||||
} catch (Throwable e) {
|
||||
|
||||
@@ -57,7 +57,7 @@ jimfs_version=1.3.1
|
||||
authlib_version=7.0.60
|
||||
concurrent_util_version=0.0.8-SNAPSHOT
|
||||
bucket4j_version=8.15.0
|
||||
itembridge_version=1.0.10
|
||||
itembridge_version=1.0.12
|
||||
|
||||
# Proxy settings
|
||||
systemProp.socks.proxyHost=127.0.0.1
|
||||
|
||||
Reference in New Issue
Block a user