Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 04:20:04 +01:00
c5a10665b8
Spigot still maintains some partial implementation of "tick skipping", a practice in which the MinecraftServer.currentTick field is updated not by an increment of one per actual tick, but instead set to System.currentTimeMillis() / 50. This behaviour means that the tracked tick may "skip" a tick value in case a previous tick took more than the expected 50ms. To compensate for this in important paths, spigot/craftbukkit implements "wall-time". Instead of incrementing/decrementing ticks on block entities/entities by one for each call to their tick() method, they instead increment/decrement important values, like an ItemEntity's age or pickupDelay, by the difference of `currentTick - lastTick`, where `lastTick` is the value of `currentTick` during the last tick() call. These "fixes" however do not play nicely with minecraft's simulation distance as entities/block entities implementing the above behaviour would "catch up" their values when moving from a non-ticking chunk to a ticking one as their `lastTick` value remains stuck on the last tick in a ticking chunk and hence lead to a large "catch up" once ticked again. Paper completely removes the "tick skipping" behaviour (See patch "Further-improve-server-tick-loop"), making the above precautions completely unnecessary, which also rids paper of the previous described incompatibility with non-ticking chunks.
56 Zeilen
2.9 KiB
Diff
56 Zeilen
2.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: ysl3000 <yannicklamprecht@live.de>
|
|
Date: Mon, 6 Jul 2020 22:18:04 +0200
|
|
Subject: [PATCH] Create HoverEvent from ItemStack Entity
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
|
|
index fd0df053cd5e8802991e665185e7f90f8001d80c..eabb8b42b890224dd19b879ff276e9908674310d 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
|
|
@@ -246,4 +246,44 @@ public final class CraftItemFactory implements ItemFactory {
|
|
return nms != null ? net.minecraft.locale.Language.getInstance().getOrDefault(nms.getItem().getDescriptionId(nms)) : null;
|
|
}
|
|
// Paper end - add getI18NDisplayName
|
|
+
|
|
+ // Paper start - bungee hover events
|
|
+ @Override
|
|
+ public net.md_5.bungee.api.chat.hover.content.Content hoverContentOf(ItemStack itemStack) {
|
|
+ throw new UnsupportedOperationException("BungeeCord Chat API does not support data components");
|
|
+ /*
|
|
+ net.md_5.bungee.api.chat.ItemTag itemTag = net.md_5.bungee.api.chat.ItemTag.ofNbt(CraftItemStack.asNMSCopy(itemStack).getOrCreateTag().toString());
|
|
+ return new net.md_5.bungee.api.chat.hover.content.Item(
|
|
+ itemStack.getType().getKey().toString(),
|
|
+ itemStack.getAmount(),
|
|
+ itemTag);
|
|
+ */
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public net.md_5.bungee.api.chat.hover.content.Content hoverContentOf(org.bukkit.entity.Entity entity) {
|
|
+ return hoverContentOf(entity, org.apache.commons.lang3.StringUtils.isBlank(entity.getCustomName()) ? null : new net.md_5.bungee.api.chat.TextComponent(entity.getCustomName()));
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public net.md_5.bungee.api.chat.hover.content.Content hoverContentOf(org.bukkit.entity.Entity entity, String customName) {
|
|
+ return hoverContentOf(entity, org.apache.commons.lang3.StringUtils.isBlank(customName) ? null : new net.md_5.bungee.api.chat.TextComponent(customName));
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public net.md_5.bungee.api.chat.hover.content.Content hoverContentOf(org.bukkit.entity.Entity entity, net.md_5.bungee.api.chat.BaseComponent customName) {
|
|
+ return new net.md_5.bungee.api.chat.hover.content.Entity(
|
|
+ entity.getType().getKey().toString(),
|
|
+ entity.getUniqueId().toString(),
|
|
+ customName);
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public net.md_5.bungee.api.chat.hover.content.Content hoverContentOf(org.bukkit.entity.Entity entity, net.md_5.bungee.api.chat.BaseComponent[] customName) {
|
|
+ return new net.md_5.bungee.api.chat.hover.content.Entity(
|
|
+ entity.getType().getKey().toString(),
|
|
+ entity.getUniqueId().toString(),
|
|
+ new net.md_5.bungee.api.chat.TextComponent(customName));
|
|
+ }
|
|
+ // Paper end - bungee hover events
|
|
}
|