13
0
geforkt von Mirrors/Paper
fix
Dieser Commit ist enthalten in:
Jason Penilla 2021-06-12 23:48:25 -07:00
Ursprung c7ea12688f
Commit 9a7acfee26
25 geänderte Dateien mit 245 neuen und 464 gelöschten Zeilen

Datei anzeigen

@ -1,45 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Phoenix616 <mail@moep.tv>
Date: Tue, 18 Sep 2018 23:50:10 +0100
Subject: [PATCH] PreSpawnerSpawnEvent
This adds a separate event before an entity is spawned by a spawner
which contains the location of the spawner too similarly to how the
SpawnerSpawnEvent gets called instead of the CreatureSpawnEvent for
spawners.
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/PreSpawnerSpawnEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/PreSpawnerSpawnEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/PreSpawnerSpawnEvent.java
@@ -0,0 +0,0 @@
+package com.destroystokyo.paper.event.entity;
+
+
+import com.google.common.base.Preconditions;
+import org.bukkit.Location;
+import org.bukkit.entity.EntityType;
+import org.bukkit.event.entity.CreatureSpawnEvent;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Called before an entity is spawned into a world by a spawner.
+ *
+ * This only includes the spawner's location and not the full BlockState snapshot for performance reasons.
+ * If you really need it you have to get the spawner yourself.
+ */
+
+public class PreSpawnerSpawnEvent extends PreCreatureSpawnEvent {
+ @NotNull private final Location spawnerLocation;
+
+ public PreSpawnerSpawnEvent(@NotNull Location location, @NotNull EntityType type, @NotNull Location spawnerLocation) {
+ super(location, type, CreatureSpawnEvent.SpawnReason.SPAWNER);
+ this.spawnerLocation = Preconditions.checkNotNull(spawnerLocation, "Spawner location may not be null");
+ }
+
+ @NotNull
+ public Location getSpawnerLocation() {
+ return spawnerLocation;
+ }
+}

Datei anzeigen

@ -1,187 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Sat, 22 Sep 2018 00:33:08 -0500
Subject: [PATCH] Add LivingEntity#getTargetEntity
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s
return this.calculateViewVector(pitch - 90.0F, yaw);
}
+ public final Vec3 getEyePosition(float partialTicks) { return getEyePosition(partialTicks); } // Paper - OBFHELPER
public final Vec3 getEyePosition(float tickDelta) {
if (tickDelta == 1.0F) {
return new Vec3(this.getX(), this.getEyeY(), this.getZ());
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s
return this.getPassengers().size() < 1;
}
+ public final float getCollisionBorderSize() { return getPickRadius(); } // Paper - OBFHELPER
public float getPickRadius() {
return 0.0F;
}
diff --git a/src/main/java/net/minecraft/world/entity/EntitySelector.java b/src/main/java/net/minecraft/world/entity/EntitySelector.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/EntitySelector.java
+++ b/src/main/java/net/minecraft/world/entity/EntitySelector.java
@@ -0,0 +0,0 @@ public final class EntitySelector {
public static final Predicate<Entity> NO_CREATIVE_OR_SPECTATOR = (entity) -> {
return !(entity instanceof Player) || !entity.isSpectator() && !((Player) entity).isCreative();
};
+ public static Predicate<Entity> canAITarget() { return ATTACK_ALLOWED; } // Paper - OBFHELPER
public static final Predicate<Entity> ATTACK_ALLOWED = (entity) -> {
return !(entity instanceof Player) || !entity.isSpectator() && !((Player) entity).isCreative() && entity.level.getDifficulty() != Difficulty.PEACEFUL;
};
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -0,0 +0,0 @@ import net.minecraft.world.level.storage.loot.LootTable;
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import net.minecraft.world.phys.AABB;
+import net.minecraft.world.phys.EntityHitResult;
import net.minecraft.world.phys.HitResult;
import net.minecraft.world.phys.Vec3;
import net.minecraft.world.scores.PlayerTeam;
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity {
return level.clip(raytrace);
}
+ public EntityHitResult getTargetEntity(int maxDistance) {
+ if (maxDistance < 1 || maxDistance > 120) {
+ throw new IllegalArgumentException("maxDistance must be between 1-120");
+ }
+
+ Vec3 start = this.getEyePosition(1.0F);
+ Vec3 direction = this.getLookAngle();
+ Vec3 end = start.add(direction.x * maxDistance, direction.y * maxDistance, direction.z * maxDistance);
+
+ List<Entity> entityList = level.getEntities(this, getBoundingBox().expand(direction.x * maxDistance, direction.y * maxDistance, direction.z * maxDistance).inflate(1.0D, 1.0D, 1.0D), EntitySelector.canAITarget().and(Entity::isPickable));
+
+ double distance = 0.0D;
+ EntityHitResult result = null;
+
+ for (Entity entity : entityList) {
+ AABB aabb = entity.getBoundingBox().grow((double) entity.getCollisionBorderSize());
+ Optional<Vec3> rayTraceResult = aabb.calculateIntercept(start, end);
+
+ if (rayTraceResult.isPresent()) {
+ Vec3 rayTrace = rayTraceResult.get();
+ double distanceTo = start.distanceToSqr(rayTrace);
+ if (distanceTo < distance || distance == 0.0D) {
+ result = new EntityHitResult(entity, rayTrace);
+ distance = distanceTo;
+ }
+ }
+ }
+
+ return result;
+ }
+
public int shieldBlockingDelay = level.paperConfig.shieldBlockingDelay;
public int getShieldBlockingDelay() {
diff --git a/src/main/java/net/minecraft/world/phys/AABB.java b/src/main/java/net/minecraft/world/phys/AABB.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/phys/AABB.java
+++ b/src/main/java/net/minecraft/world/phys/AABB.java
@@ -0,0 +0,0 @@ public class AABB {
return this.expandTowards(scale.x, scale.y, scale.z);
}
+ public final AABB expand(double x, double y, double z) { return expandTowards(x, y, z); } // Paper - OBFHELPER
public AABB expandTowards(double x, double y, double z) {
double d3 = this.minX;
double d4 = this.minY;
@@ -0,0 +0,0 @@ public class AABB {
return new AABB(d3, d4, d5, d6, d7, d8);
}
+ // Paper start
+ public AABB grow(double d0) {
+ return inflate(d0, d0, d0);
+ }
+ // Paper end
+
public AABB inflate(double x, double y, double z) {
double d3 = this.minX - x;
double d4 = this.minY - y;
@@ -0,0 +0,0 @@ public class AABB {
return this.minX < maxX && this.maxX > minX && this.minY < maxY && this.maxY > minY && this.minZ < maxZ && this.maxZ > minZ;
}
+ public final boolean contains(Vec3 vec3d) { return contains(vec3d); } // Paper - OBFHELPER
public boolean contains(Vec3 vec) {
return this.contains(vec.x, vec.y, vec.z);
}
@@ -0,0 +0,0 @@ public class AABB {
return this.inflate(-value);
}
+ public final Optional<Vec3> calculateIntercept(Vec3 vec3d, Vec3 vec3d1) { return clip(vec3d, vec3d1); } // Paper - OBFHELPER
public Optional<Vec3> clip(Vec3 min, Vec3 max) {
double[] adouble = new double[]{1.0D};
double d0 = max.x - min.x;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/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 @@
package org.bukkit.craftbukkit.entity;
import com.destroystokyo.paper.block.TargetBlockInfo;
+import com.destroystokyo.paper.entity.TargetEntityInfo;
import com.google.common.base.Preconditions;
import com.google.common.collect.Sets;
import java.util.ArrayList;
@@ -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.BlockHitResult;
+import net.minecraft.world.phys.EntityHitResult;
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 {
new TargetBlockInfo(CraftBlock.at(getHandle().level, ((BlockHitResult)rayTrace).getBlockPos()),
MCUtil.toBukkitBlockFace(((BlockHitResult)rayTrace).getDirection()));
}
+
+ public Entity getTargetEntity(int maxDistance, boolean ignoreBlocks) {
+ EntityHitResult rayTrace = rayTraceEntity(maxDistance, ignoreBlocks);
+ return rayTrace == null ? null : rayTrace.getEntity().getBukkitEntity();
+ }
+
+ public TargetEntityInfo getTargetEntityInfo(int maxDistance, boolean ignoreBlocks) {
+ EntityHitResult rayTrace = rayTraceEntity(maxDistance, ignoreBlocks);
+ return rayTrace == null ? null : new TargetEntityInfo(rayTrace.getEntity().getBukkitEntity(), new org.bukkit.util.Vector(rayTrace.getLocation().x, rayTrace.getLocation().y, rayTrace.getLocation().z));
+ }
+
+ public EntityHitResult rayTraceEntity(int maxDistance, boolean ignoreBlocks) {
+ EntityHitResult rayTrace = getHandle().getTargetEntity(maxDistance);
+ if (rayTrace == null) {
+ return null;
+ }
+ if (!ignoreBlocks) {
+ HitResult rayTraceBlocks = getHandle().getRayTrace(maxDistance, ClipContext.Fluid.NONE);
+ if (rayTraceBlocks != null) {
+ Vec3 eye = getHandle().getEyePosition(1.0F);
+ if (eye.distanceToSqr(rayTraceBlocks.getLocation()) <= eye.distanceToSqr(rayTrace.getLocation())) {
+ return null;
+ }
+ }
+ }
+ return rayTrace;
+ }
// Paper end
@Override

Datei anzeigen

@ -1,29 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Phoenix616 <mail@moep.tv>
Date: Tue, 18 Sep 2018 23:53:23 +0100
Subject: [PATCH] PreSpawnerSpawnEvent
This adds a separate event before an entity is spawned by a spawner
which contains the location of the spawner too similarly to how the
SpawnerSpawnEvent gets called instead of the CreatureSpawnEvent for
spawners.
diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
@@ -0,0 +0,0 @@ public abstract class BaseSpawner {
org.bukkit.entity.EntityType type = org.bukkit.entity.EntityType.fromName(key);
if (type != null) {
- com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event;
- event = new com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent(
+ com.destroystokyo.paper.event.entity.PreSpawnerSpawnEvent event;
+ event = new com.destroystokyo.paper.event.entity.PreSpawnerSpawnEvent(
MCUtil.toLocation(world, d3, d4, d5),
type,
- org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER
+ MCUtil.toLocation(world, blockposition)
);
if (!event.callEvent()) {
flag = true;

Datei anzeigen

@ -0,0 +1,114 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Sat, 22 Sep 2018 00:33:08 -0500
Subject: [PATCH] Add LivingEntity#getTargetEntity
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
this.setYHeadRot(yaw);
}
+ public final float getCollisionBorderSize() { return getPickRadius(); } // Paper - OBFHELPER
public float getPickRadius() {
return 0.0F;
}
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -0,0 +0,0 @@ import net.minecraft.world.level.storage.loot.LootTable;
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import net.minecraft.world.phys.AABB;
+import net.minecraft.world.phys.EntityHitResult;
import net.minecraft.world.phys.HitResult;
import net.minecraft.world.phys.Vec3;
import net.minecraft.world.scores.PlayerTeam;
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity {
return level.clip(raytrace);
}
+ public EntityHitResult getTargetEntity(int maxDistance) {
+ if (maxDistance < 1 || maxDistance > 120) {
+ throw new IllegalArgumentException("maxDistance must be between 1-120");
+ }
+
+ Vec3 start = this.getEyePosition(1.0F);
+ 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_CREATIVE_OR_SPECTATOR.and(Entity::isPickable));
+
+ double distance = 0.0D;
+ EntityHitResult result = null;
+
+ for (Entity entity : entityList) {
+ final double inflationAmount = (double) entity.getCollisionBorderSize();
+ AABB aabb = entity.getBoundingBox().inflate(inflationAmount, inflationAmount, inflationAmount);
+ Optional<Vec3> rayTraceResult = aabb.clip(start, end);
+
+ if (rayTraceResult.isPresent()) {
+ Vec3 rayTrace = rayTraceResult.get();
+ double distanceTo = start.distanceToSqr(rayTrace);
+ if (distanceTo < distance || distance == 0.0D) {
+ result = new EntityHitResult(entity, rayTrace);
+ distance = distanceTo;
+ }
+ }
+ }
+
+ return result;
+ }
+
public int shieldBlockingDelay = level.paperConfig.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
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 @@
package org.bukkit.craftbukkit.entity;
+import com.destroystokyo.paper.entity.TargetEntityInfo;
import com.google.common.base.Preconditions;
import com.google.common.collect.Sets;
import java.util.ArrayList;
@@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
new com.destroystokyo.paper.block.TargetBlockInfo(org.bukkit.craftbukkit.block.CraftBlock.at(getHandle().level, ((net.minecraft.world.phys.BlockHitResult)rayTrace).getBlockPos()),
net.minecraft.server.MCUtil.toBukkitBlockFace(((net.minecraft.world.phys.BlockHitResult)rayTrace).getDirection()));
}
+
+ public Entity getTargetEntity(int maxDistance, boolean ignoreBlocks) {
+ net.minecraft.world.phys.EntityHitResult rayTrace = rayTraceEntity(maxDistance, ignoreBlocks);
+ return rayTrace == null ? null : rayTrace.getEntity().getBukkitEntity();
+ }
+
+ public TargetEntityInfo getTargetEntityInfo(int maxDistance, boolean ignoreBlocks) {
+ net.minecraft.world.phys.EntityHitResult rayTrace = rayTraceEntity(maxDistance, ignoreBlocks);
+ return rayTrace == null ? null : new TargetEntityInfo(rayTrace.getEntity().getBukkitEntity(), new org.bukkit.util.Vector(rayTrace.getLocation().x, rayTrace.getLocation().y, rayTrace.getLocation().z));
+ }
+
+ public net.minecraft.world.phys.EntityHitResult rayTraceEntity(int maxDistance, boolean ignoreBlocks) {
+ net.minecraft.world.phys.EntityHitResult rayTrace = getHandle().getTargetEntity(maxDistance);
+ if (rayTrace == null) {
+ return null;
+ }
+ if (!ignoreBlocks) {
+ net.minecraft.world.phys.HitResult rayTraceBlocks = getHandle().getRayTrace(maxDistance, net.minecraft.world.level.ClipContext.Fluid.NONE);
+ if (rayTraceBlocks != null) {
+ net.minecraft.world.phys.Vec3 eye = getHandle().getEyePosition(1.0F);
+ if (eye.distanceToSqr(rayTraceBlocks.getLocation()) <= eye.distanceToSqr(rayTrace.getLocation())) {
+ return null;
+ }
+ }
+ }
+ return rayTrace;
+ }
// Paper end
@Override

Datei anzeigen

@ -35,10 +35,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public static int packetInSpamThreshold = 300;
@@ -0,0 +0,0 @@ public class PaperConfig {
}
tabSpamLimit = getInt("settings.spam-limiter.tab-spam-limit", tabSpamLimit);
}
+
+ public static boolean velocitySupport;
+ public static boolean velocityOnlineMode;
+ public static byte[] velocitySecretKey;
@ -52,7 +51,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ velocitySecretKey = secret.getBytes(StandardCharsets.UTF_8);
+ }
+ }
}
+
public static boolean asyncChunks = false;
private static void asyncChunks() {
ConfigurationSection section;
diff --git a/src/main/java/com/destroystokyo/paper/proxy/VelocityProxy.java b/src/main/java/com/destroystokyo/paper/proxy/VelocityProxy.java
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
@ -106,11 +108,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+
+ public static InetAddress readAddress(final FriendlyByteBuf buf) {
+ return InetAddresses.forString(buf.readUTF(Short.MAX_VALUE));
+ return InetAddresses.forString(buf.readUtf(Short.MAX_VALUE));
+ }
+
+ public static GameProfile createProfile(final FriendlyByteBuf buf) {
+ final GameProfile profile = new GameProfile(buf.readUUID(), buf.readUTF(16));
+ final GameProfile profile = new GameProfile(buf.readUUID(), buf.readUtf(16));
+ readProperties(buf, profile);
+ return profile;
+ }
@ -118,75 +120,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ private static void readProperties(final FriendlyByteBuf buf, final GameProfile profile) {
+ final int properties = buf.readVarInt();
+ for (int i1 = 0; i1 < properties; i1++) {
+ final String name = buf.readUTF(Short.MAX_VALUE);
+ final String value = buf.readUTF(Short.MAX_VALUE);
+ final String signature = buf.readBoolean() ? buf.readUTF(Short.MAX_VALUE) : null;
+ final String name = buf.readUtf(Short.MAX_VALUE);
+ final String value = buf.readUtf(Short.MAX_VALUE);
+ final String signature = buf.readBoolean() ? buf.readUtf(Short.MAX_VALUE) : null;
+ profile.getProperties().put(name, new Property(name, value, signature));
+ }
+ }
+}
diff --git a/src/main/java/net/minecraft/network/FriendlyByteBuf.java b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/network/FriendlyByteBuf.java
+++ b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
@@ -0,0 +0,0 @@ public class FriendlyByteBuf extends ByteBuf {
return this.writeVarInt(oenum.ordinal());
}
+ public int readVarInt() { return readVarInt(); } // Paper - OBFHELPER
public int readVarInt() {
int i = 0;
int j = 0;
@@ -0,0 +0,0 @@ public class FriendlyByteBuf extends ByteBuf {
return this;
}
+ public UUID readUUID() { return readUUID(); } // Paper - OBFHELPER
public UUID readUUID() {
return new UUID(this.readLong(), this.readLong());
}
@@ -0,0 +0,0 @@ public class FriendlyByteBuf extends ByteBuf {
}
}
+ public String readUTF(int maxLength) { return this.readUtf(maxLength); } // Paper - OBFHELPER
public String readUtf(int i) {
int j = this.readVarInt();
diff --git a/src/main/java/net/minecraft/network/protocol/login/ClientboundCustomQueryPacket.java b/src/main/java/net/minecraft/network/protocol/login/ClientboundCustomQueryPacket.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/network/protocol/login/ClientboundCustomQueryPacket.java
+++ b/src/main/java/net/minecraft/network/protocol/login/ClientboundCustomQueryPacket.java
@@ -0,0 +0,0 @@ public class ClientboundCustomQueryPacket implements Packet<ClientLoginPacketLis
public ClientboundCustomQueryPacket() {}
+ // Paper start
+ public ClientboundCustomQueryPacket(int id, ResourceLocation channel, FriendlyByteBuf buf) {
+ this.transactionId = id;
+ this.identifier = channel;
+ this.data = buf;
+ }
+ // Paper end
+
@Override
public void read(FriendlyByteBuf buf) throws IOException {
this.transactionId = buf.readVarInt();
diff --git a/src/main/java/net/minecraft/network/protocol/login/ServerboundCustomQueryPacket.java b/src/main/java/net/minecraft/network/protocol/login/ServerboundCustomQueryPacket.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/network/protocol/login/ServerboundCustomQueryPacket.java
+++ b/src/main/java/net/minecraft/network/protocol/login/ServerboundCustomQueryPacket.java
@@ -0,0 +0,0 @@ import net.minecraft.network.protocol.Packet;
public class ServerboundCustomQueryPacket implements Packet<ServerLoginPacketListener> {
- private int transactionId;
- private FriendlyByteBuf data;
+ private int transactionId; public int getId() { return transactionId; } // Paper - OBFHELPER
+ private FriendlyByteBuf data; public FriendlyByteBuf getBuf() { return data; } // Paper - OBFHELPER
public ServerboundCustomQueryPacket() {}
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
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@ -199,10 +139,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.network.chat.TranslatableComponent;
+import net.minecraft.network.protocol.login.ClientboundCustomQueryPacket;
import net.minecraft.network.protocol.login.ClientboundGameProfilePacket;
import net.minecraft.network.protocol.login.ClientboundHelloPacket;
import net.minecraft.network.protocol.login.ClientboundLoginCompressionPacket;
@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.util.Waitable;
import org.bukkit.event.player.AsyncPlayerPreLoginEvent;
import org.bukkit.event.player.PlayerPreLoginEvent;
@ -212,7 +148,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener {
@@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
private SecretKey secretKey;
@Nullable
private ServerPlayer delayedAcceptPlayer;
public String hostname = ""; // CraftBukkit - add field
+ private int velocityLoginMessageId = -1; // Paper - Velocity support
@ -226,7 +162,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start - Velocity support
+ if (com.destroystokyo.paper.PaperConfig.velocitySupport) {
+ this.velocityLoginMessageId = java.util.concurrent.ThreadLocalRandom.current().nextInt();
+ ClientboundCustomQueryPacket packet1 = new ClientboundCustomQueryPacket(this.velocityLoginMessageId, com.destroystokyo.paper.proxy.VelocityProxy.PLAYER_INFO_CHANNEL, new FriendlyByteBuf(Unpooled.EMPTY_BUFFER));
+ net.minecraft.network.protocol.login.ClientboundCustomQueryPacket packet1 = new net.minecraft.network.protocol.login.ClientboundCustomQueryPacket(this.velocityLoginMessageId, com.destroystokyo.paper.proxy.VelocityProxy.PLAYER_INFO_CHANNEL, new FriendlyByteBuf(Unpooled.EMPTY_BUFFER));
+ this.connection.send(packet1);
+ return;
+ }
@ -238,22 +174,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public class LoginHandler {
public void fireEvents() throws Exception {
+ // Paper start - Velocity support
+ if (ServerLoginPacketListenerImpl.this.velocityLoginMessageId == -1 && com.destroystokyo.paper.PaperConfig.velocitySupport) {
+ disconnect("This server requires you to connect with Velocity.");
+ return;
+ }
+ // Paper end
String playerName = gameProfile.getName();
java.net.InetAddress address = ((java.net.InetSocketAddress) connection.getRemoteAddress()).getAddress();
java.util.UUID uniqueId = gameProfile.getId();
+ // Paper start - Velocity support
+ if (ServerLoginPacketListenerImpl.this.velocityLoginMessageId == -1 && com.destroystokyo.paper.PaperConfig.velocitySupport) {
+ disconnect("This server requires you to connect with Velocity.");
+ return;
+ }
+ // Paper end
String playerName = ServerLoginPacketListenerImpl.this.gameProfile.getName();
java.net.InetAddress address = ((java.net.InetSocketAddress) ServerLoginPacketListenerImpl.this.connection.getRemoteAddress()).getAddress();
java.util.UUID uniqueId = ServerLoginPacketListenerImpl.this.gameProfile.getId();
@@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
// Spigot end
public void handleCustomQueryPacket(ServerboundCustomQueryPacket packet) {
+ // Paper start - Velocity support
+ if (com.destroystokyo.paper.PaperConfig.velocitySupport && packet.getId() == this.velocityLoginMessageId) {
+ FriendlyByteBuf buf = packet.getBuf();
+ if (com.destroystokyo.paper.PaperConfig.velocitySupport && packet.getTransactionId() == this.velocityLoginMessageId) {
+ FriendlyByteBuf buf = packet.getData();
+ if (buf == null) {
+ this.disconnect("This server requires you to connect with Velocity.");
+ return;
@ -271,7 +207,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ this.connection.address = new java.net.InetSocketAddress(com.destroystokyo.paper.proxy.VelocityProxy.readAddress(buf), port);
+
+ this.setGameProfile(com.destroystokyo.paper.proxy.VelocityProxy.createProfile(buf));
+ this.gameProfile = com.destroystokyo.paper.proxy.VelocityProxy.createProfile(buf);
+
+ // Proceed with login
+ authenticatorPool.execute(() -> {

Datei anzeigen

@ -26,19 +26,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private NearestHealableRaiderTargetGoal<Raider> healRaidersGoal;
private NearestAttackableWitchTargetGoal<Player> attackPlayersGoal;
@@ -0,0 +0,0 @@ public class Witch extends Raider implements RangedAttackMob {
return SoundEvents.WITCH_DEATH;
}
+ public void setDrinkingPotion(boolean drinkingPotion) { setUsingItem(drinkingPotion); } // Paper - OBFHELPER
public void setUsingItem(boolean drinking) {
this.getEntityData().set(Witch.DATA_USING_ITEM, drinking);
}
+ public boolean isDrinkingPotion() { return isDrinkingPotion(); } // Paper - OBFHELPER
public boolean isDrinkingPotion() {
return (Boolean) this.getEntityData().get(Witch.DATA_USING_ITEM);
}
@@ -0,0 +0,0 @@ public class Witch extends Raider implements RangedAttackMob {
}

Datei anzeigen

@ -23,7 +23,7 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListener
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 ServerGamePacketListener {
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
}
speed *= 2f; // TODO: Get the speed of the vehicle instead of the player
@ -37,25 +37,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (d10 - d9 > Math.max(100.0D, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && !this.isSingleplayerOwner()) {
// CraftBukkit end
ServerGamePacketListenerImpl.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", entity.getName().getString(), this.player.getName().getString(), d6, d7, d8);
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener {
double d1 = this.player.getY();
double d2 = this.player.getZ();
double d3 = this.player.getY();
- double d4 = packet.getX(this.player.getX());
+ double d4 = packet.getX(this.player.getX());double toX = d4; // Paper - OBFHELPER
double d5 = packet.getY(this.player.getY());
- double d6 = packet.getZ(this.player.getZ());
+ double d6 = packet.getZ(this.player.getZ());double toZ = d6; // Paper - OBFHELPER
float f = packet.getYRot(this.player.yRot);
float f1 = packet.getXRot(this.player.xRot);
double d7 = d4 - this.firstGoodX;
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener {
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
float prevYaw = this.player.getYRot();
float prevPitch = this.player.getXRot();
// CraftBukkit end
- double d3 = this.player.getX();
+ double d3 = this.player.getX(); final double toX = d3; // Paper - OBFHELPER
double d4 = this.player.getY();
- double d5 = this.player.getZ();
+ double d5 = this.player.getZ(); final double toZ = d5; // Paper - OBFHELPER
double d6 = this.player.getY();
double d7 = d0 - this.firstGoodX;
double d8 = d1 - this.firstGoodY;
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
} else {
speed = player.abilities.walkingSpeed * 10f;
speed = this.player.getAbilities().walkingSpeed * 10f;
}
+ // Paper start - Prevent moving into unloaded chunks
+ if (player.level.paperConfig.preventMovingIntoUnloadedChunks && (this.player.getX() != toX || this.player.getZ() != toZ) && !worldserver.hasChunk((int) Math.floor(toX) >> 4, (int) Math.floor(toZ) >> 4)) {
+ this.internalTeleport(this.player.getX(), this.player.getY(), this.player.getZ(), this.player.yRot, this.player.xRot, Collections.emptySet());
+ this.internalTeleport(this.player.getX(), this.player.getY(), this.player.getZ(), this.player.getYRot(), this.player.getXRot(), Collections.emptySet(), true);
+ return;
+ }
+ // Paper end

Datei anzeigen

@ -12,10 +12,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
+ public boolean isInDaylight() { return this.isSunBurnTick(); } // Paper - OBFHELPER
protected boolean isSunBurnTick() {
- protected boolean isSunBurnTick() {
+ public boolean isSunBurnTick() { // Paper - protected -> public
if (this.level.isDay() && !this.level.isClientSide) {
float f = this.getBrightness();
BlockPos blockposition = new BlockPos(this.getX(), this.getEyeY(), this.getZ());
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
@ -40,13 +41,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
@@ -0,0 +0,0 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob {
public long getSeed() {
return getHandle().lootTableSeed;
return this.getHandle().lootTableSeed;
}
+
+ // Paper start
+ @Override
+ public boolean isInDaylight() {
+ return getHandle().isInDaylight();
+ return getHandle().isSunBurnTick();
+ }
+ // Paper end
}

Datei anzeigen

@ -22,7 +22,7 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/ma
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player implements ContainerListener {
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player {
}
public void setCamera(Entity entity) {
@ -32,7 +32,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- this.camera = (Entity) (entity == null ? this : entity);
- if (entity1 != this.camera) {
- this.connection.send(new ClientboundSetCameraPacket(this.camera));
- this.connection.a(this.camera.getX(), this.camera.getY(), this.camera.getZ(), this.yRot, this.xRot, TeleportCause.SPECTATE); // CraftBukkit
- this.connection.b(this.camera.getX(), this.camera.getY(), this.camera.getZ(), this.getYRot(), this.getXRot(), TeleportCause.SPECTATE); // CraftBukkit
+ if (entity == null) {
+ entity = this;
}
@ -54,7 +54,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ // Validate
+ if (entity != this) {
+ if (entity.removed || entity.shouldBeRemoved || !entity.valid || entity.level == null) {
+ if (entity.isRemoved() || !entity.valid || entity.level == null) {
+ MinecraftServer.LOGGER.info("Blocking player " + this.toString() + " from spectating invalid entity " + entity.toString());
+ return;
+ }
@ -70,7 +70,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ if (entity != this) {
+ // Make sure we're in the right place
+ this.ejectPassengers(); // teleport can fail if we have passengers...
+ this.getBukkitEntity().teleport(new Location(entity.getCommandSenderWorld().getWorld(), entity.getX(), entity.getY(), entity.getZ(), this.yRot, this.xRot), TeleportCause.SPECTATE); // Correctly handle cross-world entities from api calls by using CB teleport
+ this.getBukkitEntity().teleport(new Location(entity.getCommandSenderWorld().getWorld(), entity.getX(), entity.getY(), entity.getZ(), this.getYRot(), this.getXRot()), TeleportCause.SPECTATE); // Correctly handle cross-world entities from api calls by using CB teleport
+
+ // Make sure we're tracking the entity before sending
+ ChunkMap.TrackedEntity tracker = ((ServerLevel)entity.level).getChunkSource().chunkMap.entityMap.get(entity.getId());
@ -78,7 +78,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ tracker.updatePlayer(this);
+ }
+ } else {
+ this.connection.teleport(this.camera.getX(), this.camera.getY(), this.camera.getZ(), this.yRot, this.xRot, TeleportCause.SPECTATE); // CraftBukkit
+ this.connection.teleport(this.camera.getX(), this.camera.getY(), this.camera.getZ(), this.getYRot(), this.getXRot(), TeleportCause.SPECTATE); // CraftBukkit
+ }
+ this.connection.send(new ClientboundSetCameraPacket(entity));
+ // Paper end
@ -89,11 +89,20 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListener
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 ServerGamePacketListener {
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
}
}
- private void a(List<TextFilter.FilteredText> list, UnaryOperator<String> unaryoperator, ItemStack itemstack, int slot, ItemStack old) { // CraftBukkit
+ public void a(List<TextFilter.FilteredText> list, UnaryOperator<String> unaryoperator, ItemStack itemstack, int slot, ItemStack old) { // CraftBukkit // Paper - make public
ListTag nbttaglist = new ListTag();
if (this.player.isTextFilteringEnabled()) {
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
this.a(x, y, z, yaw, pitch, PlayerTeleportEvent.TeleportCause.UNKNOWN);
}
// CraftBukkit start - Delegate to teleport(Location)
+ public final void teleport(double d0, double d1, double d2, float f, float f1, PlayerTeleportEvent.TeleportCause cause) { this.a(d0, d1, d2, f, f1, cause); } // Paper - OBFHELPER
public void a(double d0, double d1, double d2, float f, float f1, PlayerTeleportEvent.TeleportCause cause) {
this.a(d0, d1, d2, f, f1, Collections.<ClientboundPlayerPositionPacket.RelativeArgument>emptySet(), cause);
this.a(d0, d1, d2, f, f1, Collections.emptySet(), true, cause);
}

Datei anzeigen

@ -26,10 +26,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.ChunkPos;
@@ -0,0 +0,0 @@ public final class MCUtil {
return null;
}
}
+
+ @Nullable
+ public static Component getBaseComponentFromNbt(String key, CompoundTag compound) {
+ if (!compound.contains(key)) {
@ -44,7 +43,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ return null;
+ }
}
+
public static int getTicketLevelFor(net.minecraft.world.level.chunk.ChunkStatus status) {
return net.minecraft.server.level.ChunkMap.MAX_VIEW_DISTANCE + net.minecraft.world.level.chunk.ChunkStatus.getDistance(status);
}
diff --git a/src/main/java/net/minecraft/world/level/BaseCommandBlock.java b/src/main/java/net/minecraft/world/level/BaseCommandBlock.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/BaseCommandBlock.java
@ -58,14 +60,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.StringUtil;
@@ -0,0 +0,0 @@ public abstract class BaseCommandBlock implements CommandSource {
this.command = tag.getString("Command");
this.successCount = tag.getInt("SuccessCount");
if (tag.contains("CustomName", 8)) {
- this.setName(Component.Serializer.fromJson(tag.getString("CustomName")));
+ this.setName(MCUtil.getBaseComponentFromNbt("CustomName", tag)); // Paper - Catch ParseException
this.command = nbt.getString("Command");
this.successCount = nbt.getInt("SuccessCount");
if (nbt.contains("CustomName", 8)) {
- this.setName(Component.Serializer.fromJson(nbt.getString("CustomName")));
+ this.setName(MCUtil.getBaseComponentFromNbt("CustomName", nbt)); // Paper - Catch ParseException
}
if (tag.contains("TrackOutput", 1)) {
if (nbt.contains("TrackOutput", 1)) {
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BannerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BannerBlockEntity.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BannerBlockEntity.java
@ -79,19 +81,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import net.minecraft.world.item.DyeColor;
import net.minecraft.world.item.ItemStack;
@@ -0,0 +0,0 @@ public class BannerBlockEntity extends BlockEntity implements Nameable {
public void load(BlockState state, CompoundTag tag) {
super.load(state, tag);
if (tag.contains("CustomName", 8)) {
- this.name = Component.Serializer.fromJson(tag.getString("CustomName"));
+ this.name = MCUtil.getBaseComponentFromNbt("CustomName", tag); // Paper - Catch ParseException
public void load(CompoundTag nbt) {
super.load(nbt);
if (nbt.contains("CustomName", 8)) {
- this.name = Component.Serializer.fromJson(nbt.getString("CustomName"));
+ this.name = MCUtil.getBaseComponentFromNbt("CustomName", nbt); // Paper - Catch ParseException
}
if (this.hasLevel()) {
this.itemPatterns = nbt.getList("Patterns", 10);
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java
@@ -0,0 +0,0 @@ import javax.annotation.Nullable;
@@ -0,0 +0,0 @@ import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
@ -100,11 +102,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import net.minecraft.sounds.SoundSource;
import net.minecraft.world.Container;
@@ -0,0 +0,0 @@ public abstract class BaseContainerBlockEntity extends BlockEntity implements Co
super.load(state, tag);
this.lockKey = LockCode.fromTag(tag);
if (tag.contains("CustomName", 8)) {
- this.name = Component.Serializer.fromJson(tag.getString("CustomName"));
+ this.name = MCUtil.getBaseComponentFromNbt("CustomName", tag); // Paper - Catch ParseException
super.load(nbt);
this.lockKey = LockCode.fromTag(nbt);
if (nbt.contains("CustomName", 8)) {
- this.name = Component.Serializer.fromJson(nbt.getString("CustomName"));
+ this.name = MCUtil.getBaseComponentFromNbt("CustomName", nbt); // Paper - Catch ParseException
}
}

Datei anzeigen

@ -10,10 +10,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/world/entity/monster/Drowned.java
@@ -0,0 +0,0 @@ public class Drowned extends Zombie implements RangedAttackMob {
this.goalSelector.addGoal(7, new RandomStrollGoal(this, 1.0D));
this.targetSelector.addGoal(1, (new HurtByTargetGoal(this, new Class[]{Drowned.class})).setAlertOthers(ZombifiedPiglin.class));
this.targetSelector.addGoal(1, (new HurtByTargetGoal(this, 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 ( 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

@ -25,9 +25,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
@@ -0,0 +0,0 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
synchronized (throttleTracker) {
if (throttleTracker.containsKey(address) && !"127.0.0.1".equals(address.getHostAddress()) && currentTime - throttleTracker.get(address) < connectionThrottle) {
throttleTracker.put(address, currentTime);
synchronized (ServerHandshakePacketListenerImpl.throttleTracker) {
if (ServerHandshakePacketListenerImpl.throttleTracker.containsKey(address) && !"127.0.0.1".equals(address.getHostAddress()) && currentTime - ServerHandshakePacketListenerImpl.throttleTracker.get(address) < connectionThrottle) {
ServerHandshakePacketListenerImpl.throttleTracker.put(address, currentTime);
- TranslatableComponent chatmessage = new TranslatableComponent("Connection throttled! Please wait before reconnecting.");
+ TranslatableComponent chatmessage = new TranslatableComponent(com.destroystokyo.paper.PaperConfig.connectionThrottleKickMessage); // Paper - Configurable connection throttle kick message
this.connection.send(new ClientboundLoginDisconnectPacket(chatmessage));

Datei anzeigen

@ -9,11 +9,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/entity/monster/Vindicator.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Vindicator.java
@@ -0,0 +0,0 @@ public class Vindicator extends AbstractIllager {
private static final Predicate<Difficulty> DOOR_BREAKING_PREDICATE = (enumdifficulty) -> {
return enumdifficulty == Difficulty.NORMAL || enumdifficulty == Difficulty.HARD;
static final Predicate<Difficulty> DOOR_BREAKING_PREDICATE = (difficulty) -> {
return difficulty == Difficulty.NORMAL || difficulty == Difficulty.HARD;
};
- private boolean isJohnny;
+ private boolean isJohnny; public boolean isJohnny() { return isJohnny; } public void setJohnny(boolean johnny) { isJohnny = johnny; } // Paper - OBFHELPER
- boolean isJohnny;
+ private boolean isJohnny; public boolean isJohnny() { return this.isJohnny; } public void setJohnny(boolean johnny) { this.isJohnny = johnny; } // Paper - OBFHELPER
public Vindicator(EntityType<? extends Vindicator> type, Level world) {
super(type, world);

Datei anzeigen

@ -4,11 +4,11 @@ Date: Sun, 23 Sep 2018 20:59:53 -0500
Subject: [PATCH] Honor EntityAgeable.ageLock
diff --git a/src/main/java/net/minecraft/world/entity/AgableMob.java b/src/main/java/net/minecraft/world/entity/AgableMob.java
diff --git a/src/main/java/net/minecraft/world/entity/AgeableMob.java b/src/main/java/net/minecraft/world/entity/AgeableMob.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/AgableMob.java
+++ b/src/main/java/net/minecraft/world/entity/AgableMob.java
@@ -0,0 +0,0 @@ public abstract class AgableMob extends PathfinderMob {
--- a/src/main/java/net/minecraft/world/entity/AgeableMob.java
+++ b/src/main/java/net/minecraft/world/entity/AgeableMob.java
@@ -0,0 +0,0 @@ public abstract class AgeableMob extends PathfinderMob {
}
public void ageUp(int age, boolean overGrow) {

Datei anzeigen

@ -15,22 +15,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/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 {
@Nullable
public Entity getOwner() {
- return this.ownerUUID != null && this.level instanceof ServerLevel ? ((ServerLevel) this.level).getEntity(this.ownerUUID) : (this.ownerNetworkId != 0 ? this.level.getEntity(this.ownerNetworkId) : null);
+ // Paper start - MC-50319 - shooter might be in another world (arrows through portals)
+ Entity entity = this.ownerUUID != null && this.level instanceof ServerLevel ? ((ServerLevel) this.level).getEntity(this.ownerUUID) : (this.ownerNetworkId != 0 ? this.level.getEntity(this.ownerNetworkId) : null);
+ if (entity == null) {
+ for (ServerLevel world : level.getServer().getAllLevels()) {
+ entity = world.getEntity(this.ownerUUID);
+ if (entity != null) {
+ break;
return this.cachedOwner;
} else if (this.ownerUUID != null && this.level instanceof ServerLevel) {
this.cachedOwner = ((ServerLevel) this.level).getEntity(this.ownerUUID);
+ // Paper start - check all worlds
+ if (this.cachedOwner == null) {
+ for (final ServerLevel level : this.level.getServer().getAllLevels()) {
+ if (level == this.level) continue;
+ final Entity entity = level.getEntity(this.ownerUUID);
+ if (entity != null) {
+ this.cachedOwner = entity;
+ break;
+ }
+ }
+ }
+ }
+ return entity;
+ // Paper end
}
@Override
+ // Paper end
return this.cachedOwner;
} else {
return null;

Datei anzeigen

@ -12,8 +12,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
protected int nextStartTick;
protected int tryTicks;
private int maxStayTicks;
- protected BlockPos blockPos;
+ protected BlockPos blockPos;public final BlockPos getTargetPosition() { return this.blockPos; } // Paper - OBFHELPER
- protected BlockPos blockPos = BlockPos.ZERO;
+ protected BlockPos blockPos = BlockPos.ZERO; public final BlockPos getTargetPosition() { return this.blockPos; } // Paper - OBFHELPER
private boolean reachedTarget;
private final int searchRange;
private final int verticalSearchRange;
@ -33,7 +33,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.entityData.set(Turtle.HOME_POS, pos);
}
- private BlockPos getHomePos() {
- BlockPos getHomePos() {
+ public BlockPos getHomePos() { // Paper - public
return (BlockPos) this.entityData.get(Turtle.HOME_POS);
}
@ -42,47 +42,41 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return (Boolean) this.entityData.get(Turtle.HAS_EGG);
}
- private void setHasEgg(boolean hasEgg) {
- void setHasEgg(boolean hasEgg) {
+ public void setHasEgg(boolean hasEgg) { // Paper
this.entityData.set(Turtle.HAS_EGG, hasEgg);
}
+ public final boolean isDigging() { return this.isLayingEgg(); } // Paper - OBFHELPER
public boolean isLayingEgg() {
return (Boolean) this.entityData.get(Turtle.LAYING_EGG);
}
+ public final void setDigging(boolean digging) { this.setLayingEgg(digging); } // Paper - OBFHELPER
private void setLayingEgg(boolean diggingSand) {
this.layEggCounter = diggingSand ? 1 : 0;
@@ -0,0 +0,0 @@ public class Turtle extends Animal {
this.entityData.set(Turtle.LAYING_EGG, diggingSand);
}
+ public final boolean isGoingHome() { return this.isGoingHome(); } // Paper - OBFHELPER
private boolean isGoingHome() {
- boolean isGoingHome() {
+ public boolean isGoingHome() { // Paper - public
return (Boolean) this.entityData.get(Turtle.GOING_HOME);
}
+ public final void setGoingHome(boolean goingHome) { this.setGoingHome(goingHome); } // Paper - OBFHELPER
private void setGoingHome(boolean landBound) {
- void setGoingHome(boolean landBound) {
+ public void setGoingHome(boolean landBound) { // Paper - public
this.entityData.set(Turtle.GOING_HOME, landBound);
}
+ public final boolean isTravelling() { return this.isTravelling(); } // Paper - OBFHELPER
private boolean isTravelling() {
- boolean isTravelling() {
+ public boolean isTravelling() { // Paper - public
return (Boolean) this.entityData.get(Turtle.TRAVELLING);
}
+ public final void setTravelling(boolean travelling) { this.setTravelling(travelling); } // Paper - OBFHELPER
private void setTravelling(boolean travelling) {
- void setTravelling(boolean travelling) {
+ public void setTravelling(boolean travelling) { // Paper - public
this.entityData.set(Turtle.TRAVELLING, travelling);
}
@@ -0,0 +0,0 @@ public class Turtle extends Animal {
if (!this.turtle.isInWater() && this.isReachedTarget()) {
if (this.turtle.layEggCounter < 1) {
- this.turtle.setLayingEgg(true);
+ this.turtle.setDigging(new com.destroystokyo.paper.event.entity.TurtleStartDiggingEvent((org.bukkit.entity.Turtle) this.turtle.getBukkitEntity(), 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(), MCUtil.toLocation(this.turtle.level, this.getTargetPosition())).callEvent()); // Paper
} else if (this.turtle.layEggCounter > 200) {
Level world = this.turtle.level;
@ -134,7 +128,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ @Override
+ public boolean isDigging() {
+ return getHandle().isDigging();
+ return getHandle().isLayingEgg();
+ }
+
+ @Override