Skip to content

Commit

Permalink
Merge branch 'server-renderer' into 1.20.4
Browse files Browse the repository at this point in the history
  • Loading branch information
MATRIX-feather committed Dec 25, 2023
2 parents 5cbc2c8 + 12a224a commit eb823f3
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import io.papermc.paper.event.player.PlayerStopUsingItemEvent;
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import net.minecraft.core.BlockPos;
import org.bukkit.Bukkit;
import org.bukkit.Color;
import org.bukkit.entity.EntityType;
Expand All @@ -20,6 +21,7 @@

import java.util.List;
import java.util.Map;
import java.util.Optional;

public class LivingEntityWatcher extends EntityWatcher implements Listener
{
Expand Down Expand Up @@ -102,6 +104,24 @@ protected void doSync()
write(values.STUCKED_ARROWS, player.getArrowsInBody());
write(values.BEE_STINGERS, player.getBeeStingersInBody());

Optional<BlockPos> bedPos = Optional.empty();
if (player.isSleeping())
{
try
{
var bukkitPos = player.getBedLocation();
bedPos = Optional.of(
new BlockPos(bukkitPos.blockX(),bukkitPos.blockY(), bukkitPos.blockZ())
);
}
catch (Throwable t)
{
logger.warn("Error occurred while processing bed pos: " + t.getMessage());
}
}

write(values.BED_POS, bedPos);

super.doSync();
}
}

0 comments on commit eb823f3

Please sign in to comment.