mirror of
https://github.com/PaperMC/Paper.git
synced 2025-02-24 13:30:48 +01:00
Some more compilation fixes
This commit is contained in:
parent
2af3439727
commit
d6adc0b264
6 changed files with 112 additions and 20 deletions
|
@ -195,9 +195,51 @@ diff --git a/src/main/java/org/bukkit/potion/PotionBrewer.java b/src/main/java/o
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/potion/PotionBrewer.java
|
--- a/src/main/java/org/bukkit/potion/PotionBrewer.java
|
||||||
+++ b/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 {
|
@@ -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
|
@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);
|
public Collection<PotionEffect> getEffects(@NotNull PotionType type, boolean upgraded, boolean extended);
|
||||||
+
|
+
|
||||||
+ // Paper start
|
+ // Paper start
|
||||||
|
|
|
@ -28,10 +28,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} 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
|
+ // Paper start - Buffer OOB setBlock calls
|
||||||
+ if (!hasSetFarWarned) {
|
+ 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;
|
+ hasSetFarWarned = true;
|
||||||
+ if (this.getServer() != null && this.getServer().isDebugging()) {
|
+ if (this.getServer() != null && this.getServer().isDebugging()) {
|
||||||
+ io.papermc.paper.util.TraceUtil.dumpTraceForThread("far setBlock call");
|
+ io.papermc.paper.util.TraceUtil.dumpTraceForThread("far setBlock call");
|
||||||
|
|
|
@ -179,10 +179,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
private final io.papermc.paper.datapack.PaperDatapackManager datapackManager; // Paper
|
private final io.papermc.paper.datapack.PaperDatapackManager datapackManager; // Paper
|
||||||
public static Exception excessiveVelEx; // Paper - Velocity warnings
|
public static Exception excessiveVelEx; // Paper - Velocity warnings
|
||||||
private final io.papermc.paper.logging.SysoutCatcher sysoutCatcher = new io.papermc.paper.logging.SysoutCatcher(); // Paper
|
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 {
|
static {
|
||||||
ConfigurationSerialization.registerClass(CraftOfflinePlayer.class);
|
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 {
|
@@ -0,0 +0,0 @@ public final class CraftServer implements Server {
|
||||||
return datapackManager;
|
return datapackManager;
|
||||||
}
|
}
|
||||||
|
@ -222,30 +230,48 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+import java.util.ArrayList;
|
+import java.util.ArrayList;
|
||||||
+import java.util.Collection;
|
+import java.util.Collection;
|
||||||
+import org.bukkit.potion.PotionBrewer;
|
+import org.bukkit.potion.PotionBrewer;
|
||||||
+import org.bukkit.potion.PotionData;
|
|
||||||
+import org.bukkit.potion.PotionEffect;
|
+import org.bukkit.potion.PotionEffect;
|
||||||
+import org.bukkit.potion.PotionEffectType;
|
+import org.bukkit.potion.PotionEffectType;
|
||||||
+import org.bukkit.potion.PotionType;
|
+import org.bukkit.potion.PotionType;
|
||||||
+
|
+
|
||||||
+public class CraftPotionBrewer implements PotionBrewer {
|
+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
|
+ @Override
|
||||||
+ public Collection<PotionEffect> getEffects(PotionType type, boolean upgraded, boolean extended) {
|
+ 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());
|
+ final org.bukkit.NamespacedKey key = type.getKey();
|
||||||
+ Preconditions.checkArgument(!type.getKey().getKey().startsWith("long_"), "Extended potion type cannot be used directly, got %s", 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
|
+ @Override
|
||||||
+ public Collection<PotionEffect> getEffectsFromDamage(int damage) {
|
+ public Collection<PotionEffect> getEffectsFromDamage(int damage) {
|
||||||
+ return new ArrayList<PotionEffect>();
|
+ return new ArrayList<>();
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public PotionEffect createEffect(PotionEffectType potion, int duration, int amplifier) {
|
+ 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
|
+ // Paper start
|
||||||
+ @Override
|
+ @Override
|
||||||
|
@ -260,7 +286,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public void resetPotionMixes() {
|
+ public void resetPotionMixes() {
|
||||||
+ net.minecraft.world.item.alchemy.PotionBrewing.reload();
|
+ this.minecraftServer.potionBrewing().reload(this.minecraftServer.getWorldData().enabledFeatures());
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
+}
|
+}
|
||||||
|
|
|
@ -23,9 +23,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
}
|
}
|
||||||
|
|
||||||
+ // Paper start - Fix cancelling ProjectileHitEvent for piercing arrows
|
+ // Paper start - Fix cancelling ProjectileHitEvent for piercing arrows
|
||||||
@Override
|
+ @Override
|
||||||
- protected double getDefaultGravity() {
|
|
||||||
- return 0.05D;
|
|
||||||
+ public ProjectileDeflection preHitTargetOrDeflectSelf(HitResult hitResult) {
|
+ public ProjectileDeflection preHitTargetOrDeflectSelf(HitResult hitResult) {
|
||||||
+ if (hitResult instanceof EntityHitResult entityHitResult && this.hitCancelled && this.getPierceLevel() > 0) {
|
+ if (hitResult instanceof EntityHitResult entityHitResult && this.hitCancelled && this.getPierceLevel() > 0) {
|
||||||
+ if (this.piercingIgnoreEntityIds == null) {
|
+ if (this.piercingIgnoreEntityIds == null) {
|
||||||
|
@ -33,9 +31,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ }
|
+ }
|
||||||
+ this.piercingIgnoreEntityIds.add(entityHitResult.getEntity().getId());
|
+ this.piercingIgnoreEntityIds.add(entityHitResult.getEntity().getId());
|
||||||
+ }
|
+ }
|
||||||
+ super.preHitTargetOrDeflectSelf(hitResult);
|
+ return super.preHitTargetOrDeflectSelf(hitResult);
|
||||||
}
|
+ }
|
||||||
+ // Paper end - Fix cancelling ProjectileHitEvent for piercing arrows
|
+ // Paper end - Fix cancelling ProjectileHitEvent for piercing arrows
|
||||||
|
+
|
||||||
private boolean shouldFall() {
|
@Override
|
||||||
return this.inGround && this.level().noCollision((new AABB(this.position(), this.position())).inflate(0.06D));
|
protected double getDefaultGravity() {
|
||||||
|
return 0.05D;
|
||||||
|
|
|
@ -1256,7 +1256,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
@@ -0,0 +0,0 @@ public final class CraftServer implements Server {
|
@@ -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 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
|
+ // Paper start - Folia region threading API
|
||||||
+ private final io.papermc.paper.threadedregions.scheduler.FallbackRegionScheduler regionizedScheduler = new io.papermc.paper.threadedregions.scheduler.FallbackRegionScheduler();
|
+ private final io.papermc.paper.threadedregions.scheduler.FallbackRegionScheduler regionizedScheduler = new io.papermc.paper.threadedregions.scheduler.FallbackRegionScheduler();
|
||||||
|
|
|
@ -132,6 +132,32 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end - More projectile API
|
+ // 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
|
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
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java
|
||||||
|
|
Loading…
Add table
Reference in a new issue