Archiviert
13
0

Some compile fixes

Dieser Commit ist enthalten in:
Nassim Jahnke 2023-06-07 23:35:19 +02:00
Ursprung 838d8afd76
Commit 3c8e176265
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B
22 geänderte Dateien mit 61 neuen und 61 gelöschten Zeilen

Datei anzeigen

@ -7276,7 +7276,7 @@ index 51a0ddcee9a9cb1040fda643a6442d2e2e15b8a0..38ec21faaa16df5485a81a581506700a
public BlockState getBlockState(BlockPos pos) {
int i = pos.getY();
diff --git a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java
index 25156be63f91a1c41ef41154f675d04eb97459a8..ace46eec77b30aee6024e19fec9e50f363da162a 100644
index 25156be63f91a1c41ef41154f675d04eb97459a8..47bab513feec217d875192afef61f3af95b93d24 100644
--- a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java
+++ b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java
@@ -90,6 +90,18 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
@ -7288,7 +7288,7 @@ index 25156be63f91a1c41ef41154f675d04eb97459a8..ace46eec77b30aee6024e19fec9e50f3
+ // I don't want to know why this is a generic type.
+ Entity entityCasted = (Entity)entity;
+ boolean wasRemoved = entityCasted.isRemoved();
+ io.papermc.paper.chunk.system.ChunkSystem.onEntityPreAdd((net.minecraft.server.level.ServerLevel)entityCasted.level, entityCasted);
+ io.papermc.paper.chunk.system.ChunkSystem.onEntityPreAdd((net.minecraft.server.level.ServerLevel) entityCasted.level(), entityCasted);
+ if (!wasRemoved && entityCasted.isRemoved()) {
+ // removed by callback
+ return false;

Datei anzeigen

@ -27,7 +27,7 @@ index da6e806288cf3afc2c72228844d1d05eee8324a5..2905556cbb4715b0dcbaab54222e7666
BlockPos blockposition = this.blockPosition();
boolean flag = this.blockState.getBlock() instanceof ConcretePowderBlock;
diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
index 320966e6e55dad3a96fee25fe0f69135d86ee8bc..c1a1b320a6f2a97e8d51a3e8fac624243603e368 100644
index 320966e6e55dad3a96fee25fe0f69135d86ee8bc..221ce518464332a27c43850c8bc25cd2fe0a9921 100644
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
@@ -66,6 +66,12 @@ public class PrimedTnt extends Entity implements TraceableEntity {
@ -35,7 +35,7 @@ index 320966e6e55dad3a96fee25fe0f69135d86ee8bc..c1a1b320a6f2a97e8d51a3e8fac62424
this.move(MoverType.SELF, this.getDeltaMovement());
+ // Paper start - Configurable TNT entity height nerf
+ if (this.level.paperConfig().fixes.tntEntityHeightNerf.test(v -> this.getY() > v)) {
+ if (this.level().paperConfig().fixes.tntEntityHeightNerf.test(v -> this.getY() > v)) {
+ this.discard();
+ return;
+ }
@ -44,7 +44,7 @@ index 320966e6e55dad3a96fee25fe0f69135d86ee8bc..c1a1b320a6f2a97e8d51a3e8fac62424
if (this.onGround()) {
this.setDeltaMovement(this.getDeltaMovement().multiply(0.7D, -0.5D, 0.7D));
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/MinecartTNT.java b/src/main/java/net/minecraft/world/entity/vehicle/MinecartTNT.java
index 137f9052701c5b10ff03b01316ced37220dbf280..ca61c84cffb4ed80281bbc587f882840964ac92d 100644
index 137f9052701c5b10ff03b01316ced37220dbf280..1f4031cb7a101a7f25d530380974a627cc29bb09 100644
--- a/src/main/java/net/minecraft/world/entity/vehicle/MinecartTNT.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/MinecartTNT.java
@@ -53,6 +53,12 @@ public class MinecartTNT extends AbstractMinecart {
@ -52,7 +52,7 @@ index 137f9052701c5b10ff03b01316ced37220dbf280..ca61c84cffb4ed80281bbc587f882840
super.tick();
if (this.fuse > 0) {
+ // Paper start - Configurable TNT entity height nerf
+ if (this.level.paperConfig().fixes.tntEntityHeightNerf.test(v -> this.getY() > v)) {
+ if (this.level().paperConfig().fixes.tntEntityHeightNerf.test(v -> this.getY() > v)) {
+ this.discard();
+ return;
+ }

Datei anzeigen

@ -94,7 +94,7 @@ index f668a80c6bff67bf766207985c1af73f09e1bd1c..06d8211ef27a21da66d4622795cbcc8b
CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT");
CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Entity being loaded");
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
index 2905556cbb4715b0dcbaab54222e76669ce0e81d..4488d112b280a2020712708940adf65b69ca0a3c 100644
index 2905556cbb4715b0dcbaab54222e76669ce0e81d..6634c0b15213f2c50cfd0f5dde9d5fb8151a3570 100644
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
@@ -341,6 +341,14 @@ public class FallingBlockEntity extends Entity {
@ -106,14 +106,14 @@ index 2905556cbb4715b0dcbaab54222e76669ce0e81d..4488d112b280a2020712708940adf65b
+ int srcX = nbt.getInt("SourceLoc_x");
+ int srcY = nbt.getInt("SourceLoc_y");
+ int srcZ = nbt.getInt("SourceLoc_z");
+ this.setOrigin(new org.bukkit.Location(level.getWorld(), srcX, srcY, srcZ));
+ this.setOrigin(new org.bukkit.Location(this.level().getWorld(), srcX, srcY, srcZ));
+ }
+ // Paper end
}
public void setHurtsEntities(float fallHurtAmount, int fallHurtMax) {
diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
index c1a1b320a6f2a97e8d51a3e8fac624243603e368..223cd451a952addec522711b6d3a0d6c0ab0f797 100644
index 221ce518464332a27c43850c8bc25cd2fe0a9921..50fa14b045a1f75d43d90741245cc4506ed666a0 100644
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
@@ -118,6 +118,14 @@ public class PrimedTnt extends Entity implements TraceableEntity {
@ -125,7 +125,7 @@ index c1a1b320a6f2a97e8d51a3e8fac624243603e368..223cd451a952addec522711b6d3a0d6c
+ int srcX = nbt.getInt("SourceLoc_x");
+ int srcY = nbt.getInt("SourceLoc_y");
+ int srcZ = nbt.getInt("SourceLoc_z");
+ this.setOrigin(new org.bukkit.Location(level.getWorld(), srcX, srcY, srcZ));
+ this.setOrigin(new org.bukkit.Location(this.level().getWorld(), srcX, srcY, srcZ));
+ }
+ // Paper end
}

Datei anzeigen

@ -5,14 +5,14 @@ Subject: [PATCH] Configurable end credits
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 5872ead2fe3a64f02f8bc36603fbb856728fd255..d5fda07eb5408513fa0b4bca3fa14679b2beebe7 100644
index 5872ead2fe3a64f02f8bc36603fbb856728fd255..eb42e0ce8e2698973307e2b6774cbbd79c1d6457 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1024,6 +1024,7 @@ public class ServerPlayer extends Player {
this.unRide();
this.serverLevel().removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
if (!this.wonGame) {
+ if (level.paperConfig().misc.disableEndCredits) this.seenCredits = true; // Paper - Toggle to always disable end credits
+ if (this.level().paperConfig().misc.disableEndCredits) this.seenCredits = true; // Paper - Toggle to always disable end credits
this.wonGame = true;
this.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.WIN_GAME, this.seenCredits ? 0.0F : 1.0F));
this.seenCredits = true;

Datei anzeigen

@ -5,14 +5,14 @@ Subject: [PATCH] Disable explosion knockback
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 3fa9f639a598294b4956c6525fc8a630ae10da2d..da488c4dbf8f6c36cb7cfa64be1645be8a7e4ecf 100644
index 3fa9f639a598294b4956c6525fc8a630ae10da2d..fcc82ba0c632362285903bcdcc6c65069419f295 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1454,10 +1454,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
}
+ boolean knockbackCancelled = level.paperConfig().environment.disableExplosionKnockback && source.is(DamageTypeTags.IS_EXPLOSION) && this instanceof net.minecraft.world.entity.player.Player; // Paper - Disable explosion knockback
+ boolean knockbackCancelled = this.level().paperConfig().environment.disableExplosionKnockback && source.is(DamageTypeTags.IS_EXPLOSION) && this instanceof net.minecraft.world.entity.player.Player; // Paper - Disable explosion knockback
if (flag1) {
if (flag) {
this.level().broadcastEntityEvent(this, (byte) 29);
@ -25,7 +25,7 @@ index 3fa9f639a598294b4956c6525fc8a630ae10da2d..da488c4dbf8f6c36cb7cfa64be1645be
}
}
+ if (knockbackCancelled) this.level.broadcastEntityEvent(this, (byte) 2); // Paper - Disable explosion knockback
+ if (knockbackCancelled) this.level().broadcastEntityEvent(this, (byte) 2); // Paper - Disable explosion knockback
if (this.isDeadOrDying()) {
if (!this.checkTotemDeathProtection(source)) {
SoundEvent soundeffect = this.getDeathSound();

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add BeaconEffectEvent
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
index ff49285fe50e8361c2d4529bf1dda5b54a90e3fe..05d98a0f34ffd50449fbafcf23fe7d05ca721317 100644
index ff49285fe50e8361c2d4529bf1dda5b54a90e3fe..8b79df496e1fad57e8c5c0aa97d0d84ab0deed1e 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
@@ -41,6 +41,10 @@ import net.minecraft.world.phys.AABB;
@ -31,7 +31,7 @@ index ff49285fe50e8361c2d4529bf1dda5b54a90e3fe..05d98a0f34ffd50449fbafcf23fe7d05
Player entityhuman;
+ // Paper start - BeaconEffectEvent
+ org.bukkit.block.Block block = ((Player) list.get(0)).level.getWorld().getBlockAt(worldPosition.getX(), worldPosition.getY(), worldPosition.getZ());
+ org.bukkit.block.Block block = ((Player) list.get(0)).level().getWorld().getBlockAt(worldPosition.getX(), worldPosition.getY(), worldPosition.getZ());
+ PotionEffect effect = CraftPotionUtil.toBukkit(new MobEffectInstance(effects, i, b0, true, true));
+ // Paper end

Datei anzeigen

@ -21,7 +21,7 @@ index b1fcdd896fe76fc96f94b626c5a8ffbcce8008ef..2e3b1eb4c4303d40f12c2e80f0608f23
return true;
diff --git a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
index 9dffdfe5bbd0517e9a2c6a6770eea07b43ef9b33..558b09a482da3035e37c108e60e9d08849017a8d 100644
index 9dffdfe5bbd0517e9a2c6a6770eea07b43ef9b33..af2c8db71b9306da9cae9fa0e56dd7716811cbac 100644
--- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
+++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
@@ -39,13 +39,65 @@ public class ExperienceOrb extends Entity {
@ -49,7 +49,7 @@ index 9dffdfe5bbd0517e9a2c6a6770eea07b43ef9b33..558b09a482da3035e37c108e60e9d088
+ try {
+ this.spawnReason = org.bukkit.entity.ExperienceOrb.SpawnReason.valueOf(reason);
+ } catch (Exception e) {
+ this.level.getCraftServer().getLogger().warning("Invalid spawnReason set for experience orb: " + e.getMessage() + " - " + reason);
+ this.level().getCraftServer().getLogger().warning("Invalid spawnReason set for experience orb: " + e.getMessage() + " - " + reason);
+ }
+ }
+ }
@ -131,7 +131,7 @@ index 9dffdfe5bbd0517e9a2c6a6770eea07b43ef9b33..558b09a482da3035e37c108e60e9d088
@Override
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index ad9f1b9b7adc799af751bfbd0ee6fe6d27a58851..61ee6996b412d74c0d4e632ef05992c6e93187d0 100644
index 323b3a561060eacaad37832f44d0cdb9e4a1a2dc..565d0349328b7ae5fcbdf1682dcedff937457f92 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1769,7 +1769,8 @@ public abstract class LivingEntity extends Entity implements Attackable {

Datei anzeigen

@ -24,7 +24,7 @@ index 20d5a46c4022dfea24f275fe143c32b8ddf629cb..568631c8711788053af407574ab928cb
private org.bukkit.util.Vector origin;
@javax.annotation.Nullable
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 61ee6996b412d74c0d4e632ef05992c6e93187d0..a266f06422ddf52666eb11663cbf287279245596 100644
index 565d0349328b7ae5fcbdf1682dcedff937457f92..e173f7f020bc25ba68bc5c4e82cbcb7abd6c7d75 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3327,8 +3327,11 @@ public abstract class LivingEntity extends Entity implements Attackable {
@ -32,8 +32,8 @@ index 61ee6996b412d74c0d4e632ef05992c6e93187d0..a266f06422ddf52666eb11663cbf2872
}
- for (j = 0; j < list.size(); ++j) {
+ this.numCollisions = Math.max(0, this.numCollisions - this.level.paperConfig().collisions.maxEntityCollisions); // Paper
+ for (j = 0; j < list.size() && this.numCollisions < this.level.paperConfig().collisions.maxEntityCollisions; ++j) { // Paper
+ this.numCollisions = Math.max(0, this.numCollisions - this.level().paperConfig().collisions.maxEntityCollisions); // Paper
+ for (j = 0; j < list.size() && this.numCollisions < this.level().paperConfig().collisions.maxEntityCollisions; ++j) { // Paper
Entity entity = (Entity) list.get(j);
+ entity.numCollisions++; // Paper
+ this.numCollisions++; // Paper

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Make shield blocking delay configurable
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index bb5cff4ddf9c442f93a87dff8ab2aeb16a0f7c04..74c3762ebcb17d3836991f0293f02f5c42081715 100644
index c3ad63e1882d53f4207f4f08b55088d175360e8d..f894ffb7c9575d7337353ab8aaaf0b9607a92146 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3760,12 +3760,24 @@ public abstract class LivingEntity extends Entity implements Attackable {
@ -20,7 +20,7 @@ index bb5cff4ddf9c442f93a87dff8ab2aeb16a0f7c04..74c3762ebcb17d3836991f0293f02f5c
}
+ // Paper start
+ public int shieldBlockingDelay = level.paperConfig().misc.shieldBlockingDelay;
+ public int shieldBlockingDelay = this.level().paperConfig().misc.shieldBlockingDelay;
+
+ public int getShieldBlockingDelay() {
+ return shieldBlockingDelay;

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add TNTPrimeEvent
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
index 9d5d03a913366c0f60557e39523c30df7e2fde33..655f23ab6d594db838acca7baede45594ce1fd79 100644
index 9d5d03a913366c0f60557e39523c30df7e2fde33..fada988941c33e09bce5e71bcb2bb733185f6c12 100644
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
@@ -567,6 +567,11 @@ public class EnderDragon extends Mob implements Enemy {
@ -13,7 +13,7 @@ index 9d5d03a913366c0f60557e39523c30df7e2fde33..655f23ab6d594db838acca7baede4559
craftBlock.getNMS().spawnAfterBreak((ServerLevel) this.level(), blockposition, ItemStack.EMPTY, false);
}
+ // Paper start - TNTPrimeEvent
+ org.bukkit.block.Block tntBlock = level.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
+ org.bukkit.block.Block tntBlock = this.level().getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
+ if(!new com.destroystokyo.paper.event.block.TNTPrimeEvent(tntBlock, com.destroystokyo.paper.event.block.TNTPrimeEvent.PrimeReason.EXPLOSION, explosionSource.getIndirectSourceEntity().getBukkitEntity()).callEvent())
+ continue;
+ // Paper end

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add ray tracing methods to LivingEntity
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index eeeaf05cb49e3440bfa3ab94048653f75e6a42da..04926662cdb3feba1ea9ceea51be0c41f3ff227e 100644
index 221fa0ca2f1c6e099da5b47ba42548262132d6de..f3af1c540b59819375f70ffbda6135601802cdbc 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3781,6 +3781,20 @@ public abstract class LivingEntity extends Entity implements Attackable {
@ -23,10 +23,10 @@ index eeeaf05cb49e3440bfa3ab94048653f75e6a42da..04926662cdb3feba1ea9ceea51be0c41
+ Vec3 end = new Vec3(start.x + dir.getX(), start.y + dir.getY(), start.z + dir.getZ());
+ ClipContext raytrace = new ClipContext(start, end, ClipContext.Block.OUTLINE, fluidCollisionOption, this);
+
+ return level.clip(raytrace);
+ return this.level().clip(raytrace);
+ }
+
public int shieldBlockingDelay = level.paperConfig().misc.shieldBlockingDelay;
public int shieldBlockingDelay = this.level().paperConfig().misc.shieldBlockingDelay;
public int getShieldBlockingDelay() {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java

Datei anzeigen

@ -19,7 +19,7 @@ public net.minecraft.world.entity.LivingEntity getDeathSound()Lnet/minecraft/sou
public net.minecraft.world.entity.LivingEntity getSoundVolume()F
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 4885dd69d6f63666a38b6d8d859c1dd858d38ad0..e41abf22992d9348cc3c63866b01a5dbf02d6a2c 100644
index 2eff7e1f6b63a3a72e1595a089e9ee47f42bba06..35bf922f7995074dd875474cc3d5577dbdb72dad 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -243,6 +243,10 @@ public class ServerPlayer extends Player {
@ -70,7 +70,7 @@ index 4885dd69d6f63666a38b6d8d859c1dd858d38ad0..e41abf22992d9348cc3c63866b01a5db
}
}
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 04926662cdb3feba1ea9ceea51be0c41f3ff227e..e1780e5eec0171cc39b0bc27d48c0ce167ebec5d 100644
index 0238b8a11f457dd667b079a35e44ac5e19a2e0cf..41a729e19abe04ad54ee2267565c935234fb6c41 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -261,6 +261,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@ -82,7 +82,7 @@ index 04926662cdb3feba1ea9ceea51be0c41f3ff227e..e1780e5eec0171cc39b0bc27d48c0ce1
@Override
public float getBukkitYaw() {
@@ -1504,13 +1505,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
if (knockbackCancelled) this.level.broadcastEntityEvent(this, (byte) 2); // Paper - Disable explosion knockback
if (knockbackCancelled) this.level().broadcastEntityEvent(this, (byte) 2); // Paper - Disable explosion knockback
if (this.isDeadOrDying()) {
if (!this.checkTotemDeathProtection(source)) {
- SoundEvent soundeffect = this.getDeathSound();

Datei anzeigen

@ -12,7 +12,7 @@ public net.minecraft.world.level.pathfinder.Path nodes
diff --git a/src/main/java/com/destroystokyo/paper/entity/PaperPathfinder.java b/src/main/java/com/destroystokyo/paper/entity/PaperPathfinder.java
new file mode 100644
index 0000000000000000000000000000000000000000..2d799fec40afe7dade649a294761d272c83157f0
index 0000000000000000000000000000000000000000..7ba7add6475ff8d238897398c26de24de52c4cfd
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/entity/PaperPathfinder.java
@@ -0,0 +1,143 @@
@ -156,7 +156,7 @@ index 0000000000000000000000000000000000000000..2d799fec40afe7dade649a294761d272
+ }
+
+ private Location toLoc(Node point) {
+ return new Location(entity.level.getWorld(), point.x, point.y, point.z);
+ return new Location(entity.level().getWorld(), point.x, point.y, point.z);
+ }
+}
diff --git a/src/main/java/net/minecraft/world/level/pathfinder/Path.java b/src/main/java/net/minecraft/world/level/pathfinder/Path.java

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add LivingEntity#getTargetEntity
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index e1780e5eec0171cc39b0bc27d48c0ce167ebec5d..6be24dea49918cb377cd21e55927c304e288ed2b 100644
index daedfacb24f74f9487a8c89db5c8b20cf0bc742d..8c4be74a973add0028ba3180d04c6b0a23b625b2 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -117,6 +117,7 @@ import net.minecraft.world.level.storage.loot.LootTable;
@ -17,7 +17,7 @@ index e1780e5eec0171cc39b0bc27d48c0ce167ebec5d..6be24dea49918cb377cd21e55927c304
import net.minecraft.world.phys.Vec3;
import net.minecraft.world.scores.PlayerTeam;
@@ -3840,6 +3841,38 @@ public abstract class LivingEntity extends Entity implements Attackable {
return level.clip(raytrace);
return this.level().clip(raytrace);
}
+ public @Nullable EntityHitResult getTargetEntity(int maxDistance) {
@ -29,7 +29,7 @@ index e1780e5eec0171cc39b0bc27d48c0ce167ebec5d..6be24dea49918cb377cd21e55927c304
+ Vec3 direction = this.getLookAngle();
+ Vec3 end = start.add(direction.x * maxDistance, direction.y * maxDistance, direction.z * maxDistance);
+
+ List<Entity> entityList = level.getEntities(this, getBoundingBox().expandTowards(direction.x * maxDistance, direction.y * maxDistance, direction.z * maxDistance).inflate(1.0D, 1.0D, 1.0D), EntitySelector.NO_SPECTATORS.and(Entity::isPickable));
+ List<Entity> entityList = this.level().getEntities(this, getBoundingBox().expandTowards(direction.x * maxDistance, direction.y * maxDistance, direction.z * maxDistance).inflate(1.0D, 1.0D, 1.0D), EntitySelector.NO_SPECTATORS.and(Entity::isPickable));
+
+ double distance = 0.0D;
+ EntityHitResult result = null;
@ -52,7 +52,7 @@ index e1780e5eec0171cc39b0bc27d48c0ce167ebec5d..6be24dea49918cb377cd21e55927c304
+ return result;
+ }
+
public int shieldBlockingDelay = level.paperConfig().misc.shieldBlockingDelay;
public int shieldBlockingDelay = this.level().paperConfig().misc.shieldBlockingDelay;
public int getShieldBlockingDelay() {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java

Datei anzeigen

@ -25,7 +25,7 @@ index 60e291abb3ebdf8676c13a2138d8eb436d033fa2..d27e5f9dac4703b839ab8444f6b54bf5
private final int searchRange;
private final int verticalSearchRange;
diff --git a/src/main/java/net/minecraft/world/entity/animal/Turtle.java b/src/main/java/net/minecraft/world/entity/animal/Turtle.java
index fcd760cb88f84ff79811631612956fde79905132..8ad2fc2e4c958f63712d9a66b1de18cf6c48d8e9 100644
index fcd760cb88f84ff79811631612956fde79905132..99fc97051c61ac8d08afdc0ea4845e96705e243b 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Turtle.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Turtle.java
@@ -487,15 +487,18 @@ public class Turtle extends Animal {
@ -33,7 +33,7 @@ index fcd760cb88f84ff79811631612956fde79905132..8ad2fc2e4c958f63712d9a66b1de18cf
if (!this.turtle.isInWater() && this.isReachedTarget()) {
if (this.turtle.layEggCounter < 1) {
- this.turtle.setLayingEgg(true);
+ this.turtle.setLayingEgg(new com.destroystokyo.paper.event.entity.TurtleStartDiggingEvent((org.bukkit.entity.Turtle) this.turtle.getBukkitEntity(), io.papermc.paper.util.MCUtil.toLocation(this.turtle.level, this.getTargetPosition())).callEvent()); // Paper
+ this.turtle.setLayingEgg(new com.destroystokyo.paper.event.entity.TurtleStartDiggingEvent((org.bukkit.entity.Turtle) this.turtle.getBukkitEntity(), io.papermc.paper.util.MCUtil.toLocation(this.turtle.level(), this.getTargetPosition())).callEvent()); // Paper
} else if (this.turtle.layEggCounter > this.adjustedTickDelay(200)) {
Level world = this.turtle.level();
@ -41,7 +41,7 @@ index fcd760cb88f84ff79811631612956fde79905132..8ad2fc2e4c958f63712d9a66b1de18cf
- if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.turtle, this.blockPos.above(), (BlockState) Blocks.TURTLE_EGG.defaultBlockState().setValue(TurtleEggBlock.EGGS, this.turtle.random.nextInt(4) + 1)).isCancelled()) {
+ // Paper start
+ int eggCount = this.turtle.random.nextInt(4) + 1;
+ com.destroystokyo.paper.event.entity.TurtleLayEggEvent layEggEvent = new com.destroystokyo.paper.event.entity.TurtleLayEggEvent((org.bukkit.entity.Turtle) this.turtle.getBukkitEntity(), io.papermc.paper.util.MCUtil.toLocation(this.turtle.level, this.blockPos.above()), eggCount);
+ com.destroystokyo.paper.event.entity.TurtleLayEggEvent layEggEvent = new com.destroystokyo.paper.event.entity.TurtleLayEggEvent((org.bukkit.entity.Turtle) this.turtle.getBukkitEntity(), io.papermc.paper.util.MCUtil.toLocation(this.turtle.level(), this.blockPos.above()), eggCount);
+ if (layEggEvent.callEvent() && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.turtle, this.blockPos.above(), Blocks.TURTLE_EGG.defaultBlockState().setValue(TurtleEggBlock.EGGS, layEggEvent.getEggCount())).isCancelled()) {
world.playSound((Player) null, blockposition, SoundEvents.TURTLE_LAY_EGG, SoundSource.BLOCKS, 0.3F, 0.9F + world.random.nextFloat() * 0.2F);
BlockPos blockposition1 = this.blockPos.above();

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Check Drowned for Villager Aggression Config
diff --git a/src/main/java/net/minecraft/world/entity/monster/Drowned.java b/src/main/java/net/minecraft/world/entity/monster/Drowned.java
index 3e4fde2736feb03af2116cd218358845cd8f99d8..a1dec28207e4289c8cd5eb3d6c56358055ebecfb 100644
index 3e4fde2736feb03af2116cd218358845cd8f99d8..991d728db2a3b64316fc2102cf3aee470327a62e 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Drowned.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Drowned.java
@@ -78,7 +78,7 @@ public class Drowned extends Zombie implements RangedAttackMob {
@ -13,7 +13,7 @@ index 3e4fde2736feb03af2116cd218358845cd8f99d8..a1dec28207e4289c8cd5eb3d6c563580
this.targetSelector.addGoal(1, (new HurtByTargetGoal(this, new Class[]{Drowned.class})).setAlertOthers(ZombifiedPiglin.class));
this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, 10, true, false, this::okTarget));
- this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, AbstractVillager.class, false));
+ if (this.level.spigotConfig.zombieAggressiveTowardsVillager) this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, AbstractVillager.class, false)); // Paper
+ if (this.level().spigotConfig.zombieAggressiveTowardsVillager) this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, AbstractVillager.class, false)); // Paper
this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, IronGolem.class, true));
this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, Axolotl.class, true, false));
this.targetSelector.addGoal(5, new NearestAttackableTargetGoal<>(this, Turtle.class, 10, true, false, Turtle.BABY_ON_LAND_SELECTOR));

Datei anzeigen

@ -17,7 +17,7 @@ This should fully solve all of the issues around it so that only natural
influences natural spawns.
diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
index 029835914c3c88811684e90b29bfed83191b3b3f..05c014c5f0805d50cfd251b043c79ce3355eef16 100644
index 029835914c3c88811684e90b29bfed83191b3b3f..f22e1d76586980edb2dc962b4d55ad7a542b61a7 100644
--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java
+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
@@ -88,6 +88,13 @@ public final class NaturalSpawner {
@ -25,7 +25,7 @@ index 029835914c3c88811684e90b29bfed83191b3b3f..05c014c5f0805d50cfd251b043c79ce3
if (enumcreaturetype != MobCategory.MISC) {
+ // Paper start - Only count natural spawns
+ if (!entity.level.paperConfig().entities.spawning.countAllMobsForSpawning &&
+ if (!entity.level().paperConfig().entities.spawning.countAllMobsForSpawning &&
+ !(entity.spawnReason == org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL ||
+ entity.spawnReason == org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CHUNK_GEN)) {
+ continue;

Datei anzeigen

@ -25,7 +25,7 @@ P3) Solutions for 1) and especially 2) might not be future-proof, while this
server-internal fix makes this change future-proof.
diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
index e5da57b35cd82ee7b4e844cfe74289a71d38779a..62b111b83dedd145d678e592b9ffdc286bfb7486 100644
index e5da57b35cd82ee7b4e844cfe74289a71d38779a..24b549cb21926a02d736f0bbb991006b9453068d 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
@@ -165,7 +165,7 @@ public abstract class Projectile extends Entity implements TraceableEntity {
@ -33,7 +33,7 @@ index e5da57b35cd82ee7b4e844cfe74289a71d38779a..62b111b83dedd145d678e592b9ffdc28
Vec3 vec3d = shooter.getDeltaMovement();
- this.setDeltaMovement(this.getDeltaMovement().add(vec3d.x, shooter.onGround() ? 0.0D : vec3d.y, vec3d.z));
+ if (!shooter.level.paperConfig().misc.disableRelativeProjectileVelocity) this.setDeltaMovement(this.getDeltaMovement().add(vec3d.x, shooter.onGround() ? 0.0D : vec3d.y, vec3d.z)); // Paper - allow disabling relative velocity
+ if (!shooter.level().paperConfig().misc.disableRelativeProjectileVelocity) this.setDeltaMovement(this.getDeltaMovement().add(vec3d.x, shooter.onGround() ? 0.0D : vec3d.y, vec3d.z)); // Paper - allow disabling relative velocity
}
// CraftBukkit start - call projectile hit event

Datei anzeigen

@ -5,14 +5,14 @@ Subject: [PATCH] MC-145656 Fix Follow Range Initial Target
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/target/NearestAttackableTargetGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/target/NearestAttackableTargetGoal.java
index 0dad5be671f990d0edf0a155e2534b3812438902..63cd37a5e1a44cae269c9f25e1b6a730bc265de8 100644
index 0dad5be671f990d0edf0a155e2534b3812438902..370e601ff5adccc3924055b69b42dd2f1970ae45 100644
--- a/src/main/java/net/minecraft/world/entity/ai/goal/target/NearestAttackableTargetGoal.java
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/target/NearestAttackableTargetGoal.java
@@ -38,6 +38,7 @@ public class NearestAttackableTargetGoal<T extends LivingEntity> extends TargetG
this.randomInterval = reducedTickDelay(reciprocalChance);
this.setFlags(EnumSet.of(Goal.Flag.TARGET));
this.targetConditions = TargetingConditions.forCombat().range(this.getFollowDistance()).selector(targetPredicate);
+ if (mob.level.paperConfig().entities.entitiesTargetWithFollowRange) this.targetConditions.useFollowRange(); // Paper
+ if (mob.level().paperConfig().entities.entitiesTargetWithFollowRange) this.targetConditions.useFollowRange(); // Paper
}
@Override

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Optimise EntityGetter#getPlayerByUUID
Use the PlayerList map instead of iterating over all players
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index bfa12c4e44b089c4c1b03c7b8ec80774e29bd4ae..a4a48f602010b88423cc8135c98d416b26640022 100644
index bfa12c4e44b089c4c1b03c7b8ec80774e29bd4ae..388027f773995832171d51209f17e366965fd1f4 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -326,6 +326,15 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -18,7 +18,7 @@ index bfa12c4e44b089c4c1b03c7b8ec80774e29bd4ae..a4a48f602010b88423cc8135c98d416b
+ @Override
+ public Player getPlayerByUUID(UUID uuid) {
+ final Player player = this.getServer().getPlayerList().getPlayer(uuid);
+ return player != null && player.level == this ? player : null;
+ return player != null && player.level() == this ? player : null;
+ }
+ // Paper end
+

Datei anzeigen

@ -18,7 +18,7 @@ public net.minecraft.world.entity.Entity isInsidePortal
public net.minecraft.world.entity.LivingEntity jumping
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index a4a48f602010b88423cc8135c98d416b26640022..af663f9318dceac52ad7b7fb71a1020208bbc5ee 100644
index 388027f773995832171d51209f17e366965fd1f4..1ea55cced137e16dd2aebd705ea8b4494c43bc4f 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2,7 +2,6 @@ package net.minecraft.server.level;
@ -252,7 +252,7 @@ index d27e5f9dac4703b839ab8444f6b54bf54d58af86..34f319ad09276c6f68dde449c79351de
}
}
diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java
index 73a5750dd47cf8869070f92594cfb926193c8761..3d36b121ca16f84efe9331c182a959227d35630e 100644
index 73a5750dd47cf8869070f92594cfb926193c8761..1e775178f346ef3d2f121e539ba81a75c8a37c36 100644
--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java
+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java
@@ -226,17 +226,34 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
@ -266,10 +266,10 @@ index 73a5750dd47cf8869070f92594cfb926193c8761..3d36b121ca16f84efe9331c182a95922
+ this.setUnhappyCounter(this.getUnhappyCounter() - 1);
}
+ if (this.isEffectiveAi()) {
+ if (level.spigotConfig.tickInactiveVillagers) {
+ if (this.level().spigotConfig.tickInactiveVillagers) {
+ this.customServerAiStep();
+ } else {
+ this.mobTick(true);
+ this.customServerAiStep(true);
+ }
+ }
+ maybeDecayGossip();
@ -380,7 +380,7 @@ index 45f55c79a9d105f732054d61c4cf83eb5db49762..17a6327ab7b26dfab38881bbc0689b0b
}
}
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
index 9527b702fa823f00852e409a53cae772943dbe09..5f822417377b58f6952fa6e44a6e486047e354a2 100644
index 9527b702fa823f00852e409a53cae772943dbe09..ae56865222ab9b49e747cd7ee4031a1804235d52 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -1,39 +1,52 @@
@ -453,7 +453,7 @@ index 9527b702fa823f00852e409a53cae772943dbe09..5f822417377b58f6952fa6e44a6e4860
+ };
+
+ private static int checkInactiveWakeup(Entity entity) {
+ Level world = entity.level;
+ Level world = entity.level();
+ SpigotWorldConfig config = world.spigotConfig;
+ long inactiveFor = MinecraftServer.currentTick - entity.activatedTick;
+ if (entity.activationType == ActivationType.VILLAGER) {
@ -574,7 +574,7 @@ index 9527b702fa823f00852e409a53cae772943dbe09..5f822417377b58f6952fa6e44a6e4860
+ public static int checkEntityImmunities(Entity entity) // Paper - return # of ticks to get immunity
{
+ // Paper start
+ SpigotWorldConfig config = entity.level.spigotConfig;
+ SpigotWorldConfig config = entity.level().spigotConfig;
+ int inactiveWakeUpImmunity = checkInactiveWakeup(entity);
+ if (inactiveWakeUpImmunity > -1) {
+ return inactiveWakeUpImmunity;
@ -595,7 +595,7 @@ index 9527b702fa823f00852e409a53cae772943dbe09..5f822417377b58f6952fa6e44a6e4860
+ return 100; // Paper
+ }
+ // Paper start
+ if ( !entity.isOnGround() || entity.getDeltaMovement().horizontalDistanceSqr() > 9.999999747378752E-6D )
+ if ( !entity.onGround() || entity.getDeltaMovement().horizontalDistanceSqr() > 9.999999747378752E-6D )
+ {
+ return 100;
}

Datei anzeigen

@ -35,7 +35,7 @@ index 02ea0298c6dc6ed3d4350e562c255e748ca141ae..536856300da929c101f50da5827677ba
@@ -358,6 +360,10 @@ public class FallingBlockEntity extends Entity {
int srcZ = nbt.getInt("SourceLoc_z");
this.setOrigin(new org.bukkit.Location(level.getWorld(), srcX, srcY, srcZ));
this.setOrigin(new org.bukkit.Location(this.level().getWorld(), srcX, srcY, srcZ));
}
+
+ if (nbt.contains("Paper.AutoExpire")) {