mirror of
https://github.com/GeyserMC/Geyser.git
synced 2025-01-23 00:41:59 +01:00
Improve mapping custom items
This commit is contained in:
parent
a80e90d648
commit
e7d7a9d09b
1 changed files with 8 additions and 13 deletions
|
@ -26,7 +26,6 @@
|
|||
package org.geysermc.geyser.translator.item;
|
||||
|
||||
import com.google.common.collect.Multimap;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.cloudburstmc.protocol.bedrock.data.TrimMaterial;
|
||||
import org.geysermc.geyser.api.item.custom.v2.predicate.CustomItemPredicate;
|
||||
|
@ -39,7 +38,6 @@ import org.geysermc.geyser.api.item.custom.v2.predicate.match.MatchPredicateProp
|
|||
import org.geysermc.geyser.item.GeyserCustomMappingData;
|
||||
import org.geysermc.geyser.item.Items;
|
||||
import org.geysermc.geyser.level.JavaDimension;
|
||||
import org.geysermc.geyser.registry.populator.ItemRegistryPopulator;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.cache.registry.RegistryEntryData;
|
||||
import org.geysermc.geyser.util.MinecraftKey;
|
||||
|
@ -79,19 +77,16 @@ public final class CustomItemTranslator {
|
|||
}
|
||||
|
||||
for (GeyserCustomMappingData customMapping : customItems) {
|
||||
Key expectedModel = ItemRegistryPopulator.identifierToKey(customMapping.definition().model());
|
||||
if (expectedModel.equals(itemModel)) {
|
||||
boolean allMatch = true;
|
||||
for (CustomItemPredicate predicate : customMapping.definition().predicates()) {
|
||||
if (!predicateMatches(session, predicate, stackSize, components)) {
|
||||
allMatch = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (allMatch) {
|
||||
return customMapping.itemDefinition();
|
||||
boolean allMatch = true;
|
||||
for (CustomItemPredicate predicate : customMapping.definition().predicates()) {
|
||||
if (!predicateMatches(session, predicate, stackSize, components)) {
|
||||
allMatch = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (allMatch) {
|
||||
return customMapping.itemDefinition();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue