Skip to content

bug: 'lore' not 'item_lore' #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ final class CodecImpl<T> implements kr.toxicity.libraries.datacomponent.api.Code
private static final RegistryOps<JsonElement> OPS = RegistryAccess.fromRegistryOfRegistries(BuiltInRegistries.REGISTRY).createSerializationContext(JsonOps.INSTANCE);

static final CodecImpl<Component> COMPONENT = of(ComponentSerialization.CODEC, t -> t.stream().count() == 1 && t.getStyle().isEmpty() && t.getContents() instanceof PlainTextContents textContents ? new JsonPrimitive(textContents.text()) : new JsonObject());
static final CodecImpl<ItemLore> ITEM_LORE = of(ItemLore.CODEC, t -> new JsonArray());
static final CodecImpl<ItemLore> LORE = of(ItemLore.CODEC, t -> new JsonArray());
static final CodecImpl<Rarity> RARITY = of(Rarity.CODEC, t -> new JsonPrimitive(t.name().toLowerCase()));
static final CodecImpl<Unit> UNIT = of(Codec.unit(Unit.INSTANCE), t -> new JsonPrimitive(true));
static final CodecImpl<AdventureModePredicate> ADVENTURE_MODE_PREDICATE = of(AdventureModePredicate.CODEC, t -> new JsonObject());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ public net.minecraft.world.effect.MobEffectInstance asVanilla(@NotNull MobEffect
)
);

static final Converter<ItemLore, net.minecraft.world.item.component.ItemLore> ITEM_LORE = Converter.of(
static final Converter<ItemLore, net.minecraft.world.item.component.ItemLore> LORE = Converter.of(
l -> new net.minecraft.world.item.component.ItemLore(
l.lines().stream().map(COMPONENT::asVanilla).toList(),
l.styledLines().stream().map(COMPONENT::asVanilla).toList()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ final class DataComponentTypeImpl<T, R> implements kr.toxicity.libraries.datacom
Converters.COMPONENT,
CodecImpl.COMPONENT
);
static final DataComponentTypeImpl<ItemLore, net.minecraft.world.item.component.ItemLore> ITEM_LORE = register(
"item_lore",
static final DataComponentTypeImpl<ItemLore, net.minecraft.world.item.component.ItemLore> LORE = register(
"lore",
DataComponents.LORE,
Converters.ITEM_LORE,
CodecImpl.ITEM_LORE
Converters.LORE,
CodecImpl.LORE
);
static final DataComponentTypeImpl<Rarity, net.minecraft.world.item.Rarity> RARITY = register(
"rarity",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public final class NMSImpl implements NMS {

@Override
public @NotNull DataComponentType<ItemLore> lore() {
return DataComponentTypeImpl.ITEM_LORE;
return DataComponentTypeImpl.LORE;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ final class CodecImpl<T> implements kr.toxicity.libraries.datacomponent.api.Code
private static final RegistryOps<JsonElement> OPS = RegistryAccess.fromRegistryOfRegistries(BuiltInRegistries.REGISTRY).createSerializationContext(JsonOps.INSTANCE);

static final CodecImpl<Component> COMPONENT = of(ComponentSerialization.CODEC, t -> t.stream().count() == 1 && t.getStyle().isEmpty() && t.getContents() instanceof PlainTextContents textContents ? new JsonPrimitive(textContents.text()) : new JsonObject());
static final CodecImpl<ItemLore> ITEM_LORE = of(ItemLore.CODEC, t -> new JsonArray());
static final CodecImpl<ItemLore> LORE = of(ItemLore.CODEC, t -> new JsonArray());
static final CodecImpl<Rarity> RARITY = of(Rarity.CODEC, t -> new JsonPrimitive(t.name().toLowerCase()));
static final CodecImpl<Unit> UNIT = of(Codec.unit(Unit.INSTANCE), t -> new JsonPrimitive(true));
static final CodecImpl<AdventureModePredicate> ADVENTURE_MODE_PREDICATE = of(AdventureModePredicate.CODEC, t -> new JsonObject());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ public net.minecraft.world.effect.MobEffectInstance asVanilla(@NotNull MobEffect
)
);

static final Converter<ItemLore, net.minecraft.world.item.component.ItemLore> ITEM_LORE = Converter.of(
static final Converter<ItemLore, net.minecraft.world.item.component.ItemLore> LORE = Converter.of(
l -> new net.minecraft.world.item.component.ItemLore(
l.lines().stream().map(COMPONENT::asVanilla).toList(),
l.styledLines().stream().map(COMPONENT::asVanilla).toList()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ final class DataComponentTypeImpl<T, R> implements kr.toxicity.libraries.datacom
Converters.COMPONENT,
CodecImpl.COMPONENT
);
static final DataComponentTypeImpl<ItemLore, net.minecraft.world.item.component.ItemLore> ITEM_LORE = register(
"item_lore",
static final DataComponentTypeImpl<ItemLore, net.minecraft.world.item.component.ItemLore> LORE = register(
"lore",
DataComponents.LORE,
Converters.ITEM_LORE,
CodecImpl.ITEM_LORE
Converters.LORE,
CodecImpl.LORE
);
static final DataComponentTypeImpl<Rarity, net.minecraft.world.item.Rarity> RARITY = register(
"rarity",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public final class NMSImpl implements NMS {

@Override
public @NotNull DataComponentType<ItemLore> lore() {
return DataComponentTypeImpl.ITEM_LORE;
return DataComponentTypeImpl.LORE;
}

@Override
Expand Down