diff --git a/build-logic/src/main/kotlin/geyser.base-conventions.gradle.kts b/build-logic/src/main/kotlin/geyser.base-conventions.gradle.kts index 045015fe1e..093f0a8c09 100644 --- a/build-logic/src/main/kotlin/geyser.base-conventions.gradle.kts +++ b/build-logic/src/main/kotlin/geyser.base-conventions.gradle.kts @@ -26,6 +26,8 @@ dependencies { } repositories { + // mavenLocal() + mavenCentral() // Floodgate, Cumulus etc. @@ -67,6 +69,4 @@ repositories { // For Adventure snapshots maven("https://s01.oss.sonatype.org/content/repositories/snapshots/") - - //mavenLocal() } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/WolfEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/WolfEntity.java index 1b06f3860f..ff2d57aefb 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/WolfEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/WolfEntity.java @@ -128,7 +128,11 @@ protected Tag getFoodTag() { public void setBody(ItemStack stack) { super.setBody(stack); isCurseOfBinding = ItemUtils.hasEffect(session, stack, EnchantmentComponent.PREVENT_ARMOR_CHANGE); - repairableItems = GeyserItemStack.from(stack).getComponent(DataComponentType.REPAIRABLE); + if (stack != null && stack.getDataComponents() != null) { + repairableItems = stack.getDataComponents().get(DataComponentType.REPAIRABLE); + } else { + repairableItems = null; + } } @Override diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/CreakingEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/CreakingEntity.java index 1a26eb43b0..1b9fdd8a4b 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/CreakingEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/CreakingEntity.java @@ -40,14 +40,12 @@ import java.util.Optional; import java.util.UUID; - public class CreakingEntity extends MonsterEntity { - - private Vector3i homePosition; - public static final String CREAKING_STATE = "minecraft:creaking_state"; public static final String CREAKING_SWAYING_TICKS = "minecraft:creaking_swaying_ticks"; + private Vector3i homePosition; + public CreakingEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } @@ -62,6 +60,11 @@ protected void initializeMetadata() { @Override public void addAdditionalSpawnData(AddEntityPacket addEntityPacket) { propertyManager.add(CREAKING_STATE, "neutral"); + // also, the creaking seems to have this minecraft:creaking_swaying_ticks thingy + // which i guess is responsible for some animation? + // it's sent over the network, all 6 "stages" 50ms in between of each other. + // no clue what it's used for tbh, so i'm not gonna bother implementing it + // - chris propertyManager.add(CREAKING_SWAYING_TICKS, 0); propertyManager.applyIntProperties(addEntityPacket.getProperties().getIntProperties()); } diff --git a/core/src/main/java/org/geysermc/geyser/item/type/Item.java b/core/src/main/java/org/geysermc/geyser/item/type/Item.java index b12ab4d670..51750e7b11 100644 --- a/core/src/main/java/org/geysermc/geyser/item/type/Item.java +++ b/core/src/main/java/org/geysermc/geyser/item/type/Item.java @@ -49,10 +49,12 @@ import org.geysermc.geyser.translator.item.BedrockItemBuilder; import org.geysermc.geyser.translator.text.MessageTranslator; import org.geysermc.geyser.util.MinecraftKey; +import org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponent; import org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponentType; import org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents; import org.geysermc.mcprotocollib.protocol.data.game.item.component.DyedItemColor; import org.geysermc.mcprotocollib.protocol.data.game.item.component.ItemEnchantments; +import org.jetbrains.annotations.UnmodifiableView; import java.util.ArrayList; import java.util.HashMap; @@ -103,14 +105,18 @@ public Rarity defaultRarity() { * Otherwise, prefer using GeyserItemStack's getComponent */ @NonNull + @UnmodifiableView public DataComponents gatherComponents(DataComponents others) { if (others == null) { return baseComponents; } - DataComponents components = baseComponents.clone(); - components.getDataComponents().putAll(others.getDataComponents()); - return new DataComponents(ImmutableMap.copyOf(components.getDataComponents())); + //noinspection UnstableApiUsage + var builder = ImmutableMap., DataComponent>builderWithExpectedSize( + baseComponents.getDataComponents().size() + others.getDataComponents().size()); + builder.putAll(baseComponents.getDataComponents()); + builder.putAll(others.getDataComponents()); + return new DataComponents(builder.build()); } @Nullable