final patches from remapped and unmapped

keep in mind many patches in the removed folder still need to be updated
This commit is contained in:
Jason Penilla 2021-06-14 21:55:46 -07:00
parent da99f8648f
commit 5a86fba668
No known key found for this signature in database
GPG Key ID: 0E75A301420E48F8
5 changed files with 51 additions and 50 deletions

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add more line of sight methods
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index a1496fe00a2d5ba6c1af054d4327f868b2cd7344..f66ec2dfdc64871f8b752bf44086954300804f08 100644
index 244bb359492ae486f0610f5aea6b75997dbc4bdc..8ae9198ba7fdb006dc420504a984627add20dbb5 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -76,6 +76,14 @@ public interface World extends PluginMessageRecipient, Metadatable, net.kyori.ad
@ -24,7 +24,7 @@ index a1496fe00a2d5ba6c1af054d4327f868b2cd7344..f66ec2dfdc64871f8b752bf440869543
/**
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
index b6de41e3e718fa5d1b82c6f68b153e60a81265e7..ccb81ceee74fff50ec3ed88ae0a41f790c40ae87 100644
index 330eab77547ae059f716418f71ad1d3391a57a9b..cda05df6784dd4d6a09710a416dcb71c016dabfc 100644
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
@@ -483,6 +483,19 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource

View File

@ -29,10 +29,10 @@ index efc1e42d606e1c9feb1a4871c0714933ae92a1b2..7acf077bc131af718c7548cc29deef55
+ }
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java
index 80397e223990f11c9aa413f3f4ebd7c1b8ce1cff..2ff1619e6898add074481c7ca43bfbf9a8d163ca 100644
index 1d94d285951faa98ff1f70c3c5330dfaa77cb691..778936a5d1aecaaa20fe2c542466da33594a86ae 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java
@@ -94,11 +94,11 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta {
@@ -93,11 +93,11 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta {
super(tag);
if (tag.contains(BOOK_TITLE.NBT)) {
@ -46,9 +46,9 @@ index 80397e223990f11c9aa413f3f4ebd7c1b8ce1cff..2ff1619e6898add074481c7ca43bfbf9
}
if (tag.contains(RESOLVED.NBT)) {
@@ -126,7 +126,7 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta {
@@ -125,7 +125,7 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta {
} else {
page = validatePage(page);
page = this.validatePage(page);
}
- this.pages.add( limit( page, 16384 ) ); // Spigot
+ this.pages.add( limit( page, com.destroystokyo.paper.PaperConfig.itemValidationBookPageLength ) ); // Spigot // Paper - make configurable
@ -56,28 +56,28 @@ index 80397e223990f11c9aa413f3f4ebd7c1b8ce1cff..2ff1619e6898add074481c7ca43bfbf9
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index 20e008277d1188fc7b31bfb2522ef9f6429cc3fb..99e18748b3cc4168b1d15c030f992a128b666d84 100644
index 81738dac125a7247fff5e51fa595667ef25ba0a1..d4a31ebc01656ac372ef597b31df93764dba6ec5 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -357,18 +357,18 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
@@ -356,18 +356,18 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
CompoundTag display = tag.getCompound(DISPLAY.NBT);
if (display.contains(NAME.NBT)) {
- displayName = limit( display.getString(NAME.NBT), 8192 ); // Spigot
+ displayName = limit( display.getString(NAME.NBT), com.destroystokyo.paper.PaperConfig.itemValidationDisplayNameLength); // Spigot // Paper - make configurable
- this.displayName = limit( display.getString(NAME.NBT), 8192 ); // Spigot
+ this.displayName = limit( display.getString(NAME.NBT), com.destroystokyo.paper.PaperConfig.itemValidationDisplayNameLength ); // Spigot // Paper - make configurable
}
if (display.contains(LOCNAME.NBT)) {
- locName = limit( display.getString(LOCNAME.NBT), 8192 ); // Spigot
+ locName = limit( display.getString(LOCNAME.NBT), com.destroystokyo.paper.PaperConfig.itemValidationLocNameLength ); // Spigot // Paper - make configurable
- this.locName = limit( display.getString(LOCNAME.NBT), 8192 ); // Spigot
+ this.locName = limit( display.getString(LOCNAME.NBT), com.destroystokyo.paper.PaperConfig.itemValidationLocNameLength ); // Spigot // Paper - make configurable
}
if (display.contains(LORE.NBT)) {
ListTag list = display.getList(LORE.NBT, CraftMagicNumbers.NBT.TAG_STRING);
lore = new ArrayList<String>(list.size());
this.lore = new ArrayList<String>(list.size());
for (int index = 0; index < list.size(); index++) {
- String line = limit( list.getString(index), 8192 ); // Spigot
+ String line = limit( list.getString(index), com.destroystokyo.paper.PaperConfig.itemValidationLoreLineLength ); // Spigot // Paper - make configurable
lore.add(line);
this.lore.add(line);
}
}

View File

@ -5,22 +5,22 @@ Subject: [PATCH] Add more line of sight methods
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 37787a725725d22b0870dcab0f3bec8b94cfd130..79b43b1b0f8e223f256c2aaec1925426931a9a54 100644
index b954fcfcf3bd3c55ca856126670fa6967d525fe3..cf7588aa282709a7b8ce6caff4aa713d54280660 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3091,6 +3091,7 @@ public abstract class LivingEntity extends Entity {
Vec3 vec3d = new Vec3(this.getX(), this.getEyeY(), this.getZ());
Vec3 vec3d1 = new Vec3(entity.getX(), entity.getEyeY(), entity.getZ());
@@ -3424,6 +3424,7 @@ public abstract class LivingEntity extends Entity {
Vec3 vec3d = new Vec3(this.getX(), this.getEyeY(), this.getZ());
Vec3 vec3d1 = new Vec3(entity.getX(), entity.getEyeY(), entity.getZ());
+ // Paper - diff on change - used in CraftLivingEntity#hasLineOfSight(Location) and CraftWorld#lineOfSightExists
return this.level.clip(new ClipContext(vec3d, vec3d1, ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, this)).getType() == HitResult.Type.MISS;
+ // Paper - diff on change - used in CraftLivingEntity#hasLineOfSight(Location) and CraftWorld#lineOfSightExists
return vec3d1.distanceTo(vec3d) > 128.0D ? false : this.level.clip(new ClipContext(vec3d, vec3d1, ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, this)).getType() == HitResult.Type.MISS;
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 1c9321cef1a05c5e8a22dd52bc63a5103eaf7311..312ed9c693cc5108d51ad90e15d6be4bb21904e1 100644
index fb90250f1b61c34a0a88bf50bc5b5bae09de9f0e..88635209d1c6598dc62804ad01e9ebbf039435f9 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -315,6 +315,17 @@ public class CraftWorld implements World {
@@ -330,6 +330,18 @@ public class CraftWorld implements World {
public io.papermc.paper.world.MoonPhase getMoonPhase() {
return io.papermc.paper.world.MoonPhase.getPhase(getFullTime() / 24000L);
}
@ -32,6 +32,7 @@ index 1c9321cef1a05c5e8a22dd52bc63a5103eaf7311..312ed9c693cc5108d51ad90e15d6be4b
+ if (from.getWorld() != to.getWorld()) return false;
+ Vec3 vec3d = new Vec3(from.getX(), from.getY(), from.getZ());
+ Vec3 vec3d1 = new Vec3(to.getX(), to.getY(), to.getZ());
+ if (vec3d1.distanceTo(vec3d) > 128.0D) return false;
+
+ return this.getHandle().clip(new ClipContext(vec3d, vec3d1, ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, null)).getType() == HitResult.Type.MISS;
+ }
@ -39,11 +40,21 @@ index 1c9321cef1a05c5e8a22dd52bc63a5103eaf7311..312ed9c693cc5108d51ad90e15d6be4b
private static final Random rand = new Random();
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 25ba7a26c951fc5e4638bdb0db36e94d3e08fb2e..cd42edd8f36cea3acad76974c39eb0cd1585f73d 100644
index 526beeac806d65c53c117be7702ce6cc3c6ec1c1..53b61b609361c305fb8d1f1a8700e81ce139fde4 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -549,6 +549,17 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
return getHandle().canSee(((CraftEntity) other).getHandle());
@@ -29,6 +29,9 @@ import net.minecraft.world.entity.projectile.ThrownEgg;
import net.minecraft.world.entity.projectile.ThrownEnderpearl;
import net.minecraft.world.entity.projectile.ThrownExperienceBottle;
import net.minecraft.world.entity.projectile.ThrownTrident;
+import net.minecraft.world.level.ClipContext;
+import net.minecraft.world.phys.HitResult;
+import net.minecraft.world.phys.Vec3;
import org.apache.commons.lang.Validate;
import org.bukkit.FluidCollisionMode;
import org.bukkit.Location;
@@ -541,6 +544,18 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
return this.getHandle().hasLineOfSight(((CraftEntity) other).getHandle());
}
+ // Paper start
@ -52,6 +63,7 @@ index 25ba7a26c951fc5e4638bdb0db36e94d3e08fb2e..cd42edd8f36cea3acad76974c39eb0cd
+ if (this.getHandle().level != ((CraftWorld) loc.getWorld()).getHandle()) return false;
+ Vec3 vec3d = new Vec3(this.getHandle().getX(), this.getHandle().getEyeY(), this.getHandle().getZ());
+ Vec3 vec3d1 = new Vec3(loc.getX(), loc.getY(), loc.getZ());
+ if (vec3d1.distanceTo(vec3d) > 128.0D) return false;
+
+ return this.getHandle().level.clip(new ClipContext(vec3d, vec3d1, ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, this.getHandle())).getType() == HitResult.Type.MISS;
+ }
@ -59,4 +71,4 @@ index 25ba7a26c951fc5e4638bdb0db36e94d3e08fb2e..cd42edd8f36cea3acad76974c39eb0cd
+
@Override
public boolean getRemoveWhenFarAway() {
return getHandle() instanceof Mob && !((Mob) getHandle()).persistenceRequired;
return this.getHandle() instanceof Mob && !((Mob) this.getHandle()).persistenceRequired;

View File

@ -6,10 +6,10 @@ Subject: [PATCH] add per world spawn limits
Taken from #2982. Credit to Chasewhip8
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index dc5ebbb44238cb5928f385d2962c9057388575f8..f80186f663ff654ab6b69189941cd26815f65f09 100644
index f2981aa82c26d7bdac08f45818813025b240b77e..974fba89648399919802dc4c11846601d2923712 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -652,6 +652,19 @@ public class PaperWorldConfig {
@@ -605,6 +605,19 @@ public class PaperWorldConfig {
zombieVillagerInfectionChance = getDouble("zombie-villager-infection-chance", zombieVillagerInfectionChance);
}
@ -30,13 +30,13 @@ index dc5ebbb44238cb5928f385d2962c9057388575f8..f80186f663ff654ab6b69189941cd268
private void lightQueueSize() {
lightQueueSize = getInt("light-queue-size", lightQueueSize);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 312ed9c693cc5108d51ad90e15d6be4bb21904e1..89aac4214084bd72a83eaaf043b7d47cc0b748f5 100644
index 88635209d1c6598dc62804ad01e9ebbf039435f9..f2428723ac4a30f57baa0d31aba75a1a95547aa6 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -335,6 +335,13 @@ public class CraftWorld implements World {
@@ -351,6 +351,13 @@ public class CraftWorld implements World {
this.generator = gen;
environment = env;
this.environment = env;
+ // Paper start - per world spawn limits
+ this.monsterSpawn = this.world.paperConfig.spawnLimitMonsters;
+ this.animalSpawn = this.world.paperConfig.spawnLimitAnimals;

View File

@ -5,23 +5,11 @@ Subject: [PATCH] Fix PotionSplashEvent for water splash potions
Fixes SPIGOT-6221: https://hub.spigotmc.org/jira/projects/SPIGOT/issues/SPIGOT-6221
diff --git a/src/main/java/net/minecraft/world/damagesource/DamageSource.java b/src/main/java/net/minecraft/world/damagesource/DamageSource.java
index ed81d2a306d28561370745bb3389c49012f677a7..fbdfab50af195d219f9745324c8924fc777f76ec 100644
--- a/src/main/java/net/minecraft/world/damagesource/DamageSource.java
+++ b/src/main/java/net/minecraft/world/damagesource/DamageSource.java
@@ -99,6 +99,7 @@ public class DamageSource {
return (new IndirectEntityDamageSource("thrown", projectile, attacker)).setProjectile();
}
+ public static DamageSource indirectMagic(Entity target, Entity cause) { return indirectMagic(target, cause); } // Paper - OBFHELPER
public static DamageSource indirectMagic(Entity magic, @Nullable Entity attacker) {
return (new IndirectEntityDamageSource("indirectMagic", magic, attacker)).bypassArmor().setMagic();
}
diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java
index 2ff7e8dfc0a520fb330177c140a1ae5c729f14c0..8bf095bce9dfec6479185b6e60c2e9d76e3363eb 100644
index 4dc6ab94a50a1dca8603129b28405578d381a06e..8676796ff65cd0bd3f215dc7edcf3a5b2291ca27 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java
@@ -122,6 +122,7 @@ public class ThrownPotion extends ThrowableItemProjectile {
@@ -126,6 +126,7 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie
private void applyWater() {
AABB axisalignedbb = this.getBoundingBox().inflate(4.0D, 2.0D, 4.0D);
List<net.minecraft.world.entity.LivingEntity> list = this.level.getEntitiesOfClass(net.minecraft.world.entity.LivingEntity.class, axisalignedbb, ThrownPotion.WATER_SENSITIVE);
@ -29,7 +17,7 @@ index 2ff7e8dfc0a520fb330177c140a1ae5c729f14c0..8bf095bce9dfec6479185b6e60c2e9d7
if (!list.isEmpty()) {
Iterator iterator = list.iterator();
@@ -131,11 +132,22 @@ public class ThrownPotion extends ThrowableItemProjectile {
@@ -135,11 +136,23 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie
double d0 = this.distanceToSqr(entityliving);
if (d0 < 16.0D && entityliving.isSensitiveToWater()) {
@ -50,10 +38,11 @@ index 2ff7e8dfc0a520fb330177c140a1ae5c729f14c0..8bf095bce9dfec6479185b6e60c2e9d7
+ }
+ }
+ // Paper end
}
+
List<Axolotl> list1 = this.level.getEntitiesOfClass(Axolotl.class, axisalignedbb);
Iterator iterator1 = list1.iterator();
private void applySplash(List<MobEffectInstance> statusEffects, @Nullable Entity entity) {
@@ -153,6 +165,7 @@ public class ThrownPotion extends ThrowableItemProjectile {
@@ -167,6 +180,7 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie
double d0 = this.distanceToSqr(entityliving);
if (d0 < 16.0D) {