2025-11-24 22:52:51 +03:00

43 lines
1.6 KiB
Java

/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.mojang.datafixers.kinds.App
* com.mojang.datafixers.kinds.Applicative
* com.mojang.serialization.MapCodec
* com.mojang.serialization.codecs.RecordCodecBuilder
*/
package net.minecraft.network.chat.contents;
import com.mojang.datafixers.kinds.App;
import com.mojang.datafixers.kinds.Applicative;
import com.mojang.serialization.MapCodec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import java.util.Optional;
import net.minecraft.network.chat.ComponentContents;
import net.minecraft.network.chat.FormattedText;
import net.minecraft.network.chat.Style;
import net.minecraft.network.chat.contents.objects.ObjectInfo;
import net.minecraft.network.chat.contents.objects.ObjectInfos;
public record ObjectContents(ObjectInfo contents) implements ComponentContents
{
private static final String PLACEHOLDER = Character.toString('\ufffc');
public static final MapCodec<ObjectContents> MAP_CODEC = RecordCodecBuilder.mapCodec(i -> i.group((App)ObjectInfos.CODEC.forGetter(ObjectContents::contents)).apply((Applicative)i, ObjectContents::new));
public MapCodec<ObjectContents> codec() {
return MAP_CODEC;
}
@Override
public <T> Optional<T> visit(FormattedText.ContentConsumer<T> output) {
return output.accept(this.contents.description());
}
@Override
public <T> Optional<T> visit(FormattedText.StyledContentConsumer<T> output, Style currentStyle) {
return output.accept(currentStyle.withFont(this.contents.fontDescription()), PLACEHOLDER);
}
}