mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Don't delay item frame interactions
Causes interacting (moving) an item in an item frame to delay by about half a second. This delay is still present on chunk load where this delay is absolutely needed in order to the item frame to show up.
This commit is contained in:
parent
681cbeeae5
commit
ebd88c76aa
1 changed files with 21 additions and 21 deletions
|
@ -87,9 +87,12 @@ public class ItemFrameEntity extends Entity {
|
||||||
@Override
|
@Override
|
||||||
public void spawnEntity(GeyserSession session) {
|
public void spawnEntity(GeyserSession session) {
|
||||||
session.getItemFrameCache().put(bedrockPosition, entityId);
|
session.getItemFrameCache().put(bedrockPosition, entityId);
|
||||||
|
// Delay is required, or else loading in frames on chunk load is sketchy at best
|
||||||
|
session.getConnector().getGeneralThreadPool().schedule(() -> {
|
||||||
updateBlock(session);
|
updateBlock(session);
|
||||||
valid = true;
|
|
||||||
session.getConnector().getLogger().debug("Spawned item frame at location " + bedrockPosition + " with java id " + entityId);
|
session.getConnector().getLogger().debug("Spawned item frame at location " + bedrockPosition + " with java id " + entityId);
|
||||||
|
}, 500, TimeUnit.MILLISECONDS);
|
||||||
|
valid = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -170,8 +173,6 @@ public class ItemFrameEntity extends Entity {
|
||||||
* @param session GeyserSession.
|
* @param session GeyserSession.
|
||||||
*/
|
*/
|
||||||
public void updateBlock(GeyserSession session) {
|
public void updateBlock(GeyserSession session) {
|
||||||
// Delay is required, or else loading in frames on chunk load is sketchy at best
|
|
||||||
session.getConnector().getGeneralThreadPool().schedule(() -> {
|
|
||||||
UpdateBlockPacket updateBlockPacket = new UpdateBlockPacket();
|
UpdateBlockPacket updateBlockPacket = new UpdateBlockPacket();
|
||||||
updateBlockPacket.setDataLayer(0);
|
updateBlockPacket.setDataLayer(0);
|
||||||
updateBlockPacket.setBlockPosition(bedrockPosition);
|
updateBlockPacket.setBlockPosition(bedrockPosition);
|
||||||
|
@ -190,7 +191,6 @@ public class ItemFrameEntity extends Entity {
|
||||||
}
|
}
|
||||||
|
|
||||||
session.sendUpstreamPacket(blockEntityDataPacket);
|
session.sendUpstreamPacket(blockEntityDataPacket);
|
||||||
}, 500, TimeUnit.MILLISECONDS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue