From 995348f469362ce60a32af93a695340b037e56ee Mon Sep 17 00:00:00 2001 From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Date: Mon, 14 Jun 2021 21:55:46 -0700 Subject: [PATCH] final patches from remapped and unmapped keep in mind many patches in the removed folder still need to be updated --- .../Add-more-line-of-sight-methods.patch | 0 .../Add-more-line-of-sight-methods.patch | 26 ++++++++++++++----- ...SplashEvent-for-water-splash-potions.patch | 23 +++++----------- .../Make-item-validations-configurable.patch | 14 +++++----- .../add-per-world-spawn-limits.patch | 2 +- 5 files changed, 33 insertions(+), 32 deletions(-) rename patches/{api-unmapped => api}/Add-more-line-of-sight-methods.patch (100%) rename patches/{server-remapped => server}/Add-more-line-of-sight-methods.patch (69%) rename patches/{server-remapped => server}/Fix-PotionSplashEvent-for-water-splash-potions.patch (73%) rename patches/{server-remapped => server}/Make-item-validations-configurable.patch (87%) rename patches/{server-remapped => server}/add-per-world-spawn-limits.patch (98%) diff --git a/patches/api-unmapped/Add-more-line-of-sight-methods.patch b/patches/api/Add-more-line-of-sight-methods.patch similarity index 100% rename from patches/api-unmapped/Add-more-line-of-sight-methods.patch rename to patches/api/Add-more-line-of-sight-methods.patch diff --git a/patches/server-remapped/Add-more-line-of-sight-methods.patch b/patches/server/Add-more-line-of-sight-methods.patch similarity index 69% rename from patches/server-remapped/Add-more-line-of-sight-methods.patch rename to patches/server/Add-more-line-of-sight-methods.patch index 12db207900..416e08904a 100644 --- a/patches/server-remapped/Add-more-line-of-sight-methods.patch +++ b/patches/server/Add-more-line-of-sight-methods.patch @@ -9,13 +9,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -0,0 +0,0 @@ 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()); + 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -32,6 +32,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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; + } @@ -42,8 +43,18 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +@@ -0,0 +0,0 @@ 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; @@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { - return getHandle().canSee(((CraftEntity) other).getHandle()); + return this.getHandle().hasLineOfSight(((CraftEntity) other).getHandle()); } + // Paper start @@ -52,6 +63,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + @Override public boolean getRemoveWhenFarAway() { - return getHandle() instanceof Mob && !((Mob) getHandle()).persistenceRequired; + return this.getHandle() instanceof Mob && !((Mob) this.getHandle()).persistenceRequired; diff --git a/patches/server-remapped/Fix-PotionSplashEvent-for-water-splash-potions.patch b/patches/server/Fix-PotionSplashEvent-for-water-splash-potions.patch similarity index 73% rename from patches/server-remapped/Fix-PotionSplashEvent-for-water-splash-potions.patch rename to patches/server/Fix-PotionSplashEvent-for-water-splash-potions.patch index 2c6f548713..88b9363181 100644 --- a/patches/server-remapped/Fix-PotionSplashEvent-for-water-splash-potions.patch +++ b/patches/server/Fix-PotionSplashEvent-for-water-splash-potions.patch @@ -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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/damagesource/DamageSource.java -+++ b/src/main/java/net/minecraft/world/damagesource/DamageSource.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java +++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java -@@ -0,0 +0,0 @@ public class ThrownPotion extends ThrowableItemProjectile { +@@ -0,0 +0,0 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie private void applyWater() { AABB axisalignedbb = this.getBoundingBox().inflate(4.0D, 2.0D, 4.0D); List list = this.level.getEntitiesOfClass(net.minecraft.world.entity.LivingEntity.class, axisalignedbb, ThrownPotion.WATER_SENSITIVE); @@ -29,7 +17,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (!list.isEmpty()) { Iterator iterator = list.iterator(); -@@ -0,0 +0,0 @@ public class ThrownPotion extends ThrowableItemProjectile { +@@ -0,0 +0,0 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie double d0 = this.distanceToSqr(entityliving); if (d0 < 16.0D && entityliving.isSensitiveToWater()) { @@ -50,10 +38,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } + // Paper end - } ++ + List list1 = this.level.getEntitiesOfClass(Axolotl.class, axisalignedbb); + Iterator iterator1 = list1.iterator(); - private void applySplash(List statusEffects, @Nullable Entity entity) { -@@ -0,0 +0,0 @@ public class ThrownPotion extends ThrowableItemProjectile { +@@ -0,0 +0,0 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie double d0 = this.distanceToSqr(entityliving); if (d0 < 16.0D) { diff --git a/patches/server-remapped/Make-item-validations-configurable.patch b/patches/server/Make-item-validations-configurable.patch similarity index 87% rename from patches/server-remapped/Make-item-validations-configurable.patch rename to patches/server/Make-item-validations-configurable.patch index 3695bf297a..8ad9940241 100644 --- a/patches/server-remapped/Make-item-validations-configurable.patch +++ b/patches/server/Make-item-validations-configurable.patch @@ -48,7 +48,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (tag.contains(RESOLVED.NBT)) { @@ -0,0 +0,0 @@ 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 @@ -63,21 +63,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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(list.size()); + this.lore = new ArrayList(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); } } diff --git a/patches/server-remapped/add-per-world-spawn-limits.patch b/patches/server/add-per-world-spawn-limits.patch similarity index 98% rename from patches/server-remapped/add-per-world-spawn-limits.patch rename to patches/server/add-per-world-spawn-limits.patch index 4f20bb5ca2..d039827a05 100644 --- a/patches/server-remapped/add-per-world-spawn-limits.patch +++ b/patches/server/add-per-world-spawn-limits.patch @@ -36,7 +36,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ 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;