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
Modifier and TypeFieldDescriptionprivate final String
The field for theauthor
record component.static final com.mojang.serialization.Codec
<WrittenBookContent> static final com.mojang.serialization.Codec
<Component> static final WrittenBookContent
private final int
The field for thegeneration
record component.static final int
static final int
static final int
private final List
<Filterable<Component>> The field for thepages
record component.static final com.mojang.serialization.Codec
<List<Filterable<Component>>> private final boolean
The field for theresolved
record component.static final StreamCodec
<RegistryFriendlyByteBuf, WrittenBookContent> private final Filterable
<String> The field for thetitle
record component.static final int
static final int
-
Constructor Summary
ConstructorDescriptionWrittenBookContent
(Filterable<String> title, String author, int generation, List<Filterable<Component>> pages, boolean resolved) Creates an instance of aWrittenBookContent
record class. -
Method Summary
Modifier and TypeMethodDescriptionauthor()
Returns the value of theauthor
record component.final boolean
Indicates whether some other object is "equal to" this one.int
Returns the value of thegeneration
record component.getPages
(boolean p_335499_) final int
hashCode()
Returns a hash code value for this object.private static boolean
isPageTooLarge
(Component p_330243_, HolderLookup.Provider p_333440_) private static com.mojang.serialization.Codec
<Filterable<Component>> pages()
Returns the value of thepages
record component.static com.mojang.serialization.Codec
<List<Filterable<Component>>> pagesCodec
(com.mojang.serialization.Codec<Component> p_329056_) resolve
(CommandSourceStack p_333228_, Player p_329707_) boolean
resolved()
Returns the value of theresolved
record component.private static Optional
<Filterable<Component>> resolvePage
(CommandSourceStack p_335264_, Player p_333342_, Filterable<Component> p_328841_) title()
Returns the value of thetitle
record component.final String
toString()
Returns a string representation of this record class.withReplacedPages
(List<Filterable<Component>> p_330066_)
-
Field Details
-
title
The field for thetitle
record component. -
author
The field for theauthor
record component. -
generation
private final int generationThe field for thegeneration
record component. -
pages
The field for thepages
record component. -
resolved
private final boolean resolvedThe field for theresolved
record 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 aWrittenBookContent
record class.- Parameters:
title
- the value for thetitle
record componentauthor
- the value for theauthor
record componentgeneration
- the value for thegeneration
record componentpages
- the value for thepages
record componentresolved
- the value for theresolved
record component
-
-
Method Details
-
pageCodec
private static com.mojang.serialization.Codec<Filterable<Component>> pageCodec(com.mojang.serialization.Codec<Component> p_335093_) -
pagesCodec
public static com.mojang.serialization.Codec<List<Filterable<Component>>> pagesCodec(com.mojang.serialization.Codec<Component> p_329056_) -
tryCraftCopy
-
resolve
@Nullable public WrittenBookContent resolve(CommandSourceStack p_333228_, @Nullable Player p_329707_) -
markResolved
-
resolvePage
private static Optional<Filterable<Component>> resolvePage(CommandSourceStack p_335264_, @Nullable Player p_333342_, Filterable<Component> p_328841_) -
isPageTooLarge
-
getPages
-
withReplacedPages
- Specified by:
withReplacedPages
in interfaceBookContent<Component,
WrittenBookContent>
-
pages
Returns the value of thepages
record component.- Specified by:
pages
in interfaceBookContent<Component,
WrittenBookContent> - Returns:
- the value of the
pages
record component
-
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 thetitle
record component.- Returns:
- the value of the
title
record component
-
author
Returns the value of theauthor
record component.- Returns:
- the value of the
author
record component
-
generation
public int generation()Returns the value of thegeneration
record component.- Returns:
- the value of the
generation
record component
-
resolved
public boolean resolved()Returns the value of theresolved
record component.- Returns:
- the value of the
resolved
record component
-