This commit is contained in:
Jake Potrebic 2024-04-23 19:21:40 -07:00
parent 906f906089
commit 8244815161
No known key found for this signature in database
GPG Key ID: ECE0B3C133C016C5
51 changed files with 310 additions and 371 deletions

View File

@ -15,10 +15,10 @@ instead and save a lot of server resources.
See: https://github.com/PaperMC/Paper/issues/917
diff --git a/src/main/java/net/minecraft/util/SpawnUtil.java b/src/main/java/net/minecraft/util/SpawnUtil.java
index d83444ccca674011c7c32c4a9287fbadc9b64494..c5d54abfcbd74c3041d9a46f77705460fa65ce30 100644
index 3f2cad4c9c0400bf93932cb7f7219c2185fc7370..5c8e36ea8287029b1789719c687bac1a2c4c3a69 100644
--- a/src/main/java/net/minecraft/util/SpawnUtil.java
+++ b/src/main/java/net/minecraft/util/SpawnUtil.java
@@ -22,10 +22,10 @@ public class SpawnUtil {
@@ -21,10 +21,10 @@ public class SpawnUtil {
public static <T extends Mob> Optional<T> trySpawnMob(EntityType<T> entityType, MobSpawnType reason, ServerLevel world, BlockPos pos, int tries, int horizontalRange, int verticalRange, SpawnUtil.Strategy requirements) {
// CraftBukkit start
@ -31,7 +31,7 @@ index d83444ccca674011c7c32c4a9287fbadc9b64494..c5d54abfcbd74c3041d9a46f77705460
// CraftBukkit end
BlockPos.MutableBlockPos blockposition_mutableblockposition = blockposition.mutable();
@@ -35,6 +35,22 @@ public class SpawnUtil {
@@ -34,6 +34,22 @@ public class SpawnUtil {
blockposition_mutableblockposition.setWithOffset(blockposition, i1, k, j1);
if (worldserver.getWorldBorder().isWithinBounds((BlockPos) blockposition_mutableblockposition) && SpawnUtil.moveToPossibleSpawnPosition(worldserver, k, blockposition_mutableblockposition, spawnutil_a)) {
@ -51,16 +51,16 @@ index d83444ccca674011c7c32c4a9287fbadc9b64494..c5d54abfcbd74c3041d9a46f77705460
+ break;
+ }
+ // Paper end - PreCreatureSpawnEvent
T t0 = entitytypes.create(worldserver, (CompoundTag) null, null, blockposition_mutableblockposition, enummobspawn, false, false); // CraftBukkit - decompile error
T t0 = entitytypes.create(worldserver, (Consumer<T>) null, blockposition_mutableblockposition, enummobspawn, false, false); // CraftBukkit - decompile error
if (t0 != null) {
diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java
index 382b55167dede435b034866bd394455f0f6f2a00..035af9ccf679a562203a4a2c4f2b38098c57b492 100644
index 5e31d2799c299e5c3d4c02871f785179a2422323..fb621b161b0a47fac2c44b369ed01c27278bc4f6 100644
--- a/src/main/java/net/minecraft/world/entity/EntityType.java
+++ b/src/main/java/net/minecraft/world/entity/EntityType.java
@@ -418,6 +418,16 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
@@ -430,6 +430,16 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
@Nullable
public T spawn(ServerLevel worldserver, @Nullable CompoundTag nbttagcompound, @Nullable Consumer<T> consumer, BlockPos blockposition, MobSpawnType enummobspawn, boolean flag, boolean flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) {
public T spawn(ServerLevel worldserver, @Nullable Consumer<T> consumer, BlockPos blockposition, MobSpawnType enummobspawn, boolean flag, boolean flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) {
// CraftBukkit end
+ // Paper start - PreCreatureSpawnEvent
+ com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event = new com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent(
@ -72,14 +72,14 @@ index 382b55167dede435b034866bd394455f0f6f2a00..035af9ccf679a562203a4a2c4f2b3809
+ return null;
+ }
+ // Paper end - PreCreatureSpawnEvent
T t0 = this.create(worldserver, nbttagcompound, consumer, blockposition, enummobspawn, flag, flag1);
T t0 = this.create(worldserver, consumer, blockposition, enummobspawn, flag, flag1);
if (t0 != null) {
diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java
index 0b34003058205f26a89d18dad06b2067dbe897d7..0a1a70edda66bf348b3e3a9df4670cd81561cd1f 100644
index d1c3f5d076a3d560d02553d6a33e5890d0c2bfc7..4d7f95d2bd415bacccee145bfc47f2b480530c11 100644
--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java
+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java
@@ -976,7 +976,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
@@ -968,7 +968,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
}).limit(5L).collect(Collectors.toList());
if (list1.size() >= requiredCount) {
@ -89,10 +89,10 @@ index 0b34003058205f26a89d18dad06b2067dbe897d7..0a1a70edda66bf348b3e3a9df4670cd8
}
}
diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java
index fdd1fd084c46b0220c9e7e0389e9b52e782d2878..0166c5ff685490cbf67a9d26f48cb1a0be754488 100644
index 31fe2faf9137ac8b1acca9a5ffc5bbcc8aab16c1..d13abdcc7a54bdecf853c883911ef535733610b4 100644
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
@@ -130,6 +130,20 @@ public abstract class BaseSpawner {
@@ -132,6 +132,20 @@ public abstract class BaseSpawner {
} else if (!SpawnPlacements.checkSpawnRules((EntityType) optional.get(), world, MobSpawnType.SPAWNER, blockposition1, world.getRandom())) {
continue;
}
@ -114,10 +114,10 @@ index fdd1fd084c46b0220c9e7e0389e9b52e782d2878..0166c5ff685490cbf67a9d26f48cb1a0
Entity entity = EntityType.loadEntityRecursive(nbttagcompound, world, (entity1) -> {
entity1.moveTo(d0, d1, d2, entity1.getYRot(), entity1.getXRot());
diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
index 604766a286d00bb4b40c20482376fe80651beabe..352d230b365c512a4b9831265d3a57825f80fbfd 100644
index 6324689f52363f19501143c1649f0885684cb796..bce78beaadbfd0e400457bd14bcf6538be702879 100644
--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java
+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
@@ -213,7 +213,13 @@ public final class NaturalSpawner {
@@ -208,7 +208,13 @@ public final class NaturalSpawner {
j1 = biomesettingsmobs_c.minCount + world.random.nextInt(1 + biomesettingsmobs_c.maxCount - biomesettingsmobs_c.minCount);
}
@ -132,7 +132,7 @@ index 604766a286d00bb4b40c20482376fe80651beabe..352d230b365c512a4b9831265d3a5782
Mob entityinsentient = NaturalSpawner.getMobForSpawn(world, biomesettingsmobs_c.type);
if (entityinsentient == null) {
@@ -261,19 +267,40 @@ public final class NaturalSpawner {
@@ -256,10 +262,31 @@ public final class NaturalSpawner {
return squaredDistance <= 576.0D ? false : (world.getSharedSpawnPos().closerToCenterThan(new Vec3((double) pos.getX() + 0.5D, (double) pos.getY(), (double) pos.getZ() + 0.5D), 24.0D) ? false : Objects.equals(new ChunkPos(pos), chunk.getPos()) || world.isNaturalSpawningAllowed((BlockPos) pos));
}
@ -148,6 +148,7 @@ index 604766a286d00bb4b40c20482376fe80651beabe..352d230b365c512a4b9831265d3a5782
+ // Paper end - PreCreatureSpawnEvent
EntityType<?> entitytypes = spawnEntry.type;
- return entitytypes.getCategory() == MobCategory.MISC ? false : (!entitytypes.canSpawnFarFromPlayer() && squaredDistance > (double) (entitytypes.getCategory().getDespawnDistance() * entitytypes.getCategory().getDespawnDistance()) ? false : (entitytypes.canSummon() && NaturalSpawner.canSpawnMobAt(world, structureAccessor, chunkGenerator, group, spawnEntry, pos) ? (!SpawnPlacements.isSpawnPositionOk(entitytypes, world, pos) ? false : (!SpawnPlacements.checkSpawnRules(entitytypes, world, MobSpawnType.NATURAL, pos, world.random) ? false : world.noCollision(entitytypes.getSpawnAABB((double) pos.getX() + 0.5D, (double) pos.getY(), (double) pos.getZ() + 0.5D)))) : false));
+ // Paper start - PreCreatureSpawnEvent
+ com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event = new com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent(
+ io.papermc.paper.util.MCUtil.toLocation(world, pos),
@ -160,21 +161,8 @@ index 604766a286d00bb4b40c20482376fe80651beabe..352d230b365c512a4b9831265d3a5782
+ return PreSpawnStatus.CANCELLED;
+ }
+ // Paper end - PreCreatureSpawnEvent
if (entitytypes.getCategory() == MobCategory.MISC) {
- return false;
+ return PreSpawnStatus.FAIL; // Paper - PreCreatureSpawnEvent
} else if (!entitytypes.canSpawnFarFromPlayer() && squaredDistance > (double) (entitytypes.getCategory().getDespawnDistance() * entitytypes.getCategory().getDespawnDistance())) {
- return false;
+ return PreSpawnStatus.FAIL; // Paper - PreCreatureSpawnEvent
} else if (entitytypes.canSummon() && NaturalSpawner.canSpawnMobAt(world, structureAccessor, chunkGenerator, group, spawnEntry, pos)) {
SpawnPlacements.Type entitypositiontypes_surface = SpawnPlacements.getPlacementType(entitytypes);
- return !NaturalSpawner.isSpawnPositionOk(entitypositiontypes_surface, world, pos, entitytypes) ? false : (!SpawnPlacements.checkSpawnRules(entitytypes, world, MobSpawnType.NATURAL, pos, world.random) ? false : world.noCollision(entitytypes.getAABB((double) pos.getX() + 0.5D, (double) pos.getY(), (double) pos.getZ() + 0.5D)));
+ boolean isValid = !NaturalSpawner.isSpawnPositionOk(entitypositiontypes_surface, world, pos, entitytypes) ? false : (!SpawnPlacements.checkSpawnRules(entitytypes, world, MobSpawnType.NATURAL, pos, world.random) ? false : world.noCollision(entitytypes.getAABB((double) pos.getX() + 0.5D, (double) pos.getY(), (double) pos.getZ() + 0.5D))); // Paper - PreCreatureSpawnEvent
+ return isValid ? PreSpawnStatus.SUCCESS : PreSpawnStatus.FAIL; // Paper - PreCreatureSpawnEvent
} else {
- return false;
+ return PreSpawnStatus.FAIL; // Paper - PreCreatureSpawnEvent
}
+
+ return entitytypes.getCategory() == MobCategory.MISC ? PreSpawnStatus.FAIL : (!entitytypes.canSpawnFarFromPlayer() && squaredDistance > (double) (entitytypes.getCategory().getDespawnDistance() * entitytypes.getCategory().getDespawnDistance()) ? PreSpawnStatus.FAIL : (entitytypes.canSummon() && NaturalSpawner.canSpawnMobAt(world, structureAccessor, chunkGenerator, group, spawnEntry, pos) ? (!SpawnPlacements.isSpawnPositionOk(entitytypes, world, pos) ? PreSpawnStatus.FAIL : (!SpawnPlacements.checkSpawnRules(entitytypes, world, MobSpawnType.NATURAL, pos, world.random) ? PreSpawnStatus.FAIL : world.noCollision(entitytypes.getSpawnAABB((double) pos.getX() + 0.5D, (double) pos.getY(), (double) pos.getZ() + 0.5D)) ? PreSpawnStatus.SUCCESS : PreSpawnStatus.FAIL)) : PreSpawnStatus.FAIL)); // Paper - PreCreatureSpawnEvent
}
@Nullable

View File

@ -45,16 +45,3 @@ index 985e6fc43a0946943847e0c283426242ef594a26..d577384797bb381eb57437f57b726ea8
public @Nullable ProfileResult fetchProfile(final UUID profileId, final boolean requireSecure) {
return super.fetchProfile(profileId, requireSecure);
}
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
index d0b3a836de9830a4da534bedd9f94a16a82ef9c6..6f52256bfb668aee7fd1628c1c0c7b3434b847a6 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
@@ -74,7 +74,7 @@ public class SkullBlockEntity extends BlockEntity {
return apiServices.profileCache().getAsync(name).thenApplyAsync((optional) -> {
if (optional.isPresent() && !booleansupplier.getAsBoolean()) {
UUID uuid = ((GameProfile) optional.get()).getId();
- ProfileResult profileresult = apiServices.sessionService().fetchProfile(uuid, true);
+ ProfileResult profileresult = apiServices.sessionService() instanceof com.destroystokyo.paper.profile.PaperMinecraftSessionService paperMinecraftSessionService ? paperMinecraftSessionService.fetchProfile(optional.get(), true) : apiServices.sessionService().fetchProfile(uuid, true); // Paper - FillProfileEvent
return profileresult != null ? Optional.ofNullable(profileresult.profile()) : optional;
} else {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerAdvancementCriterionGrantEvent
diff --git a/src/main/java/net/minecraft/server/PlayerAdvancements.java b/src/main/java/net/minecraft/server/PlayerAdvancements.java
index dbd5f1d052348d6adae8b13ae1f2686553b7a4bf..c61789a2df774761feb79123d31eab75f9996bf2 100644
index 5657391bfe6272b70fbf7d2732d46994832c39f9..6e8ccafe8966970d1665be21266f2ffe95e1d3ed 100644
--- a/src/main/java/net/minecraft/server/PlayerAdvancements.java
+++ b/src/main/java/net/minecraft/server/PlayerAdvancements.java
@@ -225,6 +225,12 @@ public class PlayerAdvancements {

View File

@ -13,17 +13,17 @@ starting point for future additions in this area.
Fixes GH-559
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmorStand.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmorStand.java
index b77f5832265be5aaf96d95fcac4737919720fa6e..e15723080445b09852512132039ca2cde4936b7e 100644
index c4f12f96e39cb6189799a796b4cb2cb4f0b92392..84e09a934600df116206df1c3922a11ee969901a 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmorStand.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmorStand.java
@@ -8,9 +8,22 @@ import org.bukkit.Material;
@@ -11,9 +11,22 @@ import org.bukkit.Material;
import org.bukkit.configuration.serialization.DelegateDeserialization;
@DelegateDeserialization(CraftMetaItem.SerializableMeta.class)
@DelegateDeserialization(SerializableMeta.class)
-public class CraftMetaArmorStand extends CraftMetaItem {
+public class CraftMetaArmorStand extends CraftMetaItem implements com.destroystokyo.paper.inventory.meta.ArmorStandMeta { // Paper
static final ItemMetaKey ENTITY_TAG = new ItemMetaKey("EntityTag", "entity-tag");
static final ItemMetaKeyType<CustomData> ENTITY_TAG = new ItemMetaKeyType<>(DataComponents.ENTITY_DATA, "entity-tag");
+ // Paper start
+ static final ItemMetaKey INVISIBLE = new ItemMetaKey("Invisible", "invisible");
+ static final ItemMetaKey NO_BASE_PLATE = new ItemMetaKey("NoBasePlate", "no-base-plate");
@ -40,7 +40,7 @@ index b77f5832265be5aaf96d95fcac4737919720fa6e..e15723080445b09852512132039ca2cd
CompoundTag entityTag;
CraftMetaArmorStand(CraftMetaItem meta) {
@@ -21,6 +34,13 @@ public class CraftMetaArmorStand extends CraftMetaItem {
@@ -24,6 +37,13 @@ public class CraftMetaArmorStand extends CraftMetaItem {
}
CraftMetaArmorStand armorStand = (CraftMetaArmorStand) meta;
@ -54,10 +54,10 @@ index b77f5832265be5aaf96d95fcac4737919720fa6e..e15723080445b09852512132039ca2cd
this.entityTag = armorStand.entityTag;
}
@@ -29,11 +49,39 @@ public class CraftMetaArmorStand extends CraftMetaItem {
@@ -32,11 +52,39 @@ public class CraftMetaArmorStand extends CraftMetaItem {
if (tag.contains(CraftMetaArmorStand.ENTITY_TAG.NBT)) {
this.entityTag = tag.getCompound(CraftMetaArmorStand.ENTITY_TAG.NBT).copy();
getOrEmpty(tag, CraftMetaArmorStand.ENTITY_TAG).ifPresent((nbt) -> {
this.entityTag = nbt.copyTag();
+ // Paper start
+ if (entityTag.contains(INVISIBLE.NBT)) {
+ invisible = entityTag.getBoolean(INVISIBLE.NBT);
@ -79,7 +79,7 @@ index b77f5832265be5aaf96d95fcac4737919720fa6e..e15723080445b09852512132039ca2cd
+ marker = entityTag.getBoolean(MARKER.NBT);
+ }
+ // Paper end
}
});
}
CraftMetaArmorStand(Map<String, Object> map) {
@ -94,8 +94,8 @@ index b77f5832265be5aaf96d95fcac4737919720fa6e..e15723080445b09852512132039ca2cd
}
@Override
@@ -56,6 +104,31 @@ public class CraftMetaArmorStand extends CraftMetaItem {
void applyToItem(CompoundTag tag) {
@@ -59,6 +107,31 @@ public class CraftMetaArmorStand extends CraftMetaItem {
void applyToItem(CraftMetaItem.Applicator tag) {
super.applyToItem(tag);
+ // Paper start
@ -124,9 +124,9 @@ index b77f5832265be5aaf96d95fcac4737919720fa6e..e15723080445b09852512132039ca2cd
+ }
+ // Paper end
if (this.entityTag != null) {
tag.put(CraftMetaArmorStand.ENTITY_TAG.NBT, this.entityTag);
tag.put(CraftMetaArmorStand.ENTITY_TAG, CustomData.of(this.entityTag));
}
@@ -72,7 +145,7 @@ public class CraftMetaArmorStand extends CraftMetaItem {
@@ -75,7 +148,7 @@ public class CraftMetaArmorStand extends CraftMetaItem {
}
boolean isArmorStandEmpty() {
@ -135,7 +135,7 @@ index b77f5832265be5aaf96d95fcac4737919720fa6e..e15723080445b09852512132039ca2cd
}
@Override
@@ -83,7 +156,13 @@ public class CraftMetaArmorStand extends CraftMetaItem {
@@ -86,7 +159,13 @@ public class CraftMetaArmorStand extends CraftMetaItem {
if (meta instanceof CraftMetaArmorStand) {
CraftMetaArmorStand that = (CraftMetaArmorStand) meta;
@ -150,7 +150,7 @@ index b77f5832265be5aaf96d95fcac4737919720fa6e..e15723080445b09852512132039ca2cd
}
return true;
}
@@ -98,9 +177,14 @@ public class CraftMetaArmorStand extends CraftMetaItem {
@@ -101,9 +180,14 @@ public class CraftMetaArmorStand extends CraftMetaItem {
final int original;
int hash = original = super.applyHash();
@ -168,7 +168,7 @@ index b77f5832265be5aaf96d95fcac4737919720fa6e..e15723080445b09852512132039ca2cd
return original != hash ? CraftMetaArmorStand.class.hashCode() ^ hash : hash;
}
@@ -109,6 +193,28 @@ public class CraftMetaArmorStand extends CraftMetaItem {
@@ -112,6 +196,28 @@ public class CraftMetaArmorStand extends CraftMetaItem {
Builder<String, Object> serialize(Builder<String, Object> builder) {
super.serialize(builder);
@ -197,7 +197,7 @@ index b77f5832265be5aaf96d95fcac4737919720fa6e..e15723080445b09852512132039ca2cd
return builder;
}
@@ -122,4 +228,56 @@ public class CraftMetaArmorStand extends CraftMetaItem {
@@ -125,4 +231,56 @@ public class CraftMetaArmorStand extends CraftMetaItem {
return clone;
}
@ -254,30 +254,11 @@ index b77f5832265be5aaf96d95fcac4737919720fa6e..e15723080445b09852512132039ca2cd
+ }
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index 361268bcc0197c2f9f4bd065d8f7b51771d562a9..1920cf7ad846f57cd278cb9a72dce03f3d014fbb 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -1509,6 +1509,14 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
CraftMetaCrossbow.CHARGED.NBT,
CraftMetaCrossbow.CHARGED_PROJECTILES.NBT,
CraftMetaSuspiciousStew.EFFECTS.NBT,
+ // Paper start
+ CraftMetaArmorStand.ENTITY_TAG.NBT,
+ CraftMetaArmorStand.INVISIBLE.NBT,
+ CraftMetaArmorStand.NO_BASE_PLATE.NBT,
+ CraftMetaArmorStand.SHOW_ARMS.NBT,
+ CraftMetaArmorStand.SMALL.NBT,
+ CraftMetaArmorStand.MARKER.NBT,
+ // Paper end
CraftMetaCompass.LODESTONE_DIMENSION.NBT,
CraftMetaCompass.LODESTONE_POS.NBT,
CraftMetaCompass.LODESTONE_TRACKED.NBT,
diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java
index 78a2422d648fbcf0d456420d2124e03de6cfb8e0..652207b92ac20c1ba3d20939dc2bbee3c494bf5f 100644
index 482fcd5abe687accc770722778952e1fd199b471..cf436c9e62a11b8c6cbf7638de0e5635c67459ac 100644
--- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java
+++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java
@@ -364,6 +364,7 @@ public class ItemMetaTest extends AbstractTestingBase {
@@ -362,6 +362,7 @@ public class ItemMetaTest extends AbstractTestingBase {
final CraftMetaArmorStand meta = (CraftMetaArmorStand) cleanStack.getItemMeta();
meta.entityTag = new CompoundTag();
meta.entityTag.putBoolean("Small", true);

View File

@ -10,10 +10,10 @@ Flower pots are also not updated on the client when interaction is cancelled, th
also resolves this.
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
index 45236a077d798d6a257a2e982b58901167ecd06e..a8d33286832786031ac57e6ce27d5181e1a3d9b1 100644
index f4bf927477af23365a2d4618a1634195bd2054c8..5f2dec1917f1c1c3bb69446832321f3fc21dc129 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -519,7 +519,11 @@ public class ServerPlayerGameMode {
@@ -514,7 +514,11 @@ public class ServerPlayerGameMode {
// send a correcting update to the client for the block above as well, this because of replaceable blocks (such as grass, sea grass etc)
player.connection.send(new ClientboundBlockUpdatePacket(world, blockposition.above()));
@ -23,5 +23,5 @@ index 45236a077d798d6a257a2e982b58901167ecd06e..a8d33286832786031ac57e6ce27d5181
}
+ // Paper end - extend Player Interact cancellation
player.getBukkitEntity().updateInventory(); // SPIGOT-2867
enuminteractionresult = (event.useItemInHand() != Event.Result.ALLOW) ? InteractionResult.SUCCESS : InteractionResult.PASS;
return (event.useItemInHand() != Event.Result.ALLOW) ? InteractionResult.SUCCESS : InteractionResult.PASS;
} else if (this.gameModeForPlayer == GameType.SPECTATOR) {

View File

@ -7,7 +7,7 @@ This is faster if all you need is the UUID, as .getOwner() will cause
an OfflinePlayer to be loaded from disk.
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java
index 81c34b5245133cdd119f36c6bc084fb8d99f97f8..264b3fb45c47fbb6be78262838a5c0438860915f 100644
index 5192fa2aeba7833fca456bded0deedde7de03506..3952e52b94c1cc97e1d2d3885f59d7690efb74ad 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java
@@ -88,6 +88,10 @@ public abstract class CraftAbstractHorse extends CraftAnimals implements Abstrac
@ -22,7 +22,7 @@ index 81c34b5245133cdd119f36c6bc084fb8d99f97f8..264b3fb45c47fbb6be78262838a5c043
return this.getHandle().getOwnerUUID();
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTameableAnimal.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTameableAnimal.java
index 8df43597e4d60be875c27c65e0e5c69ad60d5ce2..a06679e1e5686d9bd601b3dcf8492add58918bc4 100644
index 3d19a077db7bb1e24811cede3ad958731050359f..cedb8e67e208cdf954d052a4f0a100c1c07a962b 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTameableAnimal.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTameableAnimal.java
@@ -17,6 +17,10 @@ public class CraftTameableAnimal extends CraftAnimals implements Tameable, Creat

View File

@ -0,0 +1,18 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MiniDigger <admin@benndorf.dev>
Date: Sat, 10 Mar 2018 00:50:24 +0100
Subject: [PATCH] Toggleable player crits
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 259ec0dea938758f43560b1ed7f46c1042984774..fecb622cb33fd75b87b055fb40f127cda6a22a7d 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -1251,6 +1251,7 @@ public abstract class Player extends LivingEntity {
f += this.getItemInHand(InteractionHand.MAIN_HAND).getItem().getAttackDamageBonus(this, f);
boolean flag2 = flag && this.fallDistance > 0.0F && !this.onGround() && !this.onClimbable() && !this.isInWater() && !this.hasEffect(MobEffects.BLINDNESS) && !this.isPassenger() && target instanceof LivingEntity && !this.isSprinting();
+ flag2 = flag2 && !this.level().paperConfig().entities.behavior.disablePlayerCrits; // Paper - Toggleable player crits
if (flag2) {
f *= 1.5F;
}

View File

@ -12,10 +12,10 @@ flushing on the netty event loop, so it won't do the flush on the main thread.
Renable flushing by passing -Dpaper.explicit-flush=true
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index faac9ba36d83f537fe62e177c15ae237059cc5cc..02b3f5c67b47a098f7fe15ddba0df6cb586a9ae5 100644
index 1321b9adba4c9e45dce0f717d44a7cb4e64b9bf6..42c0723e2fe43e1f268119a16067e8bdfb971208 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -114,6 +114,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@@ -123,6 +123,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
// Paper start - NetworkClient implementation
public int protocolVersion;
public java.net.InetSocketAddress virtualHost;
@ -23,7 +23,7 @@ index faac9ba36d83f537fe62e177c15ae237059cc5cc..02b3f5c67b47a098f7fe15ddba0df6cb
// Paper end
// Paper start - add utility methods
@@ -413,7 +414,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@@ -449,7 +450,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
}
if (this.channel != null) {

View File

@ -181,7 +181,7 @@ index 0000000000000000000000000000000000000000..6b0bdc266109cdfb874f08bf74323603
+
+}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 7e4fd9fa173b24261b88fb5e898c905721e69dca..02df8d59ced48bfebfacbfab669e245539605ede 100644
index 9cbe8415699a79344b3c4245cc4f9424b7df3b2a..875591131576cb3760193651fac22698e1eb9099 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -3,6 +3,9 @@ package net.minecraft.server;
@ -194,7 +194,7 @@ index 7e4fd9fa173b24261b88fb5e898c905721e69dca..02df8d59ced48bfebfacbfab669e2455
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
@@ -1433,7 +1436,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1493,7 +1496,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
if (this.hidesOnlinePlayers()) {
return new ServerStatus.Players(i, list.size(), List.of());
} else {
@ -204,7 +204,7 @@ index 7e4fd9fa173b24261b88fb5e898c905721e69dca..02df8d59ced48bfebfacbfab669e2455
int k = Mth.nextInt(this.random, 0, list.size() - j);
diff --git a/src/main/java/net/minecraft/server/network/ServerStatusPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerStatusPacketListenerImpl.java
index 7dd3dfd2ccc820d45849a89707239b7dbcaf44c3..e5006e7672ba79ed4bcf2c4173c5a9ed4c68395b 100644
index 9e62aa13845f19faf0dc0b7b27d958626e77d96e..6f1c9fa89e718cbc01a8d72de34154f49c5f46db 100644
--- a/src/main/java/net/minecraft/server/network/ServerStatusPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerStatusPacketListenerImpl.java
@@ -48,6 +48,8 @@ public class ServerStatusPacketListenerImpl implements ServerStatusPacketListene
@ -227,7 +227,7 @@ index 7dd3dfd2ccc820d45849a89707239b7dbcaf44c3..e5006e7672ba79ed4bcf2c4173c5a9ed
}
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index 0f391af1274926ef6316bd06458767a27640f54a..9c5c19ab9dc14d844631f47a93f3349409efdf43 100644
index 27b01f7ed930baab466a5e4f9608e9e1a4da0978..7cd1f375b9ad9e6d6f2d26661519f12be064a9d2 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -289,7 +289,7 @@ public class SpigotConfig

View File

@ -7,10 +7,10 @@ Co-authored-by: Connor Linfoot <connorlinfoot@me.com>
Co-authored-by: MCMDEV <john-m.1@gmx.de>
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index abfeaa9485b71d0b802c41bfd8e113d0bc9e9773..b41aa61f80cd4ab8ddd19da397244392f9efde78 100644
index 31379b0aee05862dc44f507a64f19a810e0208d5..8f72dafebcca68263eeef4076c3251819815c77d 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -157,7 +157,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
@@ -184,7 +184,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
try {
GameProfile gameprofile = ServerLoginPacketListenerImpl.this.createOfflineProfile(ServerLoginPacketListenerImpl.this.requestedUsername); // Spigot
@ -19,7 +19,7 @@ index abfeaa9485b71d0b802c41bfd8e113d0bc9e9773..b41aa61f80cd4ab8ddd19da397244392
ServerLoginPacketListenerImpl.LOGGER.info("UUID of player {} is {}", gameprofile.getName(), gameprofile.getId());
ServerLoginPacketListenerImpl.this.startClientVerification(gameprofile);
} catch (Exception ex) {
@@ -248,7 +248,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
@@ -287,7 +287,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
if (!ServerLoginPacketListenerImpl.this.connection.isConnected()) {
return;
}
@ -28,7 +28,7 @@ index abfeaa9485b71d0b802c41bfd8e113d0bc9e9773..b41aa61f80cd4ab8ddd19da397244392
// CraftBukkit end
ServerLoginPacketListenerImpl.LOGGER.info("UUID of player {} is {}", gameprofile.getName(), gameprofile.getId());
ServerLoginPacketListenerImpl.this.startClientVerification(gameprofile);
@@ -287,14 +287,23 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
@@ -326,14 +326,23 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
}
// CraftBukkit start
@ -39,11 +39,11 @@ index abfeaa9485b71d0b802c41bfd8e113d0bc9e9773..b41aa61f80cd4ab8ddd19da397244392
java.util.UUID uniqueId = gameprofile.getId();
final org.bukkit.craftbukkit.CraftServer server = ServerLoginPacketListenerImpl.this.server.server;
- AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId);
- AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId, this.transferred);
+ // Paper start - Add more fields to AsyncPlayerPreLoginEvent
+ final InetAddress rawAddress = ((InetSocketAddress) this.connection.channel.remoteAddress()).getAddress();
+ com.destroystokyo.paper.profile.PlayerProfile profile = org.bukkit.Bukkit.createProfile(uniqueId, playerName);
+ AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, rawAddress, uniqueId, profile, this.connection.hostname);
+ AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, rawAddress, uniqueId, this.transferred, profile, this.connection.hostname);
server.getPluginManager().callEvent(asyncEvent);
+ profile = asyncEvent.getPlayerProfile();
+ profile.complete();
@ -54,7 +54,7 @@ index abfeaa9485b71d0b802c41bfd8e113d0bc9e9773..b41aa61f80cd4ab8ddd19da397244392
if (PlayerPreLoginEvent.getHandlerList().getRegisteredListeners().length != 0) {
final PlayerPreLoginEvent event = new PlayerPreLoginEvent(playerName, address, uniqueId);
@@ -312,14 +321,13 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
@@ -351,14 +360,13 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
ServerLoginPacketListenerImpl.this.server.processQueue.add(waitable);
if (waitable.get() != PlayerPreLoginEvent.Result.ALLOWED) {
this.disconnect(io.papermc.paper.adventure.PaperAdventure.asVanilla(event.kickMessage())); // Paper - Adventure

View File

@ -9,10 +9,10 @@ This can be useful for changing name or skins after a player has logged in.
public-f net.minecraft.world.entity.player.Player gameProfile
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 8eec3d8b1693d9f9d7d882275e6f00cef4d3520f..6c3d907d2c4b512a4342646f9d01519cca10d87b 100644
index 56134a163da44b0bb50121831e91e9f93e86417d..82cc40becd6c08364d9547aea0d7ffa5c407c42e 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1467,7 +1467,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1465,7 +1465,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.internalTeleport(dest.getX(), dest.getY(), dest.getZ(), dest.getYaw(), dest.getPitch(), Collections.emptySet());
}
@ -22,16 +22,16 @@ index 8eec3d8b1693d9f9d7d882275e6f00cef4d3520f..6c3d907d2c4b512a4342646f9d01519c
if (Float.isNaN(f)) {
f = 0;
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index b41aa61f80cd4ab8ddd19da397244392f9efde78..e745061f3e6a4541f44ba119106915cdb7023fc6 100644
index 8f72dafebcca68263eeef4076c3251819815c77d..96a7d52f982d2dcc5fa391007e5861ca62ec0841 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -295,11 +295,11 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
@@ -334,11 +334,11 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
// Paper start - Add more fields to AsyncPlayerPreLoginEvent
final InetAddress rawAddress = ((InetSocketAddress) this.connection.channel.remoteAddress()).getAddress();
- com.destroystokyo.paper.profile.PlayerProfile profile = org.bukkit.Bukkit.createProfile(uniqueId, playerName);
+ com.destroystokyo.paper.profile.PlayerProfile profile = com.destroystokyo.paper.profile.CraftPlayerProfile.asBukkitMirror(gameprofile); // Paper - setPlayerProfileAPI
AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, rawAddress, uniqueId, profile, this.connection.hostname);
AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, rawAddress, uniqueId, this.transferred, profile, this.connection.hostname);
server.getPluginManager().callEvent(asyncEvent);
profile = asyncEvent.getPlayerProfile();
- profile.complete();
@ -40,10 +40,10 @@ index b41aa61f80cd4ab8ddd19da397244392f9efde78..e745061f3e6a4541f44ba119106915cd
playerName = gameprofile.getName();
uniqueId = gameprofile.getId();
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index d2002567e10883bcf61a2036cea1b598aacc00da..31f9d5b32a562cd33d8989810026d996b3ab69aa 100644
index 96c9b8e3f26054ca0e285dc188cd79d121e29afd..53f4a1d00aba1d522912d8a2366961c0c842d4db 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -863,10 +863,16 @@ public abstract class PlayerList {
@@ -862,10 +862,16 @@ public abstract class PlayerList {
}
public void sendPlayerPermissionLevel(ServerPlayer player) {
@ -62,7 +62,7 @@ index d2002567e10883bcf61a2036cea1b598aacc00da..31f9d5b32a562cd33d8989810026d996
public void tick() {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java
index 954825dcd011716dcd859aa285a8e3cdb6ff5464..34925d6448e0ef1d5bb4b24359f732b67aaa4230 100644
index 818df09e9245b5d89b4180b1eaa51470b7539341..461656e1cb095243bfe7a9ee2906e5b00574ae78 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java
@@ -82,8 +82,8 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
@ -77,10 +77,10 @@ index 954825dcd011716dcd859aa285a8e3cdb6ff5464..34925d6448e0ef1d5bb4b24359f732b6
public Server getServer() {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index fbb1c342e51d3d64a837efe998a33632ad254b23..d8668c60543dc048ef9084647877807fcfc168f9 100644
index 5cb5ec6cdbc71be2c3ef6b87b76b5f6007b65ea2..ccc18ed8dec330743c01c4123281a0531509a902 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -236,11 +236,6 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -246,11 +246,6 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return this.server.getPlayer(this.getUniqueId()) != null;
}
@ -91,8 +91,8 @@ index fbb1c342e51d3d64a837efe998a33632ad254b23..d8668c60543dc048ef9084647877807f
-
@Override
public InetSocketAddress getAddress() {
if (this.getHandle().connection == null) return null;
@@ -1698,8 +1693,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
if (this.getHandle().connection.protocol() == null) return null;
@@ -1774,8 +1769,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
private void untrackAndHideEntity(org.bukkit.entity.Entity entity) {
// Remove this entity from the hidden player's EntityTrackerEntry
@ -109,7 +109,7 @@ index fbb1c342e51d3d64a837efe998a33632ad254b23..d8668c60543dc048ef9084647877807f
ChunkMap.TrackedEntity entry = tracker.entityMap.get(other.getId());
if (entry != null) {
entry.removePlayer(this.getHandle());
@@ -1712,8 +1714,6 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1788,8 +1790,6 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
this.getHandle().connection.send(new ClientboundPlayerInfoRemovePacket(List.of(otherPlayer.getUUID())));
}
}
@ -118,7 +118,7 @@ index fbb1c342e51d3d64a837efe998a33632ad254b23..d8668c60543dc048ef9084647877807f
}
void resetAndHideEntity(org.bukkit.entity.Entity entity) {
@@ -1778,12 +1778,25 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1854,12 +1854,25 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
private void trackAndShowEntity(org.bukkit.entity.Entity entity) {
@ -144,7 +144,7 @@ index fbb1c342e51d3d64a837efe998a33632ad254b23..d8668c60543dc048ef9084647877807f
}
ChunkMap.TrackedEntity entry = tracker.entityMap.get(other.getId());
@@ -1793,6 +1806,39 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1869,6 +1882,39 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
this.server.getPluginManager().callEvent(new PlayerShowEntityEvent(this, entity));
}
@ -184,7 +184,7 @@ index fbb1c342e51d3d64a837efe998a33632ad254b23..d8668c60543dc048ef9084647877807f
void resetAndShowEntity(org.bukkit.entity.Entity entity) {
// SPIGOT-7312: Can't show/hide self
@@ -1804,6 +1850,34 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1880,6 +1926,34 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
this.trackAndShowEntity(entity);
}
}
@ -220,12 +220,12 @@ index fbb1c342e51d3d64a837efe998a33632ad254b23..d8668c60543dc048ef9084647877807f
public void onEntityRemove(Entity entity) {
this.invertedVisibilityEntities.remove(entity.getUUID());
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
index 457860fa9babe542347608a3fc11ad5d75e5d135..6a661bbae8bc35a4c3b4bb7e86dd77a7575fdd97 100644
index 432ad62a82573901673d654b06e87b62369bea7a..6b4d696dc9f718fecfdba9b1091630d7ac6bd18a 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
@@ -277,6 +277,13 @@ public class Commodore {
return;
@@ -363,6 +363,13 @@ public class Commodore {
}
// Paper end - Rewrite plugins
+ // Paper start - Rewrite plugins
+ if ((owner.equals("org/bukkit/OfflinePlayer") || owner.equals("org/bukkit/entity/Player")) && name.equals("getPlayerProfile") && desc.equals("()Lorg/bukkit/profile/PlayerProfile;")) {

View File

@ -9,10 +9,10 @@ In Offline Mode, will return an Offline UUID
This is a more performant way to obtain a UUID for a name than loading an OfflinePlayer
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 28a8b687958a1c1396a5a8b13a04fb371ac9f3ab..d25ee3ca530289c0deda45b01196ece98788e628 100644
index bf61a439d81b481c6d27a3b399a3a08e96d3909c..9d65bce391b00b78efed1e40a01fa2865c05e6fd 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1838,6 +1838,25 @@ public final class CraftServer implements Server {
@@ -1850,6 +1850,25 @@ public final class CraftServer implements Server {
return recipients.size();
}

View File

@ -9,10 +9,10 @@ e.g. servers which allow and support the usage of mod packs.
provide an optional flag to disable this check, at your own risk.
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index d8668c60543dc048ef9084647877807fcfc168f9..385b6df4695d924e0750e08a29f7741317ca5972 100644
index ccc18ed8dec330743c01c4123281a0531509a902..b85c23fe5bfff51c1b37b5aecda4a29f14f25f80 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -196,6 +196,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -206,6 +206,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
private CraftWorldBorder clientWorldBorder = null;
private BorderChangeListener clientWorldBorderListener = this.createWorldBorderListener();
public org.bukkit.event.player.PlayerResourcePackStatusEvent.Status resourcePackStatus; // Paper - more resource pack API
@ -20,7 +20,7 @@ index d8668c60543dc048ef9084647877807fcfc168f9..385b6df4695d924e0750e08a29f77413
public CraftPlayer(CraftServer server, ServerPlayer entity) {
super(server, entity);
@@ -2188,7 +2189,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2254,7 +2255,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
public void addChannel(String channel) {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add openSign method to HumanEntity
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
index 2cb3c0b96b769c395f7fecbeebba0ff2a33b692d..5d69945e6428c04a4b89c7469de905ed05d9dfc0 100644
index 47350439f579ef2ab408bda0fc4b8976df3a5b92..dd3377a4f69e5ac10905e52d0eecc2427e72d856 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
@@ -623,6 +623,12 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
@@ -621,6 +621,12 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
}
}

View File

@ -6,19 +6,19 @@ Subject: [PATCH] Configurable sprint interruption on attack
If the sprint interruption is disabled players continue sprinting when they attack entities.
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 654654b1d9c10934af333dfe69c27a5d3997eda4..b97a3c78ef2fc2865817ca2166f87a8d6e19055c 100644
index fecb622cb33fd75b87b055fb40f127cda6a22a7d..0fa9cb53706482f5ea385ce4355273b67911b23a 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -1283,7 +1283,11 @@ public abstract class Player extends LivingEntity {
}
@@ -1299,8 +1299,12 @@ public abstract class Player extends LivingEntity {
}
this.setDeltaMovement(this.getDeltaMovement().multiply(0.6D, 1.0D, 0.6D));
- this.setSprinting(false);
this.setDeltaMovement(this.getDeltaMovement().multiply(0.6D, 1.0D, 0.6D));
+ // Paper start - Configurable sprint interruption on attack
+ if (!this.level().paperConfig().misc.disableSprintInterruptionOnAttack) {
+ this.setSprinting(false);
+ }
this.setSprinting(false);
}
+ // Paper end - Configurable sprint interruption on attack
}
+ }
if (flag3) {
if (flag3) {
float f4 = 1.0F + EnchantmentHelper.getSweepingDamageRatio(this) * f;

View File

@ -8,10 +8,10 @@ Fires an event anytime an enderman intends to teleport away from the player
You may cancel this, enabling ranged attacks to damage the enderman for example.
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 4ad0a65cce22d92972a15c18ac6e213012b90c0a..aa7762037c3bcbbb3e51325b2ba91d5ad6db0ab0 100644
index 7b6109348bbc44727ef7d0ef8fc08561f0dc328d..3e50f3dc5b9a45ee8f368f91fbd67b599d4435fb 100644
--- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
+++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
@@ -124,6 +124,12 @@ public class EnderMan extends Monster implements NeutralMob {
@@ -119,6 +119,12 @@ public class EnderMan extends Monster implements NeutralMob {
this.setTarget(target, EntityTargetEvent.TargetReason.UNKNOWN, true);
}
@ -24,7 +24,7 @@ index 4ad0a65cce22d92972a15c18ac6e213012b90c0a..aa7762037c3bcbbb3e51325b2ba91d5a
@Override
public boolean setTarget(LivingEntity entityliving, EntityTargetEvent.TargetReason reason, boolean fireEvent) {
if (!super.setTarget(entityliving, reason, fireEvent)) {
@@ -283,7 +289,7 @@ public class EnderMan extends Monster implements NeutralMob {
@@ -268,7 +274,7 @@ public class EnderMan extends Monster implements NeutralMob {
if (this.level().isDay() && this.tickCount >= this.targetChangeTime + 600) {
float f = this.getLightLevelDependentMagicValue();
@ -33,7 +33,7 @@ index 4ad0a65cce22d92972a15c18ac6e213012b90c0a..aa7762037c3bcbbb3e51325b2ba91d5a
this.setTarget((LivingEntity) null);
this.teleport();
}
@@ -409,11 +415,13 @@ public class EnderMan extends Monster implements NeutralMob {
@@ -394,11 +400,13 @@ public class EnderMan extends Monster implements NeutralMob {
} else {
flag1 = flag && this.hurtWithCleanWater(source, (ThrownPotion) source.getDirectEntity(), amount);
@ -47,7 +47,7 @@ index 4ad0a65cce22d92972a15c18ac6e213012b90c0a..aa7762037c3bcbbb3e51325b2ba91d5a
return flag1;
}
@@ -640,7 +648,7 @@ public class EnderMan extends Monster implements NeutralMob {
@@ -623,7 +631,7 @@ public class EnderMan extends Monster implements NeutralMob {
} else {
if (this.target != null && !this.enderman.isPassenger()) {
if (this.enderman.isLookingAtMe((Player) this.target)) {

View File

@ -16,10 +16,10 @@ public net.minecraft.world.entity.projectile.Projectile cachedOwner
public net.minecraft.world.entity.projectile.Projectile ownerUUID
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 76246fdacf70309918ce413f494bdb4d8683241d..d2266bc75f2c1b0b02405eea0711a7b53d1a9e7a 100644
index 66b21ba4b3206fb52570eb67faeb1161bd043545..c3b19ba06e8bd31d2819472bdac936502dae3488 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2114,6 +2114,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -2143,6 +2143,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
public void onTickingEnd(Entity entity) {
ServerLevel.this.entityTickList.remove(entity);
@ -33,10 +33,10 @@ index 76246fdacf70309918ce413f494bdb4d8683241d..d2266bc75f2c1b0b02405eea0711a7b5
public void onTrackingStart(Entity entity) {
diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
index fbbb1fa3d5f4ace67fee96aa235cec3b39deb7b1..e432855ce79f69c0e91fa31e8f6c59a465b0d09e 100644
index 1e7224d070fc48d93ce0c4e832d94c6a50019249..5e9ef75a14a91f01a1ae5b3fb591d7258740a75d 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
@@ -101,6 +101,7 @@ public abstract class Projectile extends Entity implements TraceableEntity {
@@ -102,6 +102,7 @@ public abstract class Projectile extends Entity implements TraceableEntity {
if (nbt.hasUUID("Owner")) {
this.ownerUUID = nbt.getUUID("Owner");
this.cachedOwner = null;

View File

@ -10,10 +10,10 @@ Adds an option to control the force mode of the particle.
This adds a new Builder API which is much friendlier to use.
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index d2266bc75f2c1b0b02405eea0711a7b53d1a9e7a..256b9c6cbf52c252f8174d0aa74e1270fb092ae9 100644
index c3b19ba06e8bd31d2819472bdac936502dae3488..c25b6637355dbf856ca5b578edf51e6ebbdde7f8 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1503,12 +1503,17 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1510,12 +1510,17 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
public <T extends ParticleOptions> int sendParticles(ServerPlayer sender, T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6, boolean force) {
@ -34,20 +34,19 @@ index d2266bc75f2c1b0b02405eea0711a7b53d1a9e7a..256b9c6cbf52c252f8174d0aa74e1270
if (this.sendParticles(entityplayer, force, d0, d1, d2, packetplayoutworldparticles)) { // CraftBukkit
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index aac9eee069b16ab70b7553c6c324149011c94f8e..1480fbf52f9eb11892886b99a76a971cabb72c92 100644
index b42d482defda5a91f4e625308d5fec8c8369e5fb..c542c932f1f02df69678048e5a8e7c07b68f357d 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1952,13 +1952,20 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -1957,12 +1957,19 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override
public <T> void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data, boolean force) {
+ // Paper start - Particle API
+ spawnParticle(particle, null, null, x, y, z, count, offsetX, offsetY, offsetZ, extra, data, force);
+ this.spawnParticle(particle, null, null, x, y, z, count, offsetX, offsetY, offsetZ, extra, data, force);
+ }
+ @Override
+ public <T> void spawnParticle(Particle particle, List<Player> receivers, Player sender, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data, boolean force) {
+ // Paper end - Particle API
particle = CraftParticle.convertLegacy(particle);
data = CraftParticle.convertLegacy(data);
if (data != null) {
Preconditions.checkArgument(particle.getDataType().isInstance(data), "data (%s) should be %s", data.getClass(), particle.getDataType());

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Fix exploit that allowed colored signs to be created
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 6003731da7be596baf1954df2e13ae54e111cd91..a822b190aeee1d644c3509bb75106fa4dfdd963f 100644
index e535fb3b5194b8412c0c26c0799340916c7542eb..2e5fc484d26b5468dfb8f49d62f4518e83169618 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
@@ -201,9 +201,9 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
@@ -202,9 +202,9 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
Style chatmodifier = signtext.getMessage(i, entityhuman.isTextFilteringEnabled()).getStyle();
if (entityhuman.isTextFilteringEnabled()) {

View File

@ -8,10 +8,10 @@ Allow control over whether or not an enderman aggros a player.
This allows you to override/extend the pumpkin/stare logic.
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 aa7762037c3bcbbb3e51325b2ba91d5ad6db0ab0..13ba764d51f941c2b0d1d2af88ffd0c1fc3982c0 100644
index 3e50f3dc5b9a45ee8f368f91fbd67b599d4435fb..4d659fc8355542e6b9cadc6e1e86002e136702d2 100644
--- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
+++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
@@ -236,7 +236,15 @@ public class EnderMan extends Monster implements NeutralMob {
@@ -231,7 +231,15 @@ public class EnderMan extends Monster implements NeutralMob {
this.readPersistentAngerSaveData(this.level(), nbt);
}

View File

@ -0,0 +1,24 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 16 May 2018 20:35:16 -0400
Subject: [PATCH] WitchConsumePotionEvent
Fires when a witch consumes the potion in their hand
diff --git a/src/main/java/net/minecraft/world/entity/monster/Witch.java b/src/main/java/net/minecraft/world/entity/monster/Witch.java
index a64727fa7159f3e95f4eb44f02cb836f169b9b92..3e070a61a3099601e57d70ec663c4c6fb291c024 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Witch.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Witch.java
@@ -122,6 +122,12 @@ public class Witch extends Raider implements RangedAttackMob {
this.setItemSlot(EquipmentSlot.MAINHAND, ItemStack.EMPTY);
PotionContents potioncontents = (PotionContents) itemstack.get(DataComponents.POTION_CONTENTS);
+ // Paper start - WitchConsumePotionEvent
+ if (itemstack.is(Items.POTION)) {
+ com.destroystokyo.paper.event.entity.WitchConsumePotionEvent event = new com.destroystokyo.paper.event.entity.WitchConsumePotionEvent((org.bukkit.entity.Witch) this.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack));
+ potioncontents = event.callEvent() ? org.bukkit.craftbukkit.inventory.CraftItemStack.unwrap(event.getPotion()).get(DataComponents.POTION_CONTENTS) : null;
+ }
+ // Paper end - WitchConsumePotionEvent
if (itemstack.is(Items.POTION) && potioncontents != null) {
potioncontents.forEachEffect((effect) -> this.addEffect(effect, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK)); // CraftBukkit

View File

@ -6,15 +6,15 @@ Subject: [PATCH] WitchThrowPotionEvent
Fired when a witch throws a potion at a player
diff --git a/src/main/java/net/minecraft/world/entity/monster/Witch.java b/src/main/java/net/minecraft/world/entity/monster/Witch.java
index d2cff117f178a370a7056865246276e795b6bace..96a87db9f8976d3f1ff09beb9598db31fff72d5b 100644
index 3e070a61a3099601e57d70ec663c4c6fb291c024..c7470a5b95ee25078296c0443630c88a371b8a6f 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Witch.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Witch.java
@@ -239,9 +239,16 @@ public class Witch extends Raider implements RangedAttackMob {
potionregistry = Potions.WEAKNESS;
@@ -229,9 +229,16 @@ public class Witch extends Raider implements RangedAttackMob {
holder = Potions.WEAKNESS;
}
+ // Paper start - WitchThrowPotionEvent
+ ItemStack potion = PotionUtils.setPotion(new ItemStack(Items.SPLASH_POTION), potionregistry);
+ ItemStack potion = PotionContents.createItemStack(Items.SPLASH_POTION, holder);
+ com.destroystokyo.paper.event.entity.WitchThrowPotionEvent event = new com.destroystokyo.paper.event.entity.WitchThrowPotionEvent((org.bukkit.entity.Witch) this.getBukkitEntity(), (org.bukkit.entity.LivingEntity) target.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(potion));
+ if (!event.callEvent()) {
+ return;
@ -22,7 +22,7 @@ index d2cff117f178a370a7056865246276e795b6bace..96a87db9f8976d3f1ff09beb9598db31
+ potion = org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getPotion());
ThrownPotion entitypotion = new ThrownPotion(this.level(), this);
-
- entitypotion.setItem(PotionUtils.setPotion(new ItemStack(Items.SPLASH_POTION), potionregistry));
- entitypotion.setItem(PotionContents.createItemStack(Items.SPLASH_POTION, holder));
+ entitypotion.setItem(potion);
+ // Paper end - WitchThrowPotionEvent
entitypotion.setXRot(entitypotion.getXRot() - -20.0F);

View File

@ -5,16 +5,16 @@ Subject: [PATCH] WitchReadyPotionEvent
diff --git a/src/main/java/net/minecraft/world/entity/monster/Witch.java b/src/main/java/net/minecraft/world/entity/monster/Witch.java
index 96a87db9f8976d3f1ff09beb9598db31fff72d5b..25a1edf64602a13c07779e58b167a8471019588e 100644
index c7470a5b95ee25078296c0443630c88a371b8a6f..d286239d02b81624124c4e32ff4413bbac902d54 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Witch.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Witch.java
@@ -160,7 +160,11 @@ public class Witch extends Raider implements RangedAttackMob {
@@ -150,7 +150,11 @@ public class Witch extends Raider implements RangedAttackMob {
}
if (potionregistry != null) {
- this.setItemSlot(EquipmentSlot.MAINHAND, PotionUtils.setPotion(new ItemStack(Items.POTION), potionregistry));
if (holder != null) {
- this.setItemSlot(EquipmentSlot.MAINHAND, PotionContents.createItemStack(Items.POTION, holder));
+ // Paper start
+ ItemStack potion = PotionUtils.setPotion(new ItemStack(Items.POTION), potionregistry);
+ ItemStack potion = PotionContents.createItemStack(Items.POTION, holder);
+ potion = org.bukkit.craftbukkit.event.CraftEventFactory.handleWitchReadyPotionEvent(this, potion);
+ this.setItemSlot(EquipmentSlot.MAINHAND, potion);
+ // Paper end
@ -22,10 +22,10 @@ index 96a87db9f8976d3f1ff09beb9598db31fff72d5b..25a1edf64602a13c07779e58b167a847
this.setUsingItem(true);
if (!this.isSilent()) {
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 2bcac771a37b3e5d3b7173e24dad7823fb29757c..203b6539c55b74484cff476b6472f44ed56112c9 100644
index f7c848aa883c1ad408e7e16e605f375ab75f8cfd..f3fd59843e7517eb38bfa06b58445728d2a80001 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1902,4 +1902,14 @@ public class CraftEventFactory {
@@ -1897,4 +1897,14 @@ public class CraftEventFactory {
).callEvent();
}
// Paper end - PlayerUseUnknownEntityEvent

View File

@ -6,11 +6,11 @@ Subject: [PATCH] ItemStack#getMaxItemUseDuration
Allows you to determine how long it takes to use a usable/consumable item
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
index b59e84bbed37b002a34fe81efdce6f025617fc84..78f2159285e676b877f85df604889ddcf19e8923 100644
index 09c363f483cb12be01afd9a274c541f3bdeb992c..a58e865a047550cc4508d0515cc6f2fc639f9b3d 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
@@ -188,6 +188,13 @@ public final class CraftItemStack extends ItemStack {
return (this.handle == null) ? Material.AIR.getMaxStackSize() : this.handle.getItem().getMaxStackSize();
@@ -187,6 +187,13 @@ public final class CraftItemStack extends ItemStack {
return (this.handle == null) ? Material.AIR.getMaxStackSize() : this.handle.getMaxStackSize();
}
+ // Paper start

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add EntityTeleportEndGatewayEvent
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
index 1606c8c0dd5e27b42d0fd9da0db8a02e50efc5f9..a57743b21b6075ba01def0a41fecbf90b2df7f85 100644
index 9690416c2ffa7d1b7607d21ae0a990dcbcbcddae..f8053b42fbf144d427cc4ed44b3b735358c58a20 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
@@ -225,8 +225,14 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity {
@@ -219,8 +219,14 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity {
}

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Unset Ignited flag on cancel of Explosion Event
Otherwise the creeper infinite explodes
diff --git a/src/main/java/net/minecraft/world/entity/monster/Creeper.java b/src/main/java/net/minecraft/world/entity/monster/Creeper.java
index 79614aaa4832c969443d6393e7d5bb8a622a5d98..83b407e865e2ff4debb89c350727809601be1fa6 100644
index 01938fc75158c13c4b040fa623934ec841cbf719..dd57da9dc663484c4266d9973aee927899292749 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Creeper.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Creeper.java
@@ -279,6 +279,7 @@ public class Creeper extends Monster implements PowerableMob {
@@ -277,6 +277,7 @@ public class Creeper extends Monster implements PowerableMob {
// CraftBukkit start
} else {
this.swell = 0;

View File

@ -21,7 +21,7 @@ check is essentially the same as this.getHandle() == other.getHandle()
However, replaced it too to make it clearer of intent.
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 4808c62d3d951b201061659c91d1001e4b9b49ef..6fddbcec673564ac531a852f631f6acc460accbd 100644
index 88e0ac38214c537ea8be5d23a17ac5a58acd3682..621970006f21d219784dc58d7aa8d6062c4620f1 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -500,14 +500,15 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {

View File

@ -36,10 +36,10 @@ This change will result in some major changes to fishing formulas.
I would love to see this change in Vanilla, so Mojang please pull :)
diff --git a/src/main/java/net/minecraft/world/level/storage/loot/entries/LootPoolSingletonContainer.java b/src/main/java/net/minecraft/world/level/storage/loot/entries/LootPoolSingletonContainer.java
index f73cfe6a1fd96ebc0e24d3488f00cd3403cb3454..4f73aae0342ddcefba19e14d5400c960c2acf70c 100644
index 8e4f33319be13c9d971af40cad2d3f75b1bfff35..8124ea41ac887dbc8438a565ed411821cf4a893c 100644
--- a/src/main/java/net/minecraft/world/level/storage/loot/entries/LootPoolSingletonContainer.java
+++ b/src/main/java/net/minecraft/world/level/storage/loot/entries/LootPoolSingletonContainer.java
@@ -127,9 +127,35 @@ public abstract class LootPoolSingletonContainer extends LootPoolEntryContainer
@@ -126,9 +126,35 @@ public abstract class LootPoolSingletonContainer extends LootPoolEntryContainer
protected abstract class EntryBase implements LootPoolEntry {
@Override
public int getWeight(float luck) {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Print Error details when failing to save player data
diff --git a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
index 2a167a0131d866b4368fc30849c17acdf0ab9af0..49d39980054bce470ddaceeb6ab7fab83bf8dc54 100644
index e11c8523e633d2a8e3cea7ecd54978b2958b9684..1d287dd7379e56f7fd4b425880b850cd843f5789 100644
--- a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
+++ b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
@@ -47,7 +47,7 @@ public class PlayerDataStorage {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Make shield blocking delay configurable
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 96805bc64fd3593373ba9eecf29bd13d33d9e053..e3dfef027fb7f6aedd3e3411af6457671b5507a7 100644
index 45eef550358b0f3e6780d98c43c5856ff44ae313..dce35cc6f81440cd7c6af330d5dc5416e6faf179 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3828,12 +3828,24 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3911,12 +3911,24 @@ public abstract class LivingEntity extends Entity implements Attackable {
if (this.isUsingItem() && !this.useItem.isEmpty()) {
Item item = this.useItem.getItem();
@ -35,10 +35,10 @@ index 96805bc64fd3593373ba9eecf29bd13d33d9e053..e3dfef027fb7f6aedd3e3411af645767
return this.isShiftKeyDown();
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 19f8cfe1146374169208f26632763a882291431c..1c6abeff5b541cdea914ac956f2ab1d2e1c5769f 100644
index d77c31a8b41df69d11c1ce4b77975e9a38e317b3..0e3b9c2d7ae5091f5c485ec679852476d816f083 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -855,5 +855,15 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@@ -840,5 +840,15 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
public void setArrowsStuck(final int arrows) {
this.getHandle().setArrowCount(arrows);
}

View File

@ -9,7 +9,7 @@ Adds missing call to Illagers and also adds Arrow ItemStack to skeletons
public net.minecraft.world.entity.projectile.AbstractArrow getPickupItem()Lnet.minecraft.world.item.ItemStack;
diff --git a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
index 8a668d36bafa5ba172b0ce510b46096ec2fd116a..dadb419a04b343d6ba59353c6caa1a50aa07b67f 100644
index a400e905201aea94e1d601737f352ef5f8edc927..a19a51a40d69ad71b85b2e7e8b4cfab6d8343196 100644
--- a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
+++ b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
@@ -201,7 +201,7 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
@ -22,10 +22,10 @@ index 8a668d36bafa5ba172b0ce510b46096ec2fd116a..dadb419a04b343d6ba59353c6caa1a50
event.getProjectile().remove();
return;
diff --git a/src/main/java/net/minecraft/world/entity/monster/Illusioner.java b/src/main/java/net/minecraft/world/entity/monster/Illusioner.java
index 421ed4daed9a61b9e9395538ff36606b196ca1f1..fb84b35e34063075e69e00e430bc00e7c3b9d62c 100644
index 1be35d24c7ed4160e0c45435fce2dee0a2b99ed1..a7964208c952cb4e34916ae6523850fc3921b07e 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Illusioner.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Illusioner.java
@@ -196,8 +196,18 @@ public class Illusioner extends SpellcasterIllager implements RangedAttackMob {
@@ -183,8 +183,18 @@ public class Illusioner extends SpellcasterIllager implements RangedAttackMob {
double d3 = Math.sqrt(d0 * d0 + d2 * d2);
entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.level().getDifficulty().getId() * 4));

View File

@ -7,10 +7,10 @@ Called when a player is firing a bow and the server is choosing an arrow to use.
Plugins can skip selection of certain arrows and control which is used.
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 b97a3c78ef2fc2865817ca2166f87a8d6e19055c..0bff92eeade590852b9b37105a18df35f587559b 100644
index 0fa9cb53706482f5ea385ce4355273b67911b23a..705a756522473681516d60946ddd917647650bd4 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -2176,18 +2176,29 @@ public abstract class Player extends LivingEntity {
@@ -2219,18 +2219,29 @@ public abstract class Player extends LivingEntity {
return ImmutableList.of(Pose.STANDING, Pose.CROUCHING, Pose.SWIMMING);
}

View File

@ -9,10 +9,10 @@ Co-authored-by: aerulion <aerulion@gmail.com>
This event is called when an entity receives knockback by another entity.
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 0cc82ffdcebbdd92fa953e7c52a20911f46a503c..165cc45e2ae99e606533e5e5294e431ed5e3a2dd 100644
index e612921a7fb68dd74d8fd4084a8beccc299ff6ea..49b100e2cf9868c4f06aae0bf538fcd4a2ae0ba9 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1868,9 +1868,23 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -1892,9 +1892,23 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
}
@ -39,10 +39,10 @@ index 0cc82ffdcebbdd92fa953e7c52a20911f46a503c..165cc45e2ae99e606533e5e5294e431e
protected void markHurt() {
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index e3dfef027fb7f6aedd3e3411af6457671b5507a7..88af8a11dfc3b645c5a2b5fb629a73fc1e2b2f80 100644
index dce35cc6f81440cd7c6af330d5dc5416e6faf179..7d44d4563e39f279cf335f307a4d84d0758858ee 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1569,7 +1569,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1587,7 +1587,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
protected void blockedByShield(LivingEntity target) {
@ -51,7 +51,7 @@ index e3dfef027fb7f6aedd3e3411af6457671b5507a7..88af8a11dfc3b645c5a2b5fb629a73fc
}
private boolean checkTotemDeathProtection(DamageSource source) {
@@ -1832,7 +1832,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1850,7 +1850,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.knockback(strength, x, z, null, EntityKnockbackEvent.KnockbackCause.UNKNOWN);
}
@ -60,7 +60,7 @@ index e3dfef027fb7f6aedd3e3411af6457671b5507a7..88af8a11dfc3b645c5a2b5fb629a73fc
d0 *= 1.0D - this.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE);
if (true || d0 > 0.0D) { // CraftBukkit - Call event even when force is 0
//this.hasImpulse = true; // CraftBukkit - Move down
@@ -1844,8 +1844,22 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1862,8 +1862,22 @@ public abstract class LivingEntity extends Entity implements Attackable {
return;
}
@ -98,23 +98,23 @@ index 312398b7f1281144a0529a743d2a09376d575ff5..0c63779af7e1c790160fb2ab86bf4552
world.playSound(null, entity, this.getImpactSound.apply(entity), SoundSource.NEUTRAL, 1.0F, 1.0F);
} else if (this.hasRammedHornBreakingBlock(world, entity)) {
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/warden/SonicBoom.java b/src/main/java/net/minecraft/world/entity/ai/behavior/warden/SonicBoom.java
index c7ce058dda0dcb58197faea4f1799ebc580829c0..4f4c09cd7b75de38c0a3580386494e7e05f0acee 100644
index aa8909498c26f095060a1df364b9e20d964a6cc3..30502849f79ce0f472e4289043c7d8ec460d3f20 100644
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/warden/SonicBoom.java
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/warden/SonicBoom.java
@@ -81,7 +81,7 @@ public class SonicBoom extends Behavior<Warden> {
target.hurt(world.damageSources().sonicBoom(entity), 10.0F);
double d = 0.5 * (1.0 - target.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE));
double e = 2.5 * (1.0 - target.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE));
- target.push(vec33.x() * e, vec33.y() * d, vec33.z() * e);
+ target.push(vec33.x() * e, vec33.y() * d, vec33.z() * e, entity); // Paper - Add EntityKnockbackByEntityEvent and EntityPushedByEntityAttackEvent
@@ -83,7 +83,7 @@ public class SonicBoom extends Behavior<Warden> {
if (target.hurt(world.damageSources().sonicBoom(entity), 10.0F)) {
double d = 0.5 * (1.0 - target.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE));
double e = 2.5 * (1.0 - target.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE));
- target.push(vec33.x() * e, vec33.y() * d, vec33.z() * e);
+ target.push(vec33.x() * e, vec33.y() * d, vec33.z() * e, entity); // Paper - Add EntityKnockbackByEntityEvent and EntityPushedByEntityAttackEvent
}
});
}
}
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
index 9ab60fb1b7f9c8a342d9116e99f7f0a1e463a626..0d84f1fb53384a827d7418c322a32e3286f4081a 100644
index 963fdb4132001aa781eda45b75cb4df97d782ddc..3e2f83e2c695b024bdec2c5e11ab38596730ed4a 100644
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
@@ -459,7 +459,7 @@ public class EnderDragon extends Mob implements Enemy {
@@ -457,7 +457,7 @@ public class EnderDragon extends Mob implements Enemy {
double d3 = entity.getZ() - d1;
double d4 = Math.max(d2 * d2 + d3 * d3, 0.1D);
@ -124,10 +124,10 @@ index 9ab60fb1b7f9c8a342d9116e99f7f0a1e463a626..0d84f1fb53384a827d7418c322a32e32
entity.hurt(this.damageSources().mobAttack(this), 5.0F);
this.doEnchantDamageEffects(this, entity);
diff --git a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
index b3d05578f38af41f242f6634864ce1d2ecac14f8..aaa579ba04445aa350a439610d460a2415320cfc 100644
index 237e5927beb28bfc09d8c587782bf52799a6b604..47a62680279f15ac93eb521f7ec93c3b8d52c602 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
@@ -250,7 +250,7 @@ public abstract class HangingEntity extends Entity {
@@ -249,7 +249,7 @@ public abstract class HangingEntity extends Entity {
}
@Override
@ -137,10 +137,10 @@ index b3d05578f38af41f242f6634864ce1d2ecac14f8..aaa579ba04445aa350a439610d460a24
this.kill();
this.dropItem((Entity) null);
diff --git a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
index 78a3c87b74218a0d5792801c07e3a263c15fcd5b..f90878e0449f39f66ae3a7036a65c374b36b7dbc 100644
index f36746cd077bca3145b6168a60f05050d3ba14c7..d4f498789ae1d93533f058b0ce4981eed1ce8ea2 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
@@ -159,9 +159,9 @@ public class ItemFrame extends HangingEntity {
@@ -153,9 +153,9 @@ public class ItemFrame extends HangingEntity {
}
@Override
@ -153,10 +153,10 @@ index 78a3c87b74218a0d5792801c07e3a263c15fcd5b..f90878e0449f39f66ae3a7036a65c374
}
diff --git a/src/main/java/net/minecraft/world/entity/monster/Ravager.java b/src/main/java/net/minecraft/world/entity/monster/Ravager.java
index 041f1650b853138e4286fe83a08d79d276054ce7..aba20a4352d8983b01ab5d329187588f68d3e405 100644
index d02c7f6a2a2631a67fb6e078d6bc81971e712038..1264fb03d2dcab088fc4a7c2788c9f9df53cba5d 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Ravager.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Ravager.java
@@ -265,7 +265,7 @@ public class Ravager extends Raider {
@@ -257,7 +257,7 @@ public class Ravager extends Raider {
double d1 = entity.getZ() - this.getZ();
double d2 = Math.max(d0 * d0 + d1 * d1, 0.001D);
@ -179,23 +179,23 @@ index 38c27b4aa37e8b046e3eccdde3f527eb555da6f8..05dee42941a842bf4bba9480a2c04a14
}
}
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 0bff92eeade590852b9b37105a18df35f587559b..c934c7614281f77376858909c86d9a1a73c8e174 100644
index 705a756522473681516d60946ddd917647650bd4..4e1c032c7cdca81021c280a15db89e63a90ffe42 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -1279,7 +1279,7 @@ public abstract class Player extends LivingEntity {
if (target instanceof LivingEntity) {
((LivingEntity) target).knockback((double) ((float) i * 0.5F), (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)), this, EntityKnockbackEvent.KnockbackCause.ENTITY_ATTACK); // CraftBukkit
} else {
- target.push((double) (-Mth.sin(this.getYRot() * 0.017453292F) * (float) i * 0.5F), 0.1D, (double) (Mth.cos(this.getYRot() * 0.017453292F) * (float) i * 0.5F));
+ target.push((double) (-Mth.sin(this.getYRot() * 0.017453292F) * (float) i * 0.5F), 0.1D, (double) (Mth.cos(this.getYRot() * 0.017453292F) * (float) i * 0.5F), this); // Paper - Add EntityKnockbackByEntityEvent and EntityPushedByEntityAttackEvent
}
@@ -1295,7 +1295,7 @@ public abstract class Player extends LivingEntity {
if (target instanceof LivingEntity) {
((LivingEntity) target).knockback((double) ((float) i * 0.5F), (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)), this, EntityKnockbackEvent.KnockbackCause.ENTITY_ATTACK); // CraftBukkit
} else {
- target.push((double) (-Mth.sin(this.getYRot() * 0.017453292F) * (float) i * 0.5F), 0.1D, (double) (Mth.cos(this.getYRot() * 0.017453292F) * (float) i * 0.5F));
+ target.push((double) (-Mth.sin(this.getYRot() * 0.017453292F) * (float) i * 0.5F), 0.1D, (double) (Mth.cos(this.getYRot() * 0.017453292F) * (float) i * 0.5F), this); // Paper - Add EntityKnockbackByEntityEvent and EntityPushedByEntityAttackEvent
}
this.setDeltaMovement(this.getDeltaMovement().multiply(0.6D, 1.0D, 0.6D));
this.setDeltaMovement(this.getDeltaMovement().multiply(0.6D, 1.0D, 0.6D));
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
index c210ae3795b1bbaefbe84a6f62b9d3dd75d642a4..f1d7f202b99b8ae4c16d10956d68d74efae8445b 100644
index efcfbcb3dc352c9015cc9121dc8d98e8deed8bfd..464ba41fd284e29374dbc81c984cf9486e51393e 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
@@ -410,7 +410,7 @@ public abstract class AbstractArrow extends Projectile {
@@ -421,7 +421,7 @@ public abstract class AbstractArrow extends Projectile {
Vec3 vec3d = this.getDeltaMovement().multiply(1.0D, 0.0D, 1.0D).normalize().scale((double) this.knockback * 0.6D * d0);
if (vec3d.lengthSqr() > 0.0D) {
@ -205,10 +205,10 @@ index c210ae3795b1bbaefbe84a6f62b9d3dd75d642a4..f1d7f202b99b8ae4c16d10956d68d74e
}
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
index 00cfa26783ce0772c75166266ead258a415097bc..ade10a9fd93f4c0f04cd56ce5e1da06af4a05060 100644
index 111e6a7ab25e5513154984545c1737d2f7fd7d5f..146f5a33e1d538e46e4f7034a498d30f742a96f7 100644
--- a/src/main/java/net/minecraft/world/level/Explosion.java
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
@@ -298,7 +298,17 @@ public class Explosion {
@@ -299,7 +299,17 @@ public class Explosion {
Vec3 result = entity.getDeltaMovement().add(vec3d1);
org.bukkit.event.entity.EntityKnockbackEvent event = CraftEventFactory.callEntityKnockbackEvent((org.bukkit.craftbukkit.entity.CraftLivingEntity) entity.getBukkitEntity(), this.source, org.bukkit.event.entity.EntityKnockbackEvent.KnockbackCause.EXPLOSION, d13, vec3d1, result.x, result.y, result.z);

View File

@ -6,12 +6,12 @@ Subject: [PATCH] Expand Explosions API
Add Entity as a Source capability, and add more API choices, and on Location.
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 1480fbf52f9eb11892886b99a76a971cabb72c92..afdba543388f5f2e194add0e988f8515db24f76e 100644
index c542c932f1f02df69678048e5a8e7c07b68f357d..81c12ffb8c0996f081e951af0a68eb985a3b3d3d 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -755,6 +755,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {
public boolean createExplosion(double x, double y, double z, float power, boolean setFire, boolean breakBlocks, Entity source) {
return !this.world.explode(source == null ? null : ((CraftEntity) source).getHandle(), x, y, z, power, setFire, breakBlocks ? net.minecraft.world.level.Level.ExplosionInteraction.MOB : net.minecraft.world.level.Level.ExplosionInteraction.NONE).wasCanceled;
@@ -764,6 +764,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {
return !this.world.explode(source == null ? null : ((CraftEntity) source).getHandle(), x, y, z, power, setFire, explosionType).wasCanceled;
}
+ // Paper start
+ @Override

View File

@ -13,10 +13,10 @@ public net/minecraft/server/level/ServerPlayer completeUsingItem()V
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 1c6abeff5b541cdea914ac956f2ab1d2e1c5769f..0fe087cd6037b4dd694cc3c5c3eac8203ea6d519 100644
index 0e3b9c2d7ae5091f5c485ec679852476d816f083..bd5b535663935dc8f4a2a8f5c233c1c720400bd7 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -866,4 +866,53 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@@ -851,4 +851,53 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
getHandle().setShieldBlockingDelay(delay);
}
// Paper end

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add config to disable ender dragon legacy check
diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
index 141df4dba676fd0a714d5d48d385ee71084a7990..1c716cf65d77e54ba8f90c8cf736e20c64f5df2e 100644
index 1a56247191172622f2bde6d799bc44f70b9ce3ae..6f9c78b124a33212125e98905efc8a09a1891500 100644
--- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
+++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
@@ -106,6 +106,10 @@ public class EndDragonFight {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Implement World.getEntity(UUID) API
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index afdba543388f5f2e194add0e988f8515db24f76e..3d189fd1a1ac17f1dee4af631f8ed59387c977d4 100644
index 81c12ffb8c0996f081e951af0a68eb985a3b3d3d..59060c33f87db609510df111234b957b51badd87 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1091,6 +1091,15 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -1100,6 +1100,15 @@ public class CraftWorld extends CraftRegionAccessor implements World {
return list;
}

View File

@ -7,10 +7,10 @@ Allows you to determine why an inventory was closed, enabling plugin developers
to "confirm" things based on if it was player triggered close or not.
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 256b9c6cbf52c252f8174d0aa74e1270fb092ae9..113dce44ce086272fe7f20a2007efadee142ff85 100644
index c25b6637355dbf856ca5b578edf51e6ebbdde7f8..75213d34740e512763a8eb4411ef2b48c6204434 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1235,7 +1235,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1241,7 +1241,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
for (net.minecraft.world.level.block.entity.BlockEntity tileentity : chunk.getBlockEntities().values()) {
if (tileentity instanceof net.minecraft.world.Container) {
for (org.bukkit.entity.HumanEntity h : Lists.newArrayList(((net.minecraft.world.Container) tileentity).getViewers())) {
@ -19,7 +19,7 @@ index 256b9c6cbf52c252f8174d0aa74e1270fb092ae9..113dce44ce086272fe7f20a2007efade
}
}
}
@@ -2204,7 +2204,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -2228,7 +2228,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
// Spigot Start
if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message
for (org.bukkit.entity.HumanEntity h : Lists.newArrayList(((org.bukkit.inventory.InventoryHolder) entity.getBukkitEntity()).getInventory().getViewers())) {
@ -29,10 +29,10 @@ index 256b9c6cbf52c252f8174d0aa74e1270fb092ae9..113dce44ce086272fe7f20a2007efade
}
// Spigot End
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 98d229fb8f342775482f2ed199265bda3f043a96..0b039c43bd3bd46f31477fc75585038270242de2 100644
index 84e8ab9bdd4911412732e490ff8d10ba93d67f45..e073b48ed6cbefc503216615f54d09b309217d80 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -648,7 +648,7 @@ public class ServerPlayer extends Player {
@@ -688,7 +688,7 @@ public class ServerPlayer extends Player {
}
// Paper end - Configurable container update tick rate
if (!this.level().isClientSide && !this.containerMenu.stillValid(this)) {
@ -41,7 +41,7 @@ index 98d229fb8f342775482f2ed199265bda3f043a96..0b039c43bd3bd46f31477fc755850382
this.containerMenu = this.inventoryMenu;
}
@@ -841,7 +841,7 @@ public class ServerPlayer extends Player {
@@ -908,7 +908,7 @@ public class ServerPlayer extends Player {
// SPIGOT-943 - only call if they have an inventory open
if (this.containerMenu != this.inventoryMenu) {
@ -50,7 +50,7 @@ index 98d229fb8f342775482f2ed199265bda3f043a96..0b039c43bd3bd46f31477fc755850382
}
net.kyori.adventure.text.Component deathMessage = event.deathMessage() != null ? event.deathMessage() : net.kyori.adventure.text.Component.empty(); // Paper - Adventure
@@ -1465,7 +1465,7 @@ public class ServerPlayer extends Player {
@@ -1549,7 +1549,7 @@ public class ServerPlayer extends Player {
}
// CraftBukkit end
if (this.containerMenu != this.inventoryMenu) {
@ -59,7 +59,7 @@ index 98d229fb8f342775482f2ed199265bda3f043a96..0b039c43bd3bd46f31477fc755850382
}
// this.nextContainerCounter(); // CraftBukkit - moved up
@@ -1493,7 +1493,13 @@ public class ServerPlayer extends Player {
@@ -1577,7 +1577,13 @@ public class ServerPlayer extends Player {
@Override
public void closeContainer() {
@ -75,10 +75,10 @@ index 98d229fb8f342775482f2ed199265bda3f043a96..0b039c43bd3bd46f31477fc755850382
this.doCloseContainer();
}
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 6c3d907d2c4b512a4342646f9d01519cca10d87b..0217a40d7c22d31fa5f5046df6f0c64d8bb44442 100644
index 82cc40becd6c08364d9547aea0d7ffa5c407c42e..36f7a897bd1e0b73c6969cd6d46abe3496098189 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2530,10 +2530,15 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2612,10 +2612,15 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@Override
public void handleContainerClose(ServerboundContainerClosePacket packet) {
@ -96,10 +96,10 @@ index 6c3d907d2c4b512a4342646f9d01519cca10d87b..0217a40d7c22d31fa5f5046df6f0c64d
this.player.doCloseContainer();
}
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 31f9d5b32a562cd33d8989810026d996b3ab69aa..2dac6be5b320d7c12aa70fd09d7d218b8cd89287 100644
index 53f4a1d00aba1d522912d8a2366961c0c842d4db..43fc4e945c6a3cd94522d667055ab3dd80f961f6 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -519,7 +519,7 @@ public abstract class PlayerList {
@@ -517,7 +517,7 @@ public abstract class PlayerList {
// CraftBukkit start - Quitting must be before we do final save of data, in case plugins need to modify it
// See SPIGOT-5799, SPIGOT-6145
if (entityplayer.containerMenu != entityplayer.inventoryMenu) {
@ -109,10 +109,10 @@ index 31f9d5b32a562cd33d8989810026d996b3ab69aa..2dac6be5b320d7c12aa70fd09d7d218b
PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(entityplayer.getBukkitEntity(), 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() : io.papermc.paper.adventure.PaperAdventure.asAdventure(entityplayer.getDisplayName()))); // Paper - Adventure
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 c934c7614281f77376858909c86d9a1a73c8e174..83c7ba56900ce40f71d98062bf15110a76597dce 100644
index 4e1c032c7cdca81021c280a15db89e63a90ffe42..9cc9c6f7e211d9cf42a050f3a265d0bceaf7fd40 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -265,7 +265,7 @@ public abstract class Player extends LivingEntity {
@@ -277,7 +277,7 @@ public abstract class Player extends LivingEntity {
this.updateIsUnderwater();
super.tick();
if (!this.level().isClientSide && this.containerMenu != null && !this.containerMenu.stillValid(this)) {
@ -121,7 +121,7 @@ index c934c7614281f77376858909c86d9a1a73c8e174..83c7ba56900ce40f71d98062bf15110a
this.containerMenu = this.inventoryMenu;
}
@@ -497,6 +497,13 @@ public abstract class Player extends LivingEntity {
@@ -496,6 +496,13 @@ public abstract class Player extends LivingEntity {
}
@ -136,10 +136,10 @@ index c934c7614281f77376858909c86d9a1a73c8e174..83c7ba56900ce40f71d98062bf15110a
this.containerMenu = this.inventoryMenu;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
index 5d69945e6428c04a4b89c7469de905ed05d9dfc0..0886cb3367022c4ab7e4dbebafb70fc651bcb9aa 100644
index dd3377a4f69e5ac10905e52d0eecc2427e72d856..c79607a2f45b7a487a95cf98b9b0eb6b36501410 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
@@ -379,7 +379,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
@@ -377,7 +377,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
if (((ServerPlayer) this.getHandle()).connection == null) return;
if (this.getHandle().containerMenu != this.getHandle().inventoryMenu) {
// fire INVENTORY_CLOSE if one already open
@ -148,7 +148,7 @@ index 5d69945e6428c04a4b89c7469de905ed05d9dfc0..0886cb3367022c4ab7e4dbebafb70fc6
}
ServerPlayer player = (ServerPlayer) this.getHandle();
AbstractContainerMenu container;
@@ -449,8 +449,14 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
@@ -447,8 +447,14 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
@Override
public void closeInventory() {
@ -165,10 +165,10 @@ index 5d69945e6428c04a4b89c7469de905ed05d9dfc0..0886cb3367022c4ab7e4dbebafb70fc6
@Override
public boolean isBlocking() {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 385b6df4695d924e0750e08a29f7741317ca5972..d06d26133e00eb47b6ac950bb4efbf4ac6fe9da5 100644
index b85c23fe5bfff51c1b37b5aecda4a29f14f25f80..87e3eeb126284eab6d3391ae11d3bf2a8edfcb61 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1184,7 +1184,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1260,7 +1260,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
// Close any foreign inventory
if (this.getHandle().containerMenu != this.getHandle().inventoryMenu) {
@ -178,10 +178,10 @@ index 385b6df4695d924e0750e08a29f7741317ca5972..d06d26133e00eb47b6ac950bb4efbf4a
// Check if the fromWorld and toWorld are the same.
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 203b6539c55b74484cff476b6472f44ed56112c9..2456857cfcb3dd258781067cd7ddbe18d5f68309 100644
index f3fd59843e7517eb38bfa06b58445728d2a80001..63fec320871781d92f5ec552aac7fc08b2009f59 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1264,7 +1264,7 @@ public class CraftEventFactory {
@@ -1259,7 +1259,7 @@ public class CraftEventFactory {
public static AbstractContainerMenu callInventoryOpenEvent(ServerPlayer player, AbstractContainerMenu container, boolean cancelled) {
if (player.containerMenu != player.inventoryMenu) { // fire INVENTORY_CLOSE if one already open
@ -190,7 +190,7 @@ index 203b6539c55b74484cff476b6472f44ed56112c9..2456857cfcb3dd258781067cd7ddbe18
}
CraftServer server = player.level().getCraftServer();
@@ -1451,8 +1451,18 @@ public class CraftEventFactory {
@@ -1446,8 +1446,18 @@ public class CraftEventFactory {
return event;
}

View File

@ -16,10 +16,10 @@ Refresh the player inventory when PlayerInteractEntityEvent is
cancelled to avoid this problem.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 0217a40d7c22d31fa5f5046df6f0c64d8bb44442..de6fff0e915c66123d0691840b180cf60dc8a95a 100644
index 36f7a897bd1e0b73c6969cd6d46abe3496098189..b9fb2472405c19afb9888720a9abd86687e9bf12 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2421,6 +2421,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2489,6 +2489,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
}
if (event.isCancelled()) {

View File

@ -6,10 +6,10 @@ Subject: [PATCH] add more information to Entity.toString()
UUID, ticks lived, valid, dead
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 165cc45e2ae99e606533e5e5294e431ed5e3a2dd..36f0a43cc301840406eab260b162295fe760f8bb 100644
index 49b100e2cf9868c4f06aae0bf538fcd4a2ae0ba9..c2dd3767fbeb7215c9b2703054c9068252828355 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -3166,7 +3166,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -3182,7 +3182,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
public String toString() {
String s = this.level() == null ? "~NULL~" : this.level().toString();

View File

@ -37,7 +37,7 @@ index 02f407757a37c9dc8b3f4a899ac3b04719d8ceed..c5269c3117901b8521720d1b32689d7f
if (this.currentPath != null) {
while (!this.currentPath.isDone()) {
diff --git a/src/main/java/net/minecraft/world/entity/projectile/DragonFireball.java b/src/main/java/net/minecraft/world/entity/projectile/DragonFireball.java
index a425659d89165610fdb1afa3095bf4ac867646ae..58723ea75f7db9bf3889b99139669b14a284a3a1 100644
index d0fb77a9d1e6e207ce23c1df0f91f3409ab6da08..cecfae3bee405fb57df28e83b005e100e72b896b 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/DragonFireball.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/DragonFireball.java
@@ -62,8 +62,10 @@ public class DragonFireball extends AbstractHurtingProjectile {

View File

@ -5,28 +5,28 @@ Subject: [PATCH] PlayerElytraBoostEvent
diff --git a/src/main/java/net/minecraft/world/item/FireworkRocketItem.java b/src/main/java/net/minecraft/world/item/FireworkRocketItem.java
index 3749cfca8f007973d1a2206d8f2ba15283a550e1..a9f82e37c088c6f6ae2a049fcc7acea01b8802cd 100644
index 38b33eb92d21d0099285a304c6e064bbf56db4eb..16da60b7ecf2e0d4a49804dfa1ad47d4ae672571 100644
--- a/src/main/java/net/minecraft/world/item/FireworkRocketItem.java
+++ b/src/main/java/net/minecraft/world/item/FireworkRocketItem.java
@@ -68,12 +68,19 @@ public class FireworkRocketItem extends Item {
@@ -57,9 +57,19 @@ public class FireworkRocketItem extends Item implements ProjectileItem {
if (!world.isClientSide) {
FireworkRocketEntity fireworkRocketEntity = new FireworkRocketEntity(world, itemStack, user);
fireworkRocketEntity.spawningEntity = user.getUUID(); // Paper
- world.addFreshEntity(fireworkRocketEntity);
- if (!user.getAbilities().instabuild) {
- itemStack.consume(1, user);
- user.awardStat(Stats.ITEM_USED.get(this));
+ // Paper start - PlayerElytraBoostEvent
+ com.destroystokyo.paper.event.player.PlayerElytraBoostEvent event = new com.destroystokyo.paper.event.player.PlayerElytraBoostEvent((org.bukkit.entity.Player) user.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemStack), (org.bukkit.entity.Firework) fireworkRocketEntity.getBukkitEntity(), org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(hand));
+ if (event.callEvent() && world.addFreshEntity(fireworkRocketEntity)) {
+ user.awardStat(Stats.ITEM_USED.get(this));
+ if (event.shouldConsume() && !user.getAbilities().instabuild) {
itemStack.shrink(1);
+ if (event.shouldConsume() && !user.hasInfiniteMaterials()) {
+ itemStack.shrink(1);
+ } else ((net.minecraft.server.level.ServerPlayer) user).getBukkitEntity().updateInventory();
+ } else if (user instanceof net.minecraft.server.level.ServerPlayer) {
+ ((net.minecraft.server.level.ServerPlayer) user).getBukkitEntity().updateInventory();
+ // Paper end - PlayerElytraBoostEvent
}
- user.awardStat(Stats.ITEM_USED.get(this));
+ }
+
+ // user.awardStat(Stats.ITEM_USED.get(this)); // Paper - PlayerElytraBoostEvent; move up
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] PlayerLaunchProjectileEvent
diff --git a/src/main/java/net/minecraft/world/item/EggItem.java b/src/main/java/net/minecraft/world/item/EggItem.java
index 32b63407b943fb00d765dbf4e0eefb4b06f801b6..a3bd507793994e9cc87a956871a8afbb8ca9460d 100644
index be7d1bfb13cf0afb80ba98f3b56602bccebeab64..4ebd634cff286b10868e26eeb3ecf34abdcab22e 100644
--- a/src/main/java/net/minecraft/world/item/EggItem.java
+++ b/src/main/java/net/minecraft/world/item/EggItem.java
@@ -25,21 +25,33 @@ public class EggItem extends Item {
@@ -28,19 +28,31 @@ public class EggItem extends Item implements ProjectileItem {
entityegg.setItem(itemstack);
entityegg.shootFromRotation(user, user.getXRot(), user.getYRot(), 0.0F, 1.5F, 1.0F);
@ -17,8 +17,8 @@ index 32b63407b943fb00d765dbf4e0eefb4b06f801b6..a3bd507793994e9cc87a956871a8afbb
+ // Paper start - PlayerLaunchProjectileEvent
+ com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent event = new com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent((org.bukkit.entity.Player) user.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack), (org.bukkit.entity.Projectile) entityegg.getBukkitEntity());
+ if (event.callEvent() && world.addFreshEntity(entityegg)) {
+ if (event.shouldConsume() && !user.getAbilities().instabuild) {
+ itemstack.shrink(1);
+ if (event.shouldConsume()) {
+ itemstack.consume(1, user);
+ } else if (user instanceof net.minecraft.server.level.ServerPlayer) {
+ ((net.minecraft.server.level.ServerPlayer) user).getBukkitEntity().updateInventory();
+ }
@ -38,15 +38,13 @@ index 32b63407b943fb00d765dbf4e0eefb4b06f801b6..a3bd507793994e9cc87a956871a8afbb
+ /* // Paper start - PlayerLaunchProjectileEvent; moved up
user.awardStat(Stats.ITEM_USED.get(this));
if (!user.getAbilities().instabuild) {
itemstack.shrink(1);
}
itemstack.consume(1, user);
+ */ // Paper end - PlayerLaunchProjectileEvent
return InteractionResultHolder.sidedSuccess(itemstack, world.isClientSide());
}
diff --git a/src/main/java/net/minecraft/world/item/EnderpearlItem.java b/src/main/java/net/minecraft/world/item/EnderpearlItem.java
index c7d4745aed77b23562cde7c68b8870fa239428d4..8c8cf8705107c95d9a4eab28b5845ae13c4ffb3c 100644
index 48048204b619dd515253c8ffb05a0f7105ef7718..20a91d798d31a71b3c05efa2cc5bda55494e26cc 100644
--- a/src/main/java/net/minecraft/world/item/EnderpearlItem.java
+++ b/src/main/java/net/minecraft/world/item/EnderpearlItem.java
@@ -25,7 +25,20 @@ public class EnderpearlItem extends Item {
@ -57,8 +55,8 @@ index c7d4745aed77b23562cde7c68b8870fa239428d4..8c8cf8705107c95d9a4eab28b5845ae1
+ // Paper start - PlayerLaunchProjectileEvent
+ com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent event = new com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent((org.bukkit.entity.Player) user.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack), (org.bukkit.entity.Projectile) entityenderpearl.getBukkitEntity());
+ if (event.callEvent() && world.addFreshEntity(entityenderpearl)) {
+ if (event.shouldConsume() && !user.getAbilities().instabuild) {
+ itemstack.shrink(1);
+ if (event.shouldConsume()) {
+ itemstack.consume(1, user);
+ } else if (user instanceof net.minecraft.server.level.ServerPlayer) {
+ ((net.minecraft.server.level.ServerPlayer) user).getBukkitEntity().updateInventory();
+ }
@ -71,7 +69,7 @@ index c7d4745aed77b23562cde7c68b8870fa239428d4..8c8cf8705107c95d9a4eab28b5845ae1
if (user instanceof net.minecraft.server.level.ServerPlayer) {
((net.minecraft.server.level.ServerPlayer) user).getBukkitEntity().updateInventory();
}
@@ -33,6 +46,7 @@ public class EnderpearlItem extends Item {
@@ -33,12 +46,14 @@ public class EnderpearlItem extends Item {
}
}
@ -79,19 +77,18 @@ index c7d4745aed77b23562cde7c68b8870fa239428d4..8c8cf8705107c95d9a4eab28b5845ae1
world.playSound((Player) null, user.getX(), user.getY(), user.getZ(), SoundEvents.ENDER_PEARL_THROW, SoundSource.NEUTRAL, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F));
user.getCooldowns().addCooldown(this, 20);
// CraftBukkit end
@@ -41,6 +55,7 @@ public class EnderpearlItem extends Item {
if (!user.getAbilities().instabuild) {
itemstack.shrink(1);
}
+ */ // Paper end - PlayerLaunchProjectileEvent; moved up
user.awardStat(Stats.ITEM_USED.get(this));
itemstack.consume(1, user);
+ */ // Paper end - PlayerLaunchProjectileEvent; moved up
return InteractionResultHolder.sidedSuccess(itemstack, world.isClientSide());
}
}
diff --git a/src/main/java/net/minecraft/world/item/ExperienceBottleItem.java b/src/main/java/net/minecraft/world/item/ExperienceBottleItem.java
index fe03ef2e400b246f7f3a9333506f22b63ae28690..ad147f392e7ef151d971d462431ab67d378cc920 100644
index 686f0fd87e06fa7552d66fd3e38a3e059c22f180..7448309b6dca619b6366aa55fe3a395a830ffbdd 100644
--- a/src/main/java/net/minecraft/world/item/ExperienceBottleItem.java
+++ b/src/main/java/net/minecraft/world/item/ExperienceBottleItem.java
@@ -22,27 +22,46 @@ public class ExperienceBottleItem extends Item {
@@ -20,25 +20,44 @@ public class ExperienceBottleItem extends Item implements ProjectileItem {
@Override
public InteractionResultHolder<ItemStack> use(Level world, Player user, InteractionHand hand) {
ItemStack itemStack = user.getItemInHand(hand);
@ -114,8 +111,8 @@ index fe03ef2e400b246f7f3a9333506f22b63ae28690..ad147f392e7ef151d971d462431ab67d
+ // Paper start - PlayerLaunchProjectileEvent
+ com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent event = new com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent((org.bukkit.entity.Player) user.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemStack), (org.bukkit.entity.Projectile) thrownExperienceBottle.getBukkitEntity());
+ if (event.callEvent() && world.addFreshEntity(thrownExperienceBottle)) {
+ if (event.shouldConsume() && !user.getAbilities().instabuild) {
+ itemStack.shrink(1);
+ if (event.shouldConsume()) {
+ itemStack.consume(1, user);
+ } else if (user instanceof net.minecraft.server.level.ServerPlayer) {
+ ((net.minecraft.server.level.ServerPlayer) user).getBukkitEntity().updateInventory();
+ }
@ -142,18 +139,16 @@ index fe03ef2e400b246f7f3a9333506f22b63ae28690..ad147f392e7ef151d971d462431ab67d
+ /* // Paper start - PlayerLaunchProjectileEvent; moved up
user.awardStat(Stats.ITEM_USED.get(this));
if (!user.getAbilities().instabuild) {
itemStack.shrink(1);
}
itemStack.consume(1, user);
+ */ // Paper end - PlayerLaunchProjectileEvent
return InteractionResultHolder.sidedSuccess(itemStack, world.isClientSide());
}
diff --git a/src/main/java/net/minecraft/world/item/FireworkRocketItem.java b/src/main/java/net/minecraft/world/item/FireworkRocketItem.java
index a9f82e37c088c6f6ae2a049fcc7acea01b8802cd..e1c8b24a92ea63a645406522a3c2fb5efd87f01a 100644
index 16da60b7ecf2e0d4a49804dfa1ad47d4ae672571..218f2f085309f04438f8b07bc41cf242583db2dc 100644
--- a/src/main/java/net/minecraft/world/item/FireworkRocketItem.java
+++ b/src/main/java/net/minecraft/world/item/FireworkRocketItem.java
@@ -54,8 +54,12 @@ public class FireworkRocketItem extends Item {
@@ -43,8 +43,12 @@ public class FireworkRocketItem extends Item implements ProjectileItem {
itemStack
);
fireworkRocketEntity.spawningEntity = context.getPlayer() == null ? null : context.getPlayer().getUUID(); // Paper
@ -169,10 +164,10 @@ index a9f82e37c088c6f6ae2a049fcc7acea01b8802cd..e1c8b24a92ea63a645406522a3c2fb5e
return InteractionResult.sidedSuccess(level.isClientSide);
diff --git a/src/main/java/net/minecraft/world/item/LingeringPotionItem.java b/src/main/java/net/minecraft/world/item/LingeringPotionItem.java
index a822d82b577be20b5c8aa9ba1a4a0d6e4a493354..fec53407acc9bb95ae91e02a44ebc0e8d51355cf 100644
index b94888d359ec92bf7ef77b0610f41ba75185a26e..c9b511cc4f2499ca13e3cd8f1cdabdc225f66b9c 100644
--- a/src/main/java/net/minecraft/world/item/LingeringPotionItem.java
+++ b/src/main/java/net/minecraft/world/item/LingeringPotionItem.java
@@ -23,6 +23,10 @@ public class LingeringPotionItem extends ThrowablePotionItem {
@@ -24,6 +24,10 @@ public class LingeringPotionItem extends ThrowablePotionItem {
@Override
public InteractionResultHolder<ItemStack> use(Level world, Player user, InteractionHand hand) {
@ -183,7 +178,7 @@ index a822d82b577be20b5c8aa9ba1a4a0d6e4a493354..fec53407acc9bb95ae91e02a44ebc0e8
world.playSound(
null,
user.getX(),
@@ -33,6 +37,9 @@ public class LingeringPotionItem extends ThrowablePotionItem {
@@ -34,6 +38,9 @@ public class LingeringPotionItem extends ThrowablePotionItem {
0.5F,
0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F)
);
@ -195,25 +190,25 @@ index a822d82b577be20b5c8aa9ba1a4a0d6e4a493354..fec53407acc9bb95ae91e02a44ebc0e8
}
}
diff --git a/src/main/java/net/minecraft/world/item/SnowballItem.java b/src/main/java/net/minecraft/world/item/SnowballItem.java
index d60e57e84f7d66e1858ab50ac33777feedf1c54d..bc8186a5bc3a98b35fad570729dd4ba52efab238 100644
index 2ae40936b31012fab0c7c42a7dea13b01ec6068f..32b170551a2f5bdc88d29f4d03750bfe3974e71b 100644
--- a/src/main/java/net/minecraft/world/item/SnowballItem.java
+++ b/src/main/java/net/minecraft/world/item/SnowballItem.java
@@ -26,18 +26,26 @@ public class SnowballItem extends Item {
@@ -29,17 +29,26 @@ public class SnowballItem extends Item implements ProjectileItem {
entitysnowball.setItem(itemstack);
entitysnowball.shootFromRotation(user, user.getXRot(), user.getYRot(), 0.0F, 1.5F, 1.0F);
- if (world.addFreshEntity(entitysnowball)) {
- if (!user.getAbilities().instabuild) {
- itemstack.consume(1, user);
+ // Paper start - PlayerLaunchProjectileEvent
+ com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent event = new com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent((org.bukkit.entity.Player) user.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack), (org.bukkit.entity.Projectile) entitysnowball.getBukkitEntity());
+ if (event.callEvent() && world.addFreshEntity(entitysnowball)) {
+ user.awardStat(Stats.ITEM_USED.get(this));
+ if (event.shouldConsume() && !user.getAbilities().instabuild) {
+ if (event.shouldConsume()) {
+ // Paper end - PlayerLaunchProjectileEvent
itemstack.shrink(1);
+ itemstack.consume(1, user);
+ } else if (user instanceof net.minecraft.server.level.ServerPlayer) { // Paper - PlayerLaunchProjectileEvent
+ ((net.minecraft.server.level.ServerPlayer) user).getBukkitEntity().updateInventory(); // Paper - PlayerLaunchProjectileEvent
}
+ }
world.playSound((Player) null, user.getX(), user.getY(), user.getZ(), SoundEvents.SNOWBALL_THROW, SoundSource.NEUTRAL, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F));
- } else if (user instanceof net.minecraft.server.level.ServerPlayer) {
@ -225,16 +220,9 @@ index d60e57e84f7d66e1858ab50ac33777feedf1c54d..bc8186a5bc3a98b35fad570729dd4ba5
}
// CraftBukkit end
+ /* // Paper start - PlayerLaunchProjectileEvent; moved up
user.awardStat(Stats.ITEM_USED.get(this));
// CraftBukkit start - moved up
/*
@@ -45,6 +53,7 @@ public class SnowballItem extends Item {
itemstack.shrink(1);
}
*/
+ // Paper end - PlayerLaunchProjectileEvent
- user.awardStat(Stats.ITEM_USED.get(this));
+ // user.awardStat(Stats.ITEM_USED.get(this)); // Paper - PlayerLaunchProjectileEvent; moved up
// itemstack.consume(1, entityhuman); // CraftBukkit - moved up
return InteractionResultHolder.sidedSuccess(itemstack, world.isClientSide());
}
diff --git a/src/main/java/net/minecraft/world/item/SplashPotionItem.java b/src/main/java/net/minecraft/world/item/SplashPotionItem.java
@ -264,10 +252,10 @@ index 935c34ba7eb14348becdd3ac0c29766abf7ca614..73bac60b3bf6d20d415a8250d0426251
}
}
diff --git a/src/main/java/net/minecraft/world/item/ThrowablePotionItem.java b/src/main/java/net/minecraft/world/item/ThrowablePotionItem.java
index 0673f62f25532955f3552b64f122e644d42027e4..f47f793c62a919fb65c081ddb82d597a978d3b20 100644
index 12795451393e48f5c9ab4b1dfd9369e1ee6e0367..369955746f4b51f69fa01103e3771dd74fc6c8f0 100644
--- a/src/main/java/net/minecraft/world/item/ThrowablePotionItem.java
+++ b/src/main/java/net/minecraft/world/item/ThrowablePotionItem.java
@@ -19,13 +19,31 @@ public class ThrowablePotionItem extends PotionItem {
@@ -22,11 +22,29 @@ public class ThrowablePotionItem extends PotionItem implements ProjectileItem {
ThrownPotion thrownPotion = new ThrownPotion(world, user);
thrownPotion.setItem(itemStack);
thrownPotion.shootFromRotation(user, user.getXRot(), user.getYRot(), -20.0F, 0.5F, 1.0F);
@ -275,8 +263,8 @@ index 0673f62f25532955f3552b64f122e644d42027e4..f47f793c62a919fb65c081ddb82d597a
+ // Paper start - PlayerLaunchProjectileEvent
+ com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent event = new com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent((org.bukkit.entity.Player) user.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemStack), (org.bukkit.entity.Projectile) thrownPotion.getBukkitEntity());
+ if (event.callEvent() && world.addFreshEntity(thrownPotion)) {
+ if (event.shouldConsume() && !user.getAbilities().instabuild) {
+ itemStack.shrink(1);
+ if (event.shouldConsume()) {
+ itemStack.consume(1, user);
+ } else if (user instanceof net.minecraft.server.level.ServerPlayer) {
+ ((net.minecraft.server.level.ServerPlayer) user).getBukkitEntity().updateInventory();
+ }
@ -293,18 +281,16 @@ index 0673f62f25532955f3552b64f122e644d42027e4..f47f793c62a919fb65c081ddb82d597a
+ /* // Paper start - PlayerLaunchProjectileEvent; moved up
user.awardStat(Stats.ITEM_USED.get(this));
if (!user.getAbilities().instabuild) {
itemStack.shrink(1);
}
itemStack.consume(1, user);
+ */ // Paper end
return InteractionResultHolder.sidedSuccess(itemStack, world.isClientSide());
}
diff --git a/src/main/java/net/minecraft/world/item/TridentItem.java b/src/main/java/net/minecraft/world/item/TridentItem.java
index f46d0015d707e6708b9e19cc8f20fad5d3bd590b..a792c7b7a6179aa88fc473b27ef0ca13bd91a395 100644
index d8d59ddaa5277b9602f37d7c5bb5753030582996..47de500fddb0716d142f8f5876a82a95afaa06fa 100644
--- a/src/main/java/net/minecraft/world/item/TridentItem.java
+++ b/src/main/java/net/minecraft/world/item/TridentItem.java
@@ -83,21 +83,26 @@ public class TridentItem extends Item implements Vanishable {
@@ -82,19 +82,24 @@ public class TridentItem extends Item implements ProjectileItem {
}
// CraftBukkit start
@ -320,16 +306,14 @@ index f46d0015d707e6708b9e19cc8f20fad5d3bd590b..a792c7b7a6179aa88fc473b27ef0ca13
}
+ if (event.shouldConsume()) { // Paper - PlayerLaunchProjectileEvent
stack.hurtAndBreak(1, entityhuman, (entityhuman1) -> {
entityhuman1.broadcastBreakEvent(user.getUsedItemHand());
});
stack.hurtAndBreak(1, entityhuman, LivingEntity.getSlotForHand(user.getUsedItemHand()));
+ } // Paper - PlayerLaunchProjectileEvent
entitythrowntrident.pickupItemStack = stack.copy(); // SPIGOT-4511 update since damage call moved
// CraftBukkit end
world.playSound((Player) null, (Entity) entitythrowntrident, SoundEvents.TRIDENT_THROW, SoundSource.PLAYERS, 1.0F, 1.0F);
- if (!entityhuman.getAbilities().instabuild) {
+ if (event.shouldConsume() && !entityhuman.getAbilities().instabuild) { // Paper - PlayerLaunchProjectileEvent
- if (!entityhuman.hasInfiniteMaterials()) {
+ if (event.shouldConsume() && !entityhuman.hasInfiniteMaterials()) {
entityhuman.getInventory().removeItem(stack);
}
// CraftBukkit start - SPIGOT-5458 also need in this branch :(

View File

@ -1,18 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MiniDigger <admin@benndorf.dev>
Date: Sat, 10 Mar 2018 00:50:24 +0100
Subject: [PATCH] Toggleable player crits
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 0043a1f877a0a74d361a37dfa0652d1931835988..654654b1d9c10934af333dfe69c27a5d3997eda4 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -1234,6 +1234,7 @@ public abstract class Player extends LivingEntity {
boolean flag2 = flag && this.fallDistance > 0.0F && !this.onGround() && !this.onClimbable() && !this.isInWater() && !this.hasEffect(MobEffects.BLINDNESS) && !this.isPassenger() && target instanceof LivingEntity;
+ flag2 = flag2 && !this.level().paperConfig().entities.behavior.disablePlayerCrits; // Paper - Toggleable player crits
flag2 = flag2 && !this.isSprinting();
if (flag2) {
f *= 1.5F;

View File

@ -1,24 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 16 May 2018 20:35:16 -0400
Subject: [PATCH] WitchConsumePotionEvent
Fires when a witch consumes the potion in their hand
diff --git a/src/main/java/net/minecraft/world/entity/monster/Witch.java b/src/main/java/net/minecraft/world/entity/monster/Witch.java
index eeecb9057e039b4696ca4de1cd7191a95d17a1a6..d2cff117f178a370a7056865246276e795b6bace 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Witch.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Witch.java
@@ -126,7 +126,11 @@ public class Witch extends Raider implements RangedAttackMob {
this.setItemSlot(EquipmentSlot.MAINHAND, ItemStack.EMPTY);
if (itemstack.is(Items.POTION)) {
- List<MobEffectInstance> list = PotionUtils.getMobEffects(itemstack);
+ // Paper start - WitchConsumePotionEvent
+ com.destroystokyo.paper.event.entity.WitchConsumePotionEvent event = new com.destroystokyo.paper.event.entity.WitchConsumePotionEvent((org.bukkit.entity.Witch) this.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack));
+
+ List<MobEffectInstance> list = event.callEvent() ? PotionUtils.getMobEffects(org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getPotion())) : null;
+ // Paper end - WitchConsumePotionEvent
if (list != null) {
Iterator iterator = list.iterator();