Record Class WrittenBookContent
java.lang.Object
java.lang.Record
net.minecraft.world.item.component.WrittenBookContent
- All Implemented Interfaces:
BookContent<Component,WrittenBookContent>
public record WrittenBookContent(Filterable<String> title, String author, int generation, List<Filterable<Component>> pages, boolean resolved)
extends Record
implements BookContent<Component,WrittenBookContent>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final StringThe field for theauthorrecord component.static final com.mojang.serialization.Codec<WrittenBookContent> static final com.mojang.serialization.Codec<Component> static final WrittenBookContentprivate final intThe field for thegenerationrecord component.static final intstatic final intstatic final intprivate final List<Filterable<Component>> The field for thepagesrecord component.static final com.mojang.serialization.Codec<List<Filterable<Component>>> private final booleanThe field for theresolvedrecord component.static final StreamCodec<RegistryFriendlyByteBuf, WrittenBookContent> private final Filterable<String> The field for thetitlerecord component.static final intstatic final int -
Constructor Summary
ConstructorsConstructorDescriptionWrittenBookContent(Filterable<String> title, String author, int generation, List<Filterable<Component>> pages, boolean resolved) Creates an instance of aWrittenBookContentrecord class. -
Method Summary
Modifier and TypeMethodDescriptionauthor()Returns the value of theauthorrecord component.final booleanIndicates whether some other object is "equal to" this one.intReturns the value of thegenerationrecord component.getPages(boolean p_330387_) final inthashCode()Returns a hash code value for this object.private static booleanisPageTooLarge(Component p_331458_, HolderLookup.Provider p_331039_) private static com.mojang.serialization.Codec<Filterable<Component>> pages()Returns the value of thepagesrecord component.static com.mojang.serialization.Codec<List<Filterable<Component>>> pagesCodec(com.mojang.serialization.Codec<Component> p_335930_) resolve(CommandSourceStack p_330312_, Player p_331808_) booleanresolved()Returns the value of theresolvedrecord component.private static Optional<Filterable<Component>> resolvePage(CommandSourceStack p_330620_, Player p_330555_, Filterable<Component> p_330218_) title()Returns the value of thetitlerecord component.final StringtoString()Returns a string representation of this record class.withReplacedPages(List<Filterable<Component>> p_333901_)
-
Field Details
-
title
The field for thetitlerecord component. -
author
The field for theauthorrecord component. -
generation
private final int generationThe field for thegenerationrecord component. -
pages
The field for thepagesrecord component. -
resolved
private final boolean resolvedThe field for theresolvedrecord component. -
EMPTY
-
PAGE_LENGTH
public static final int PAGE_LENGTH- See Also:
-
TITLE_LENGTH
public static final int TITLE_LENGTH- See Also:
-
TITLE_MAX_LENGTH
public static final int TITLE_MAX_LENGTH- See Also:
-
MAX_GENERATION
public static final int MAX_GENERATION- See Also:
-
MAX_CRAFTABLE_GENERATION
public static final int MAX_CRAFTABLE_GENERATION- See Also:
-
CONTENT_CODEC
-
PAGES_CODEC
-
CODEC
-
STREAM_CODEC
-
-
Constructor Details
-
WrittenBookContent
public WrittenBookContent(Filterable<String> title, String author, int generation, List<Filterable<Component>> pages, boolean resolved) Creates an instance of aWrittenBookContentrecord class.- Parameters:
title- the value for thetitlerecord componentauthor- the value for theauthorrecord componentgeneration- the value for thegenerationrecord componentpages- the value for thepagesrecord componentresolved- the value for theresolvedrecord component
-
-
Method Details
-
pageCodec
private static com.mojang.serialization.Codec<Filterable<Component>> pageCodec(com.mojang.serialization.Codec<Component> p_335677_) -
pagesCodec
public static com.mojang.serialization.Codec<List<Filterable<Component>>> pagesCodec(com.mojang.serialization.Codec<Component> p_335930_) -
tryCraftCopy
-
resolve
@Nullable public WrittenBookContent resolve(CommandSourceStack p_330312_, @Nullable Player p_331808_) -
markResolved
-
resolvePage
private static Optional<Filterable<Component>> resolvePage(CommandSourceStack p_330620_, @Nullable Player p_330555_, Filterable<Component> p_330218_) -
isPageTooLarge
-
getPages
-
withReplacedPages
- Specified by:
withReplacedPagesin interfaceBookContent<Component,WrittenBookContent>
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
title
Returns the value of thetitlerecord component.- Returns:
- the value of the
titlerecord component
-
author
Returns the value of theauthorrecord component.- Returns:
- the value of the
authorrecord component
-
generation
public int generation()Returns the value of thegenerationrecord component.- Returns:
- the value of the
generationrecord component
-
pages
Returns the value of thepagesrecord component.- Specified by:
pagesin interfaceBookContent<Component,WrittenBookContent> - Returns:
- the value of the
pagesrecord component
-
resolved
public boolean resolved()Returns the value of theresolvedrecord component.- Returns:
- the value of the
resolvedrecord component
-