fix
Dieser Commit ist enthalten in:
Jason Penilla 2021-06-12 23:48:25 -07:00
Ursprung 0fa2a949ae
Commit 79f1d1a078
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 0E75A301420E48F8
27 geänderte Dateien mit 340 neuen und 481 gelöschten Zeilen

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Material API additions
diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java
index a9769ae0bad61d200c70331eba0b655da4ba03b2..9c28351c7c3f60c6a3b4020329344f91efeedae1 100644
index da9f91d0a1d20839cfbc4e564f4987cda440f2ac..52290c43d1c02785c4cae4a73494a75cdc369e02 100644
--- a/src/main/java/org/bukkit/Material.java
+++ b/src/main/java/org/bukkit/Material.java
@@ -98,6 +98,7 @@ import org.jetbrains.annotations.Nullable;
@@ -99,6 +99,7 @@ import org.jetbrains.annotations.Nullable;
/**
* An enum of all material IDs accepted by the official server and client
*/
@ -16,7 +16,7 @@ index a9769ae0bad61d200c70331eba0b655da4ba03b2..9c28351c7c3f60c6a3b4020329344f91
public enum Material implements Keyed {
//<editor-fold desc="Materials" defaultstate="collapsed">
AIR(9648, 0),
@@ -3976,6 +3977,22 @@ public enum Material implements Keyed {
@@ -3977,6 +3978,22 @@ public enum Material implements Keyed {
}
}

Datei anzeigen

@ -946,7 +946,7 @@ index 0000000000000000000000000000000000000000..9266c9d77e2eef7cd717dc729834a190
+ .ensureSize("WATER_BASED", 9);
+}
diff --git a/src/main/java/org/bukkit/Tag.java b/src/main/java/org/bukkit/Tag.java
index aacbfadc91f580cc667603c8165eacbadee38cca..3c2a6a2167eab43097f5d6ccf1550e12795fc0b6 100644
index 53b66c28f0fed97664d0886683731e94ca59bdd2..88ea8b6c5c2c4d2116f646341de62590718bc28c 100644
--- a/src/main/java/org/bukkit/Tag.java
+++ b/src/main/java/org/bukkit/Tag.java
@@ -10,6 +10,10 @@ import org.jetbrains.annotations.NotNull;

Datei anzeigen

@ -49,7 +49,7 @@ index 0000000000000000000000000000000000000000..f52644fab1522bdf83ff4f489e9805b2
+ }
+}
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
index 8fe7ccf12339355554835542cc1068d9f6c3a435..561db9d594633e3909fd6d69dad1dc2976928d58 100644
index 05992ade1bca42a6233373b44513b89986d89c5a..ac6921093457cee6d01fd27690c8bb6034b4af53 100644
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
@@ -151,6 +151,50 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add sun related API
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index ec8e3a949a869545a8e0cb8c2f59f1a6dd8f5485..ce1a3de1d03e10b18c0098ee2778361cc9a4cb01 100644
index 1264c65235e622f648d71ef10d804ef5193da973..b80a2fe9eb6824d986126e451900a62244d3a8e7 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -1812,6 +1812,16 @@ public interface World extends PluginMessageRecipient, Metadatable, net.kyori.ad

Datei anzeigen

@ -8,6 +8,8 @@ which contains the location of the spawner too similarly to how the
SpawnerSpawnEvent gets called instead of the CreatureSpawnEvent for
spawners.
Dropped as it does not apply due to the earlier PreCreatureSpawnEvent patch not being applied
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..48cff063594840a07aeaf35513780e28ea019a76

Datei anzeigen

@ -8,6 +8,8 @@ which contains the location of the spawner too similarly to how the
SpawnerSpawnEvent gets called instead of the CreatureSpawnEvent for
spawners.
Dropped as it does not apply due to the earlier PreCreatureSpawnEvent patch not being applied
diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java
index ac572eba10a7239d71dfae060f623b076d4252ce..1ce675d0d24ceb5724f5ac2d8f671e38f2735f74 100644
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java

Datei anzeigen

@ -1,18 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
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
index d7c19e5607bcf92c874b3656c2742f4c84dceb12..354311dc541588212a2eacba38e60c7e34aa4c2b 100644
--- a/src/main/java/net/minecraft/world/entity/AgableMob.java
+++ b/src/main/java/net/minecraft/world/entity/AgableMob.java
@@ -82,6 +82,7 @@ public abstract class AgableMob extends PathfinderMob {
}
public void ageUp(int age, boolean overGrow) {
+ if (ageLocked) return; // Paper - GH-1459
int j = this.getAge();
int k = j;

Datei anzeigen

@ -1,36 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 17 Oct 2018 19:17:27 -0400
Subject: [PATCH] MC-50319: Check other worlds for shooter of projectiles
Say a player shoots an arrow through a nether portal, the game
would lose the shooter for determining things such as Player Kills,
because the entity is in another world.
If the projectile fails to find the shooter in the current world, check
other worlds.
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 d1dd173c11d751b15c3afd4309e386931fd9cf8d..d385fb6eee5000951c350b6ced5669dc3dcce725 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
@@ -44,7 +44,18 @@ 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 entity;
+ // Paper end
}
@Override

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 c5d6235a132818dfc78105e9d03d0687f697bb00..d106118dbf4fb270f8526e40a767dd4c563a333f 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1503,6 +1503,7 @@ 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());
@@ -2153,6 +2154,7 @@ 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 e92a8c4c49c452e1f3f0c06398f2a74e3432262f..d3640975c5a33b4911428760691215905b987385 100644
--- a/src/main/java/net/minecraft/world/entity/EntitySelector.java
+++ b/src/main/java/net/minecraft/world/entity/EntitySelector.java
@@ -22,6 +22,7 @@ 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 29d4ed42e5d763639a50d849ef274c4d848bc9c9..046a05925739005080af35c4be984303b575bf68 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -108,6 +108,7 @@ 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;
@@ -3657,6 +3658,37 @@ 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 983d0495ec35128ca3ef68566ada065bc4b21efc..143a160a7577e9e34d34a9f3b900db03d3f297af 100644
--- a/src/main/java/net/minecraft/world/phys/AABB.java
+++ b/src/main/java/net/minecraft/world/phys/AABB.java
@@ -116,6 +116,7 @@ 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;
@@ -145,6 +146,12 @@ 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;
@@ -204,6 +211,7 @@ 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);
}
@@ -237,6 +245,7 @@ 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 7e3a215f1592bed9f35e22076d9e35a5a49a430e..a01bd035846df0e2e28dc55e2ef2f5f35b83f905 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -1,6 +1,7 @@
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;
@@ -30,8 +31,11 @@ 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;
@@ -215,6 +219,33 @@ 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

@ -13,10 +13,10 @@ Shulkers) may need to be changed in order for it to re-save properly
No more crashing though.
diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java
index 68c3f069f8f832ab3d146748348aded69b5ad823..1fecc81b25109592907623741225a6222a8c5ccc 100644
index 5c290f263fc2b643987c96ea75729bf1ff493760..0df3961919f04f27eb265ab316aa5a0f15a70854 100644
--- a/src/main/java/net/minecraft/server/MCUtil.java
+++ b/src/main/java/net/minecraft/server/MCUtil.java
@@ -7,6 +7,8 @@ import com.google.common.util.concurrent.ThreadFactoryBuilder;
@@ -6,6 +6,8 @@ import com.google.common.util.concurrent.ThreadFactoryBuilder;
import it.unimi.dsi.fastutil.objects.ObjectRBTreeSet;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
@ -25,11 +25,10 @@ index 68c3f069f8f832ab3d146748348aded69b5ad823..1fecc81b25109592907623741225a622
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.ChunkPos;
@@ -514,4 +516,19 @@ public final class MCUtil {
return null;
@@ -513,6 +515,21 @@ public final class MCUtil {
}
}
+
+ @Nullable
+ public static Component getBaseComponentFromNbt(String key, CompoundTag compound) {
+ if (!compound.contains(key)) {
@ -44,9 +43,12 @@ index 68c3f069f8f832ab3d146748348aded69b5ad823..1fecc81b25109592907623741225a622
+
+ 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 9ad077259563a3d960d32a59d4b6fc3cfbe3440c..00dc4cd436023b946d7005f17a7ba983a4bbdfb6 100644
index 04a3627667498b841fbff547d1874d99cc708af4..2e6172930526efc536a214e420e690a5ea42ac3e 100644
--- a/src/main/java/net/minecraft/world/level/BaseCommandBlock.java
+++ b/src/main/java/net/minecraft/world/level/BaseCommandBlock.java
@@ -12,6 +12,7 @@ import net.minecraft.commands.CommandSourceStack;
@ -57,20 +59,20 @@ index 9ad077259563a3d960d32a59d4b6fc3cfbe3440c..00dc4cd436023b946d7005f17a7ba983
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.StringUtil;
@@ -72,7 +73,7 @@ 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
@@ -73,7 +74,7 @@ public abstract class BaseCommandBlock implements CommandSource {
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 2e3ec85e7bd1c375db0662dba2617d8924dbd2a6..2c885be67b9c992b96f5caf78130d46abb455ceb 100644
index e07c9e7e37a2c6aa3fc4b7fdc2d547d9c8a2177e..83f27ede626fc7e263acf2c9417a2c2699e4c79a 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BannerBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BannerBlockEntity.java
@@ -9,6 +9,7 @@ import net.minecraft.nbt.ListTag;
@@ -10,6 +10,7 @@ import net.minecraft.nbt.ListTag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket;
@ -78,20 +80,20 @@ index 2e3ec85e7bd1c375db0662dba2617d8924dbd2a6..2c885be67b9c992b96f5caf78130d46a
import net.minecraft.world.Nameable;
import net.minecraft.world.item.DyeColor;
import net.minecraft.world.item.ItemStack;
@@ -70,7 +71,7 @@ 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
@@ -95,7 +96,7 @@ public class BannerBlockEntity extends BlockEntity implements Nameable {
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 a7358274fe367a113b304a5ce332b8dcf721b7af..2b420109e9bed184aaa4ffbcee666b4c325c5a28 100644
index 16fd9b356fee79b56893fe0a7c71721ae81664ab..67e39ebc7984d47bdf9081c24cb26845d70b83bb 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
@@ -4,6 +4,7 @@ import javax.annotation.Nullable;
@@ -5,6 +5,7 @@ import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
@ -99,12 +101,12 @@ index a7358274fe367a113b304a5ce332b8dcf721b7af..2b420109e9bed184aaa4ffbcee666b4c
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.world.Container;
@@ -30,7 +31,7 @@ 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
@@ -31,7 +32,7 @@ public abstract class BaseContainerBlockEntity extends BlockEntity implements Co
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

@ -0,0 +1,18 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Sun, 23 Sep 2018 20:59:53 -0500
Subject: [PATCH] Honor EntityAgeable.ageLock
diff --git a/src/main/java/net/minecraft/world/entity/AgeableMob.java b/src/main/java/net/minecraft/world/entity/AgeableMob.java
index 123b125a3576903767983c93135086ca7a8ea813..c0780a8714808498390282b7fa1da1f3aacf8e2a 100644
--- a/src/main/java/net/minecraft/world/entity/AgeableMob.java
+++ b/src/main/java/net/minecraft/world/entity/AgeableMob.java
@@ -84,6 +84,7 @@ public abstract class AgeableMob extends PathfinderMob {
}
public void ageUp(int age, boolean overGrow) {
+ if (ageLocked) return; // Paper - GH-1459
int j = this.getAge();
int k = j;

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Configurable connection throttle kick message
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index 62621562137cba4804f0465c58d25ca2786328e5..7178b37f7978c7e9031a22726005c5099fd78fe0 100644
index ee8ead249d89bc81f87bfff6a1f594a9aeb21250..585be2fcbd63a59f911df69136eae07ce665053c 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -281,6 +281,11 @@ public class PaperConfig {
@@ -282,6 +282,11 @@ public class PaperConfig {
authenticationServersDownKickMessage = Strings.emptyToNull(getString("messages.kick.authentication-servers-down", authenticationServersDownKickMessage));
}
@ -21,13 +21,13 @@ index 62621562137cba4804f0465c58d25ca2786328e5..7178b37f7978c7e9031a22726005c509
Object val = config.get("settings.save-player-data");
if (val instanceof Boolean) {
diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
index 45c9dc9c2a580a5cd57fd4e891fbaa2b1336f5c5..6f98be2b9b00f71dd041e7511c70166fdecf0749 100644
index 484221e5a9c246aa91e0eacef3911b0e9ecff401..c09d3cdb3acb04b6a833c30a619ff2af5e8b6b18 100644
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
@@ -50,7 +50,7 @@ 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

@ -8,7 +8,7 @@ our own relocation. Also lets us rewrite NMS calls for when we're
debugging in an IDE pre-relocate.
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
index 45cbdcfc131bbc0e2bf23cc30a572df72eecd51c..49e5a86c223f1b28ce7da6ced276b2f880777856 100644
index a79c62e1c3ee49ada505c07b1171b439beeb4bdf..cbf630243410f97c21b14f654e81dc96b0323b70 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
@@ -6,7 +6,9 @@ import java.io.FileOutputStream;
@ -167,7 +167,7 @@ index 45cbdcfc131bbc0e2bf23cc30a572df72eecd51c..49e5a86c223f1b28ce7da6ced276b2f8
if ( owner.equals( "org/bukkit/block/Biome" ) )
{
switch ( name )
@@ -270,6 +384,14 @@ public class Commodore
@@ -273,6 +387,14 @@ public class Commodore
return;
}

Datei anzeigen

@ -5,22 +5,23 @@ Subject: [PATCH] Add sun related API
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index f3690ea49cf90c816b8b3554b47d6f2d9dfbe016..29a2eeee9f2011ed6fcc44f19041f616decfdb38 100644
index 8451baff82cb7ec7615ab50a409724897ccf4d95..32e8ae0d2a0f78af671a632c4d1be58a0b38a392 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -1595,6 +1595,7 @@ public abstract class Mob extends LivingEntity {
@@ -1561,7 +1561,7 @@ public abstract class Mob extends LivingEntity {
}
+ 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 57a2af56b53567371fdb6d0a55866e1e4e37cf3b..7b5abccac9793811bd56340c8f9d23806e832365 100644
index b8565aa86b478adb6fca6d433637ddb342ce6dcb..fda8858375a08e0aac15ca00751df5a34ed6a0f2 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -847,6 +847,13 @@ public class CraftWorld implements World {
@@ -866,6 +866,13 @@ public class CraftWorld implements World {
}
}
@ -35,18 +36,18 @@ index 57a2af56b53567371fdb6d0a55866e1e4e37cf3b..7b5abccac9793811bd56340c8f9d2380
public long getGameTime() {
return world.levelData.getGameTime();
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
index b5fe55a77c8558cf2ea32689ff57911530df75f9..1e3a0851c75d8067d2699f00bb3f6621d1d739d8 100644
index 9c9fa83615cd06539ce5e4e3d4feaa69f65b7931..317b6abd2764cf34ef5c42bdbf48ab0bc5a03d27 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
@@ -77,4 +77,11 @@ 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

@ -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 960c3e75a60ef33141e615bd8b256528eeaf399c..0974781e2f7fc541eaf397de033fb12b87dbf8ba 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2339,6 +2339,7 @@ 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 fd0c307a4b340661ba9aff9ae4e0055c139a1ebd..8333d604fce05349455bf1779f3e5b0a980c4c16 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -116,6 +116,7 @@ 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;
@@ -3730,6 +3731,38 @@ 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 cb4c15d17ea3f22e6baa73ba6ce2a18e34ac4b00..5477f288db57d63051f4579b8cd3c19e3af430ee 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -1,5 +1,6 @@
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;
@@ -210,6 +211,33 @@ 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

@ -5,23 +5,23 @@ Subject: [PATCH] Turtle API
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java
index 4584fad16a65f06e77e97a0804d88dbe83f7c5c1..c8680e795deeb68e0662eac7c760a103d1c767b4 100644
index 70a51ba19fb34f652858b18f24554261787d97e2..065d0752db0e3ae2a89d707aaa2145807f50ecad 100644
--- a/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java
@@ -14,7 +14,7 @@ public abstract class MoveToBlockGoal extends Goal {
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;
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 c54f4b83b9f2fdb15ddb363be0a179a05eb3693b..42b636c4ebb6eb83c8a9f3f5f9a766d37d065dc3 100644
index b782d278463a72b8514719e9b14986f268828772..e638d982b4bd1d261a7282cad6dab98ad0b55213 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Turtle.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Turtle.java
@@ -14,6 +14,7 @@ import net.minecraft.nbt.CompoundTag;
@@ -11,6 +11,7 @@ import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.network.syncher.EntityDataSerializers;
import net.minecraft.network.syncher.SynchedEntityData;
@ -33,56 +33,50 @@ index c54f4b83b9f2fdb15ddb363be0a179a05eb3693b..42b636c4ebb6eb83c8a9f3f5f9a766d3
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);
}
@@ -109,31 +110,37 @@ public class Turtle extends Animal {
@@ -109,7 +110,7 @@ public class Turtle extends Animal {
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;
@@ -122,19 +123,19 @@ 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);
}
@@ -500,14 +507,17 @@ public class Turtle extends Animal {
@@ -487,14 +488,17 @@ 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;
@ -98,7 +92,7 @@ index c54f4b83b9f2fdb15ddb363be0a179a05eb3693b..42b636c4ebb6eb83c8a9f3f5f9a766d3
}
// CraftBukkit end
this.turtle.setHasEgg(false);
@@ -636,7 +646,7 @@ public class Turtle extends Animal {
@@ -562,7 +566,7 @@ public class Turtle extends Animal {
@Override
public boolean canUse() {
@ -108,7 +102,7 @@ index c54f4b83b9f2fdb15ddb363be0a179a05eb3693b..42b636c4ebb6eb83c8a9f3f5f9a766d3
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTurtle.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTurtle.java
index ed08089f21c8958fc9fc7e6e73a2b6ff9108242c..e50f6051baf34981707adce56ab2d3e1f341fb4c 100644
index ed08089f21c8958fc9fc7e6e73a2b6ff9108242c..a3849ebba14b47b33f1af57c47f94c02aebea232 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTurtle.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTurtle.java
@@ -24,4 +24,36 @@ public class CraftTurtle extends CraftAnimals implements Turtle {
@ -134,7 +128,7 @@ index ed08089f21c8958fc9fc7e6e73a2b6ff9108242c..e50f6051baf34981707adce56ab2d3e1
+
+ @Override
+ public boolean isDigging() {
+ return getHandle().isDigging();
+ return getHandle().isLayingEgg();
+ }
+
+ @Override

Datei anzeigen

@ -0,0 +1,35 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 17 Oct 2018 19:17:27 -0400
Subject: [PATCH] MC-50319: Check other worlds for shooter of projectiles
Say a player shoots an arrow through a nether portal, the game
would lose the shooter for determining things such as Player Kills,
because the entity is in another world.
If the projectile fails to find the shooter in the current world, check
other worlds.
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 30118ff975da9491fa41db2133d217c2a797a8e3..7311923d36ee872b4331d84f80709bb6cee61086 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
@@ -57,6 +57,18 @@ public abstract class Projectile extends Entity {
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;
+ }
+ }
+ }
+ // Paper end
return this.cachedOwner;
} else {
return null;

Datei anzeigen

@ -19,10 +19,10 @@ spectate the target entity.
Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 75419c866641ab654349cde6ca3fbdef701dd8d9..92139b271eb6c305787662ef8c7d221fb42296f7 100644
index bea1461ee3bd65f02bf6add6ed967555092fd675..b2324b53b3cec3e577a8ec8c45b113c232d220a6 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1818,14 +1818,58 @@ public class ServerPlayer extends Player implements ContainerListener {
@@ -1822,14 +1822,58 @@ public class ServerPlayer extends Player {
}
public void setCamera(Entity entity) {
@ -32,7 +32,7 @@ index 75419c866641ab654349cde6ca3fbdef701dd8d9..92139b271eb6c305787662ef8c7d221f
- 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 75419c866641ab654349cde6ca3fbdef701dd8d9..92139b271eb6c305787662ef8c7d221f
+ }
+ // 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 75419c866641ab654349cde6ca3fbdef701dd8d9..92139b271eb6c305787662ef8c7d221f
+ 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 75419c866641ab654349cde6ca3fbdef701dd8d9..92139b271eb6c305787662ef8c7d221f
+ 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
@ -86,14 +86,23 @@ index 75419c866641ab654349cde6ca3fbdef701dd8d9..92139b271eb6c305787662ef8c7d221f
@Override
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 900c9b1106a153bc386f6c3d9c11226f8ac69f86..4fd8d775790c037e82f9b0d29ed0eccf03c2dc66 100644
index a29b8c83be940e4b3db06d881b59b03120e931ab..06922b26ca1f2e31f7c8a527f1a8fdda4a8554c0 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1353,6 +1353,7 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener {
@@ -1068,7 +1068,7 @@ 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()) {
@@ -1381,6 +1381,7 @@ 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

@ -14,10 +14,10 @@ forwarding, and is integrated into the Minecraft login process by using the 1.13
login plugin message packet.
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index 7178b37f7978c7e9031a22726005c5099fd78fe0..3139c194f9b1bc3510d51a81f13ae43d00a3dc29 100644
index 585be2fcbd63a59f911df69136eae07ce665053c..9768c591e72ce2ef5fdb43e2fc63378c57773216 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -8,6 +8,7 @@ import java.io.IOException;
@@ -9,6 +9,7 @@ import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
@ -25,7 +25,7 @@ index 7178b37f7978c7e9031a22726005c5099fd78fe0..3139c194f9b1bc3510d51a81f13ae43d
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -252,7 +253,7 @@ public class PaperConfig {
@@ -253,7 +254,7 @@ public class PaperConfig {
}
public static boolean isProxyOnlineMode() {
@ -34,11 +34,10 @@ index 7178b37f7978c7e9031a22726005c5099fd78fe0..3139c194f9b1bc3510d51a81f13ae43d
}
public static int packetInSpamThreshold = 300;
@@ -324,4 +325,18 @@ public class PaperConfig {
}
@@ -326,6 +327,20 @@ 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,10 +51,13 @@ index 7178b37f7978c7e9031a22726005c5099fd78fe0..3139c194f9b1bc3510d51a81f13ae43d
+ 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..5490ddb9f2ff1fc3e6088e703c246a06594076bc
index 0000000000000000000000000000000000000000..41d73aa91fb401612e087aa1b7278ba61d28bf3a
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/proxy/VelocityProxy.java
@@ -0,0 +1,66 @@
@ -106,11 +108,11 @@ index 0000000000000000000000000000000000000000..5490ddb9f2ff1fc3e6088e703c246a06
+ }
+
+ 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,80 +120,18 @@ index 0000000000000000000000000000000000000000..5490ddb9f2ff1fc3e6088e703c246a06
+ 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 10f1e3d761af83507bf71a00092641e22d0c8049..a295845409824b930992426451ef26856d6e7c36 100644
--- a/src/main/java/net/minecraft/network/FriendlyByteBuf.java
+++ b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
@@ -191,6 +191,7 @@ 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;
@@ -231,6 +232,7 @@ public class FriendlyByteBuf extends ByteBuf {
return this;
}
+ public UUID readUUID() { return readUUID(); } // Paper - OBFHELPER
public UUID readUUID() {
return new UUID(this.readLong(), this.readLong());
}
@@ -358,6 +360,7 @@ 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 8a0301cc4a411c4f9384331d68794ca73b797f5f..88a63635d73983afe58406c66f4ea81cd823c627 100644
--- a/src/main/java/net/minecraft/network/protocol/login/ClientboundCustomQueryPacket.java
+++ b/src/main/java/net/minecraft/network/protocol/login/ClientboundCustomQueryPacket.java
@@ -13,6 +13,14 @@ 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 ed5c62d121c69e91da9fd5f91ccf9abd665a3b40..790edd9f5a2527f5f715e2e2bec0b454cf0a2ce7 100644
--- a/src/main/java/net/minecraft/network/protocol/login/ServerboundCustomQueryPacket.java
+++ b/src/main/java/net/minecraft/network/protocol/login/ServerboundCustomQueryPacket.java
@@ -6,8 +6,8 @@ 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 0aa3a154d68f00edcc09b947a24b2b59b1e135e6..22d6f41001977917ec75046252cbf7157b92396d 100644
index 1d05725374bdffad6a8ab1502ee732775345024d..a196ab2510a1c302ef1c946400c1a7c07619994a 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -18,9 +18,11 @@ import javax.crypto.Cipher;
@@ -18,6 +18,7 @@ import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import net.minecraft.DefaultUncaughtExceptionHandler;
import net.minecraft.network.Connection;
@ -199,11 +139,7 @@ index 0aa3a154d68f00edcc09b947a24b2b59b1e135e6..22d6f41001977917ec75046252cbf715
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;
@@ -43,6 +45,7 @@ import org.bukkit.craftbukkit.util.Waitable;
@@ -44,6 +45,7 @@ import org.bukkit.craftbukkit.util.Waitable;
import org.bukkit.event.player.AsyncPlayerPreLoginEvent;
import org.bukkit.event.player.PlayerPreLoginEvent;
// CraftBukkit end
@ -211,22 +147,22 @@ index 0aa3a154d68f00edcc09b947a24b2b59b1e135e6..22d6f41001977917ec75046252cbf715
public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener {
@@ -59,6 +62,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
private SecretKey secretKey;
@@ -62,6 +64,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
@Nullable
private ServerPlayer delayedAcceptPlayer;
public String hostname = ""; // CraftBukkit - add field
+ private int velocityLoginMessageId = -1; // Paper - Velocity support
public ServerLoginPacketListenerImpl(MinecraftServer server, Connection connection) {
this.state = ServerLoginPacketListenerImpl.State.HELLO;
@@ -211,6 +215,14 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
@@ -233,6 +236,14 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
this.state = ServerLoginPacketListenerImpl.State.KEY;
this.connection.send(new ClientboundHelloPacket("", this.server.getKeyPair().getPublic().getEncoded(), this.nonce));
} else {
+ // 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;
+ }
@ -234,26 +170,26 @@ index 0aa3a154d68f00edcc09b947a24b2b59b1e135e6..22d6f41001977917ec75046252cbf715
// Spigot start
// Paper start - Cache authenticator threads
authenticatorPool.execute(new Runnable() {
@@ -312,6 +324,12 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
@@ -334,6 +345,12 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
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();
@@ -359,6 +377,40 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
+ // 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();
@@ -381,6 +398,40 @@ 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 0aa3a154d68f00edcc09b947a24b2b59b1e135e6..22d6f41001977917ec75046252cbf715
+ }
+ 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(() -> {
@ -289,10 +225,10 @@ index 0aa3a154d68f00edcc09b947a24b2b59b1e135e6..22d6f41001977917ec75046252cbf715
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 5e36d705c56384f507fd85f704eae634379a27f1..c06b35f114a8d243198b66c44ef57d8c2b201361 100644
index 16645b4c096936c4d5c00f335e5cdb7dd4a4e2bd..717ad1c24bbc882db8f76cfef7bf847c58914e5a 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -680,7 +680,7 @@ public final class CraftServer implements Server {
@@ -683,7 +683,7 @@ public final class CraftServer implements Server {
@Override
public long getConnectionThrottle() {
// Spigot Start - Automatically set connection throttle for bungee configurations

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add more Witch API
diff --git a/src/main/java/net/minecraft/world/entity/monster/Witch.java b/src/main/java/net/minecraft/world/entity/monster/Witch.java
index a37ee32b46aa87be6e3eeca2892b4e7294fd1aef..bc9380782c2afba359852542837e7154c4c6cf8b 100644
index 5e2e8cb5eba4ba36065f07abed954b2aad022321..ee32917c9852a97c27779ea969131e6c28bbb3ac 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Witch.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Witch.java
@@ -1,5 +1,8 @@
@ -26,20 +26,7 @@ index a37ee32b46aa87be6e3eeca2892b4e7294fd1aef..bc9380782c2afba359852542837e7154
private NearestHealableRaiderTargetGoal<Raider> healRaidersGoal;
private NearestAttackableWitchTargetGoal<Player> attackPlayersGoal;
@@ -95,10 +98,12 @@ 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);
}
@@ -157,21 +162,24 @@ public class Witch extends Raider implements RangedAttackMob {
@@ -157,21 +160,24 @@ public class Witch extends Raider implements RangedAttackMob {
}
if (potionregistry != null) {
@ -76,7 +63,7 @@ index a37ee32b46aa87be6e3eeca2892b4e7294fd1aef..bc9380782c2afba359852542837e7154
}
}
@@ -183,6 +191,24 @@ public class Witch extends Raider implements RangedAttackMob {
@@ -183,6 +189,24 @@ public class Witch extends Raider implements RangedAttackMob {
super.aiStep();
}

Datei anzeigen

@ -5,15 +5,15 @@ 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 cc9cd34f77e1f568572f312655fb2fe8e83bd733..0addfd6a1421fc99840d9229bad3ba04e524317b 100644
index bacc065a9ce619fb0ac15b61cc5032c6bec00019..50228e59d629e75e97d23bd3ec92088f75480827 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Drowned.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Drowned.java
@@ -82,7 +82,7 @@ public class Drowned extends Zombie implements RangedAttackMob {
@@ -79,7 +79,7 @@ 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

@ -5,15 +5,15 @@ Subject: [PATCH] Here's Johnny!
diff --git a/src/main/java/net/minecraft/world/entity/monster/Vindicator.java b/src/main/java/net/minecraft/world/entity/monster/Vindicator.java
index a41f61daf6cbbb13d0b86cdbad8a4cae00368653..623de661f3b56062792e3a7dbc508637aa58aca5 100644
index aaeb82575ce0a3dac7c4e413fb782925573894d7..dcaec42b0756cf36da813815b4a54e4d6c4e293a 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Vindicator.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Vindicator.java
@@ -51,7 +51,7 @@ 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

@ -6,10 +6,10 @@ Subject: [PATCH] Add option to prevent players from moving into unloaded
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index f280dbff4a09bc611a9ca565c6d697d08801f53b..fbf3ccfb347a5ba6e895339e9576629d940d1aa4 100644
index c17c504acdc12b6ef37d6643eb98a57fa5ca40c9..13e730b18c346934c061fb570048623ad66e7344 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -396,4 +396,9 @@ public class PaperWorldConfig {
@@ -390,4 +390,9 @@ public class PaperWorldConfig {
waterOverLavaFlowSpeed = getInt("water-over-lava-flow-speed", 5);
log("Water over lava flow speed: " + waterOverLavaFlowSpeed);
}
@ -20,10 +20,10 @@ index f280dbff4a09bc611a9ca565c6d697d08801f53b..fbf3ccfb347a5ba6e895339e9576629d
+ }
}
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 4fd8d775790c037e82f9b0d29ed0eccf03c2dc66..b5593300516fad767f603084aca4abcda4424db3 100644
index 06922b26ca1f2e31f7c8a527f1a8fdda4a8554c0..5f4718fa42be0ade1a40c0472efbbd0c65f061a7 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -541,6 +541,13 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener {
@@ -532,6 +532,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
}
speed *= 2f; // TODO: Get the speed of the vehicle instead of the player
@ -37,25 +37,25 @@ index 4fd8d775790c037e82f9b0d29ed0eccf03c2dc66..b5593300516fad767f603084aca4abcd
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);
@@ -1139,9 +1146,9 @@ 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;
@@ -1180,6 +1187,12 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener {
@@ -1168,9 +1175,9 @@ 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;
@@ -1208,6 +1215,12 @@ 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