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:
RednedEpic 2020-05-23 23:14:29 -05:00
parent 681cbeeae5
commit ebd88c76aa
1 changed files with 21 additions and 21 deletions

View File

@ -87,9 +87,12 @@ public class ItemFrameEntity extends Entity {
@Override
public void spawnEntity(GeyserSession session) {
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);
valid = true;
session.getConnector().getLogger().debug("Spawned item frame at location " + bedrockPosition + " with java id " + entityId);
}, 500, TimeUnit.MILLISECONDS);
valid = true;
}
@Override
@ -170,8 +173,6 @@ public class ItemFrameEntity extends Entity {
* @param session GeyserSession.
*/
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.setDataLayer(0);
updateBlockPacket.setBlockPosition(bedrockPosition);
@ -190,7 +191,6 @@ public class ItemFrameEntity extends Entity {
}
session.sendUpstreamPacket(blockEntityDataPacket);
}, 500, TimeUnit.MILLISECONDS);
}
/**