More more more patches

This commit is contained in:
Nassim Jahnke 2023-03-14 19:59:51 +01:00
parent c02edac0c7
commit 8f5ec00c38
98 changed files with 82 additions and 102 deletions

View file

@ -9,4 +9,3 @@
# minecraft net.minecraft.world.level.entity.LevelEntityGetterAdapter # minecraft net.minecraft.world.level.entity.LevelEntityGetterAdapter
# minecraft net/minecraft/world/level/entity/LevelEntityGetter.java # minecraft net/minecraft/world/level/entity/LevelEntityGetter.java
minecraft net.minecraft.WorldVersion

View file

@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.updateStatusIcon(this.status); this.status = this.buildServerStatus();
// Spigot start // Spigot start
+ org.spigotmc.WatchdogThread.hasStarted = true; // Paper + org.spigotmc.WatchdogThread.hasStarted = true; // Paper

View file

@ -33,7 +33,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Override @Override
@@ -0,0 +0,0 @@ public class Phantom extends FlyingMob implements Enemy { @@ -0,0 +0,0 @@ public class Phantom extends FlyingMob implements Enemy {
return entitysize.scale(f); return (double) this.getEyeHeight();
} }
+ // Paper start + // Paper start

View file

@ -15,7 +15,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity { @@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
ItemStack itemstack1 = this.getItemBySlot(enumitemslot); ItemStack itemstack1 = this.getItemBySlot(enumitemslot);
if (this.equipmentHasChanged(itemstack, itemstack1)) { if (this.equipmentHasChanged(itemstack, itemstack1)) {

View file

@ -20,5 +20,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ entity = new net.minecraft.world.entity.item.ItemEntity(world, x, y, z, new net.minecraft.world.item.ItemStack(net.minecraft.world.item.Item.byBlock(net.minecraft.world.level.block.Blocks.DIRT))); + entity = new net.minecraft.world.entity.item.ItemEntity(world, x, y, z, new net.minecraft.world.item.ItemStack(net.minecraft.world.item.Item.byBlock(net.minecraft.world.level.block.Blocks.DIRT)));
+ // Paper end + // Paper end
} else if (FallingBlock.class.isAssignableFrom(clazz)) { } else if (FallingBlock.class.isAssignableFrom(clazz)) {
BlockPos pos = new BlockPos(x, y, z); BlockPos pos = BlockPos.containing(x, y, z);
entity = FallingBlockEntity.fall(world, pos, this.getHandle().getBlockState(pos)); entity = FallingBlockEntity.fall(world, pos, this.getHandle().getBlockState(pos));

View file

@ -36,7 +36,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java --- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java +++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
@@ -0,0 +0,0 @@ public abstract class Projectile extends Entity { @@ -0,0 +0,0 @@ public abstract class Projectile extends Entity implements TraceableEntity {
protected void readAdditionalSaveData(CompoundTag nbt) { protected void readAdditionalSaveData(CompoundTag nbt) {
if (nbt.hasUUID("Owner")) { if (nbt.hasUUID("Owner")) {
this.ownerUUID = nbt.getUUID("Owner"); this.ownerUUID = nbt.getUUID("Owner");

View file

@ -34,26 +34,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.teleport(); this.teleport();
} }
@@ -0,0 +0,0 @@ public class EnderMan extends Monster implements NeutralMob { @@ -0,0 +0,0 @@ public class EnderMan extends Monster implements NeutralMob {
flag = false; } else {
} flag1 = flag && this.hurtWithCleanWater(source, (ThrownPotion) source.getDirectEntity(), amount);
+ if (this.tryEscape(com.destroystokyo.paper.event.entity.EndermanEscapeEvent.Reason.INDIRECT)) { // Paper start + if (this.tryEscape(com.destroystokyo.paper.event.entity.EndermanEscapeEvent.Reason.INDIRECT)) { // Paper start
for (int i = 0; i < 64; ++i) { for (int i = 0; i < 64; ++i) {
if (this.teleport()) { if (this.teleport()) {
return true; return true;
}
} }
+ } // Paper end
return flag1;
} }
+ } // Paper end
return flag;
} else {
boolean flag1 = super.hurt(source, amount);
- if (!this.level.isClientSide() && !(source.getEntity() instanceof LivingEntity) && this.random.nextInt(10) != 0) {
+ if (!this.level.isClientSide() && !(source.getEntity() instanceof LivingEntity) && this.random.nextInt(10) != 0 && this.tryEscape(source == DamageSource.DROWN ? com.destroystokyo.paper.event.entity.EndermanEscapeEvent.Reason.DROWN : com.destroystokyo.paper.event.entity.EndermanEscapeEvent.Reason.INDIRECT)) { // Paper - use to be critical hits as else, but mojang removed critical hits in 1.16.2 due to MC-185684
this.teleport();
}
@@ -0,0 +0,0 @@ public class EnderMan extends Monster implements NeutralMob { @@ -0,0 +0,0 @@ public class EnderMan extends Monster implements NeutralMob {
} else { } else {
if (this.target != null && !this.enderman.isPassenger()) { if (this.target != null && !this.enderman.isPassenger()) {

View file

@ -36,16 +36,16 @@ diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/ma
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/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 { @@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
d0 = (Math.random() - Math.random()) * 0.01D;
} }
this.hurtDir = (float) (Mth.atan2(d1, d0) * 57.2957763671875D - (double) this.getYRot());
- this.knockback(0.4000000059604645D, d0, d1); - this.knockback(0.4000000059604645D, d0, d1);
+ this.knockback(0.4000000059604645D, d0, d1, entity1); // Paper + this.knockback(0.4000000059604645D, d0, d1, entity1); // Paper
} else { if (!flag) {
this.hurtDir = (float) ((int) (Math.random() * 2.0D) * 180); this.indicateDamage(d0, d1);
} }
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity { @@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
} }
protected void blockedByShield(LivingEntity target) { protected void blockedByShield(LivingEntity target) {
@ -54,7 +54,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
private boolean checkTotemDeathProtection(DamageSource source) { private boolean checkTotemDeathProtection(DamageSource source) {
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity { @@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
} }
public void knockback(double strength, double x, double z) { public void knockback(double strength, double x, double z) {
@ -66,7 +66,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
strength *= 1.0D - this.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE); strength *= 1.0D - this.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE);
if (strength > 0.0D) { if (strength > 0.0D) {
this.hasImpulse = true; this.hasImpulse = true;
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity { @@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
Vec3 vec3d1 = (new Vec3(x, 0.0D, z)).normalize().scale(strength); Vec3 vec3d1 = (new Vec3(x, 0.0D, z)).normalize().scale(strength);
this.setDeltaMovement(vec3d.x / 2.0D - vec3d1.x, this.onGround ? Math.min(0.4D, vec3d.y / 2.0D + strength) : vec3d.y, vec3d.z / 2.0D - vec3d1.z); this.setDeltaMovement(vec3d.x / 2.0D - vec3d1.x, this.onGround ? Math.min(0.4D, vec3d.y / 2.0D + strength) : vec3d.y, vec3d.z / 2.0D - vec3d1.z);
@ -86,7 +86,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/n
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java --- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity { @@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity implements Targeting {
if (flag) { if (flag) {
if (f1 > 0.0F && target instanceof LivingEntity) { if (f1 > 0.0F && target instanceof LivingEntity) {
@ -102,7 +102,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class RamTarget extends Behavior<Goat> { @@ -0,0 +0,0 @@ public class RamTarget extends Behavior<Goat> {
float f = 0.25F * (float)(i - j); float f = 0.25F * (float)(i - j);
float g = Mth.clamp(entity.getSpeed() * 1.65F, 0.2F, 3.0F) + f; float g = Mth.clamp(entity.getSpeed() * 1.65F, 0.2F, 3.0F) + f;
float h = livingEntity.isDamageSourceBlocked(DamageSource.mobAttack(entity)) ? 0.5F : 1.0F; float h = livingEntity.isDamageSourceBlocked(world.damageSources().mobAttack(entity)) ? 0.5F : 1.0F;
- livingEntity.knockback((double)(h * g) * this.getKnockbackForce.applyAsDouble(entity), this.ramDirection.x(), this.ramDirection.z()); - livingEntity.knockback((double)(h * g) * this.getKnockbackForce.applyAsDouble(entity), this.ramDirection.x(), this.ramDirection.z());
+ livingEntity.knockback((double)(h * g) * this.getKnockbackForce.applyAsDouble(entity), this.ramDirection.x(), this.ramDirection.z(), entity); // Paper + livingEntity.knockback((double)(h * g) * this.getKnockbackForce.applyAsDouble(entity), this.ramDirection.x(), this.ramDirection.z(), entity); // Paper
this.finishRam(world, entity); this.finishRam(world, entity);
@ -113,7 +113,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/warden/SonicBoom.java --- a/src/main/java/net/minecraft/world/entity/ai/behavior/warden/SonicBoom.java
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/warden/SonicBoom.java +++ b/src/main/java/net/minecraft/world/entity/ai/behavior/warden/SonicBoom.java
@@ -0,0 +0,0 @@ public class SonicBoom extends Behavior<Warden> { @@ -0,0 +0,0 @@ public class SonicBoom extends Behavior<Warden> {
target.hurt(DamageSource.sonicBoom(entity), 10.0F); target.hurt(world.damageSources().sonicBoom(entity), 10.0F);
double d = 0.5D * (1.0D - target.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE)); double d = 0.5D * (1.0D - target.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE));
double e = 2.5D * (1.0D - target.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE)); double e = 2.5D * (1.0D - target.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE));
- target.push(vec33.x() * e, vec33.y() * d, vec33.z() * e); - target.push(vec33.x() * e, vec33.y() * d, vec33.z() * e);
@ -132,7 +132,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- entity.push(d2 / d4 * 4.0D, 0.20000000298023224D, d3 / d4 * 4.0D); - entity.push(d2 / d4 * 4.0D, 0.20000000298023224D, d3 / d4 * 4.0D);
+ entity.push(d2 / d4 * 4.0D, 0.20000000298023224D, d3 / d4 * 4.0D, this); // Paper + entity.push(d2 / d4 * 4.0D, 0.20000000298023224D, d3 / d4 * 4.0D, this); // Paper
if (!this.phaseManager.getCurrentPhase().isSitting() && ((LivingEntity) entity).getLastHurtByMobTimestamp() < entity.tickCount - 2) { if (!this.phaseManager.getCurrentPhase().isSitting() && ((LivingEntity) entity).getLastHurtByMobTimestamp() < entity.tickCount - 2) {
entity.hurt(DamageSource.mobAttack(this), 5.0F); entity.hurt(this.damageSources().mobAttack(this), 5.0F);
this.doEnchantDamageEffects(this, entity); this.doEnchantDamageEffects(this, entity);
diff --git a/src/main/java/net/minecraft/world/entity/monster/Ravager.java b/src/main/java/net/minecraft/world/entity/monster/Ravager.java diff --git a/src/main/java/net/minecraft/world/entity/monster/Ravager.java b/src/main/java/net/minecraft/world/entity/monster/Ravager.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
@ -179,9 +179,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public abstract class Player extends LivingEntity { @@ -0,0 +0,0 @@ public abstract class Player extends LivingEntity {
if (entityliving != this && entityliving != target && !this.isAlliedTo((Entity) entityliving) && (!(entityliving instanceof ArmorStand) || !((ArmorStand) entityliving).isMarker()) && this.distanceToSqr((Entity) entityliving) < 9.0D) { if (entityliving != this && entityliving != target && !this.isAlliedTo((Entity) entityliving) && (!(entityliving instanceof ArmorStand) || !((ArmorStand) entityliving).isMarker()) && this.distanceToSqr((Entity) entityliving) < 9.0D) {
// CraftBukkit start - Only apply knockback if the damage hits // CraftBukkit start - Only apply knockback if the damage hits
if (entityliving.hurt(DamageSource.playerAttack(this).sweep(), f4)) { if (entityliving.hurt(this.damageSources().playerAttack(this).sweep(), f4)) {
- entityliving.knockback(0.4000000059604645D, (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F))); - entityliving.knockback(0.4000000059604645D, (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)));
+ entityliving.knockback(0.4000000059604645D, (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)), this); // Paper + entityliving.knockback(0.4000000059604645D, (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)), this); // Pa
} }
// CraftBukkit end // CraftBukkit end
} }

View file

@ -174,27 +174,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ +
+} +}
diff --git a/src/main/java/net/minecraft/network/protocol/status/ClientboundStatusResponsePacket.java b/src/main/java/net/minecraft/network/protocol/status/ClientboundStatusResponsePacket.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/network/protocol/status/ClientboundStatusResponsePacket.java
+++ b/src/main/java/net/minecraft/network/protocol/status/ClientboundStatusResponsePacket.java
@@ -0,0 +0,0 @@ import net.minecraft.util.GsonHelper;
import net.minecraft.util.LowerCaseEnumTypeAdapterFactory;
public class ClientboundStatusResponsePacket implements Packet<ClientStatusPacketListener> {
- private static final Gson GSON = (new GsonBuilder()).registerTypeAdapter(ServerStatus.Version.class, new ServerStatus.Version.Serializer()).registerTypeAdapter(ServerStatus.Players.class, new ServerStatus.Players.Serializer()).registerTypeAdapter(ServerStatus.class, new ServerStatus.Serializer()).registerTypeHierarchyAdapter(Component.class, new Component.Serializer()).registerTypeHierarchyAdapter(Style.class, new Style.Serializer()).registerTypeAdapterFactory(new LowerCaseEnumTypeAdapterFactory()).create();
+ private static final Gson GSON = (new GsonBuilder()).registerTypeAdapter(ServerStatus.Version.class, new ServerStatus.Version.Serializer()).registerTypeAdapter(ServerStatus.Players.class, new ServerStatus.Players.Serializer()).registerTypeAdapter(ServerStatus.class, new ServerStatus.Serializer()).registerTypeHierarchyAdapter(Component.class, new Component.Serializer()).registerTypeHierarchyAdapter(Style.class, new Style.Serializer()).registerTypeAdapterFactory(new LowerCaseEnumTypeAdapterFactory())
+ .registerTypeAdapter(io.papermc.paper.adventure.AdventureComponent.class, new io.papermc.paper.adventure.AdventureComponent.Serializer())
+ .create();
private final ServerStatus status;
public ClientboundStatusResponsePacket(ServerStatus metadata) {
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -0,0 +0,0 @@ package net.minecraft.server; @@ -0,0 +0,0 @@ package net.minecraft.server;
import com.google.common.base.Preconditions;
import com.google.common.base.Splitter; import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
+import co.aikar.timings.Timings; +import co.aikar.timings.Timings;
@ -204,14 +189,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.lastServerStatus = i; if (this.hidesOnlinePlayers()) {
this.status.setPlayers(new ServerStatus.Players(this.getMaxPlayers(), this.getPlayerCount())); return new ServerStatus.Players(i, list.size(), List.of());
if (!this.hidesOnlinePlayers()) { } else {
- GameProfile[] agameprofile = new GameProfile[Math.min(this.getPlayerCount(), 12)]; - int j = Math.min(list.size(), 12);
+ GameProfile[] agameprofile = new GameProfile[Math.min(this.getPlayerCount(), org.spigotmc.SpigotConfig.playerSample)]; // Paper + int j = Math.min(list.size(), org.spigotmc.SpigotConfig.playerSample); // Paper
int j = Mth.nextInt(this.random, 0, this.getPlayerCount() - agameprofile.length); ObjectArrayList<GameProfile> objectarraylist = new ObjectArrayList(j);
int k = Mth.nextInt(this.random, 0, list.size() - j);
for (int k = 0; k < agameprofile.length; ++k) {
diff --git a/src/main/java/net/minecraft/server/network/ServerStatusPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerStatusPacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerStatusPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerStatusPacketListenerImpl.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/network/ServerStatusPacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerStatusPacketListenerImpl.java
@ -223,8 +208,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start - Replace everything + // Paper start - Replace everything
+ /* + /*
// CraftBukkit start // CraftBukkit start
// this.connection.send(new PacketStatusOutServerInfo(this.server.getStatus())); // this.connection.send(new PacketStatusOutServerInfo(this.status));
final Object[] players = this.server.getPlayerList().players.toArray(); MinecraftServer server = MinecraftServer.getServer();
@@ -0,0 +0,0 @@ public class ServerStatusPacketListenerImpl implements ServerStatusPacketListene @@ -0,0 +0,0 @@ public class ServerStatusPacketListenerImpl implements ServerStatusPacketListene
this.connection.send(new ClientboundStatusResponsePacket(ping)); this.connection.send(new ClientboundStatusResponsePacket(ping));

View file

@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/ma
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/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 { @@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
if (this.isUsingItem() && !this.useItem.isEmpty()) { if (this.isUsingItem() && !this.useItem.isEmpty()) {
Item item = this.useItem.getItem(); Item item = this.useItem.getItem();

View file

@ -8,6 +8,19 @@ This can be useful for changing name or skins after a player has logged in.
== AT == == AT ==
public-f net.minecraft.world.entity.player.Player gameProfile public-f net.minecraft.world.entity.player.Player gameProfile
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
this.internalTeleport(dest.getX(), dest.getY(), dest.getZ(), dest.getYaw(), dest.getPitch(), Collections.emptySet());
}
- private void internalTeleport(double d0, double d1, double d2, float f, float f1, Set<RelativeMovement> set) {
+ public void internalTeleport(double d0, double d1, double d2, float f, float f1, Set<RelativeMovement> set) { // Paper
// CraftBukkit start
if (Float.isNaN(f)) {
f = 0;
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@ -66,8 +79,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public InetSocketAddress getAddress() { public InetSocketAddress getAddress() {
if (this.getHandle().connection == null) return null; if (this.getHandle().connection == null) return null;
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
this.hiddenEntities.put(entity.getUniqueId(), hidingPlugins);
private void untrackAndHideEntity(org.bukkit.entity.Entity entity) {
// Remove this entity from the hidden player's EntityTrackerEntry // Remove this entity from the hidden player's EntityTrackerEntry
- ChunkMap tracker = ((ServerLevel) this.getHandle().level).getChunkSource().chunkMap; - ChunkMap tracker = ((ServerLevel) this.getHandle().level).getChunkSource().chunkMap;
+ // Paper start + // Paper start
@ -90,28 +103,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- server.getPluginManager().callEvent(new PlayerHideEntityEvent(this, entity)); - server.getPluginManager().callEvent(new PlayerHideEntityEvent(this, entity));
} }
@Override void resetAndHideEntity(org.bukkit.entity.Entity entity) {
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
this.hiddenEntities.remove(entity.getUniqueId());
- ChunkMap tracker = ((ServerLevel) this.getHandle().level).getChunkSource().chunkMap;
+ // Paper start
Entity other = ((CraftEntity) entity).getHandle();
+ registerEntity(other);
+
+ server.getPluginManager().callEvent(new PlayerShowEntityEvent(this, entity));
+ }
+ private void registerEntity(Entity other) {
+ ChunkMap tracker = ((ServerLevel) this.getHandle().level).getChunkSource().chunkMap;
+ // Paper end
if (other instanceof ServerPlayer) {
ServerPlayer otherPlayer = (ServerPlayer) other;
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
if (entry != null && !entry.seenBy.contains(this.getHandle().connection)) { if (entry != null && !entry.seenBy.contains(this.getHandle().connection)) {
entry.updatePlayer(this.getHandle()); entry.updatePlayer(this.getHandle());
} }
+ server.getPluginManager().callEvent(new PlayerShowEntityEvent(this, entity)); // Paper
+ } + }
+ // Paper start + // Paper start
+ @Override + @Override
@ -130,22 +127,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ bukkitPlayer.unregisterEntity(self); + bukkitPlayer.unregisterEntity(self);
+ } + }
+ } + }
+
- server.getPluginManager().callEvent(new PlayerShowEntityEvent(this, entity));
+ // Set the game profile here, we should have unregistered the entity via iterating all player entities above. + // Set the game profile here, we should have unregistered the entity via iterating all player entities above.
+ self.gameProfile = gameProfile; + self.gameProfile = gameProfile;
+
- server.getPluginManager().callEvent(new PlayerShowEntityEvent(this, entity));
+ // Re-register the game profile for all players + // Re-register the game profile for all players
+ for (ServerPlayer player : players) { + for (ServerPlayer player : players) {
+ CraftPlayer bukkitPlayer = player.getBukkitEntity(); + CraftPlayer bukkitPlayer = player.getBukkitEntity();
+ if (bukkitPlayer.canSee(this)) { + if (bukkitPlayer.canSee(this)) {
+ bukkitPlayer.registerEntity(self); + bukkitPlayer.trackAndShowEntity(self);
+ } + }
+ } + }
+ // Refresh misc player things AFTER sending game profile + // Refresh misc player things AFTER sending game profile
+ this.refreshPlayer(); + this.refreshPlayer();
} }
void resetAndShowEntity(org.bukkit.entity.Entity entity) {
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
this.trackAndShowEntity(entity);
}
}
+ // Paper start
+ public com.destroystokyo.paper.profile.PlayerProfile getPlayerProfile() { + public com.destroystokyo.paper.profile.PlayerProfile getPlayerProfile() {
+ return new com.destroystokyo.paper.profile.CraftPlayerProfile(this).clone(); + return new com.destroystokyo.paper.profile.CraftPlayerProfile(this).clone();
+ } + }
@ -160,7 +163,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ ServerLevel worldserver = handle.getLevel(); + ServerLevel worldserver = handle.getLevel();
+ connection.send(new net.minecraft.network.protocol.game.ClientboundRespawnPacket(worldserver.dimensionTypeId(), worldserver.dimension(), net.minecraft.world.level.biome.BiomeManager.obfuscateSeed(worldserver.getSeed()), handle.gameMode.getGameModeForPlayer(), handle.gameMode.getPreviousGameModeForPlayer(), worldserver.isDebug(), worldserver.isFlat(), net.minecraft.network.protocol.game.ClientboundRespawnPacket.KEEP_ALL_DATA, this.getHandle().getLastDeathLocation())); + connection.send(new net.minecraft.network.protocol.game.ClientboundRespawnPacket(worldserver.dimensionTypeId(), worldserver.dimension(), net.minecraft.world.level.biome.BiomeManager.obfuscateSeed(worldserver.getSeed()), handle.gameMode.getGameModeForPlayer(), handle.gameMode.getPreviousGameModeForPlayer(), worldserver.isDebug(), worldserver.isFlat(), net.minecraft.network.protocol.game.ClientboundRespawnPacket.KEEP_ALL_DATA, this.getHandle().getLastDeathLocation()));
+ handle.onUpdateAbilities(); + handle.onUpdateAbilities();
+ connection.internalTeleport(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch(), java.util.Collections.emptySet(), false); + connection.internalTeleport(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch(), java.util.Collections.emptySet());
+ net.minecraft.server.MinecraftServer.getServer().getPlayerList().sendAllPlayerInfo(handle); + net.minecraft.server.MinecraftServer.getServer().getPlayerList().sendAllPlayerInfo(handle);
+ +
+ if (this.isOp()) { + if (this.isOp()) {
@ -169,10 +172,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ } + }
+ // Paper end + // Paper end
+
public void onEntityRemove(Entity entity) { public void onEntityRemove(Entity entity) {
this.hiddenEntities.remove(entity.getUUID()); this.invertedVisibilityEntities.remove(entity.getUUID());
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java --- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java

View file

@ -68,8 +68,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent; +import com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.net.InetAddresses;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
import com.mojang.datafixers.util.Either;
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { @@ -0,0 +0,0 @@ public class ServerPlayer extends Player {
// CraftBukkit end // CraftBukkit end
public boolean isRealPlayer; // Paper public boolean isRealPlayer; // Paper

View file

@ -85,8 +85,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Override @Override
@@ -0,0 +0,0 @@ public class Slime extends Mob implements Enemy { @@ -0,0 +0,0 @@ public class Slime extends Mob implements Enemy {
}
((Slime.SlimeMoveControl) this.slime.getMoveControl()).setDirection(this.slime.getYRot(), this.slime.isDealsDamage());
} }
+ +
+ // Paper start - clear timer and target when goal resets + // Paper start - clear timer and target when goal resets
@ -118,7 +118,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper end + // Paper end
} }
((Slime.SlimeMoveControl) this.slime.getMoveControl()).setDirection(this.chosenDegrees, false); MoveControl controllermove = this.slime.getMoveControl();
@@ -0,0 +0,0 @@ public class Slime extends Mob implements Enemy { @@ -0,0 +0,0 @@ public class Slime extends Mob implements Enemy {
@Override @Override
@ -129,7 +129,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Override @Override
@@ -0,0 +0,0 @@ public class Slime extends Mob implements Enemy { @@ -0,0 +0,0 @@ public class Slime extends Mob implements Enemy {
((Slime.SlimeMoveControl) this.slime.getMoveControl()).setWantedMovement(1.0D);
} }
} }
+ +

View file

@ -10,8 +10,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/build.gradle.kts +++ b/build.gradle.kts
@@ -0,0 +0,0 @@ dependencies { @@ -0,0 +0,0 @@ dependencies {
implementation("commons-lang:commons-lang:2.6") implementation("commons-lang:commons-lang:2.6")
runtimeOnly("org.xerial:sqlite-jdbc:3.36.0.3") runtimeOnly("org.xerial:sqlite-jdbc:3.41.0.0")
runtimeOnly("mysql:mysql-connector-java:8.0.29") runtimeOnly("com.mysql:mysql-connector-j:8.0.32")
+ runtimeOnly("com.lmax:disruptor:3.4.4") // Paper + runtimeOnly("com.lmax:disruptor:3.4.4") // Paper
runtimeOnly("org.apache.maven:maven-resolver-provider:3.8.5") runtimeOnly("org.apache.maven:maven-resolver-provider:3.8.5")

View file

@ -8,21 +8,22 @@ diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java --- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java +++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
@@ -0,0 +0,0 @@ public abstract class Projectile extends Entity { @@ -0,0 +0,0 @@ public abstract class Projectile extends Entity implements TraceableEntity {
if (!entity.isSpectator() && entity.isAlive() && entity.isPickable()) { } else {
Entity entity1 = this.getOwner(); Entity entity1 = this.getOwner();
+ // Paper start - Cancel hit for vanished players + // Paper start - Cancel hit for vanished players
+ if (entity1 instanceof net.minecraft.server.level.ServerPlayer && entity instanceof net.minecraft.server.level.ServerPlayer) { + if (entity1 instanceof net.minecraft.server.level.ServerPlayer && entity instanceof net.minecraft.server.level.ServerPlayer) {
+ org.bukkit.entity.Player collided = (org.bukkit.entity.Player) entity.getBukkitEntity(); + org.bukkit.entity.Player collided = (org.bukkit.entity.Player) entity.getBukkitEntity();
+ org.bukkit.entity.Player shooter = (org.bukkit.entity.Player) entity1.getBukkitEntity(); + org.bukkit.entity.Player shooter = (org.bukkit.entity.Player) entity1.getBukkitEntity();
+ if (!shooter.canSee(collided)) return false; + if (!shooter.canSee(collided)) {
+ return false;
+ }
+ } + }
return entity1 == null || this.leftOwner || !entity1.isPassengerOfSameVehicle(entity);
+ // Paper end + // Paper end
} else { return entity1 == null || this.leftOwner || !entity1.isPassengerOfSameVehicle(entity);
return false;
} }
}
diff --git a/src/main/java/net/minecraft/world/item/BlockItem.java b/src/main/java/net/minecraft/world/item/BlockItem.java diff --git a/src/main/java/net/minecraft/world/item/BlockItem.java b/src/main/java/net/minecraft/world/item/BlockItem.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/item/BlockItem.java --- a/src/main/java/net/minecraft/world/item/BlockItem.java