Update MCPL and MCAuthLib (#4645)

* Update MCPL and MCAuthLib

* Bump MCPL
This commit is contained in:
AJ Ferguson 2024-05-06 21:40:32 -04:00 committed by GitHub
parent 8addcadb71
commit 0a261f1d9d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 12 additions and 8 deletions

View file

@ -25,11 +25,11 @@
package org.geysermc.geyser.inventory.item;
import it.unimi.dsi.fastutil.ints.Int2ObjectMaps;
import lombok.Getter;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.geysermc.mcprotocollib.protocol.data.game.item.component.PotionContents;
import java.util.Collections;
import java.util.Locale;
@Getter
@ -88,7 +88,7 @@ public enum Potion {
}
public PotionContents toComponent() {
return new PotionContents(this.ordinal(), -1, Int2ObjectMaps.emptyMap());
return new PotionContents(this.ordinal(), -1, Collections.emptyList());
}
public static @Nullable Potion getByJavaId(int javaId) {

View file

@ -95,8 +95,11 @@ public enum TippedArrowPotion {
this.javaColor = arrowParticleColor.getColor();
}
public static TippedArrowPotion of(int id) {
return VALUES[id];
public static @Nullable TippedArrowPotion of(int id) {
if (id >= 0 && id < VALUES.length) {
return VALUES[id];
}
return null;
}
public static @Nullable TippedArrowPotion getByBedrockId(int bedrockId) {

View file

@ -25,7 +25,6 @@
package org.geysermc.geyser.item.type;
import it.unimi.dsi.fastutil.ints.Int2ObjectMaps;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData;
import org.geysermc.geyser.inventory.GeyserItemStack;
@ -36,6 +35,8 @@ import org.geysermc.geyser.registry.type.ItemMappings;
import org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponentType;
import org.geysermc.mcprotocollib.protocol.data.game.item.component.PotionContents;
import java.util.Collections;
public class ArrowItem extends Item {
public ArrowItem(String javaIdentifier, Builder builder) {
super(javaIdentifier, builder);
@ -47,7 +48,7 @@ public class ArrowItem extends Item {
GeyserItemStack itemStack = super.translateToJava(itemData, mapping, mappings);
if (tippedArrowPotion != null) {
itemStack = Items.TIPPED_ARROW.newItemStack(itemStack.getAmount(), itemStack.getComponents());
PotionContents contents = new PotionContents(tippedArrowPotion.ordinal(), -1, Int2ObjectMaps.emptyMap());
PotionContents contents = new PotionContents(tippedArrowPotion.ordinal(), -1, Collections.emptyList());
itemStack.getOrCreateComponents().put(DataComponentType.POTION_CONTENTS, contents);
}
return itemStack;