mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-12-22 16:48:25 +01:00
fixed Protocol Range impl
This commit is contained in:
parent
2ce8031494
commit
16d8079d73
@ -1,10 +1,3 @@
|
||||
# ViaFabricPlus
|
||||
Clientside ViaVersion, ViaLegacy and ViaAprilFools implementation with clientside fixes for Fabric
|
||||
|
||||
TODO:
|
||||
ViaFabricPlus-Visual:
|
||||
|
||||
Armor
|
||||
Hunger bar
|
||||
Signature indicator
|
||||
Petrified Oak slab
|
||||
|
@ -41,7 +41,7 @@ public class ItemReleaseVersionDefinition {
|
||||
private final static Map<Item, ProtocolRange[]> itemMap = new HashMap<>();
|
||||
|
||||
public static boolean contains(final Item item, final ComparableProtocolVersion version) {
|
||||
if (!itemMap.containsKey(item)) return false;
|
||||
if (!itemMap.containsKey(item)) return true;
|
||||
|
||||
return Arrays.stream(itemMap.get(item)).anyMatch(protocolRange -> protocolRange.contains(version));
|
||||
}
|
||||
|
@ -50,9 +50,11 @@ public class ProtocolRange {
|
||||
}
|
||||
|
||||
public boolean contains(final ComparableProtocolVersion protocolVersion) {
|
||||
if (this.lowerBound != null && this.lowerBound.getIndex() < protocolVersion.getIndex()) return false;
|
||||
|
||||
return this.upperBound == null || this.upperBound.getIndex() <= protocolVersion.getIndex();
|
||||
if (this.lowerBound != null && protocolVersion.getIndex() < lowerBound.getIndex())
|
||||
return false;
|
||||
if (this.upperBound != null && protocolVersion.getIndex() > upperBound.getIndex())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -31,7 +31,7 @@ public class ProtocolSyncBooleanValue extends AbstractValue<Boolean> {
|
||||
private boolean syncWithProtocol;
|
||||
|
||||
public ProtocolSyncBooleanValue(String name, ProtocolRange protocolRange) {
|
||||
super(name, true);
|
||||
super(name + " (" + protocolRange.toString() + ")", true);
|
||||
|
||||
this.protocolRange = protocolRange;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user