forked from GeyserMC/Geyser
More comments
This commit is contained in:
parent
3ba396e625
commit
a5c020e7ee
1 changed files with 2 additions and 3 deletions
|
@ -72,7 +72,6 @@ public class LecternInventoryTranslator extends BaseInventoryTranslator {
|
||||||
LecternContainer lecternContainer = (LecternContainer) inventory;
|
LecternContainer lecternContainer = (LecternContainer) inventory;
|
||||||
lecternContainer.setCurrentBedrockPage(value / 2);
|
lecternContainer.setCurrentBedrockPage(value / 2);
|
||||||
lecternContainer.setBlockEntityTag(lecternContainer.getBlockEntityTag().toBuilder().putInt("page", lecternContainer.getCurrentBedrockPage()).build());
|
lecternContainer.setBlockEntityTag(lecternContainer.getBlockEntityTag().toBuilder().putInt("page", lecternContainer.getCurrentBedrockPage()).build());
|
||||||
System.out.println(lecternContainer.getBlockEntityTag());
|
|
||||||
BlockEntityUtils.updateBlockEntity(session, lecternContainer.getBlockEntityTag(), lecternContainer.getPosition());
|
BlockEntityUtils.updateBlockEntity(session, lecternContainer.getBlockEntityTag(), lecternContainer.getPosition());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -100,7 +99,7 @@ public class LecternInventoryTranslator extends BaseInventoryTranslator {
|
||||||
if (tag != null) {
|
if (tag != null) {
|
||||||
// Position has to be the last interacted position... right?
|
// Position has to be the last interacted position... right?
|
||||||
Vector3i position = session.getLastInteractionPosition();
|
Vector3i position = session.getLastInteractionPosition();
|
||||||
// shouldRefresh means that we should boot out the
|
// shouldRefresh means that we should boot out the client on our side because their lectern GUI isn't updated yet
|
||||||
boolean shouldRefresh = !session.getConnector().getWorldManager().shouldExpectLecternHandled() && !session.getLecternCache().contains(position);
|
boolean shouldRefresh = !session.getConnector().getWorldManager().shouldExpectLecternHandled() && !session.getLecternCache().contains(position);
|
||||||
int pagesSize = ((ListTag) tag.get("pages")).size();
|
int pagesSize = ((ListTag) tag.get("pages")).size();
|
||||||
ItemData itemData = geyserItemStack.getItemData(session);
|
ItemData itemData = geyserItemStack.getItemData(session);
|
||||||
|
@ -116,7 +115,6 @@ public class LecternInventoryTranslator extends BaseInventoryTranslator {
|
||||||
// Even with serverside access to lecterns, we don't easily know which lectern this is, so we need to rebuild
|
// Even with serverside access to lecterns, we don't easily know which lectern this is, so we need to rebuild
|
||||||
// the block entity tag
|
// the block entity tag
|
||||||
lecternContainer.setBlockEntityTag(blockEntityTag);
|
lecternContainer.setBlockEntityTag(blockEntityTag);
|
||||||
System.out.println(blockEntityTag);
|
|
||||||
lecternContainer.setPosition(position);
|
lecternContainer.setPosition(position);
|
||||||
if (shouldRefresh) {
|
if (shouldRefresh) {
|
||||||
// Update the lectern because it's not updated client-side
|
// Update the lectern because it's not updated client-side
|
||||||
|
@ -148,6 +146,7 @@ public class LecternInventoryTranslator extends BaseInventoryTranslator {
|
||||||
builder.putByte("hasBook", (byte) 1);
|
builder.putByte("hasBook", (byte) 1);
|
||||||
builder.putInt("totalPages", totalPages);
|
builder.putInt("totalPages", totalPages);
|
||||||
} else {
|
} else {
|
||||||
|
// Not usually needed, but helps with kicking out Bedrock players from reading the UI
|
||||||
builder.putByte("hasBook", (byte) 0);
|
builder.putByte("hasBook", (byte) 0);
|
||||||
}
|
}
|
||||||
return builder;
|
return builder;
|
||||||
|
|
Loading…
Reference in a new issue