Class BookData
java.lang.Object
com.hammy275.immersivemc.common.immersive.storage.network.impl.BookData
- All Implemented Interfaces:
NetworkStorage
,WorldStorage
- Direct Known Subclasses:
ClientBookData
-
Field Summary
Modifier and TypeFieldDescriptionboolean
net.minecraft.world.item.ItemStack
int
static final double
float
static final int
static final double
static final float
OBB[]
net.minecraft.world.entity.player.Player
int
static final int
net.minecraft.core.BlockPos
net.minecraft.world.phys.Vec3[]
float
static final float
static final double
static final double
static final float
static final double
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
decode
(net.minecraft.network.FriendlyByteBuf buffer) Decode the buffer into this object.void
encode
(net.minecraft.network.FriendlyByteBuf buffer) Encode this storage into a buffer.protected net.minecraft.world.phys.Vec3
WorldStorageHandler<? extends NetworkStorage>
int
protected net.minecraft.world.phys.Vec3
getLeftRight
(PosRot hand, boolean left) protected int
int
boolean
isDirty()
void
lastPage()
void
lecternPlayerTick
(net.minecraft.world.entity.player.Player player, net.minecraft.core.BlockPos pos) void
void
load
(net.minecraft.nbt.CompoundTag nbt, int lastVanillaDataVersion) Load from the NBT tag into this object.void
protected int
protected void
void
nextPage()
boolean
boolean
protected boolean
possiblyBeginPageTurn
(net.minecraft.world.phys.Vec3 handPos, OBB startBox) protected void
net.minecraft.nbt.CompoundTag
save
(net.minecraft.nbt.CompoundTag nbt) Save this object into the NBT tag.void
setDirty()
void
setPage
(int newPageIndex) void
startPageTurn
(PageChangeState state, int handIndex) void
startPageTurnAnim
(net.minecraft.world.entity.player.Player pageTurner, boolean isNextPage) void
-
Field Details
-
scaleSize
public static final float scaleSize- See Also:
-
singlePageWidth
public static final double singlePageWidth- See Also:
-
pageHalfHeight
public static final double pageHalfHeight- See Also:
-
textStackScaleSize
public static final float textStackScaleSize- See Also:
-
textUpAmount
public static final double textUpAmount- See Also:
-
textInteractDistanceSqr
public static final double textInteractDistanceSqr- See Also:
-
pageTilt
public static final float pageTilt- See Also:
-
linesPerPage
public static final int linesPerPage- See Also:
-
pixelsPerLine
public static final int pixelsPerLine- See Also:
-
leftPageRot
public static final double leftPageRot -
book
public net.minecraft.world.item.ItemStack book -
leftPageIndex
public int leftPageIndex -
pageChangeState
-
leftPageTurn
public float leftPageTurn -
rightPageTurn
public float rightPageTurn -
pageTurner
public transient net.minecraft.world.entity.player.Player pageTurner -
pageTurnerIndex
public transient int pageTurnerIndex -
pageTurnBoxes
-
positions
public transient net.minecraft.world.phys.Vec3[] positions -
lecternPosRot
-
authoritative
public transient boolean authoritative -
pos
public transient net.minecraft.core.BlockPos pos
-
-
Constructor Details
-
BookData
public BookData() -
BookData
public BookData(boolean authoritative)
-
-
Method Details
-
setPage
public void setPage(int newPageIndex) -
nextPage
public void nextPage() -
lastPage
public void lastPage() -
isDirty
public boolean isDirty() -
setDirty
public void setDirty() -
markNoLongerDirty
public void markNoLongerDirty() -
lecternPlayerTick
public void lecternPlayerTick(net.minecraft.world.entity.player.Player player, net.minecraft.core.BlockPos pos) -
lecternServerTick
public void lecternServerTick() -
tick
-
encode
public void encode(net.minecraft.network.FriendlyByteBuf buffer) Description copied from interface:NetworkStorage
Encode this storage into a buffer.- Specified by:
encode
in interfaceNetworkStorage
- Parameters:
buffer
- Buffer to encode storage into.
-
decode
public void decode(net.minecraft.network.FriendlyByteBuf buffer) Description copied from interface:NetworkStorage
Decode the buffer into this object.- Specified by:
decode
in interfaceNetworkStorage
- Parameters:
buffer
- Buffer to decode from.
-
startPageTurn
-
startPageTurnAnim
public void startPageTurnAnim(net.minecraft.world.entity.player.Player pageTurner, boolean isNextPage) -
maybeConvertToNonVR
protected void maybeConvertToNonVR() -
maxLeftPageIndex
protected int maxLeftPageIndex() -
getPageCount
protected int getPageCount() -
getLeftRight
-
getAway
- Parameters:
hand
- Hand data- Returns:
- The vector pointing away from the book. This is the opposite of the look vector of an HMD looking directly at the book.
-
resetTurnState
protected void resetTurnState() -
possiblyBeginPageTurn
-
onFirstPage
public boolean onFirstPage() -
onLastPage
public boolean onLastPage() -
getLeftPageIndex
public int getLeftPageIndex() -
getRightPageIndex
public int getRightPageIndex() -
load
public void load(net.minecraft.nbt.CompoundTag nbt, int lastVanillaDataVersion) Description copied from interface:WorldStorage
Load from the NBT tag into this object.- Specified by:
load
in interfaceWorldStorage
- Parameters:
nbt
- NBT tag to load from.lastVanillaDataVersion
- The last vanilla data version this storage was loaded in.
-
save
public net.minecraft.nbt.CompoundTag save(net.minecraft.nbt.CompoundTag nbt) Description copied from interface:WorldStorage
Save this object into the NBT tag.- Specified by:
save
in interfaceWorldStorage
- Parameters:
nbt
- NBT tag to save to.- Returns:
- The same NBT tag as provided to this method.
-
getHandler
- Specified by:
getHandler
in interfaceWorldStorage
- Returns:
- Handler for this type of WorldStorage.
-