13
0
geforkt von Mirrors/Paper

Some more compilation fixes

Dieser Commit ist enthalten in:
Bjarne Koll 2024-04-25 19:42:24 +02:00
Ursprung 2af3439727
Commit d6adc0b264
6 geänderte Dateien mit 112 neuen und 20 gelöschten Zeilen

Datei anzeigen

@ -195,9 +195,51 @@ diff --git a/src/main/java/org/bukkit/potion/PotionBrewer.java b/src/main/java/o
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/potion/PotionBrewer.java
+++ b/src/main/java/org/bukkit/potion/PotionBrewer.java
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull;
* Represents a brewer that can create {@link PotionEffect}s.
*/
public interface PotionBrewer {
-
+ // Paper start - keep old spigot methods, removal in 1.20.6
/**
* Creates a {@link PotionEffect} from the given {@link PotionEffectType},
* applying duration modifiers and checks.
@@ -0,0 +0,0 @@ public interface PotionBrewer {
* @param duration The duration in ticks
* @param amplifier The amplifier of the effect
* @return The resulting potion effect
+ * @deprecated use {@link PotionEffectType#createEffect(int, int)} instead.
*/
+ @Deprecated(forRemoval = true, since = "1.20.5")
@NotNull
@Deprecated
- public PotionEffect createEffect(@NotNull PotionEffectType potion, int duration, int amplifier);
+ default PotionEffect createEffect(@NotNull PotionEffectType potion, int duration, int amplifier) {
+ return potion.createEffect(duration, amplifier);
+ }
/**
* Returns a collection of {@link PotionEffect} that would be applied from
@@ -0,0 +0,0 @@ public interface PotionBrewer {
* @return The list of effects
* @deprecated Non-Functional
*/
- @Deprecated
+ @Deprecated(forRemoval = true, since = "1.20.5")
@NotNull
- public Collection<PotionEffect> getEffectsFromDamage(int damage);
+ default Collection<PotionEffect> getEffectsFromDamage(final int damage) {
+ return new java.util.ArrayList<>();
+ }
+ // Paper start - keep old spigot methods, removal in 1.20.6
/**
* Returns a collection of {@link PotionEffect} that would be applied from
@@ -0,0 +0,0 @@ public interface PotionBrewer {
* @deprecated Upgraded / extended potions are now their own {@link PotionType} use {@link PotionType#getPotionEffects()} instead
*/
@NotNull
- @Deprecated
+ @Deprecated(forRemoval = true, since = "1.20.5")
public Collection<PotionEffect> getEffects(@NotNull PotionType type, boolean upgraded, boolean extended);
+
+ // Paper start

Datei anzeigen

@ -28,10 +28,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return true;
} else {
- Util.logAndPauseIfInIde("Detected setBlock in a far chunk [" + i + ", " + j + "], pos: " + String.valueOf(pos) + ", status: " + String.valueOf(this.generatingStatus) + (this.currentlyGenerating == null ? "" : ", currently generating: " + (String) this.currentlyGenerating.get()));
+ // Paper start - Buffer OOB setBlock calls
+ if (!hasSetFarWarned) {
+ Util.logAndPauseIfInIde("Detected setBlock in a far chunk [" + i + ", " + j + "], pos: " + String.valueOf(pos) + ", status: " + String.valueOf(this.generatingStatus) + (this.currentlyGenerating == null ? "" : ", currently generating: " + (String) this.currentlyGenerating.get()));
Util.logAndPauseIfInIde("Detected setBlock in a far chunk [" + i + ", " + j + "], pos: " + String.valueOf(pos) + ", status: " + String.valueOf(this.generatingStatus) + (this.currentlyGenerating == null ? "" : ", currently generating: " + (String) this.currentlyGenerating.get()));
+ hasSetFarWarned = true;
+ if (this.getServer() != null && this.getServer().isDebugging()) {
+ io.papermc.paper.util.TraceUtil.dumpTraceForThread("far setBlock call");

Datei anzeigen

@ -179,10 +179,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private final io.papermc.paper.datapack.PaperDatapackManager datapackManager; // Paper
public static Exception excessiveVelEx; // Paper - Velocity warnings
private final io.papermc.paper.logging.SysoutCatcher sysoutCatcher = new io.papermc.paper.logging.SysoutCatcher(); // Paper
+ private final org.bukkit.craftbukkit.potion.CraftPotionBrewer potionBrewer = new org.bukkit.craftbukkit.potion.CraftPotionBrewer(); // Paper - Custom Potion Mixes
+ private final org.bukkit.craftbukkit.potion.CraftPotionBrewer potionBrewer; // Paper - Custom Potion Mixes
static {
ConfigurationSerialization.registerClass(CraftOfflinePlayer.class);
@@ -0,0 +0,0 @@ public final class CraftServer implements Server {
if (this.configuration.getBoolean("settings.use-map-color-cache")) {
MapPalette.setMapColorCache(new CraftMapColorCache(this.logger));
}
+ this.potionBrewer = new org.bukkit.craftbukkit.potion.CraftPotionBrewer(playerList.getServer()); // Paper - custom potion mixes
datapackManager = new io.papermc.paper.datapack.PaperDatapackManager(console.getPackRepository()); // Paper
}
@@ -0,0 +0,0 @@ public final class CraftServer implements Server {
return datapackManager;
}
@ -222,30 +230,48 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import java.util.ArrayList;
+import java.util.Collection;
+import org.bukkit.potion.PotionBrewer;
+import org.bukkit.potion.PotionData;
+import org.bukkit.potion.PotionEffect;
+import org.bukkit.potion.PotionEffectType;
+import org.bukkit.potion.PotionType;
+
+public class CraftPotionBrewer implements PotionBrewer {
+
+ private final net.minecraft.server.MinecraftServer minecraftServer;
+
+ public CraftPotionBrewer(net.minecraft.server.MinecraftServer minecraftServer) {
+ this.minecraftServer = minecraftServer;
+ }
+
+ // Paper start - keep old spigot methods, removal in 1.20.6
+ @Override
+ public Collection<PotionEffect> getEffects(PotionType type, boolean upgraded, boolean extended) {
+ Preconditions.checkArgument(!type.getKey().getKey().startsWith("strong_"), "Strong potion type cannot be used directly, got %s", type.getKey());
+ Preconditions.checkArgument(!type.getKey().getKey().startsWith("long_"), "Extended potion type cannot be used directly, got %s", type.getKey());
+ final org.bukkit.NamespacedKey key = type.getKey();
+
+ return CraftPotionUtil.fromBukkit(new PotionData(type, upgraded, extended)).getPotionEffects();
+ Preconditions.checkArgument(!key.getKey().startsWith("strong_"), "Strong potion type cannot be used directly, got %s", key);
+ Preconditions.checkArgument(!key.getKey().startsWith("long_"), "Extended potion type cannot be used directly, got %s", key);
+
+ org.bukkit.NamespacedKey effectiveKey = key;
+ if (upgraded) {
+ effectiveKey = new org.bukkit.NamespacedKey(key.namespace(), "strong_" + key.key());
+ } else if (extended) {
+ effectiveKey = new org.bukkit.NamespacedKey(key.namespace(), "long_" + key.key());
+ }
+
+ final org.bukkit.potion.PotionType effectivePotionType = org.bukkit.Registry.POTION.get(effectiveKey);
+ Preconditions.checkNotNull(type, "Unknown potion type from data " + effectiveKey.asMinimalString()); // Legacy error message in 1.20.4
+ return effectivePotionType.getPotionEffects();
+ }
+
+ @Override
+ public Collection<PotionEffect> getEffectsFromDamage(int damage) {
+ return new ArrayList<PotionEffect>();
+ return new ArrayList<>();
+ }
+
+ @Override
+ public PotionEffect createEffect(PotionEffectType potion, int duration, int amplifier) {
+ return new PotionEffect(potion, potion.isInstant() ? 1 : (int) (duration * potion.getDurationModifier()), amplifier);
+ return new PotionEffect(potion, potion.isInstant() ? 1 : duration, amplifier);
+ }
+ // Paper end - keep old spigot methods, removal in 1.20.6
+
+ // Paper start
+ @Override
@ -260,7 +286,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ @Override
+ public void resetPotionMixes() {
+ net.minecraft.world.item.alchemy.PotionBrewing.reload();
+ this.minecraftServer.potionBrewing().reload(this.minecraftServer.getWorldData().enabledFeatures());
+ }
+ // Paper end
+}

Datei anzeigen

@ -23,9 +23,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
+ // Paper start - Fix cancelling ProjectileHitEvent for piercing arrows
@Override
- protected double getDefaultGravity() {
- return 0.05D;
+ @Override
+ public ProjectileDeflection preHitTargetOrDeflectSelf(HitResult hitResult) {
+ if (hitResult instanceof EntityHitResult entityHitResult && this.hitCancelled && this.getPierceLevel() > 0) {
+ if (this.piercingIgnoreEntityIds == null) {
@ -33,9 +31,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ this.piercingIgnoreEntityIds.add(entityHitResult.getEntity().getId());
+ }
+ super.preHitTargetOrDeflectSelf(hitResult);
}
+ return super.preHitTargetOrDeflectSelf(hitResult);
+ }
+ // Paper end - Fix cancelling ProjectileHitEvent for piercing arrows
private boolean shouldFall() {
return this.inGround && this.level().noCollision((new AABB(this.position(), this.position())).inflate(0.06D));
+
@Override
protected double getDefaultGravity() {
return 0.05D;

Datei anzeigen

@ -1256,7 +1256,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -0,0 +0,0 @@ public final class CraftServer implements Server {
private final io.papermc.paper.logging.SysoutCatcher sysoutCatcher = new io.papermc.paper.logging.SysoutCatcher(); // Paper
private final org.bukkit.craftbukkit.potion.CraftPotionBrewer potionBrewer = new org.bukkit.craftbukkit.potion.CraftPotionBrewer(); // Paper - Custom Potion Mixes
private final org.bukkit.craftbukkit.potion.CraftPotionBrewer potionBrewer; // Paper - Custom Potion Mixes
+ // Paper start - Folia region threading API
+ private final io.papermc.paper.threadedregions.scheduler.FallbackRegionScheduler regionizedScheduler = new io.papermc.paper.threadedregions.scheduler.FallbackRegionScheduler();

Datei anzeigen

@ -132,6 +132,32 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ // Paper end - More projectile API
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractArrow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractArrow.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractArrow.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractArrow.java
@@ -0,0 +0,0 @@ public class CraftAbstractArrow extends AbstractProjectile implements AbstractAr
this.getHandle().setCritArrow(critical);
}
- @Override
- public ProjectileSource getShooter() {
- return this.getHandle().projectileSource;
- }
-
- @Override
- public void setShooter(ProjectileSource shooter) {
- if (shooter instanceof Entity) {
- this.getHandle().setOwner(((CraftEntity) shooter).getHandle());
- } else {
- this.getHandle().setOwner(null);
- }
- this.getHandle().projectileSource = shooter;
- }
+ // Paper - moved to AbstractProjectil
@Override
public boolean isInBlock() {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java