some more stuffs

This commit is contained in:
Jake Potrebic 2023-06-07 19:04:01 -07:00
parent 1eba407610
commit 47c5d82017
No known key found for this signature in database
GPG Key ID: ECE0B3C133C016C5
47 changed files with 375 additions and 265 deletions

View File

@ -54,3 +54,56 @@ index af04071d37e70b8cc9837d57477c8493be8afb9f..00000f1399b053bb3c7b6d4792559b63
+ }
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/inventory/SmithingTransformRecipe.java b/src/main/java/org/bukkit/inventory/SmithingTransformRecipe.java
index 08fd3eca8383cdc2d06c3ce973e8c402d279077e..ad2fc850819c9784d477b59adcc5f5ab32ed4fac 100644
--- a/src/main/java/org/bukkit/inventory/SmithingTransformRecipe.java
+++ b/src/main/java/org/bukkit/inventory/SmithingTransformRecipe.java
@@ -23,6 +23,22 @@ public class SmithingTransformRecipe extends SmithingRecipe {
super(key, result, base, addition);
this.template = template;
}
+ // Paper start
+ /**
+ * Create a smithing recipe to produce the specified result ItemStack.
+ *
+ * @param key The unique recipe key
+ * @param result The item you want the recipe to create.
+ * @param template The template item.
+ * @param base The base ingredient
+ * @param addition The addition ingredient
+ * @param copyNbt whether to copy the nbt from the input base item to the output
+ */
+ public SmithingTransformRecipe(@NotNull NamespacedKey key, @NotNull ItemStack result, @NotNull RecipeChoice template, @NotNull RecipeChoice base, @NotNull RecipeChoice addition, boolean copyNbt) {
+ super(key, result, base, addition, copyNbt);
+ this.template = template;
+ }
+ // Paper end
/**
* Get the template recipe item.
diff --git a/src/main/java/org/bukkit/inventory/SmithingTrimRecipe.java b/src/main/java/org/bukkit/inventory/SmithingTrimRecipe.java
index 32cbdc342615e76ff7a896e67cb0736b0bdf1978..9e84114528507848a4c1947d677ba02d06f9dc14 100644
--- a/src/main/java/org/bukkit/inventory/SmithingTrimRecipe.java
+++ b/src/main/java/org/bukkit/inventory/SmithingTrimRecipe.java
@@ -23,6 +23,21 @@ public class SmithingTrimRecipe extends SmithingRecipe implements ComplexRecipe
super(key, new ItemStack(Material.AIR), base, addition);
this.template = template;
}
+ // Paper start
+ /**
+ * Create a smithing recipe to produce the specified result ItemStack.
+ *
+ * @param key The unique recipe key
+ * @param template The template item.
+ * @param base The base ingredient
+ * @param addition The addition ingredient
+ * @param copyNbt whether to copy the nbt from the input base item to the output
+ */
+ public SmithingTrimRecipe(@NotNull NamespacedKey key, @NotNull RecipeChoice template, @NotNull RecipeChoice base, @NotNull RecipeChoice addition, boolean copyNbt) {
+ super(key, new ItemStack(Material.AIR), base, addition, copyNbt);
+ this.template = template;
+ }
+ // Paper end
/**
* Get the template recipe item.

View File

@ -34,15 +34,15 @@ index 4c46a843c5c7e6f735f6b5f0f3c034524a0cf1e1..2baba1ccc1acd50693e05d565784d11d
list.forEach((entityplayer) -> {
diff --git a/src/main/java/net/minecraft/world/entity/monster/ElderGuardian.java b/src/main/java/net/minecraft/world/entity/monster/ElderGuardian.java
index 0b6c6740e1411a558d224589b3786f3ba8e0a1bc..d02286d553c600fe7e75f48e278e380d21c5b868 100644
index 4e4b68904151d0d851b13f14f89c1c305e95fd5a..8f481e11815d7162dd62a2b850b3d2af6d904519 100644
--- a/src/main/java/net/minecraft/world/entity/monster/ElderGuardian.java
+++ b/src/main/java/net/minecraft/world/entity/monster/ElderGuardian.java
@@ -67,7 +67,7 @@ public class ElderGuardian extends Guardian {
super.customServerAiStep();
if ((this.tickCount + this.getId()) % 1200 == 0) {
MobEffectInstance mobeffect = new MobEffectInstance(MobEffects.DIG_SLOWDOWN, 6000, 2);
- List<ServerPlayer> list = MobEffectUtil.addEffectToPlayersAround((ServerLevel) this.level, this, this.position(), 50.0D, mobeffect, 1200, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
+ List<ServerPlayer> list = MobEffectUtil.addEffectToPlayersAround((ServerLevel) this.level, this, this.position(), 50.0D, mobeffect, 1200, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK, (player) -> new io.papermc.paper.event.entity.ElderGuardianAppearanceEvent(getBukkitEntity(), player.getBukkitEntity()).callEvent()); // CraftBukkit // Paper
- List<ServerPlayer> list = MobEffectUtil.addEffectToPlayersAround((ServerLevel) this.level(), this, this.position(), 50.0D, mobeffect, 1200, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
+ List<ServerPlayer> list = MobEffectUtil.addEffectToPlayersAround((ServerLevel) this.level(), this, this.position(), 50.0D, mobeffect, 1200, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK, (player) -> new io.papermc.paper.event.entity.ElderGuardianAppearanceEvent(getBukkitEntity(), player.getBukkitEntity()).callEvent()); // CraftBukkit // Paper
list.forEach((entityplayer) -> {
entityplayer.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.GUARDIAN_ELDER_EFFECT, this.isSilent() ? 0.0F : 1.0F));

View File

@ -11,13 +11,13 @@ Move the tick logic into the post tick, where portaling was
designed to happen in the first place.
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 4dc8a8fcffddfc6673d5c161be1224d822ad3dab..f646e2230dbf1dd6bfb1a43545d95a4d9895c3d6 100644
index 1f92d5dbaad1fb2bdfedb6c2044aa99a61388b21..223af8b0b40f11496a0639f220f8e6605be8da2a 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -511,6 +511,36 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
return chunkMap.playerEntityTrackerTrackMaps[type.ordinal()].getObjectsInRange(MCUtil.getCoordinateKey(this));
@@ -431,6 +431,37 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
// Paper end - optimise entity tracking
// Paper end
+ // Paper start - make end portalling safe
+ public BlockPos portalBlock;
+ public ServerLevel portalWorld;
@ -48,10 +48,11 @@ index 4dc8a8fcffddfc6673d5c161be1224d822ad3dab..f646e2230dbf1dd6bfb1a43545d95a4d
+ this.teleportTo(worldserver, null);
+ }
+ // Paper end - make end portalling safe
+
public Entity(EntityType<?> type, Level world) {
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
@@ -2731,6 +2761,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
this.passengers = ImmutableList.of();
@@ -2765,6 +2796,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
this.processPortalCooldown();

View File

@ -5,21 +5,21 @@ Subject: [PATCH] Line Of Sight Changes
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index a99130c736ab17442d708e44434bdb426a3fee91..5cbe700d5620164690ea4a596ec996b6906b473b 100644
index 4ad927541de2f5af9121d17b4f8b359049ee2000..3a669f8e0cd072fcbd5e5ed4b55abb0f73c009e7 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3506,7 +3506,8 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3555,7 +3555,8 @@ public abstract class LivingEntity extends Entity implements Attackable {
Vec3 vec3d = new Vec3(this.getX(), this.getEyeY(), this.getZ());
Vec3 vec3d1 = new Vec3(entity.getX(), entity.getEyeY(), entity.getZ());
- return vec3d1.distanceTo(vec3d) > 128.0D ? false : this.level.clip(new ClipContext(vec3d, vec3d1, ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, this)).getType() == HitResult.Type.MISS;
- return vec3d1.distanceTo(vec3d) > 128.0D ? false : this.level().clip(new ClipContext(vec3d, vec3d1, ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, this)).getType() == HitResult.Type.MISS;
+ // Paper - diff on change - used in CraftLivingEntity#hasLineOfSight(Location) and CraftWorld#lineOfSightExists
+ return vec3d1.distanceToSqr(vec3d) > 128D * 128D ? false : this.level.clip(new ClipContext(vec3d, vec3d1, ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, this)).getType() == HitResult.Type.MISS; // Paper - use distanceToSqr
+ return vec3d1.distanceToSqr(vec3d) > 128D * 128D ? false : this.level().clip(new ClipContext(vec3d, vec3d1, ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, this)).getType() == HitResult.Type.MISS;
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
index f01c6f684da1438808f018fe9a814ecaceb49b2f..505ce1ae7df56be0e70faf359ae1e5ebcc06255e 100644
index 5bd5a059c5beeade313f74ba3c1fc63825bd286b..d7c9b421eb636c0642b73263f46f824b95c1614e 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
@@ -996,5 +996,16 @@ public abstract class CraftRegionAccessor implements RegionAccessor {
@ -40,7 +40,7 @@ index f01c6f684da1438808f018fe9a814ecaceb49b2f..505ce1ae7df56be0e70faf359ae1e5eb
// Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index b38d72e921c4705cae72eb65113b36c87e4250fd..f217df2d3c7a53b72418fab63cef06dbc107fe0d 100644
index b38d72e921c4705cae72eb65113b36c87e4250fd..61292952681727bcd651064619bff1b41c560d75 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -29,6 +29,9 @@ import net.minecraft.world.entity.projectile.ThrownEgg;
@ -60,12 +60,12 @@ index b38d72e921c4705cae72eb65113b36c87e4250fd..f217df2d3c7a53b72418fab63cef06db
+ // Paper start
+ @Override
+ public boolean hasLineOfSight(Location loc) {
+ if (this.getHandle().level != ((CraftWorld) loc.getWorld()).getHandle()) return false;
+ if (this.getHandle().level() != ((CraftWorld) loc.getWorld()).getHandle()) return false;
+ Vec3 vec3d = new Vec3(this.getHandle().getX(), this.getHandle().getEyeY(), this.getHandle().getZ());
+ Vec3 vec3d1 = new Vec3(loc.getX(), loc.getY(), loc.getZ());
+ if (vec3d1.distanceToSqr(vec3d) > 128D * 128D) return false; //Return early if the distance is greater than 128 blocks
+
+ return this.getHandle().level.clip(new ClipContext(vec3d, vec3d1, ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, this.getHandle())).getType() == HitResult.Type.MISS;
+ return this.getHandle().level().clip(new ClipContext(vec3d, vec3d1, ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, this.getHandle())).getType() == HitResult.Type.MISS;
+ }
+ // Paper end
+

View File

@ -6,7 +6,7 @@ Subject: [PATCH] add per world spawn limits
Taken from #2982. Credit to Chasewhip8
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index d2c7730a63118612eb0a60853b3221fab3b6f37e..0acb97676ad066d474b0290cbbb8555f11d09154 100644
index 44d59c9f5053cd6affddf7a51e37ed4b7bd43b08..26468a3788c157241ded0ef7c4c704f801ef53a0 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -213,6 +213,13 @@ public class CraftWorld extends CraftRegionAccessor implements World {

View File

@ -8,7 +8,7 @@ Fixes SPIGOT-6221: https://hub.spigotmc.org/jira/projects/SPIGOT/issues/SPIGOT-6
Fix splash events cancellation that still show particles/sound
diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java
index 7f895fe93b7002ee271f985abbeaf4cd11e900ee..5f7be427bfc4d954dece4792764004cf0b7757a1 100644
index 8b245d69f2d7935bb52e3ddff0757afa95c8e329..bc8cc9ced3fd32ff916c42e8ae95a95414dd1f25 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java
@@ -104,56 +104,77 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie
@ -33,7 +33,7 @@ index 7f895fe93b7002ee271f985abbeaf4cd11e900ee..5f7be427bfc4d954dece4792764004cf
+ if (showParticles) { // Paper
int i = potionregistry.hasInstantEffects() ? 2007 : 2002;
this.level.levelEvent(i, this.blockPosition(), PotionUtils.getColor(itemstack));
this.level().levelEvent(i, this.blockPosition(), PotionUtils.getColor(itemstack));
+ } // Paper
this.discard();
}
@ -43,9 +43,9 @@ index 7f895fe93b7002ee271f985abbeaf4cd11e900ee..5f7be427bfc4d954dece4792764004cf
+ private static final Predicate<net.minecraft.world.entity.LivingEntity> APPLY_WATER_GET_ENTITIES_PREDICATE = ThrownPotion.WATER_SENSITIVE_OR_ON_FIRE.or(Axolotl.class::isInstance); // Paper
+ private boolean applyWater() { // Paper
AABB axisalignedbb = this.getBoundingBox().inflate(4.0D, 2.0D, 4.0D);
- List<net.minecraft.world.entity.LivingEntity> list = this.level.getEntitiesOfClass(net.minecraft.world.entity.LivingEntity.class, axisalignedbb, ThrownPotion.WATER_SENSITIVE_OR_ON_FIRE);
- List<net.minecraft.world.entity.LivingEntity> list = this.level().getEntitiesOfClass(net.minecraft.world.entity.LivingEntity.class, axisalignedbb, ThrownPotion.WATER_SENSITIVE_OR_ON_FIRE);
+ // Paper start
+ List<net.minecraft.world.entity.LivingEntity> list = this.level.getEntitiesOfClass(net.minecraft.world.entity.LivingEntity.class, axisalignedbb, ThrownPotion.APPLY_WATER_GET_ENTITIES_PREDICATE);
+ List<net.minecraft.world.entity.LivingEntity> list = this.level().getEntitiesOfClass(net.minecraft.world.entity.LivingEntity.class, axisalignedbb, ThrownPotion.APPLY_WATER_GET_ENTITIES_PREDICATE);
+ Map<LivingEntity, Double> affected = new HashMap<>();
+ java.util.Set<LivingEntity> rehydrate = new java.util.HashSet<>();
+ java.util.Set<LivingEntity> extinguish = new java.util.HashSet<>();
@ -71,7 +71,7 @@ index 7f895fe93b7002ee271f985abbeaf4cd11e900ee..5f7be427bfc4d954dece4792764004cf
}
}
- List<Axolotl> list1 = this.level.getEntitiesOfClass(Axolotl.class, axisalignedbb);
- List<Axolotl> list1 = this.level().getEntitiesOfClass(Axolotl.class, axisalignedbb);
- Iterator iterator1 = list1.iterator();
-
- while (iterator1.hasNext()) {
@ -102,7 +102,7 @@ index 7f895fe93b7002ee271f985abbeaf4cd11e900ee..5f7be427bfc4d954dece4792764004cf
- private void applySplash(List<MobEffectInstance> statusEffects, @Nullable Entity entity) {
+ private boolean applySplash(List<MobEffectInstance> statusEffects, @Nullable Entity entity) { // Paper
AABB axisalignedbb = this.getBoundingBox().inflate(4.0D, 2.0D, 4.0D);
List<net.minecraft.world.entity.LivingEntity> list1 = this.level.getEntitiesOfClass(net.minecraft.world.entity.LivingEntity.class, axisalignedbb);
List<net.minecraft.world.entity.LivingEntity> list1 = this.level().getEntitiesOfClass(net.minecraft.world.entity.LivingEntity.class, axisalignedbb);
Map<LivingEntity, Double> affected = new HashMap<LivingEntity, Double>(); // CraftBukkit
@@ -171,6 +192,7 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie
if (d0 < 16.0D) {
@ -122,7 +122,7 @@ index 7f895fe93b7002ee271f985abbeaf4cd11e900ee..5f7be427bfc4d954dece4792764004cf
- private void makeAreaOfEffectCloud(ItemStack stack, Potion potion) {
+ private boolean makeAreaOfEffectCloud(ItemStack stack, Potion potion) { // Paper
AreaEffectCloud entityareaeffectcloud = new AreaEffectCloud(this.level, this.getX(), this.getY(), this.getZ());
AreaEffectCloud entityareaeffectcloud = new AreaEffectCloud(this.level(), this.getX(), this.getY(), this.getZ());
Entity entity = this.getOwner();
@@ -244,10 +267,12 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie
@ -144,7 +144,7 @@ index 7f895fe93b7002ee271f985abbeaf4cd11e900ee..5f7be427bfc4d954dece4792764004cf
org.bukkit.event.entity.LingeringPotionSplashEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callLingeringPotionSplashEvent(this, entityareaeffectcloud);
- if (!(event.isCancelled() || entityareaeffectcloud.isRemoved())) {
+ if (!(event.isCancelled() || entityareaeffectcloud.isRemoved() || (noEffects && entityareaeffectcloud.effects.isEmpty() && entityareaeffectcloud.getPotion().getEffects().isEmpty()))) { // Paper - don't spawn area effect cloud if the effects were empty and not changed during the event handling
this.level.addFreshEntity(entityareaeffectcloud);
this.level().addFreshEntity(entityareaeffectcloud);
} else {
entityareaeffectcloud.discard();
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Fix PlayerDropItemEvent using wrong item
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 47d2bf15871e50e46c0e5df725f2bbacfe12a869..4b4bb21149a102a8cbf46ee104417dadb49999df 100644
index 75fef72efe7e85bf494bce6184b6814487f2c900..c89538fe76c37ca1790c837a8eec1d1bd418eefd 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -2249,7 +2249,7 @@ public class ServerPlayer extends Player {
@@ -2252,7 +2252,7 @@ public class ServerPlayer extends Player {
if (retainOwnership) {
if (!itemstack1.isEmpty()) {
@ -18,10 +18,10 @@ index 47d2bf15871e50e46c0e5df725f2bbacfe12a869..4b4bb21149a102a8cbf46ee104417dad
this.awardStat(Stats.DROP);
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index eb0f9c2e54d75ee80bcc421d1042d1eea7c57a16..997b2458a3e14296437e76737b837d90d4936072 100644
index b3634a1d92182c746948862fc64b2e47d11320ba..8f604924b47ed4027f4212007530b6d0c39f73a9 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -722,6 +722,11 @@ public abstract class Player extends LivingEntity {
@@ -724,6 +724,11 @@ public abstract class Player extends LivingEntity {
}
double d0 = this.getEyeY() - 0.30000001192092896D;
@ -30,6 +30,6 @@ index eb0f9c2e54d75ee80bcc421d1042d1eea7c57a16..997b2458a3e14296437e76737b837d90
+ itemstack.setCount(0);
+ itemstack = tmp;
+ // Paper end
ItemEntity entityitem = new ItemEntity(this.level, this.getX(), d0, this.getZ(), itemstack);
ItemEntity entityitem = new ItemEntity(this.level(), this.getX(), d0, this.getZ(), itemstack);
entityitem.setPickUpDelay(40);

View File

@ -109,7 +109,7 @@ index 0000000000000000000000000000000000000000..41bf71d116ffc5431586ce54abba7f8d
+ }
+}
diff --git a/src/main/java/net/minecraft/world/entity/animal/AbstractSchoolingFish.java b/src/main/java/net/minecraft/world/entity/animal/AbstractSchoolingFish.java
index e2efbf08e39f8966cb75c9f06f8e0990fbc1dbb4..ebe6ded8adc9de83f94d5a17968563916bc3ef9e 100644
index 39ed3ca76d6b64ef3917280ec822721cc02afada..86b437836cb4b1f6e8ca9acd5f1f93b925cf9e51 100644
--- a/src/main/java/net/minecraft/world/entity/animal/AbstractSchoolingFish.java
+++ b/src/main/java/net/minecraft/world/entity/animal/AbstractSchoolingFish.java
@@ -52,6 +52,7 @@ public abstract class AbstractSchoolingFish extends AbstractFish {
@ -121,10 +121,10 @@ index e2efbf08e39f8966cb75c9f06f8e0990fbc1dbb4..ebe6ded8adc9de83f94d5a1796856391
this.leader = null;
}
diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java
index 2a6dda97fcc761eb3e7109e032d3bb10c83908d7..728ddf4399faafd68e9dcc3a14850a039d1a3e4f 100644
index 2824792295dab6e52015b479a77c61efb1150041..c2f56c44e824e3d4f169691b557483a4f0f5b3c6 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Bee.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java
@@ -542,11 +542,13 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
@@ -541,11 +541,13 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
this.setFlag(4, hasStung);
}
@ -139,7 +139,7 @@ index 2a6dda97fcc761eb3e7109e032d3bb10c83908d7..728ddf4399faafd68e9dcc3a14850a03
}
diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java
index e8574bd4b412c1db82aaec9dced47b63de9dbf28..9058f9f2e561cda9f475f33218bf7a78297de4bc 100644
index 71a08510a928d4570822282bb31f14013ec3834a..4aeab90e778629c355189dfe79c39c4b21f5f5ac 100644
--- a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java
+++ b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java
@@ -44,6 +44,7 @@ public class Tadpole extends AbstractFish {
@ -154,8 +154,8 @@ index e8574bd4b412c1db82aaec9dced47b63de9dbf28..9058f9f2e561cda9f475f33218bf7a78
@Override
public void aiStep() {
super.aiStep();
- if (!this.level.isClientSide) {
+ if (!this.level.isClientSide && !this.ageLocked) { // Paper
- if (!this.level().isClientSide) {
+ if (!this.level().isClientSide && !this.ageLocked) { // Paper
this.setAge(this.age + 1);
}
@ -199,7 +199,7 @@ index e8574bd4b412c1db82aaec9dced47b63de9dbf28..9058f9f2e561cda9f475f33218bf7a78
}
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
index 68788aa7a1db1468aecf0a2acb1ac03d92c9f5b9..d38ac1f3ef105474df1294541041c2607ca53244 100644
index bb2a75f25a2959c8d387836f806b544b73e2e7c7..64b1668856bb2afda3707f7ccc11764fab33ae9f 100644
--- a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
@@ -693,6 +693,15 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
@ -231,7 +231,7 @@ index 68788aa7a1db1468aecf0a2acb1ac03d92c9f5b9..d38ac1f3ef105474df1294541041c260
if (angry) {
this.setEating(false);
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java b/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java
index 1c67b4d6ec31711b7d41ea1f1394067ad8765277..39c6b9b74e072953abe6398ecfcdd444e6d8f194 100644
index 80ba55e9bbbc69dab0d420a5cd846aa78424bbe4..4033945cb992e2c9bf42b8a7eda581319a6c6917 100644
--- a/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java
@@ -72,7 +72,7 @@ public class Llama extends AbstractChestedHorse implements VariantHolder<Llama.V
@ -244,7 +244,7 @@ index 1c67b4d6ec31711b7d41ea1f1394067ad8765277..39c6b9b74e072953abe6398ecfcdd444
public Llama(EntityType<? extends Llama> type, Level world) {
super(type, world);
diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
index 2cbcd304b1117d4791d7e32d7738c12cfd4d1c9e..1102e0e7d1c4e5b62924545e137cc8a9830de08f 100644
index 4576c96f85fe5a614a78e53926dfbc2705618423..9adff51029781795c2cdf479a89111b3a1f102c0 100644
--- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
+++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
@@ -84,6 +84,11 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
@ -269,7 +269,7 @@ index 2cbcd304b1117d4791d7e32d7738c12cfd4d1c9e..1102e0e7d1c4e5b62924545e137cc8a9
@Override
diff --git a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
index c8fe9126f0b6e973aae04d825613fcf67e0838d2..418d6301f067803e2471e59ac2d52a68cbff249b 100644
index fd608b1461ef28a5181ed3beb31f356272f8328f..4616addb05fcc20b1ec6ca1dea01cbefed697acd 100644
--- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
+++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
@@ -446,6 +446,16 @@ public class EnderMan extends Monster implements NeutralMob {
@ -290,7 +290,7 @@ index c8fe9126f0b6e973aae04d825613fcf67e0838d2..418d6301f067803e2471e59ac2d52a68
public boolean requiresCustomPersistence() {
return super.requiresCustomPersistence() || this.getCarriedBlock() != null;
diff --git a/src/main/java/net/minecraft/world/entity/monster/Ghast.java b/src/main/java/net/minecraft/world/entity/monster/Ghast.java
index 1f3506d38894fea224f3b2f125b45c3b68d705c7..bb2cb17e4e5ce142eeec18951c8948e3d6b3209c 100644
index f535564035b80bc531198575acd0a7846a1197c2..592b0dae251800552a0771ec46b4b8532b63075d 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Ghast.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Ghast.java
@@ -66,6 +66,12 @@ public class Ghast extends FlyingMob implements Enemy {
@ -307,7 +307,7 @@ index 1f3506d38894fea224f3b2f125b45c3b68d705c7..bb2cb17e4e5ce142eeec18951c8948e3
protected boolean shouldDespawnInPeaceful() {
return true;
diff --git a/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java b/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
index bbeb9ebe0a939281ef67d624d589c53bee55b44d..aabedf25fa40ffa0d7b378c6006928f806ef0fa6 100644
index d673c4ff3274452433c9aa630ff320a38f68163a..59ed51907fc21784b37a55ee01207d8a730ae29a 100644
--- a/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
+++ b/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
@@ -198,6 +198,12 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder {
@ -325,15 +325,15 @@ index bbeb9ebe0a939281ef67d624d589c53bee55b44d..aabedf25fa40ffa0d7b378c6006928f8
this.getEntityData().set(ZombieVillager.DATA_CONVERTING_ID, true);
@@ -205,7 +211,7 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder {
this.removeEffect(MobEffects.WEAKNESS, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.CONVERSION);
this.addEffect(new MobEffectInstance(MobEffects.DAMAGE_BOOST, delay, Math.min(this.level.getDifficulty().getId() - 1, 0)), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.CONVERSION);
this.addEffect(new MobEffectInstance(MobEffects.DAMAGE_BOOST, delay, Math.min(this.level().getDifficulty().getId() - 1, 0)), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.CONVERSION);
// CraftBukkit end
- this.level.broadcastEntityEvent(this, (byte) 16);
+ if (broadcastEntityEvent) this.level.broadcastEntityEvent(this, (byte) 16); // Paper - missing entity behaviour api - converting without entity event
- this.level().broadcastEntityEvent(this, (byte) 16);
+ if (broadcastEntityEvent) this.level().broadcastEntityEvent(this, (byte) 16); // Paper - missing entity behaviour api - converting without entity event
}
@Override
diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownTrident.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownTrident.java
index 36bab0afb7dff206f76779f1c1bc619ac306d4d7..db151bf624095014c99d78b4f6748d2c3792abea 100644
index 61d4877b4f74362e38104bfeacb7d66534ad798e..454dd67920826b8b62c2654abfd43fc08c2648e4 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/ThrownTrident.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownTrident.java
@@ -105,6 +105,20 @@ public class ThrownTrident extends AbstractArrow {
@ -358,7 +358,7 @@ index 36bab0afb7dff206f76779f1c1bc619ac306d4d7..db151bf624095014c99d78b4f6748d2c
@Override
protected EntityHitResult findHitEntity(Vec3 currentPosition, Vec3 nextPosition) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
index 505ce1ae7df56be0e70faf359ae1e5ebcc06255e..cc3a90a3337b7d59e4377a1e2448f17a23604e57 100644
index d7c9b421eb636c0642b73263f46f824b95c1614e..c738fb984ffd120e5adccdb5828833f180e72e80 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
@@ -832,14 +832,19 @@ public abstract class CraftRegionAccessor implements RegionAccessor {
@ -632,7 +632,7 @@ index 04976616da8c85b1278dad33ff05554aa74a6b33..75c7645fb5732c43d1da15181cf5c7ee
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 5fc33fcde4d60934f03b681d65aa6e7f2d0f6202..f5b199b3cdccbe7d8a3331555469c622c853fd03 100644
index bed8b8d3091216856168277af7f51c54b5b1e1f1..9155af9c7e001d4cb431e74b12c9d98227011d51 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -227,10 +227,16 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@ -961,7 +961,7 @@ index 3bdcc754a5afb6506178bd5c0d4f9c6e02bc24da..3cb4860fea30bfaf2147b4f29a34336b
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftRaider.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftRaider.java
index 2c1537889cacba666549c1595a4e1a07a28dff31..ad10ba1dbaf81e767441aa8e1babed1d3e654121 100644
index 7345a644b57c8022d9e326575419c87551c4e8fc..f0b061979f9acdce6d06f70b651692c841418d96 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftRaider.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftRaider.java
@@ -63,4 +63,16 @@ public abstract class CraftRaider extends CraftMonster implements Raider {
@ -1205,7 +1205,7 @@ index 08c55cb00c8ff3c39dd99c64227d5d60abee2a51..6ecdc4bf1f6b8f0363e667135ba46343
public void increaseAnger(Entity entity, int increase) {
Preconditions.checkArgument(entity != null, "Entity cannot be null");
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java
index 8c32f70ec0defa5c67f2d02d13116e27de5de76d..1a21d30620f13a48976da5ead7edab201ea68b21 100644
index f9c3a14bf4674f21ed32f6dc2a4296a935dd2b6d..1477c2c04d8f5c5639ce94808fe2a7029cedaeb2 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java
@@ -73,4 +73,36 @@ public class CraftWither extends CraftMonster implements Wither, com.destroystok

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Ensure disconnect for book edit is called on main
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 2663576ec20dbeda9ca131a57ea3cee02680e4be..caa8455611046ddd33d07cc61891bb632cbfdb5e 100644
index 9140806ac0bcf36bb76d666c160e183534b314a0..1006ad14ee4bf9e175ee3c2e1c1f09bde792a339 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1205,7 +1205,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -1202,7 +1202,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
// Paper end
// CraftBukkit start
if (this.lastBookTick + 20 > MinecraftServer.currentTick) {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Fix return value of Block#applyBoneMeal always being false
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
index 9a1304103d367e2d7bc552977542b46e9887bcb4..9fa50da214ad9a134008c91e1e07223904a8e6a3 100644
index 30fc626f51437e254993edd9b14337fa60ba313c..e7e5c9fa734072e9ae15eb5f6d75c7740ba3ba44 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
@@ -585,7 +585,7 @@ public class CraftBlock implements Block {

View File

@ -8,10 +8,10 @@ ticket level 33 (yes getChunkIfLoaded will actually perform a chunk
load in that case).
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index e93a1713505d52d719738b36ea59859c547553b7..16b73f0498936a8413f6adedd7f92bab07a4a108 100644
index ff7b9b47c9c29949cc4ee8da162b77ef17909bdb..fa58ec5466edd5ce6a1887b73f628fb6c7272d88 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -225,7 +225,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -228,7 +228,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
@Override public LevelChunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI
@ -21,10 +21,10 @@ index e93a1713505d52d719738b36ea59859c547553b7..16b73f0498936a8413f6adedd7f92bab
@Override
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 8a6f01af6d9a210fbd5cf14002c426c2e36fc51b..5f43dbd3b4a50f425b188beb2ed9236ed2db0a06 100644
index 3da3de6a442c3b398a96fff26cd0d81a8130fc01..02e8627fc9312e865f3a1f71cc9ecba712a098a2 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -202,6 +202,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -200,6 +200,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
return (CraftServer) Bukkit.getServer();
}
@ -37,9 +37,9 @@ index 8a6f01af6d9a210fbd5cf14002c426c2e36fc51b..5f43dbd3b4a50f425b188beb2ed9236e
+
public abstract ResourceKey<LevelStem> getTypeKey();
protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, java.util.concurrent.Executor executor) { // Paper - Async-Anti-Xray - Pass executor
protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator) { // Paper
diff --git a/src/main/java/net/minecraft/world/level/gameevent/GameEventDispatcher.java b/src/main/java/net/minecraft/world/level/gameevent/GameEventDispatcher.java
index cd92aaa1c874d78762bbab529dfcea71b36d2a91..25e4596e64b74ada86f210b06ba837be8efc21d1 100644
index e9ead1e49f9043430e316c36ade83b70cf850e47..f2d10d58617644a589ecec3e17358c1277795e5d 100644
--- a/src/main/java/net/minecraft/world/level/gameevent/GameEventDispatcher.java
+++ b/src/main/java/net/minecraft/world/level/gameevent/GameEventDispatcher.java
@@ -56,7 +56,7 @@ public class GameEventDispatcher {

View File

@ -58,37 +58,29 @@ index 0000000000000000000000000000000000000000..01a2bc1feec808790bb93618ce46adb9
+ }
+}
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
index aca2da47651a76f3e5593d71c500d749d92ccc3b..4da4edae517a0efec6e03a719ec47b700509dab1 100644
index 41c863a104d53b6c6feb4576d5b62cead229efec..dab2adffbe5ac586b61371ea9234a1056fd36a51 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
@@ -43,6 +43,7 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
private boolean renderMessagedFiltered;
private DyeColor color;
private boolean hasGlowingText;
+ private static final org.apache.logging.log4j.Logger LOGGER = org.apache.logging.log4j.LogManager.getLogger();
public SignBlockEntity(BlockPos pos, BlockState state) {
super(BlockEntityType.SIGN, pos, state);
@@ -260,7 +261,17 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
@@ -271,7 +271,17 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
ClickEvent chatclickable = chatmodifier.getClickEvent();
if (chatclickable != null && chatclickable.getAction() == ClickEvent.Action.RUN_COMMAND) {
- player.getServer().getCommands().performPrefixedCommand(this.createCommandSourceStack(player), chatclickable.getValue());
- player.getServer().getCommands().performPrefixedCommand(this.createCommandSourceStack(player, world, pos), chatclickable.getValue());
+ // Paper start
+ String command = chatclickable.getValue().startsWith("/") ? chatclickable.getValue() : "/" + chatclickable.getValue();
+ if (org.spigotmc.SpigotConfig.logCommands) {
+ LOGGER.info("{} issued server command: {}", player.getScoreboardName(), command);
+ }
+ io.papermc.paper.event.player.PlayerSignCommandPreprocessEvent event = new io.papermc.paper.event.player.PlayerSignCommandPreprocessEvent(player.getBukkitEntity(), command, new org.bukkit.craftbukkit.util.LazyPlayerSet(player.getServer()), (org.bukkit.block.Sign) io.papermc.paper.util.MCUtil.toBukkitBlock(this.level, this.worldPosition).getState());
+ io.papermc.paper.event.player.PlayerSignCommandPreprocessEvent event = new io.papermc.paper.event.player.PlayerSignCommandPreprocessEvent((org.bukkit.entity.Player) player.getBukkitEntity(), command, new org.bukkit.craftbukkit.util.LazyPlayerSet(player.getServer()), (org.bukkit.block.Sign) io.papermc.paper.util.MCUtil.toBukkitBlock(this.level, this.worldPosition).getState());
+ if (!event.callEvent()) {
+ return false;
+ }
+ player.getServer().getCommands().performPrefixedCommand(this.createCommandSourceStack(((org.bukkit.craftbukkit.entity.CraftPlayer) event.getPlayer()).getHandle()), event.getMessage());
+ player.getServer().getCommands().performPrefixedCommand(this.createCommandSourceStack(((org.bukkit.craftbukkit.entity.CraftPlayer) event.getPlayer()).getHandle(), world, pos), event.getMessage());
+ // Paper end
flag1 = true;
}
}
@@ -296,8 +307,21 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
@@ -308,8 +318,23 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
String s = player == null ? "Sign" : player.getName().getString();
Object object = player == null ? Component.literal("Sign") : player.getDisplayName();
@ -96,7 +88,9 @@ index aca2da47651a76f3e5593d71c500d749d92ccc3b..4da4edae517a0efec6e03a719ec47b70
+ CommandSource commandSource = this.level.paperConfig().misc.showSignClickCommandFailureMsgsToPlayer ? new io.papermc.paper.commands.DelegatingCommandSource(this) {
+ @Override
+ public void sendSystemMessage(Component message) {
+ player.sendSystemMessage(message);
+ if (player != null) {
+ player.sendSystemMessage(message);
+ }
+ }
+
+ @Override
@ -106,11 +100,11 @@ index aca2da47651a76f3e5593d71c500d749d92ccc3b..4da4edae517a0efec6e03a719ec47b70
+ } : this;
+ // Paper end
// CraftBukkit - this
- return new CommandSourceStack(this, Vec3.atCenterOf(this.worldPosition), Vec2.ZERO, (ServerLevel) this.level, 2, s, (Component) object, this.level.getServer(), player);
+ return new CommandSourceStack(commandSource, Vec3.atCenterOf(this.worldPosition), Vec2.ZERO, (ServerLevel) this.level, 2, s, (Component) object, this.level.getServer(), player); // Paper
- return new CommandSourceStack(this, Vec3.atCenterOf(pos), Vec2.ZERO, (ServerLevel) world, 2, s, (Component) object, world.getServer(), player);
+ return new CommandSourceStack(commandSource, Vec3.atCenterOf(pos), Vec2.ZERO, (ServerLevel) world, 2, s, (Component) object, world.getServer(), player); // Paper
}
public DyeColor getColor() {
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java b/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java
index d113e54a30db16e2ad955170df6030d15de530d6..26f3a2799e687731d883e7733591f6934479e88d 100644
--- a/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Adds PlayerArmSwingEvent
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index de3aff55fd3d72e350b97a5a59ff7707cade3660..da575295905ba67b6f8c44dc4a27fd16cc550c7b 100644
index 1006ad14ee4bf9e175ee3c2e1c1f09bde792a339..1a7f3833b4be83d19e2fc54df78eac84557b5a70 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2492,7 +2492,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2484,7 +2484,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
}
// Arm swing animation

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Fixes kick event leave message not being sent
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 4b4bb21149a102a8cbf46ee104417dadb49999df..44cf1f81ed53f72b87530cee006e54014a2798bf 100644
index c89538fe76c37ca1790c837a8eec1d1bd418eefd..1901bea8474e9af9d68b79bd9bd3abf319461f81 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -270,7 +270,6 @@ public class ServerPlayer extends Player {
@ -15,9 +15,9 @@ index 4b4bb21149a102a8cbf46ee104417dadb49999df..44cf1f81ed53f72b87530cee006e5401
- public String kickLeaveMessage = null; // SPIGOT-3034: Forward leave message to PlayerQuitEvent
// CraftBukkit end
public boolean isRealPlayer; // Paper
public double lastEntitySpawnRadiusSquared; // Paper - optimise isOutsideRange, this field is in blocks
public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index da9efc8be6bcaec4f0144a3c51896ce37b539f11..435006230d4fc81dc72c79e6110e91f33a687a77 100644
index 1a7f3833b4be83d19e2fc54df78eac84557b5a70..a5e113b571910cc26bfbcff4b7a792f86ecb1192 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -514,7 +514,6 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@ -37,7 +37,7 @@ index da9efc8be6bcaec4f0144a3c51896ce37b539f11..435006230d4fc81dc72c79e6110e91f3
this.connection.setReadOnly();
MinecraftServer minecraftserver = this.server;
Connection networkmanager = this.connection;
@@ -1984,6 +1983,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -1976,6 +1975,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@Override
public void onDisconnect(Component reason) {
@ -49,7 +49,7 @@ index da9efc8be6bcaec4f0144a3c51896ce37b539f11..435006230d4fc81dc72c79e6110e91f3
// CraftBukkit start - Rarely it would send a disconnect line twice
if (this.processedDisconnect) {
return;
@@ -2001,7 +2005,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -1993,7 +1997,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
this.player.disconnect();
// Paper start - Adventure
@ -59,22 +59,22 @@ index da9efc8be6bcaec4f0144a3c51896ce37b539f11..435006230d4fc81dc72c79e6110e91f3
this.server.getPlayerList().broadcastSystemMessage(PaperAdventure.asVanilla(quitMessage), false);
// Paper end
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index c3e0fa27c34132a99f6cc9c0eb7d9544a9873eed..0e314e2b85ed17bef7b9cc75573b0dc6c13b46b1 100644
index 75bb6a8fa53734b8b6548a9f203e0ff574ae08dc..7e764cf21d18a2887f7c8d424245508c2966c179 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -557,6 +557,11 @@ public abstract class PlayerList {
@@ -564,6 +564,11 @@ public abstract class PlayerList {
}
public net.kyori.adventure.text.Component remove(ServerPlayer entityplayer) { // Paper - return Component
public net.kyori.adventure.text.Component remove(ServerPlayer entityplayer) { // CraftBukkit - return string // Paper - return Component
+ // Paper start
+ return this.remove(entityplayer, net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? entityplayer.getBukkitEntity().displayName() : PaperAdventure.asAdventure(entityplayer.getDisplayName())));
+ }
+ public net.kyori.adventure.text.Component remove(ServerPlayer entityplayer, net.kyori.adventure.text.Component leaveMessage) {
+ // Paper end
ServerLevel worldserver = entityplayer.getLevel();
ServerLevel worldserver = entityplayer.serverLevel();
entityplayer.awardStat(Stats.LEAVE_GAME);
@@ -567,7 +572,7 @@ public abstract class PlayerList {
@@ -574,7 +579,7 @@ public abstract class PlayerList {
entityplayer.closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.DISCONNECT); // Paper
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add config for mobs immune to default effects
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 2c4d6294e1c5a0baa76d20fa5d6f95a06e73152b..db69a26a019615df9d6b0f3ab8f3069d25445f07 100644
index 3a669f8e0cd072fcbd5e5ed4b55abb0f73c009e7..38b0bde34420734c50fe23aa169af82a7de4e1c2 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1146,7 +1146,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1164,7 +1164,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
if (this.getMobType() == MobType.UNDEAD) {
MobEffect mobeffectlist = effect.getEffect();
@ -18,7 +18,7 @@ index 2c4d6294e1c5a0baa76d20fa5d6f95a06e73152b..db69a26a019615df9d6b0f3ab8f3069d
}
}
diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
index 1102e0e7d1c4e5b62924545e137cc8a9830de08f..148b351624bd201592332751adc9adf95da02376 100644
index 9adff51029781795c2cdf479a89111b3a1f102c0..3d3567e09ddf0982dfa6b2279019168a6f4abaaa 100644
--- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
+++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
@@ -605,7 +605,7 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
@ -31,7 +31,7 @@ index 1102e0e7d1c4e5b62924545e137cc8a9830de08f..148b351624bd201592332751adc9adf9
private class WitherDoNothingGoal extends Goal {
diff --git a/src/main/java/net/minecraft/world/entity/monster/Spider.java b/src/main/java/net/minecraft/world/entity/monster/Spider.java
index 9174feeca84d6413663387df9881b4c227165782..61fd27992516e1238195f8e60766428f01719ba7 100644
index b9acef460ff7e8bc9e24997771beeba6bea1f28a..dd7c7fb6ed3086b1439499df806cdb84ce7d6eb2 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Spider.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Spider.java
@@ -133,7 +133,7 @@ public class Spider extends Monster {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Fix incorrect message for outdated client
diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
index de25fde984d17a3228803a8a274372b0fe27da5e..8f52acc03943b18f87b3b2581066496a254b1156 100644
index 8393c1a2d15d5ad255c9808b0d0edd6aeb447893..63cf71940f6480c593a43bd39900c50676367404 100644
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
@@ -82,7 +82,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL

View File

@ -11,7 +11,7 @@ It does not make a lot of sense to damage players if they get crammed,
For those who really want it a config option is provided.
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 44cf1f81ed53f72b87530cee006e54014a2798bf..a649d1baa727dd16cb8e786bdf510021e2d16d26 100644
index 1901bea8474e9af9d68b79bd9bd3abf319461f81..369b4b5fc1df238870081efece42e897318da67d 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -100,6 +100,7 @@ import net.minecraft.util.Mth;
@ -22,7 +22,7 @@ index 44cf1f81ed53f72b87530cee006e54014a2798bf..a649d1baa727dd16cb8e786bdf510021
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.entity.Entity;
@@ -1432,7 +1433,7 @@ public class ServerPlayer extends Player {
@@ -1430,7 +1431,7 @@ public class ServerPlayer extends Player {
@Override
public boolean isInvulnerableTo(DamageSource damageSource) {

View File

@ -19,13 +19,13 @@ index ac0cfdef53ec82665acf362235842de4f17bfdd1..05c1e8c9f013547d4fcdbbd299329166
}
diff --git a/src/main/java/net/minecraft/world/entity/animal/Panda.java b/src/main/java/net/minecraft/world/entity/animal/Panda.java
index 2db5d8a937c841718e7b568c215109c39775d82c..0a18108fda778af5b600f77533770bd98584d60e 100644
index 7f4ff9658b0eca2034333810fd2b199a3d186e72..a0933b8467bf81333dc103055e73bb75069dcb36 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Panda.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Panda.java
@@ -528,7 +528,9 @@ public class Panda extends Animal {
}
if (!this.level.isClientSide() && this.random.nextInt(700) == 0 && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
if (!this.level().isClientSide() && this.random.nextInt(700) == 0 && this.level().getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
+ this.forceDrops = true; // Paper
this.spawnAtLocation((ItemLike) Items.SLIME_BALL);
+ this.forceDrops = false; // Paper
@ -53,10 +53,10 @@ index 2db5d8a937c841718e7b568c215109c39775d82c..0a18108fda778af5b600f77533770bd9
int i = Panda.this.isLazy() ? Panda.this.random.nextInt(50) + 10 : Panda.this.random.nextInt(150) + 10;
diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java b/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java
index 035c0ff01000f3fd57e1fcab13b93cafb133a169..7b42f7bd100808cb2367d0d7c7361e8f2e597502 100644
index 2c012e8d314e8b785300de3f810f95c7452b7348..7ef04ef7995b093eef022b397cda8c27c8faede0 100644
--- a/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java
+++ b/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java
@@ -325,7 +325,9 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
@@ -322,7 +322,9 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
@Override
protected void finishConversion(ServerLevel world) {
PiglinAi.cancelAdmiring(this);
@ -67,7 +67,7 @@ index 035c0ff01000f3fd57e1fcab13b93cafb133a169..7b42f7bd100808cb2367d0d7c7361e8f
}
diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
index e6d398f07564b4027552db9836e6da2c0972cd42..a3c28f327627b340905ba61238ce8454db0ec9ee 100644
index 7611481c7e469a3b9eb4d00f4816adb7b190127e..092cdb889564903102dccfe7bf2e320a1eba5efe 100644
--- a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
+++ b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
@@ -270,7 +270,9 @@ public class PiglinAi {
@ -91,7 +91,7 @@ index e6d398f07564b4027552db9836e6da2c0972cd42..a3c28f327627b340905ba61238ce8454
}
diff --git a/src/main/java/net/minecraft/world/entity/raid/Raider.java b/src/main/java/net/minecraft/world/entity/raid/Raider.java
index 50010cc6774c351539cf09e517b7967f45822ec8..da37c51ee443c2f1191a32671912a967a13003cf 100644
index 06d4c1787b1ee4976e6ed1773d3ff7130aebc2d0..9948085f51659f9b896622251739343d658dd0b2 100644
--- a/src/main/java/net/minecraft/world/entity/raid/Raider.java
+++ b/src/main/java/net/minecraft/world/entity/raid/Raider.java
@@ -250,7 +250,9 @@ public abstract class Raider extends PatrollingMonster {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Stinger API
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index f217df2d3c7a53b72418fab63cef06dbc107fe0d..cbb6b437358823cd52518682f32dd597c9aeb85a 100644
index 61292952681727bcd651064619bff1b41c560d75..1973a8ed75f9bacebebfa74dd2d06bf7d840ea4a 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -340,7 +340,28 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Fix incosistency issue with empty map items in CB
diff --git a/src/main/java/net/minecraft/world/item/MapItem.java b/src/main/java/net/minecraft/world/item/MapItem.java
index f883e1bc4150bc074f1d8363a95b4eae16f3828e..586852e347cfeb6e52d16e51b3f193e814036e81 100644
index 75b110c6fb685390306fe3b8504aeea9bd6deedd..d3c29e6bf8b3c2dd628809177dac50220a7de415 100644
--- a/src/main/java/net/minecraft/world/item/MapItem.java
+++ b/src/main/java/net/minecraft/world/item/MapItem.java
@@ -73,7 +73,7 @@ public class MapItem extends ComplexItem {

View File

@ -105,7 +105,7 @@ index 0000000000000000000000000000000000000000..a8e813ca89b033f061e695288b3383bd
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index dad38e93aba899b250155a5075fc85fc988d6a8a..a77453e8390d6c9f656c7ae0ea413abfc7381070 100644
index b8f5f17b9759d82e39d2e619ce58704f7d74d3c1..3e8266fce7fec1185620125874d8349dd180b727 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -300,6 +300,7 @@ public final class CraftServer implements Server {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Improve boat collision performance
diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java
index d5b37301d4e860c019105445001ed7a9a6f849bd..f4935f7fc3cbd6ba8f079def43bd735364a2ce87 100644
index 7354711e194ab58b11b68f447c1fc795fe611a65..5579dad0ba8f2e4ce43883e7d36059c2a2bd1b83 100644
--- a/src/main/java/net/minecraft/Util.java
+++ b/src/main/java/net/minecraft/Util.java
@@ -112,6 +112,7 @@ public class Util {
@@ -113,6 +113,7 @@ public class Util {
}).findFirst().orElseThrow(() -> {
return new IllegalStateException("No jar file system provider found");
});
@ -17,10 +17,10 @@ index d5b37301d4e860c019105445001ed7a9a6f849bd..f4935f7fc3cbd6ba8f079def43bd7353
};
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 2b40508750c2f70d1988f324f87e599fc62329f3..a7046e42c1935e9a4e529726072d9f88caaa703a 100644
index 38b0bde34420734c50fe23aa169af82a7de4e1c2..3017e7a6c2685e4ab82a425025c363133209222d 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1334,7 +1334,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1383,7 +1383,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
if (!source.is(DamageTypeTags.IS_PROJECTILE)) {
Entity entity = source.getDirectEntity();
@ -29,7 +29,7 @@ index 2b40508750c2f70d1988f324f87e599fc62329f3..a7046e42c1935e9a4e529726072d9f88
LivingEntity entityliving = (LivingEntity) entity;
this.blockUsingShield(entityliving);
@@ -1439,11 +1439,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1488,11 +1488,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
if (entity1 != null && !source.is(DamageTypeTags.IS_EXPLOSION)) {
@ -44,7 +44,7 @@ index 2b40508750c2f70d1988f324f87e599fc62329f3..a7046e42c1935e9a4e529726072d9f88
d0 = (Math.random() - Math.random()) * 0.01D;
}
@@ -2177,7 +2178,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -2220,7 +2221,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.hurtCurrentlyUsedShield((float) -event.getDamage(DamageModifier.BLOCKING));
Entity entity = damagesource.getDirectEntity();
@ -54,7 +54,7 @@ index 2b40508750c2f70d1988f324f87e599fc62329f3..a7046e42c1935e9a4e529726072d9f88
}
}
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
index 8b562ca6cc92c31c764aebf05d511e347cff8a83..12e3209c5246ede89daaf8455fe70b4a517e12f6 100644
index 9fd8c9b82ee6a2cf94a90d0acb42637a2fde7ad5..fab73940378f0635c2b5634f6c91a589bdd80031 100644
--- a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
@@ -709,8 +709,8 @@ public class Boat extends Entity implements VariantHolder<Boat.Type> {

View File

@ -5,15 +5,15 @@ Subject: [PATCH] Prevent AFK kick while watching end credits.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 435006230d4fc81dc72c79e6110e91f33a687a77..adffa10ad47d1c2a9479ca91073a12e61538a608 100644
index a5e113b571910cc26bfbcff4b7a792f86ecb1192..8342fa795a4813ca5a4292c4933f01f8b4a5a4f3 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -431,7 +431,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
--this.dropSpamTickCount;
}
- if (this.player.getLastActionTime() > 0L && this.server.getPlayerIdleTimeout() > 0 && Util.getMillis() - this.player.getLastActionTime() > (long) (this.server.getPlayerIdleTimeout() * 1000 * 60)) {
+ if (this.player.getLastActionTime() > 0L && this.server.getPlayerIdleTimeout() > 0 && Util.getMillis() - this.player.getLastActionTime() > (long) (this.server.getPlayerIdleTimeout() * 1000 * 60) && !this.player.wonGame) { // Paper - Prevent AFK kick while watching end credits.
- if (this.player.getLastActionTime() > 0L && this.server.getPlayerIdleTimeout() > 0 && Util.getMillis() - this.player.getLastActionTime() > (long) this.server.getPlayerIdleTimeout() * 1000L * 60L) {
+ if (this.player.getLastActionTime() > 0L && this.server.getPlayerIdleTimeout() > 0 && Util.getMillis() - this.player.getLastActionTime() > (long) this.server.getPlayerIdleTimeout() * 1000L * 60L && !this.player.wonGame) { // Paper - Prevent AFK kick while watching end credits.
this.player.resetLastActionTime(); // CraftBukkit - SPIGOT-854
this.disconnect(Component.translatable("multiplayer.disconnect.idling"), org.bukkit.event.player.PlayerKickEvent.Cause.IDLING); // Paper - kick event cause
}

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerSetSpawnEvent
diff --git a/src/main/java/net/minecraft/server/commands/SetSpawnCommand.java b/src/main/java/net/minecraft/server/commands/SetSpawnCommand.java
index 3072f513c22904f8066e0c37f345df4fdb451f8a..aa701e68ed81562861eba559e61e522b934d5851 100644
index a2d0699e8427b2262a2396495111125eccafbb66..c29340eb3e4044f6c342146bcd1ddbed6b9a5969 100644
--- a/src/main/java/net/minecraft/server/commands/SetSpawnCommand.java
+++ b/src/main/java/net/minecraft/server/commands/SetSpawnCommand.java
@@ -38,11 +38,23 @@ public class SetSpawnCommand {
@ -34,19 +34,19 @@ index 3072f513c22904f8066e0c37f345df4fdb451f8a..aa701e68ed81562861eba559e61e522b
String s = resourcekey.location().toString();
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index a649d1baa727dd16cb8e786bdf510021e2d16d26..cdf85898d6ca9f1159b175dbc2760522abd8eb95 100644
index 369b4b5fc1df238870081efece42e897318da67d..096a8c7c6559bf252d8dbba09a33e97fd8a0b4af 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1309,7 +1309,7 @@ public class ServerPlayer extends Player {
@@ -1307,7 +1307,7 @@ public class ServerPlayer extends Player {
} else if (this.bedBlocked(blockposition, enumdirection)) {
return Either.left(Player.BedSleepingProblem.OBSTRUCTED);
} else {
- this.setRespawnPosition(this.level.dimension(), blockposition, this.getYRot(), false, true, PlayerSpawnChangeEvent.Cause.BED); // CraftBukkit
+ this.setRespawnPosition(this.level.dimension(), blockposition, this.getYRot(), false, true, com.destroystokyo.paper.event.player.PlayerSetSpawnEvent.Cause.BED); // Paper - PlayerSetSpawnEvent
if (this.level.isDay()) {
- this.setRespawnPosition(this.level().dimension(), blockposition, this.getYRot(), false, true, PlayerSpawnChangeEvent.Cause.BED); // CraftBukkit
+ this.setRespawnPosition(this.level().dimension(), blockposition, this.getYRot(), false, true, com.destroystokyo.paper.event.player.PlayerSetSpawnEvent.Cause.BED); // Paper - PlayerSetSpawnEvent
if (this.level().isDay()) {
return Either.left(Player.BedSleepingProblem.NOT_POSSIBLE_NOW);
} else {
@@ -2151,44 +2151,50 @@ public class ServerPlayer extends Player {
@@ -2154,44 +2154,50 @@ public class ServerPlayer extends Player {
return this.respawnForced;
}
@ -130,7 +130,7 @@ index a649d1baa727dd16cb8e786bdf510021e2d16d26..cdf85898d6ca9f1159b175dbc2760522
} else {
this.respawnPosition = null;
this.respawnDimension = Level.OVERWORLD;
@@ -2196,6 +2202,7 @@ public class ServerPlayer extends Player {
@@ -2199,6 +2205,7 @@ public class ServerPlayer extends Player {
this.respawnForced = false;
}
@ -139,10 +139,10 @@ index a649d1baa727dd16cb8e786bdf510021e2d16d26..cdf85898d6ca9f1159b175dbc2760522
public void trackChunk(ChunkPos chunkPos, Packet<?> chunkDataPacket) {
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 4771829ba2b2b215567b2f4ceca963a7d2a0f559..801cf17505cee999e7ed58081fa908ca693df498 100644
index 7e764cf21d18a2887f7c8d424245508c2966c179..cbc8d79b22568d2233614c8fcd592b4f4e2c8d51 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -853,7 +853,7 @@ public abstract class PlayerList {
@@ -860,7 +860,7 @@ public abstract class PlayerList {
location = CraftLocation.toBukkit(vec3d, worldserver1.getWorld(), f1, 0.0F);
} else if (blockposition != null) {
entityplayer1.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.NO_RESPAWN_BLOCK_AVAILABLE, 0.0F));
@ -172,10 +172,10 @@ index 1a27b7faa22e6b3dc5fce329ed06425de56c4315..b9903c29bdea8d1e3b6fce0e97be6bd9
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index fd7d05c097dcb300aab5320b395e7133dc54998f..88ec1bb0bea5aeb4a6e0ee628de58ac9f1f546cf 100644
index 1b206a58cb9bc92e8b9a6ac1919bff95f341ede9..d9ec6b1d52c54ae3c05b3e895c88751039a2fe1c 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1371,9 +1371,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1302,9 +1302,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public void setBedSpawnLocation(Location location, boolean override) {
if (location == null) {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Make hoppers respect inventory max stack size
diff --git a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
index 6605a7f7c046729850256489c21a1e90f0cca972..789e5458f4a137694563a22612455506807de51b 100644
index 73e505630e8a702e0c46e042c478a9c9c246856c..6907e647ef4d3f5c9c46edb4cf0905844dd1cea9 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
@@ -436,15 +436,17 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Optimize entity tracker passenger checks
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
index d4696783f5adaee5f4350dfe5da8d6b85cf07f7e..dd75d109feacbc146dc49ae1e1b4bba94b51d18b 100644
index 3f3c7ced3a43e2b0eb451930c09188e3706a1bee..3a7a0e24e1c12ae044a455ee4f85216508e97d21 100644
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
@@ -78,7 +78,7 @@ public class ServerEntity {
@@ -76,7 +76,7 @@ public class ServerEntity {
this.trackedPlayers = trackedPlayers;
// CraftBukkit end
this.ap = Vec3.ZERO;

View File

@ -5,14 +5,14 @@ Subject: [PATCH] Config option for Piglins guarding chests
diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
index a3c28f327627b340905ba61238ce8454db0ec9ee..c3a2b83794c612340edf0bc67f58917f1f96db45 100644
index 092cdb889564903102dccfe7bf2e320a1eba5efe..c8e6893a7d2be08d6b0d111aa6e58e72f3376edc 100644
--- a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
+++ b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
@@ -477,6 +477,7 @@ public class PiglinAi {
}
public static void angerNearbyPiglins(Player player, boolean blockOpen) {
+ if (!player.level.paperConfig().entities.behavior.piglinsGuardChests) return; // Paper
List<Piglin> list = player.level.getEntitiesOfClass(Piglin.class, player.getBoundingBox().inflate(16.0D));
+ if (!player.level().paperConfig().entities.behavior.piglinsGuardChests) return; // Paper
List<Piglin> list = player.level().getEntitiesOfClass(Piglin.class, player.getBoundingBox().inflate(16.0D));
list.stream().filter(PiglinAi::isIdle).filter((entitypiglin) -> {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Added EntityDamageItemEvent
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index 36c560ea3b33ef854f2190d07209b7f36c6d7e6b..8b7d4b0bdb18067213462492ce4b8af2477a111b 100644
index 12c0e0096153d1c7166829d6f7417d54d364df67..99be49b179b46ed1a9c3b3784dcd91f2fcc34ca9 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -583,7 +583,7 @@ public final class ItemStack {
@@ -591,7 +591,7 @@ public final class ItemStack {
return this.getItem().getMaxDamage();
}
@ -17,7 +17,7 @@ index 36c560ea3b33ef854f2190d07209b7f36c6d7e6b..8b7d4b0bdb18067213462492ce4b8af2
if (!this.isDamageableItem()) {
return false;
} else {
@@ -601,8 +601,8 @@ public final class ItemStack {
@@ -609,8 +609,8 @@ public final class ItemStack {
amount -= k;
// CraftBukkit start
@ -28,7 +28,7 @@ index 36c560ea3b33ef854f2190d07209b7f36c6d7e6b..8b7d4b0bdb18067213462492ce4b8af2
event.getPlayer().getServer().getPluginManager().callEvent(event);
if (amount != event.getDamage() || event.isCancelled()) {
@@ -613,6 +613,14 @@ public final class ItemStack {
@@ -621,6 +621,14 @@ public final class ItemStack {
}
amount = event.getDamage();
@ -43,7 +43,7 @@ index 36c560ea3b33ef854f2190d07209b7f36c6d7e6b..8b7d4b0bdb18067213462492ce4b8af2
}
// CraftBukkit end
if (amount <= 0) {
@@ -620,8 +628,8 @@ public final class ItemStack {
@@ -628,8 +636,8 @@ public final class ItemStack {
}
}
@ -54,9 +54,9 @@ index 36c560ea3b33ef854f2190d07209b7f36c6d7e6b..8b7d4b0bdb18067213462492ce4b8af2
}
j = this.getDamageValue() + amount;
@@ -633,7 +641,7 @@ public final class ItemStack {
@@ -641,7 +649,7 @@ public final class ItemStack {
public <T extends LivingEntity> void hurtAndBreak(int amount, T entity, Consumer<T> breakCallback) {
if (!entity.level.isClientSide && (!(entity instanceof net.minecraft.world.entity.player.Player) || !((net.minecraft.world.entity.player.Player) entity).getAbilities().instabuild)) {
if (!entity.level().isClientSide && (!(entity instanceof net.minecraft.world.entity.player.Player) || !((net.minecraft.world.entity.player.Player) entity).getAbilities().instabuild)) {
if (this.isDamageableItem()) {
- if (this.hurt(amount, entity.getRandom(), entity instanceof ServerPlayer ? (ServerPlayer) entity : null)) {
+ if (this.hurt(amount, entity.getRandom(), entity /*instanceof ServerPlayer ? (ServerPlayer) entity : null*/)) { // Paper - pass LivingEntity for EntityItemDamageEvent

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Optimize indirect passenger iteration
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index f646e2230dbf1dd6bfb1a43545d95a4d9895c3d6..d69352cc86f1a40bf696e30f11a3a84fac3b20c5 100644
index 223af8b0b40f11496a0639f220f8e6605be8da2a..6b6fbcc69c834e2bb48ddd9dfbb18e93d536f40b 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -3765,20 +3765,34 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -3809,26 +3809,41 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
private Stream<Entity> getIndirectPassengersStream() {
@ -43,8 +43,7 @@ index f646e2230dbf1dd6bfb1a43545d95a4d9895c3d6..d69352cc86f1a40bf696e30f11a3a84f
return () -> {
return this.getIndirectPassengersStream().iterator();
};
@@ -3795,6 +3809,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
// Paper end - rewrite chunk system
}
public boolean hasExactlyOnePlayerPassenger() {
+ if (this.passengers.isEmpty()) { return false; } // Paper

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Configurable item frame map cursor update interval
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
index dd75d109feacbc146dc49ae1e1b4bba94b51d18b..f9fc646811a3952065d1b9fc74ff7a10ae495c32 100644
index 3a7a0e24e1c12ae044a455ee4f85216508e97d21..c41f06c82d2db758d8a91317ef21eb2f5eb76a49 100644
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
@@ -118,7 +118,7 @@ public class ServerEntity {
@@ -114,7 +114,7 @@ public class ServerEntity {
if (true || this.tickCount % 10 == 0) { // CraftBukkit - Moved below, should always enter this block
ItemStack itemstack = entityitemframe.getItem();

View File

@ -5,37 +5,37 @@ Subject: [PATCH] Make EntityUnleashEvent cancellable
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 3fbdd1b01bc86696b958ca6b7a3848e72fb51d50..00c6605f06773c52f6f5c5c1f5bcdd6dd67fb5b6 100644
index 1887b9cd309556eeacac2a5e5cd922560101fa72..b6e48531a2a1316eef786e0476574eb1c3c29a9e 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -1541,7 +1541,7 @@ public abstract class Mob extends LivingEntity implements Targeting {
@@ -1543,7 +1543,7 @@ public abstract class Mob extends LivingEntity implements Targeting {
if (flag1 && this.isLeashed()) {
// Paper start - drop leash variable
EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN, true);
- this.level.getCraftServer().getPluginManager().callEvent(event); // CraftBukkit
EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.UNKNOWN, true);
- this.level().getCraftServer().getPluginManager().callEvent(event); // CraftBukkit
+ if (!event.callEvent()) { return flag1; }
this.dropLeash(true, event.isDropLeash());
// Paper end
}
diff --git a/src/main/java/net/minecraft/world/entity/PathfinderMob.java b/src/main/java/net/minecraft/world/entity/PathfinderMob.java
index e49fb8be7d3975506a6c39c87cace664e45b3c86..a53466a84973f5e83afc71245b317ab4296e0f9e 100644
index a4dfe40d30a5abf5d614d0921b3b23023fdbc4b1..610bc67af915c8ff40a6c8a0d8e022e7db8614d8 100644
--- a/src/main/java/net/minecraft/world/entity/PathfinderMob.java
+++ b/src/main/java/net/minecraft/world/entity/PathfinderMob.java
@@ -51,7 +51,7 @@ public abstract class PathfinderMob extends Mob {
if (f > entity.level.paperConfig().misc.maxLeashDistance) { // Paper
if (f > entity.level().paperConfig().misc.maxLeashDistance) { // Paper
// Paper start - drop leash variable
EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE, true);
- this.level.getCraftServer().getPluginManager().callEvent(event); // CraftBukkit
- this.level().getCraftServer().getPluginManager().callEvent(event); // CraftBukkit
+ if (!event.callEvent()) { return; }
this.dropLeash(true, event.isDropLeash());
// Paper end
}
@@ -63,7 +63,7 @@ public abstract class PathfinderMob extends Mob {
if (f > entity.level.paperConfig().misc.maxLeashDistance) { // Paper
if (f > entity.level().paperConfig().misc.maxLeashDistance) { // Paper
// Paper start - drop leash variable
EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE, true);
- this.level.getCraftServer().getPluginManager().callEvent(event); // CraftBukkit
+ if (!event.callEvent()) return;
- this.level().getCraftServer().getPluginManager().callEvent(event); // CraftBukkit
+ if (!event.callEvent()) { return; }
this.dropLeash(true, event.isDropLeash());
// Paper end
this.goalSelector.disableControlFlag(Goal.Flag.MOVE);

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Clear bucket NBT after dispense
diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
index abd20f9495c315e73c1eb6572b8fc47db27450d7..9b56f742443ad98994acc34630f1cef75a00ca8a 100644
index cec6ee5d31f2a86a61fd142035af853fa512e211..f651d866355557d10d4bb8730e0aceac483d3ba7 100644
--- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
+++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
@@ -652,8 +652,7 @@ public interface DispenseItemBehavior {
@@ -650,8 +650,7 @@ public interface DispenseItemBehavior {
Item item = Items.BUCKET;
stack.shrink(1);
if (stack.isEmpty()) {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Change EnderEye target without changing other things
diff --git a/src/main/java/net/minecraft/world/entity/projectile/EyeOfEnder.java b/src/main/java/net/minecraft/world/entity/projectile/EyeOfEnder.java
index f1582be22ffdd916eaab8998e3f367f2aac29d51..855e85e8d0d1f15304b0a42b46ef845325e103aa 100644
index ee6bbe96503e9205349e9a5c411dc60dd952ec9e..e48706e2fefc39fcce3c65f629153fdcd677044c 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/EyeOfEnder.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/EyeOfEnder.java
@@ -73,6 +73,11 @@ public class EyeOfEnder extends Entity implements ItemSupplier {
@@ -70,6 +70,11 @@ public class EyeOfEnder extends Entity implements ItemSupplier {
}
public void signalTo(BlockPos pos) {
@ -20,7 +20,7 @@ index f1582be22ffdd916eaab8998e3f367f2aac29d51..855e85e8d0d1f15304b0a42b46ef8453
double d0 = (double) pos.getX();
int i = pos.getY();
double d1 = (double) pos.getZ();
@@ -90,8 +95,10 @@ public class EyeOfEnder extends Entity implements ItemSupplier {
@@ -87,8 +92,10 @@ public class EyeOfEnder extends Entity implements ItemSupplier {
this.tz = d1;
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add BlockBreakBlockEvent
diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java
index 536a4e9f2bec3f44ca00edaf518c5d6c475d3c8b..4f91e4832a94c3facbc711fcae4cb5ad540a5ca0 100644
index 36b196c8834c4eb873bfca0b12f1fc2b421ea071..9522e646529f3d849471931b4b3c0d133e7fcfc5 100644
--- a/src/main/java/net/minecraft/world/level/block/Block.java
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
@@ -331,6 +331,23 @@ public class Block extends BlockBehaviour implements ItemLike {
@@ -319,6 +319,23 @@ public class Block extends BlockBehaviour implements ItemLike {
}
}
@ -30,13 +30,13 @@ index 536a4e9f2bec3f44ca00edaf518c5d6c475d3c8b..4f91e4832a94c3facbc711fcae4cb5ad
+ }
+ // Paper end
public static void dropResources(BlockState state, Level world, BlockPos pos, @Nullable BlockEntity blockEntity, Entity entity, ItemStack tool) {
public static void dropResources(BlockState state, Level world, BlockPos pos, @Nullable BlockEntity blockEntity, @Nullable Entity entity, ItemStack tool) {
if (world instanceof ServerLevel) {
diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
index 8d73893100884c08aa552ff41c2a07a3e714df47..24a822ade17849a083161216c184f02c30b5cb1f 100644
index 9abae63e06c1dde9b8434d32bac8798808428d10..9b3d253c4224410719bf778a4688fce13c12069d 100644
--- a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
@@ -400,7 +400,7 @@ public class PistonBaseBlock extends DirectionalBlock {
@@ -401,7 +401,7 @@ public class PistonBaseBlock extends DirectionalBlock {
iblockdata1 = world.getBlockState(blockposition3);
BlockEntity tileentity = iblockdata1.hasBlockEntity() ? world.getBlockEntity(blockposition3) : null;
@ -46,10 +46,10 @@ index 8d73893100884c08aa552ff41c2a07a3e714df47..24a822ade17849a083161216c184f02c
world.gameEvent(GameEvent.BLOCK_DESTROY, blockposition3, GameEvent.Context.of(iblockdata1));
if (!iblockdata1.is(BlockTags.FIRE)) {
diff --git a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
index 00516a230073391b31795ec5af2aa7aa48db639a..bf4de7b8fd630c596e096a411a8c84c64c13ebf7 100644
index fbf699e777d45db3dcf1606d34f509ca1a5bbb7a..37fcbca0c56b7707a0c9f5d3ae874aff7268f6fc 100644
--- a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
+++ b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
@@ -294,7 +294,7 @@ public abstract class FlowingFluid extends Fluid {
@@ -292,7 +292,7 @@ public abstract class FlowingFluid extends Fluid {
((LiquidBlockContainer) state.getBlock()).placeLiquid(world, pos, state, fluidState);
} else {
if (!state.isAir()) {
@ -58,14 +58,14 @@ index 00516a230073391b31795ec5af2aa7aa48db639a..bf4de7b8fd630c596e096a411a8c84c6
}
world.setBlock(pos, fluidState.createLegacyBlock(), 3);
@@ -302,6 +302,7 @@ public abstract class FlowingFluid extends Fluid {
@@ -300,6 +300,7 @@ public abstract class FlowingFluid extends Fluid {
}
+ protected void beforeDestroyingBlock(LevelAccessor world, BlockPos pos, BlockState state, BlockPos source) { beforeDestroyingBlock(world, pos, state); } // Paper - add source parameter
protected abstract void beforeDestroyingBlock(LevelAccessor world, BlockPos pos, BlockState state);
private static short getCacheKey(BlockPos blockposition, BlockPos blockposition1) {
private static short getCacheKey(BlockPos from, BlockPos to) {
diff --git a/src/main/java/net/minecraft/world/level/material/WaterFluid.java b/src/main/java/net/minecraft/world/level/material/WaterFluid.java
index 1897c0012800d5ba9d2fc386f3e2bf57c9d878bb..82e85fbbd45244d02df90fa00c9046e7f51275a2 100644
--- a/src/main/java/net/minecraft/world/level/material/WaterFluid.java

View File

@ -0,0 +1,147 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Sun, 26 Sep 2021 12:57:28 -0700
Subject: [PATCH] Option to prevent NBT copy in smithing recipes
diff --git a/src/main/java/net/minecraft/world/item/crafting/SmithingTransformRecipe.java b/src/main/java/net/minecraft/world/item/crafting/SmithingTransformRecipe.java
index 2b3718f9fc68c286e8abdde4a960e19b97302531..7819a914bbbe4f0e2a4407e4c99b14732d4d89c5 100644
--- a/src/main/java/net/minecraft/world/item/crafting/SmithingTransformRecipe.java
+++ b/src/main/java/net/minecraft/world/item/crafting/SmithingTransformRecipe.java
@@ -25,8 +25,15 @@ public class SmithingTransformRecipe implements SmithingRecipe {
final Ingredient base;
final Ingredient addition;
final ItemStack result;
+ final boolean copyNBT; // Paper
public SmithingTransformRecipe(ResourceLocation id, Ingredient template, Ingredient base, Ingredient addition, ItemStack result) {
+ // Paper start
+ this(id, template, base, addition, result, true);
+ }
+ public SmithingTransformRecipe(ResourceLocation id, Ingredient template, Ingredient base, Ingredient addition, ItemStack result, boolean copyNBT) {
+ this.copyNBT = copyNBT;
+ // Paper end
this.id = id;
this.template = template;
this.base = base;
@@ -42,11 +49,13 @@ public class SmithingTransformRecipe implements SmithingRecipe {
@Override
public ItemStack assemble(Container inventory, RegistryAccess registryManager) {
ItemStack itemstack = this.result.copy();
+ if (this.copyNBT) { // Paper - copy nbt conditionally
CompoundTag nbttagcompound = inventory.getItem(1).getTag();
if (nbttagcompound != null) {
itemstack.setTag(nbttagcompound.copy());
}
+ } // Paper
return itemstack;
}
@@ -91,7 +100,7 @@ public class SmithingTransformRecipe implements SmithingRecipe {
public Recipe toBukkitRecipe() {
CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
- CraftSmithingTransformRecipe recipe = new CraftSmithingTransformRecipe(CraftNamespacedKey.fromMinecraft(this.id), result, CraftRecipe.toBukkit(this.template), CraftRecipe.toBukkit(this.base), CraftRecipe.toBukkit(this.addition));
+ CraftSmithingTransformRecipe recipe = new CraftSmithingTransformRecipe(CraftNamespacedKey.fromMinecraft(this.id), result, CraftRecipe.toBukkit(this.template), CraftRecipe.toBukkit(this.base), CraftRecipe.toBukkit(this.addition), this.copyNBT); // Paper
return recipe;
}
diff --git a/src/main/java/net/minecraft/world/item/crafting/SmithingTrimRecipe.java b/src/main/java/net/minecraft/world/item/crafting/SmithingTrimRecipe.java
index c28b0d7a97e8463f7fe15bbf0f3485f2559efd4a..5b0cee067b5c69d2d4c51b8c8d2489744b843043 100644
--- a/src/main/java/net/minecraft/world/item/crafting/SmithingTrimRecipe.java
+++ b/src/main/java/net/minecraft/world/item/crafting/SmithingTrimRecipe.java
@@ -31,8 +31,15 @@ public class SmithingTrimRecipe implements SmithingRecipe {
final Ingredient template;
final Ingredient base;
final Ingredient addition;
+ final boolean copyNbt; // Paper
public SmithingTrimRecipe(ResourceLocation id, Ingredient template, Ingredient base, Ingredient addition) {
+ // Paper start
+ this(id, template, base, addition, true);
+ }
+ public SmithingTrimRecipe(ResourceLocation id, Ingredient template, Ingredient base, Ingredient addition, boolean copyNbt) {
+ this.copyNbt = copyNbt;
+ // Paper end
this.id = id;
this.template = template;
this.base = base;
@@ -59,7 +66,7 @@ public class SmithingTrimRecipe implements SmithingRecipe {
return ItemStack.EMPTY;
}
- ItemStack itemstack1 = itemstack.copy();
+ ItemStack itemstack1 = this.copyNbt ? itemstack.copy() : new ItemStack(itemstack.getItem(), itemstack.getCount()); // Paper
itemstack1.setCount(1);
ArmorTrim armortrim = new ArmorTrim((Holder) optional.get(), (Holder) optional1.get());
@@ -124,7 +131,7 @@ public class SmithingTrimRecipe implements SmithingRecipe {
// CraftBukkit start
@Override
public Recipe toBukkitRecipe() {
- return new CraftSmithingTrimRecipe(CraftNamespacedKey.fromMinecraft(this.id), CraftRecipe.toBukkit(this.template), CraftRecipe.toBukkit(this.base), CraftRecipe.toBukkit(this.addition));
+ return new CraftSmithingTrimRecipe(CraftNamespacedKey.fromMinecraft(this.id), CraftRecipe.toBukkit(this.template), CraftRecipe.toBukkit(this.base), CraftRecipe.toBukkit(this.addition), this.copyNbt); // Paper
}
// CraftBukkit end
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftSmithingTransformRecipe.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftSmithingTransformRecipe.java
index 872baa62d5c893141af88727f5f93911cebf8cdc..248d742b173d7b5fae655e656cd87146e2a483c1 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftSmithingTransformRecipe.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftSmithingTransformRecipe.java
@@ -11,12 +11,17 @@ public class CraftSmithingTransformRecipe extends SmithingTransformRecipe implem
public CraftSmithingTransformRecipe(NamespacedKey key, ItemStack result, RecipeChoice template, RecipeChoice base, RecipeChoice addition) {
super(key, result, template, base, addition);
}
+ // Paper start
+ public CraftSmithingTransformRecipe(NamespacedKey key, ItemStack result, RecipeChoice template, RecipeChoice base, RecipeChoice addition, boolean copyNbt) {
+ super(key, result, template, base, addition, copyNbt);
+ }
+ // Paper end
public static CraftSmithingTransformRecipe fromBukkitRecipe(SmithingTransformRecipe recipe) {
if (recipe instanceof CraftSmithingTransformRecipe) {
return (CraftSmithingTransformRecipe) recipe;
}
- CraftSmithingTransformRecipe ret = new CraftSmithingTransformRecipe(recipe.getKey(), recipe.getResult(), recipe.getTemplate(), recipe.getBase(), recipe.getAddition());
+ CraftSmithingTransformRecipe ret = new CraftSmithingTransformRecipe(recipe.getKey(), recipe.getResult(), recipe.getTemplate(), recipe.getBase(), recipe.getAddition(), recipe.willCopyNbt()); // Paper
return ret;
}
@@ -24,6 +29,6 @@ public class CraftSmithingTransformRecipe extends SmithingTransformRecipe implem
public void addToCraftingManager() {
ItemStack result = this.getResult();
- MinecraftServer.getServer().getRecipeManager().addRecipe(new net.minecraft.world.item.crafting.SmithingTransformRecipe(CraftNamespacedKey.toMinecraft(this.getKey()), toNMS(this.getTemplate(), true), toNMS(this.getBase(), true), toNMS(this.getAddition(), true), CraftItemStack.asNMSCopy(result)));
+ MinecraftServer.getServer().getRecipeManager().addRecipe(new net.minecraft.world.item.crafting.SmithingTransformRecipe(CraftNamespacedKey.toMinecraft(this.getKey()), toNMS(this.getTemplate(), true), toNMS(this.getBase(), true), toNMS(this.getAddition(), true), CraftItemStack.asNMSCopy(result), this.willCopyNbt())); // Paper
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftSmithingTrimRecipe.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftSmithingTrimRecipe.java
index 6ef43f58d8fb6bbe9e2a58fc0bb62fb0c935d7f9..610e6fa88e5d835027ba19d1bd3ff31cc42d2687 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftSmithingTrimRecipe.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftSmithingTrimRecipe.java
@@ -11,17 +11,22 @@ public class CraftSmithingTrimRecipe extends SmithingTrimRecipe implements Craft
public CraftSmithingTrimRecipe(NamespacedKey key, RecipeChoice template, RecipeChoice base, RecipeChoice addition) {
super(key, template, base, addition);
}
+ // Paper start
+ public CraftSmithingTrimRecipe(NamespacedKey key, RecipeChoice template, RecipeChoice base, RecipeChoice addition, boolean copyNbt) {
+ super(key, template, base, addition, copyNbt);
+ }
+ // Paper end
public static CraftSmithingTrimRecipe fromBukkitRecipe(SmithingTrimRecipe recipe) {
if (recipe instanceof CraftSmithingTrimRecipe) {
return (CraftSmithingTrimRecipe) recipe;
}
- CraftSmithingTrimRecipe ret = new CraftSmithingTrimRecipe(recipe.getKey(), recipe.getTemplate(), recipe.getBase(), recipe.getAddition());
+ CraftSmithingTrimRecipe ret = new CraftSmithingTrimRecipe(recipe.getKey(), recipe.getTemplate(), recipe.getBase(), recipe.getAddition(), recipe.willCopyNbt()); // Paper
return ret;
}
@Override
public void addToCraftingManager() {
- MinecraftServer.getServer().getRecipeManager().addRecipe(new net.minecraft.world.item.crafting.SmithingTrimRecipe(CraftNamespacedKey.toMinecraft(this.getKey()), toNMS(this.getTemplate(), true), toNMS(this.getBase(), true), toNMS(this.getAddition(), true)));
+ MinecraftServer.getServer().getRecipeManager().addRecipe(new net.minecraft.world.item.crafting.SmithingTrimRecipe(CraftNamespacedKey.toMinecraft(this.getKey()), toNMS(this.getTemplate(), true), toNMS(this.getBase(), true), toNMS(this.getAddition(), true), this.willCopyNbt())); // Paper
}
}

View File

@ -54,7 +54,7 @@ index e2d3fe9af7d3bd82bee519b20e141cd58f68bbd6..944a4fee237730c0d89567aaa6ddf268
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
index 2eb62af25076b7160b0159ec382baebe5162b024..0ef20dc6a43dc973183854a638d5f9f770583ec1 100644
index fe5d3b60ad740b7f1cce040f9c8d96ac51245ef6..43ffc4180b1ef2d2000991ad58b0706141470d08 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
@@ -251,6 +251,14 @@ public class Commodore

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add back EntityPortalExitEvent
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index d69352cc86f1a40bf696e30f11a3a84fac3b20c5..d2f93f6cf5ff5a0ee5de18d4e593c1423e191d14 100644
index 6b6fbcc69c834e2bb48ddd9dfbb18e93d536f40b..cd57b071a7cfd6ace4457dddc82367735e64e952 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -3217,6 +3217,23 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -3256,6 +3256,23 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
} else {
// CraftBukkit start
worldserver = shapedetectorshape.world;
@ -32,7 +32,7 @@ index d69352cc86f1a40bf696e30f11a3a84fac3b20c5..d2f93f6cf5ff5a0ee5de18d4e593c142
if (worldserver == this.level) {
// SPIGOT-6782: Just move the entity if a plugin changed the world to the one the entity is already in
this.moveTo(shapedetectorshape.pos.x, shapedetectorshape.pos.y, shapedetectorshape.pos.z, shapedetectorshape.yRot, shapedetectorshape.xRot);
@@ -3236,8 +3253,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -3275,8 +3292,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
if (entity != null) {
entity.restoreFrom(this);

View File

@ -7,10 +7,10 @@ Subject: [PATCH] Add methods to find targets for lightning strikes
public net.minecraft.server.level.ServerLevel findLightningRod(Lnet/minecraft/core/BlockPos;)Ljava/util/Optional;
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 16b73f0498936a8413f6adedd7f92bab07a4a108..f12d844d422ca4175d4cb2b8e3112b590a207a16 100644
index fa58ec5466edd5ce6a1887b73f628fb6c7272d88..ebce1f6331ab31b7dea1d4f46ff278c4907cdbea 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -833,6 +833,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -744,6 +744,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
protected BlockPos findLightningTargetAround(BlockPos pos) {
@ -22,7 +22,7 @@ index 16b73f0498936a8413f6adedd7f92bab07a4a108..f12d844d422ca4175d4cb2b8e3112b59
BlockPos blockposition1 = this.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, pos);
Optional<BlockPos> optional = this.findLightningRod(blockposition1);
@@ -847,6 +852,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -758,6 +763,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
if (!list.isEmpty()) {
return ((LivingEntity) list.get(this.random.nextInt(list.size()))).blockPosition();
} else {
@ -31,10 +31,10 @@ index 16b73f0498936a8413f6adedd7f92bab07a4a108..f12d844d422ca4175d4cb2b8e3112b59
blockposition1 = blockposition1.above(2);
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 0acb97676ad066d474b0290cbbb8555f11d09154..1c0cf2bb708e4333319fd3355d937a3dcc3c1ade 100644
index 26468a3788c157241ded0ef7c4c704f801ef53a0..fe27f31adb000ed5de86432dc4347cd19964e6f3 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -693,6 +693,23 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -698,6 +698,23 @@ public class CraftWorld extends CraftRegionAccessor implements World {
return (LightningStrike) lightning.getBukkitEntity();
}

View File

@ -1,84 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Sun, 26 Sep 2021 12:57:28 -0700
Subject: [PATCH] Option to prevent NBT copy in smithing recipes
diff --git a/src/main/java/net/minecraft/world/item/crafting/LegacyUpgradeRecipe.java b/src/main/java/net/minecraft/world/item/crafting/LegacyUpgradeRecipe.java
index 9c8ca33327e2e54c1c9d7f5a3a9a6648b5422737..06c7ca77456acc1f206aabc6d4198128ca927c6a 100644
--- a/src/main/java/net/minecraft/world/item/crafting/LegacyUpgradeRecipe.java
+++ b/src/main/java/net/minecraft/world/item/crafting/LegacyUpgradeRecipe.java
@@ -26,8 +26,15 @@ public class LegacyUpgradeRecipe implements SmithingRecipe {
final Ingredient addition;
final ItemStack result;
private final ResourceLocation id;
+ final boolean copyNBT; // Paper
public LegacyUpgradeRecipe(ResourceLocation id, Ingredient base, Ingredient addition, ItemStack result) {
+ // Paper start
+ this(id, base, addition, result, true);
+ }
+ public LegacyUpgradeRecipe(ResourceLocation id, Ingredient base, Ingredient addition, ItemStack result, boolean copyNBT) {
+ this.copyNBT = copyNBT;
+ // Paper end
this.id = id;
this.base = base;
this.addition = addition;
@@ -42,11 +49,13 @@ public class LegacyUpgradeRecipe implements SmithingRecipe {
@Override
public ItemStack assemble(Container inventory, RegistryAccess registryManager) {
ItemStack itemstack = this.result.copy();
+ if (this.copyNBT) { // Paper - copy nbt conditionally
CompoundTag nbttagcompound = inventory.getItem(0).getTag();
if (nbttagcompound != null) {
itemstack.setTag(nbttagcompound.copy());
}
+ } // Paper
return itemstack;
}
@@ -98,7 +107,7 @@ public class LegacyUpgradeRecipe implements SmithingRecipe {
public Recipe toBukkitRecipe() {
CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
- CraftSmithingRecipe recipe = new CraftSmithingRecipe(CraftNamespacedKey.fromMinecraft(this.id), result, CraftRecipe.toBukkit(this.base), CraftRecipe.toBukkit(this.addition));
+ CraftSmithingRecipe recipe = new CraftSmithingRecipe(CraftNamespacedKey.fromMinecraft(this.id), result, CraftRecipe.toBukkit(this.base), CraftRecipe.toBukkit(this.addition), this.copyNBT); // Paper
return recipe;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftSmithingRecipe.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftSmithingRecipe.java
index d3e149d9d9b514f0d5b06799cc5dc9b790de5085..1c133200eb9efac6ae6eef553e5a69d3d3a8df83 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftSmithingRecipe.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftSmithingRecipe.java
@@ -8,15 +8,21 @@ import org.bukkit.inventory.RecipeChoice;
import org.bukkit.inventory.SmithingRecipe;
public class CraftSmithingRecipe extends SmithingRecipe implements CraftRecipe {
+ @Deprecated // Paper
public CraftSmithingRecipe(NamespacedKey key, ItemStack result, RecipeChoice base, RecipeChoice addition) {
super(key, result, base, addition);
}
+ // Paper start
+ public CraftSmithingRecipe(NamespacedKey key, ItemStack result, RecipeChoice base, RecipeChoice addition, boolean copyNbt) {
+ super(key, result, base, addition, copyNbt);
+ }
+ // Paper end
public static CraftSmithingRecipe fromBukkitRecipe(SmithingRecipe recipe) {
if (recipe instanceof CraftSmithingRecipe) {
return (CraftSmithingRecipe) recipe;
}
- CraftSmithingRecipe ret = new CraftSmithingRecipe(recipe.getKey(), recipe.getResult(), recipe.getBase(), recipe.getAddition());
+ CraftSmithingRecipe ret = new CraftSmithingRecipe(recipe.getKey(), recipe.getResult(), recipe.getBase(), recipe.getAddition(), recipe.willCopyNbt()); // Paper
return ret;
}
@@ -24,6 +30,6 @@ public class CraftSmithingRecipe extends SmithingRecipe implements CraftRecipe {
public void addToCraftingManager() {
ItemStack result = this.getResult();
- MinecraftServer.getServer().getRecipeManager().addRecipe(new net.minecraft.world.item.crafting.LegacyUpgradeRecipe(CraftNamespacedKey.toMinecraft(this.getKey()), toNMS(this.getBase(), true), toNMS(this.getAddition(), true), CraftItemStack.asNMSCopy(result)));
+ MinecraftServer.getServer().getRecipeManager().addRecipe(new net.minecraft.world.item.crafting.LegacyUpgradeRecipe(CraftNamespacedKey.toMinecraft(this.getKey()), toNMS(this.getBase(), true), toNMS(this.getAddition(), true), CraftItemStack.asNMSCopy(result), this.willCopyNbt())); // Paper
}
}