13
0
geforkt von Mirrors/Paper
Dieser Commit ist enthalten in:
Owen1212055 2024-10-24 09:25:36 -04:00
Ursprung 80de05ff33
Commit 26f7b4c72e
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 2133292072886A30
9 geänderte Dateien mit 77 neuen und 78 gelöschten Zeilen

Datei anzeigen

@ -16,36 +16,36 @@ sideeffects, meaning the disable event cannot share a handlerlist with
the cooldown event the cooldown event
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java 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 454b29d8c9e42e328933aa578f49d28f1e77898a..d0b51d96d6795b5fa03bc195b90324680545b752 100644 index a19a795deaa7f46c92b97912e2ade006bc90c2d5..61d412c4f1ebd55661cc3f0260468e3ac0efe0bb 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java --- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -1005,7 +1005,7 @@ public abstract class Player extends LivingEntity { @@ -970,7 +970,7 @@ public abstract class Player extends LivingEntity {
protected void blockUsingShield(LivingEntity attacker) { ItemStack itemstack = this.getItemBlockingWith();
super.blockUsingShield(attacker);
if (attacker.canDisableShield()) { if (attacker.canDisableShield() && itemstack != null) {
- this.disableShield(); - this.disableShield(itemstack);
+ this.disableShield(attacker); // Paper - Add PlayerShieldDisableEvent + this.disableShield(itemstack, attacker); // Paper - Add PlayerShieldDisableEvent
} }
} }
@@ -1498,8 +1498,21 @@ public abstract class Player extends LivingEntity { @@ -1463,8 +1463,21 @@ public abstract class Player extends LivingEntity {
this.attack(target); this.attack(target);
} }
+ @io.papermc.paper.annotation.DoNotUse @Deprecated // Paper - Add PlayerShieldDisableEvent + @io.papermc.paper.annotation.DoNotUse @Deprecated // Paper - Add PlayerShieldDisableEvent
public void disableShield() { public void disableShield(ItemStack shield) {
- this.getCooldowns().addCooldown(Items.SHIELD, 100); - this.getCooldowns().addCooldown(shield, 100);
+ // Paper start - Add PlayerShieldDisableEvent + // Paper start - Add PlayerShieldDisableEvent
+ this.disableShield(null); + this.disableShield(shield, null);
+ } + }
+ public void disableShield(@Nullable LivingEntity attacker) { + public void disableShield(ItemStack shield, @Nullable LivingEntity attacker) {
+ final org.bukkit.entity.Entity finalAttacker = attacker != null ? attacker.getBukkitEntity() : null; + final org.bukkit.entity.Entity finalAttacker = attacker != null ? attacker.getBukkitEntity() : null;
+ if (finalAttacker != null) { + if (finalAttacker != null) {
+ final io.papermc.paper.event.player.PlayerShieldDisableEvent shieldDisableEvent = new io.papermc.paper.event.player.PlayerShieldDisableEvent((org.bukkit.entity.Player) getBukkitEntity(), finalAttacker, 100); + final io.papermc.paper.event.player.PlayerShieldDisableEvent shieldDisableEvent = new io.papermc.paper.event.player.PlayerShieldDisableEvent((org.bukkit.entity.Player) getBukkitEntity(), finalAttacker, 100);
+ if (!shieldDisableEvent.callEvent()) return; + if (!shieldDisableEvent.callEvent()) return;
+ this.getCooldowns().addCooldown(Items.SHIELD, shieldDisableEvent.getCooldown()); + this.getCooldowns().addCooldown(shield, shieldDisableEvent.getCooldown());
+ } else { + } else {
+ this.getCooldowns().addCooldown(Items.SHIELD, 100); + this.getCooldowns().addCooldown(shield, 100);
+ } + }
+ // Paper end - Add PlayerShieldDisableEvent + // Paper end - Add PlayerShieldDisableEvent
this.stopUsingItem(); this.stopUsingItem();

Datei anzeigen

@ -53,10 +53,10 @@ index 084935138b1484f3d96e99f4e5655a6c04931907..9e357abe13f55bd9ce3a1d5348bcf19a
if (nbt.contains("LootTableSeed", 4)) { if (nbt.contains("LootTableSeed", 4)) {
this.setLootTableSeed(nbt.getLong("LootTableSeed")); this.setLootTableSeed(nbt.getLong("LootTableSeed"));
diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java
index b98f9246b60daf31460f41ce214dfa7c011f5684..842b0cec0397d7ae5166617627340ffac0e35db1 100644 index 4eec58353343b414120e189afed04b98ae3e87c8..d77014aadf83088fb53f30a9dbe879f3089e159e 100644
--- a/src/main/java/net/minecraft/world/entity/EntityType.java --- a/src/main/java/net/minecraft/world/entity/EntityType.java
+++ b/src/main/java/net/minecraft/world/entity/EntityType.java +++ b/src/main/java/net/minecraft/world/entity/EntityType.java
@@ -623,7 +623,7 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT @@ -690,7 +690,7 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
} }
public static Optional<EntityType<?>> by(CompoundTag nbt) { public static Optional<EntityType<?>> by(CompoundTag nbt) {
@ -66,10 +66,10 @@ index b98f9246b60daf31460f41ce214dfa7c011f5684..842b0cec0397d7ae5166617627340ffa
@Nullable @Nullable
diff --git a/src/main/java/net/minecraft/world/entity/Leashable.java b/src/main/java/net/minecraft/world/entity/Leashable.java diff --git a/src/main/java/net/minecraft/world/entity/Leashable.java b/src/main/java/net/minecraft/world/entity/Leashable.java
index e7535f15be3cc1537aafee53779ccfb4f21d1f38..bd6d587cedfe0e345536d7ebb6b7ca204f073efe 100644 index 1a6448cccf79a94013f9f44c3067d91da3da1f7e..06af888e4c3d9d01a462b487742b597184a7a8a6 100644
--- a/src/main/java/net/minecraft/world/entity/Leashable.java --- a/src/main/java/net/minecraft/world/entity/Leashable.java
+++ b/src/main/java/net/minecraft/world/entity/Leashable.java +++ b/src/main/java/net/minecraft/world/entity/Leashable.java
@@ -54,7 +54,13 @@ public interface Leashable { @@ -55,7 +55,13 @@ public interface Leashable {
@Nullable @Nullable
default Leashable.LeashData readLeashData(CompoundTag nbt) { default Leashable.LeashData readLeashData(CompoundTag nbt) {
if (nbt.contains("leash", 10)) { if (nbt.contains("leash", 10)) {
@ -85,10 +85,10 @@ index e7535f15be3cc1537aafee53779ccfb4f21d1f38..bd6d587cedfe0e345536d7ebb6b7ca20
if (nbt.contains("leash", 11)) { if (nbt.contains("leash", 11)) {
Either<UUID, BlockPos> either = (Either) NbtUtils.readBlockPos(nbt, "leash").map(Either::right).orElse(null); // CraftBukkit - decompile error Either<UUID, BlockPos> either = (Either) NbtUtils.readBlockPos(nbt, "leash").map(Either::right).orElse(null); // CraftBukkit - decompile error
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 13ef1ad250b56dbadba0244186e369d7ba9b5c0e..94169703c5a8111df1ed550d57f59f4a3bb97ae1 100644 index f42a98324ecfc992cf36c2f44cdb781ad4edbad4..a7f0d49637eb72b4645997a97cc6927b16a59738 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -887,11 +887,13 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -911,11 +911,13 @@ public abstract class LivingEntity extends Entity implements Attackable {
if (nbt.contains("SleepingX", 99) && nbt.contains("SleepingY", 99) && nbt.contains("SleepingZ", 99)) { if (nbt.contains("SleepingX", 99) && nbt.contains("SleepingY", 99) && nbt.contains("SleepingZ", 99)) {
BlockPos blockposition = new BlockPos(nbt.getInt("SleepingX"), nbt.getInt("SleepingY"), nbt.getInt("SleepingZ")); BlockPos blockposition = new BlockPos(nbt.getInt("SleepingX"), nbt.getInt("SleepingY"), nbt.getInt("SleepingZ"));
@ -103,23 +103,23 @@ index 13ef1ad250b56dbadba0244186e369d7ba9b5c0e..94169703c5a8111df1ed550d57f59f4a
if (nbt.contains("Brain", 10)) { if (nbt.contains("Brain", 10)) {
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index cf1f6a0081f0dbcf43842ec23accf6c3ae9b79d8..58ff5b4df2124901df757315e42b2490a7da7415 100644 index 8a0e65ac8318a467996f48b423db1ac621359fbe..aad63549d7c4f501b683b8dead4938eac27895eb 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java --- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -603,7 +603,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab @@ -601,7 +601,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
this.leashData = this.readLeashData(nbt); this.leashData = this.readLeashData(nbt);
this.setLeftHanded(nbt.getBoolean("LeftHanded")); this.setLeftHanded(nbt.getBoolean("LeftHanded"));
if (nbt.contains("DeathLootTable", 8)) { if (nbt.contains("DeathLootTable", 8)) {
- this.lootTable = ResourceKey.create(Registries.LOOT_TABLE, ResourceLocation.parse(nbt.getString("DeathLootTable"))); - this.lootTable = Optional.of(ResourceKey.create(Registries.LOOT_TABLE, ResourceLocation.parse(nbt.getString("DeathLootTable"))));
+ this.lootTable = net.minecraft.Optionull.map(ResourceLocation.tryParse(nbt.getString("DeathLootTable")), rl -> ResourceKey.create(Registries.LOOT_TABLE, rl)); // Paper - Validate ResourceLocation + this.lootTable = Optional.ofNullable(ResourceLocation.tryParse(nbt.getString("DeathLootTable"))).map((rs) -> ResourceKey.create(Registries.LOOT_TABLE, rs)); // Paper - Validate ResourceLocation
this.lootTableSeed = nbt.getLong("DeathLootTableSeed"); this.lootTableSeed = nbt.getLong("DeathLootTableSeed");
} }
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java 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 10d30304c8c89b1f2a55be8529035311d1424e44..ddf47dab1ab92c45e3eea09239d418a9798ed59e 100644 index 75cc3db39c974abab8510af4a633fc6812efc647..14e31ae88e90d8ea1a98800cc6c1c3527bb2ed6b 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java --- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java +++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
@@ -649,7 +649,7 @@ public abstract class AbstractArrow extends Projectile { @@ -695,7 +695,7 @@ public abstract class AbstractArrow extends Projectile {
this.setCritArrow(nbt.getBoolean("crit")); this.setCritArrow(nbt.getBoolean("crit"));
this.setPierceLevel(nbt.getByte("PierceLevel")); this.setPierceLevel(nbt.getByte("PierceLevel"));
if (nbt.contains("SoundEvent", 8)) { if (nbt.contains("SoundEvent", 8)) {
@ -129,41 +129,40 @@ index 10d30304c8c89b1f2a55be8529035311d1424e44..ddf47dab1ab92c45e3eea09239d418a9
if (nbt.contains("item", 10)) { if (nbt.contains("item", 10)) {
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/ContainerEntity.java b/src/main/java/net/minecraft/world/entity/vehicle/ContainerEntity.java diff --git a/src/main/java/net/minecraft/world/entity/vehicle/ContainerEntity.java b/src/main/java/net/minecraft/world/entity/vehicle/ContainerEntity.java
index ccc7367ab2740bea0f2b907223a0920b11665092..845eff7401b811c179dc9dee70eca0d724be5c80 100644 index 5c78e33d4d369700a5fa6eb3cbbe85756465a063..35f90e06dcf30c2e6a2a63e81215283ffbb3ec05 100644
--- a/src/main/java/net/minecraft/world/entity/vehicle/ContainerEntity.java --- a/src/main/java/net/minecraft/world/entity/vehicle/ContainerEntity.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/ContainerEntity.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/ContainerEntity.java
@@ -73,7 +73,7 @@ public interface ContainerEntity extends Container, MenuProvider { @@ -73,7 +73,7 @@ public interface ContainerEntity extends Container, MenuProvider {
default void readChestVehicleSaveData(CompoundTag nbt, HolderLookup.Provider registriesLookup) { default void readChestVehicleSaveData(CompoundTag nbt, HolderLookup.Provider registries) {
this.clearItemStacks(); this.clearItemStacks();
if (nbt.contains("LootTable", 8)) { if (nbt.contains("LootTable", 8)) {
- this.setLootTable(ResourceKey.create(Registries.LOOT_TABLE, ResourceLocation.parse(nbt.getString("LootTable")))); - this.setContainerLootTable(ResourceKey.create(Registries.LOOT_TABLE, ResourceLocation.parse(nbt.getString("LootTable"))));
+ this.setLootTable(net.minecraft.Optionull.map(ResourceLocation.tryParse(nbt.getString("LootTable")), rl -> ResourceKey.create(Registries.LOOT_TABLE, rl))); // Paper - Validate ResourceLocation + this.setContainerLootTable(net.minecraft.Optionull.map(ResourceLocation.tryParse(nbt.getString("LootTable")), rl -> ResourceKey.create(Registries.LOOT_TABLE, rl))); // Paper - Validate ResourceLocation
// Paper start - LootTable API // Paper start - LootTable API
if (this.getLootTable() != null) { if (this.getLootTable() != null) {
this.lootableData().loadNbt(nbt); this.lootableData().loadNbt(nbt);
diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
index 65ab9b22f724877b68f4f25aad2831e2cb080b19..730aca233f6e7564d4cb85b5b628d23c4f01d2f4 100644 index ecb9abc570ef87541184a8033cb33c82a4d1daf2..a1ac34668fcd53cf8adf4ce463e0254b26575fbf 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
@@ -295,7 +295,12 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit @@ -180,7 +180,11 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
while (iterator.hasNext()) { while (iterator.hasNext()) {
String s = (String) iterator.next(); String s = (String) iterator.next();
- this.recipesUsed.put(ResourceLocation.parse(s), nbttagcompound1.getInt(s)); - this.recipesUsed.put(ResourceKey.create(Registries.RECIPE, ResourceLocation.parse(s)), nbttagcompound1.getInt(s));
+ // Paper start - Validate ResourceLocation + // Paper start - Validate ResourceLocation
+ final ResourceLocation resourceLocation = ResourceLocation.tryParse(s); + final ResourceLocation resourceLocation = ResourceLocation.tryParse(s);
+ if (resourceLocation != null) { + if (resourceLocation != null) {
+ this.recipesUsed.put(resourceLocation, nbttagcompound1.getInt(s)); + this.recipesUsed.put(ResourceKey.create(Registries.RECIPE, resourceLocation), nbttagcompound1.getInt(s));
+ } + }
+ // Paper end - Validate ResourceLocation
} }
// Paper start - cook speed multiplier API // Paper start - cook speed multiplier API
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BrushableBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BrushableBlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/BrushableBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BrushableBlockEntity.java
index 32de29c385c784ab87e29b2e072f3992386cd775..dc02a3d84b397f634f77f4df9c06e245cc4dcb75 100644 index 1bfffbf54b1b440c6e19a908ea2bd70387d06b5c..b08867878e56f88569d547765f29cab018a9e791 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BrushableBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/BrushableBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BrushableBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BrushableBlockEntity.java
@@ -202,7 +202,7 @@ public class BrushableBlockEntity extends BlockEntity { @@ -194,7 +194,7 @@ public class BrushableBlockEntity extends BlockEntity {
private boolean tryLoadLootTable(CompoundTag nbt) { private boolean tryLoadLootTable(CompoundTag nbt) {
if (nbt.contains("LootTable", 8)) { if (nbt.contains("LootTable", 8)) {

Datei anzeigen

@ -7,7 +7,7 @@ This causes spawnAfterBreak to spawn xp by default, removing the need to manuall
For classes that use custom xp amounts, they can drop the resources with disabling For classes that use custom xp amounts, they can drop the resources with disabling
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 3f87e60c0d43703a8450b5920dac59a970809397..471fd54edf6aa962d997878ee638974f7f594fa8 100644 index d048d0e4b16459b5bad44ebfa3c6a8f336f6762b..83537aa240ebff8dd19b450956730dc3d4f355a0 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -617,7 +617,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -617,7 +617,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@ -21,10 +21,10 @@ index 3f87e60c0d43703a8450b5920dac59a970809397..471fd54edf6aa962d997878ee638974f
boolean flag1 = this.setBlock(pos, fluid.createLegacyBlock(), 3, maxUpdateDepth); boolean flag1 = this.setBlock(pos, fluid.createLegacyBlock(), 3, maxUpdateDepth);
diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java
index c083dc8b2a69c3747b250d13f1a28ad22b5e6119..bf52c36f31992a01a7403d8c85151327c9e944c4 100644 index 6fb3f551f432d7e668c606fb7bd3514408e0478a..9917df070d9815b6915e4a0b022dfe4e5b7861e7 100644
--- a/src/main/java/net/minecraft/world/level/block/Block.java --- a/src/main/java/net/minecraft/world/level/block/Block.java
+++ b/src/main/java/net/minecraft/world/level/block/Block.java +++ b/src/main/java/net/minecraft/world/level/block/Block.java
@@ -312,23 +312,31 @@ public class Block extends BlockBehaviour implements ItemLike { @@ -311,23 +311,31 @@ public class Block extends BlockBehaviour implements ItemLike {
for (ItemStack drop : Block.getDrops(state, serverLevel, pos, blockEntity)) { for (ItemStack drop : Block.getDrops(state, serverLevel, pos, blockEntity)) {
items.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(drop)); items.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(drop));
} }
@ -58,7 +58,7 @@ index c083dc8b2a69c3747b250d13f1a28ad22b5e6119..bf52c36f31992a01a7403d8c85151327
} }
} }
@@ -412,7 +420,7 @@ public class Block extends BlockBehaviour implements ItemLike { @@ -415,7 +423,7 @@ public class Block extends BlockBehaviour implements ItemLike {
player.awardStat(Stats.BLOCK_MINED.get(this)); player.awardStat(Stats.BLOCK_MINED.get(this));
player.causeFoodExhaustion(0.005F, org.bukkit.event.entity.EntityExhaustionEvent.ExhaustionReason.BLOCK_MINED); // CraftBukkit - EntityExhaustionEvent player.causeFoodExhaustion(0.005F, org.bukkit.event.entity.EntityExhaustionEvent.ExhaustionReason.BLOCK_MINED); // CraftBukkit - EntityExhaustionEvent
if (includeDrops) { // Paper - fix drops not preventing stats/food exhaustion if (includeDrops) { // Paper - fix drops not preventing stats/food exhaustion
@ -68,10 +68,10 @@ index c083dc8b2a69c3747b250d13f1a28ad22b5e6119..bf52c36f31992a01a7403d8c85151327
} }
diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
index a8bec3c405732e5863cf717b1fe948d00837bed2..240c250a93289776686d09d7eae17c07d7278da5 100644 index 0665ca48fe2f8ab1ce1c0306b11be19b06445f74..1b988b92e80faa1ac224caf9f9e955ac43a4c45a 100644
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java --- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
@@ -1119,6 +1119,7 @@ public abstract class BlockBehaviour implements FeatureElement { @@ -1180,6 +1180,7 @@ public abstract class BlockBehaviour implements FeatureElement {
public void spawnAfterBreak(ServerLevel world, BlockPos pos, ItemStack tool, boolean dropExperience) { public void spawnAfterBreak(ServerLevel world, BlockPos pos, ItemStack tool, boolean dropExperience) {
this.getBlock().spawnAfterBreak(this.asState(), world, pos, tool, dropExperience); this.getBlock().spawnAfterBreak(this.asState(), world, pos, tool, dropExperience);
@ -80,7 +80,7 @@ index a8bec3c405732e5863cf717b1fe948d00837bed2..240c250a93289776686d09d7eae17c07
public List<ItemStack> getDrops(LootParams.Builder builder) { public List<ItemStack> getDrops(LootParams.Builder builder) {
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
index 461a66c323a74db5a70981fafc5fa20f54f0f40d..ac11f18690434922179b61ffcc3036dea025b0cb 100644 index a34e888f63ead250c41b6bbe6850a5e5b4254c3d..66ac5d0b6dafd0323b73953cdd633dca624c3bcd 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
@@ -509,7 +509,7 @@ public class CraftBlock implements Block { @@ -509,7 +509,7 @@ public class CraftBlock implements Block {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Fixup NamespacedKey handling
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java b/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java b/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java
index e34deaf398dc6722c3128bdd6b9bc16da2d33bf7..f028daa4f23a1f1868c9922991259739cadc5da2 100644 index 90b82ad996b2b85628c9a5ddeef9410150b7f70c..5fd22a80e9d05afbea273471cee991732a9485fd 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java --- a/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java
@@ -38,7 +38,7 @@ public class CraftLootTable implements org.bukkit.loot.LootTable { @@ -38,7 +38,7 @@ public class CraftLootTable implements org.bukkit.loot.LootTable {
@ -18,7 +18,7 @@ index e34deaf398dc6722c3128bdd6b9bc16da2d33bf7..f028daa4f23a1f1868c9922991259739
public static NamespacedKey minecraftToBukkitKey(ResourceKey<LootTable> minecraft) { public static NamespacedKey minecraftToBukkitKey(ResourceKey<LootTable> minecraft) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java b/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java b/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java
index 9b78bfd187a1bd5f99af5690f194441904956c7d..bd16933a5341908b21e549f66080c33466ad1079 100644 index aa66fd8dca886c1f064d8cb4a3d15c2086c1719a..f8450a2abd1e96fac7827d252cc00038b9dee839 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java --- a/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java
@@ -122,6 +122,16 @@ public class CraftRegistry<B extends Keyed, M> implements Registry<B> { @@ -122,6 +122,16 @@ public class CraftRegistry<B extends Keyed, M> implements Registry<B> {
@ -81,7 +81,7 @@ index bcac1359c667ef1ee46384f9c7a5adf4010d2b08..98a4463c9f194f33f4f85d95a0b9fa06
@Override @Override
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmor.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmor.java diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmor.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmor.java
index 2c57fd269484ed79814d974877585f9f7e6393d3..865977ce17fbb8793a1eefd71079729e83f5cfaf 100644 index 0fdd9dd47594a7e7e785c34c09d9b4a79aad2439..0d3b1692af010bfd7ea83e22e9571dc954906f71 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmor.java --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmor.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmor.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmor.java
@@ -38,8 +38,9 @@ public class CraftMetaArmor extends CraftMetaItem implements ArmorMeta { @@ -38,8 +38,9 @@ public class CraftMetaArmor extends CraftMetaItem implements ArmorMeta {

Datei anzeigen

@ -18,10 +18,10 @@ index a043ac10834562d357ef0b5aded2e916e2a0d056..74276c368016fcc4dbf9579b2ecbadc9
@VisibleForTesting @VisibleForTesting
static long encode(double value) { static long encode(double value) {
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 6c667823c2ef15766f3afc1a9c819cb6c24b0912..4c1cf5798209297e1e8a634b63770e917a84a63c 100644 index 29a28e160f6ca87d263b84fbf0c5429d30e34a21..a43eef8bf05855270601761494b6a67dc55cb1c9 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1519,10 +1519,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1578,10 +1578,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
public void updatePlayer(ServerPlayer player) { public void updatePlayer(ServerPlayer player) {
org.spigotmc.AsyncCatcher.catchOp("player tracker update"); // Spigot org.spigotmc.AsyncCatcher.catchOp("player tracker update"); // Spigot
if (player != this.entity) { if (player != this.entity) {
@ -39,21 +39,21 @@ index 6c667823c2ef15766f3afc1a9c819cb6c24b0912..4c1cf5798209297e1e8a634b63770e91
// Paper start - Configurable entity tracking range by Y // Paper start - Configurable entity tracking range by Y
boolean flag = d1 <= d2; boolean flag = d1 <= d2;
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
index a2fbbbd7a66d4e7b1063638f8467e8887a417282..0e7ace92522fbd4cef7b2c2b8a0f8b86c2cce192 100644 index 7118e1f806af98159ec292f9340d7e4004e2b486..f3456aeeab7eee5b6d0383a4bf1338dd8cc95bb3 100644
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java --- a/src/main/java/net/minecraft/server/level/ServerEntity.java
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java +++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
@@ -163,7 +163,13 @@ public class ServerEntity { @@ -178,7 +178,13 @@ public class ServerEntity {
i = Mth.floor(this.entity.getYRot() * 256.0F / 360.0F);
j = Mth.floor(this.entity.getXRot() * 256.0F / 360.0F); ++this.teleportDelay;
Vec3 vec3d = this.entity.trackingPosition(); Vec3 vec3d = this.entity.trackingPosition();
- boolean flag1 = this.positionCodec.delta(vec3d).lengthSqr() >= 7.62939453125E-6D; - boolean flag1 = this.positionCodec.delta(vec3d).lengthSqr() >= 7.62939453125E-6D;
+ // Paper start - reduce allocation of Vec3D here + // Paper start - reduce allocation of Vec3D here
+ Vec3 base = this.positionCodec.base; + Vec3 base = this.positionCodec.base;
+ double vec3d_dx = vec3d.x - base.x; + double vec3d_dx = vec3d.x - base.x;
+ double vec3d_dy = vec3d.y - base.y; + double vec3d_dy = vec3d.y - base.y;
+ double vec3d_dz = vec3d.z - base.z; + double vec3d_dz = vec3d.z - base.z;
+ boolean flag1 = (vec3d_dx * vec3d_dx + vec3d_dy * vec3d_dy + vec3d_dz * vec3d_dz) >= 7.62939453125E-6D; + boolean flag1 = (vec3d_dx * vec3d_dx + vec3d_dy * vec3d_dy + vec3d_dz * vec3d_dz) >= 7.62939453125E-6D;
+ // Paper end - reduce allocation of Vec3D here + // Paper end - reduce allocation of Vec3D here
Packet<?> packet1 = null; Packet<?> packet1 = null;
boolean flag2 = flag1 || this.tickCount % 60 == 0; boolean flag2 = flag1 || this.tickCount % 60 == 0;
boolean flag3 = Math.abs(i - this.lastSentYRot) >= 1 || Math.abs(j - this.lastSentXRot) >= 1; boolean flag3 = false;

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Add PlayerTradeEvent and PlayerPurchaseEvent
Co-authored-by: Alexander <protonull@protonmail.com> Co-authored-by: Alexander <protonull@protonmail.com>
diff --git a/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java b/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java diff --git a/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java b/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
index 2a155d3611ca2370830ca763d40074df6641958f..d28ebcae036168dd65a5f3236d12ee416308c23f 100644 index 39cb40b077e9c07471437d5bec16ba9a7e6bce52..5f656fc726a1dc5f42657095a2f2b7cf85b92d7c 100644
--- a/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java --- a/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
+++ b/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java +++ b/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
@@ -141,11 +141,24 @@ public abstract class AbstractVillager extends AgeableMob implements InventoryCa @@ -141,11 +141,24 @@ public abstract class AbstractVillager extends AgeableMob implements InventoryCa
@ -37,10 +37,10 @@ index 2a155d3611ca2370830ca763d40074df6641958f..d28ebcae036168dd65a5f3236d12ee41
CriteriaTriggers.TRADE.trigger((ServerPlayer) this.tradingPlayer, this, offer.getResult()); CriteriaTriggers.TRADE.trigger((ServerPlayer) this.tradingPlayer, this, offer.getResult());
} }
diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
index 8a1035c0aa859f67a6806c183d96a88ddf760baa..46159a127d910028c62ada90ff2d2dccc3b62fc3 100644 index 85caec29a705f216eff8a5ae11f250697891a05c..78d0ff45c016e900d87010e8b26b0bb10e63f445 100644
--- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java --- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java +++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
@@ -768,6 +768,14 @@ public abstract class AbstractContainerMenu { @@ -831,6 +831,14 @@ public abstract class AbstractContainerMenu {
public abstract boolean stillValid(Player player); public abstract boolean stillValid(Player player);
protected boolean moveItemStackTo(ItemStack stack, int startIndex, int endIndex, boolean fromLast) { protected boolean moveItemStackTo(ItemStack stack, int startIndex, int endIndex, boolean fromLast) {
@ -55,7 +55,7 @@ index 8a1035c0aa859f67a6806c183d96a88ddf760baa..46159a127d910028c62ada90ff2d2dcc
boolean flag1 = false; boolean flag1 = false;
int k = startIndex; int k = startIndex;
@@ -791,6 +799,11 @@ public abstract class AbstractContainerMenu { @@ -854,6 +862,11 @@ public abstract class AbstractContainerMenu {
slot = (Slot) this.slots.get(k); slot = (Slot) this.slots.get(k);
itemstack1 = slot.getItem(); itemstack1 = slot.getItem();
@ -67,7 +67,7 @@ index 8a1035c0aa859f67a6806c183d96a88ddf760baa..46159a127d910028c62ada90ff2d2dcc
if (!itemstack1.isEmpty() && ItemStack.isSameItemSameComponents(stack, itemstack1)) { if (!itemstack1.isEmpty() && ItemStack.isSameItemSameComponents(stack, itemstack1)) {
l = itemstack1.getCount() + stack.getCount(); l = itemstack1.getCount() + stack.getCount();
int i1 = slot.getMaxStackSize(itemstack1); int i1 = slot.getMaxStackSize(itemstack1);
@@ -798,12 +811,16 @@ public abstract class AbstractContainerMenu { @@ -861,12 +874,16 @@ public abstract class AbstractContainerMenu {
if (l <= i1) { if (l <= i1) {
stack.setCount(0); stack.setCount(0);
itemstack1.setCount(l); itemstack1.setCount(l);
@ -84,7 +84,7 @@ index 8a1035c0aa859f67a6806c183d96a88ddf760baa..46159a127d910028c62ada90ff2d2dcc
flag1 = true; flag1 = true;
} }
} }
@@ -834,10 +851,21 @@ public abstract class AbstractContainerMenu { @@ -897,10 +914,21 @@ public abstract class AbstractContainerMenu {
slot = (Slot) this.slots.get(k); slot = (Slot) this.slots.get(k);
itemstack1 = slot.getItem(); itemstack1 = slot.getItem();
@ -107,10 +107,10 @@ index 8a1035c0aa859f67a6806c183d96a88ddf760baa..46159a127d910028c62ada90ff2d2dcc
break; break;
} }
diff --git a/src/main/java/net/minecraft/world/inventory/MerchantMenu.java b/src/main/java/net/minecraft/world/inventory/MerchantMenu.java diff --git a/src/main/java/net/minecraft/world/inventory/MerchantMenu.java b/src/main/java/net/minecraft/world/inventory/MerchantMenu.java
index e45ab844afdf1a65f23eeff4c4d6cd9e3a8a28e2..5de2030452b96a4df7ce0be82f07e002db595dee 100644 index 90560dfad263d42432dc034a29930e6bab953b9a..6a529b5e289c416c0ebdc0260086ec039777aa40 100644
--- a/src/main/java/net/minecraft/world/inventory/MerchantMenu.java --- a/src/main/java/net/minecraft/world/inventory/MerchantMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/MerchantMenu.java +++ b/src/main/java/net/minecraft/world/inventory/MerchantMenu.java
@@ -135,12 +135,12 @@ public class MerchantMenu extends AbstractContainerMenu { @@ -123,12 +123,12 @@ public class MerchantMenu extends AbstractContainerMenu {
itemstack = itemstack1.copy(); itemstack = itemstack1.copy();
if (slot == 2) { if (slot == 2) {
@ -126,7 +126,7 @@ index e45ab844afdf1a65f23eeff4c4d6cd9e3a8a28e2..5de2030452b96a4df7ce0be82f07e002
} else if (slot != 0 && slot != 1) { } else if (slot != 0 && slot != 1) {
if (slot >= 3 && slot < 30) { if (slot >= 3 && slot < 30) {
if (!this.moveItemStackTo(itemstack1, 30, 39, false)) { if (!this.moveItemStackTo(itemstack1, 30, 39, false)) {
@@ -153,6 +153,7 @@ public class MerchantMenu extends AbstractContainerMenu { @@ -141,6 +141,7 @@ public class MerchantMenu extends AbstractContainerMenu {
return ItemStack.EMPTY; return ItemStack.EMPTY;
} }
@ -134,7 +134,7 @@ index e45ab844afdf1a65f23eeff4c4d6cd9e3a8a28e2..5de2030452b96a4df7ce0be82f07e002
if (itemstack1.isEmpty()) { if (itemstack1.isEmpty()) {
slot1.setByPlayer(ItemStack.EMPTY); slot1.setByPlayer(ItemStack.EMPTY);
} else { } else {
@@ -164,6 +165,21 @@ public class MerchantMenu extends AbstractContainerMenu { @@ -152,6 +153,21 @@ public class MerchantMenu extends AbstractContainerMenu {
} }
slot1.onTake(player, itemstack1); slot1.onTake(player, itemstack1);

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add ShulkerDuplicateEvent
diff --git a/src/main/java/net/minecraft/world/entity/monster/Shulker.java b/src/main/java/net/minecraft/world/entity/monster/Shulker.java diff --git a/src/main/java/net/minecraft/world/entity/monster/Shulker.java b/src/main/java/net/minecraft/world/entity/monster/Shulker.java
index bf58956379d0a5dbfdc34e8626847638b4111433..920c7a92643e83598f39bf984cca430d9deed2cd 100644 index 0fffa9dbcbbb15a2138f9a4e4d8e812c8047a7bb..6e0f2f6573ed6be9b91de960d55c269417ad8907 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Shulker.java --- a/src/main/java/net/minecraft/world/entity/monster/Shulker.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Shulker.java +++ b/src/main/java/net/minecraft/world/entity/monster/Shulker.java
@@ -491,6 +491,11 @@ public class Shulker extends AbstractGolem implements VariantHolder<Optional<Dye @@ -492,6 +492,11 @@ public class Shulker extends AbstractGolem implements VariantHolder<Optional<Dye
if (entityshulker != null) { if (entityshulker != null) {
entityshulker.setVariant(this.getVariant()); entityshulker.setVariant(this.getVariant());
entityshulker.moveTo(vec3d); entityshulker.moveTo(vec3d);

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add api for spawn egg texture colors
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index b07c8111daa010dee2bb8be52162aafa4c267f1f..73a3e708f21c1b9c5de1fc180f728d6da7eea0fb 100644 index fa3add7cc39997d137b9dbc2178e08e9a6e5f31a..b6591836a8d9301b8cf909223426df0e8e675c1f 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -643,6 +643,15 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -643,6 +643,15 @@ public final class CraftMagicNumbers implements UnsafeValues {