mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 15:30:19 +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.
29 lines
1.7 KiB
Diff
29 lines
1.7 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Tamion <70228790+notTamion@users.noreply.github.com>
|
|
Date: Sun, 5 Nov 2023 09:51:28 +0100
|
|
Subject: [PATCH] Add HiddenPotionEffect API
|
|
|
|
== AT ==
|
|
public net.minecraft.world.effect.MobEffectInstance hiddenEffect
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionUtil.java b/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionUtil.java
|
|
index 01af4db5d0f17ea2943e5c464d4122a358503bc1..cb11f0624e4e65aa06bfaaec90729ee536cd53a0 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionUtil.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionUtil.java
|
|
@@ -78,6 +78,7 @@ public class CraftPotionUtil {
|
|
|
|
public static MobEffectInstance fromBukkit(PotionEffect effect) {
|
|
Holder<MobEffect> type = CraftPotionEffectType.bukkitToMinecraftHolder(effect.getType());
|
|
+ // Paper - Note: do not copy over the hidden effect, as this method is only used for applying to entities which we do not want to convert over.
|
|
return new MobEffectInstance(type, effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles(), effect.hasIcon()); // Paper
|
|
}
|
|
|
|
@@ -87,7 +88,7 @@ public class CraftPotionUtil {
|
|
int duration = effect.getDuration();
|
|
boolean ambient = effect.isAmbient();
|
|
boolean particles = effect.isVisible();
|
|
- return new PotionEffect(type, duration, amp, ambient, particles, effect.showIcon()); // Paper
|
|
+ return new PotionEffect(type, duration, amp, ambient, particles, effect.showIcon(), effect.hiddenEffect == null ? null : toBukkit(effect.hiddenEffect)); // Paper
|
|
}
|
|
|
|
public static boolean equals(Holder<MobEffect> mobEffect, PotionEffectType type) {
|