mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-12-22 14:34:59 +01:00
Revert a change, ensure that gathering all components works and doesn't throw due to duplicate keys
This commit is contained in:
parent
06a9b2866e
commit
8779eab5e5
2 changed files with 4 additions and 12 deletions
|
@ -128,11 +128,7 @@ public class WolfEntity extends TameableEntity {
|
|||
public void setBody(ItemStack stack) {
|
||||
super.setBody(stack);
|
||||
isCurseOfBinding = ItemUtils.hasEffect(session, stack, EnchantmentComponent.PREVENT_ARMOR_CHANGE);
|
||||
if (stack != null && stack.getDataComponents() != null) {
|
||||
repairableItems = stack.getDataComponents().get(DataComponentType.REPAIRABLE);
|
||||
} else {
|
||||
repairableItems = null;
|
||||
}
|
||||
repairableItems = GeyserItemStack.from(stack).getComponent(DataComponentType.REPAIRABLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -49,7 +49,6 @@ import org.geysermc.geyser.text.MinecraftLocale;
|
|||
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;
|
||||
|
@ -111,12 +110,9 @@ public class Item {
|
|||
return baseComponents;
|
||||
}
|
||||
|
||||
//noinspection UnstableApiUsage
|
||||
var builder = ImmutableMap.<DataComponentType<?>, DataComponent<?, ?>>builderWithExpectedSize(
|
||||
baseComponents.getDataComponents().size() + others.getDataComponents().size());
|
||||
builder.putAll(baseComponents.getDataComponents());
|
||||
builder.putAll(others.getDataComponents());
|
||||
return new DataComponents(builder.build());
|
||||
DataComponents components = baseComponents.clone();
|
||||
components.getDataComponents().putAll(others.getDataComponents());
|
||||
return new DataComponents(ImmutableMap.copyOf(components.getDataComponents()));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
|
Loading…
Reference in a new issue