mirror of
https://github.com/GeyserMC/Geyser.git
synced 2025-01-10 03:52:30 +01:00
Use unbreakable predicate when converting v1 to v2 mappings
This commit is contained in:
parent
bca98c7d22
commit
6e0e3c03dd
1 changed files with 6 additions and 0 deletions
|
@ -32,8 +32,11 @@ import org.geysermc.geyser.api.GeyserApi;
|
||||||
import org.geysermc.geyser.api.item.custom.v2.BedrockCreativeTab;
|
import org.geysermc.geyser.api.item.custom.v2.BedrockCreativeTab;
|
||||||
import org.geysermc.geyser.api.item.custom.v2.CustomItemBedrockOptions;
|
import org.geysermc.geyser.api.item.custom.v2.CustomItemBedrockOptions;
|
||||||
import org.geysermc.geyser.api.item.custom.v2.CustomItemDefinition;
|
import org.geysermc.geyser.api.item.custom.v2.CustomItemDefinition;
|
||||||
|
import org.geysermc.geyser.api.item.custom.v2.predicate.ConditionPredicate;
|
||||||
import org.geysermc.geyser.api.item.custom.v2.predicate.RangeDispatchPredicate;
|
import org.geysermc.geyser.api.item.custom.v2.predicate.RangeDispatchPredicate;
|
||||||
|
import org.geysermc.geyser.api.util.TriState;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.OptionalInt;
|
import java.util.OptionalInt;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
@ -149,6 +152,9 @@ public interface CustomItemData {
|
||||||
if (options.damagePredicate().isPresent()) {
|
if (options.damagePredicate().isPresent()) {
|
||||||
definition.predicate(new RangeDispatchPredicate(RangeDispatchPredicate.RangeDispatchProperty.DAMAGE, options.damagePredicate().getAsInt()));
|
definition.predicate(new RangeDispatchPredicate(RangeDispatchPredicate.RangeDispatchProperty.DAMAGE, options.damagePredicate().getAsInt()));
|
||||||
}
|
}
|
||||||
|
if (options.unbreakable() != TriState.NOT_SET) {
|
||||||
|
definition.predicate(new ConditionPredicate(ConditionPredicate.ConditionProperty.UNBREAKABLE, Objects.requireNonNull(options.unbreakable().toBoolean())));
|
||||||
|
}
|
||||||
return definition;
|
return definition;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue