[ci skip] Add more patch identifying comments
Dieser Commit ist enthalten in:
Ursprung
848a3960f6
Commit
ebf97bdfdd
@ -1,11 +1,11 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: lukas81298 <lukas81298@gmail.com>
|
From: lukas81298 <lukas81298@gmail.com>
|
||||||
Date: Tue, 12 Jan 2021 14:41:38 +0100
|
Date: Tue, 12 Jan 2021 14:41:38 +0100
|
||||||
Subject: [PATCH] fixed entity vehicle collision event not called
|
Subject: [PATCH] fix entity vehicle collision event not called
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
|
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
|
||||||
index 9780232286052d2cbbd604e71caf47dfb81fc1dc..c906ca07509939a06b9aaf2da0dafb172830a638 100644
|
index 9780232286052d2cbbd604e71caf47dfb81fc1dc..dc421a0a6430583f1f0154e1dd689b80253f6e3d 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
|
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
|
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
|
||||||
@@ -168,7 +168,15 @@ public abstract class AbstractMinecart extends VehicleEntity {
|
@@ -168,7 +168,15 @@ public abstract class AbstractMinecart extends VehicleEntity {
|
||||||
@ -13,7 +13,7 @@ index 9780232286052d2cbbd604e71caf47dfb81fc1dc..c906ca07509939a06b9aaf2da0dafb17
|
|||||||
@Override
|
@Override
|
||||||
public boolean canCollideWith(Entity other) {
|
public boolean canCollideWith(Entity other) {
|
||||||
- return Boat.canVehicleCollide(this, other);
|
- return Boat.canVehicleCollide(this, other);
|
||||||
+ // Paper start - fixed VehicleEntityCollisionEvent not called when colliding with player
|
+ // Paper start - fix VehicleEntityCollisionEvent not called when colliding with player
|
||||||
+ boolean collides = Boat.canVehicleCollide(this, other);
|
+ boolean collides = Boat.canVehicleCollide(this, other);
|
||||||
+ if (!collides) {
|
+ if (!collides) {
|
||||||
+ return false;
|
+ return false;
|
||||||
@ -21,7 +21,7 @@ index 9780232286052d2cbbd604e71caf47dfb81fc1dc..c906ca07509939a06b9aaf2da0dafb17
|
|||||||
+ org.bukkit.event.vehicle.VehicleEntityCollisionEvent collisionEvent = new org.bukkit.event.vehicle.VehicleEntityCollisionEvent((org.bukkit.entity.Vehicle) getBukkitEntity(), other.getBukkitEntity());
|
+ org.bukkit.event.vehicle.VehicleEntityCollisionEvent collisionEvent = new org.bukkit.event.vehicle.VehicleEntityCollisionEvent((org.bukkit.entity.Vehicle) getBukkitEntity(), other.getBukkitEntity());
|
||||||
+
|
+
|
||||||
+ return collisionEvent.callEvent();
|
+ return collisionEvent.callEvent();
|
||||||
+ // Paper end
|
+ // Paper end - fix VehicleEntityCollisionEvent not called when colliding with player
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
@ -1,25 +1,25 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: lukas81298 <lukas81298@gommehd.net>
|
From: lukas81298 <lukas81298@gommehd.net>
|
||||||
Date: Fri, 22 Jan 2021 21:50:18 +0100
|
Date: Fri, 22 Jan 2021 21:50:18 +0100
|
||||||
Subject: [PATCH] optimized dirt and snow spreading
|
Subject: [PATCH] optimize dirt and snow spreading
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java b/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java
|
diff --git a/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java b/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java
|
||||||
index f38524cbcaa908644d901bf0929331d6dfd99ed9..1acdf9dad2621a20b077c5f88dab5e0f8688a38f 100644
|
index f38524cbcaa908644d901bf0929331d6dfd99ed9..35a70bd30bc4beb06de4bb6e305ec3a787b43044 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java
|
--- a/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java
|
+++ b/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java
|
||||||
@@ -19,8 +19,13 @@ public abstract class SpreadingSnowyDirtBlock extends SnowyDirtBlock {
|
@@ -19,8 +19,13 @@ public abstract class SpreadingSnowyDirtBlock extends SnowyDirtBlock {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean canBeGrass(BlockState state, LevelReader world, BlockPos pos) {
|
private static boolean canBeGrass(BlockState state, LevelReader world, BlockPos pos) {
|
||||||
+ // Paper start
|
+ // Paper start - Perf: optimize dirt and snow spreading
|
||||||
+ return canBeGrass(world.getChunk(pos), state, world, pos);
|
+ return canBeGrass(world.getChunk(pos), state, world, pos);
|
||||||
+ }
|
+ }
|
||||||
+ private static boolean canBeGrass(net.minecraft.world.level.chunk.ChunkAccess chunk, BlockState state, LevelReader world, BlockPos pos) {
|
+ private static boolean canBeGrass(net.minecraft.world.level.chunk.ChunkAccess chunk, BlockState state, LevelReader world, BlockPos pos) {
|
||||||
+ // Paper end
|
+ // Paper end - Perf: optimize dirt and snow spreading
|
||||||
BlockPos blockposition1 = pos.above();
|
BlockPos blockposition1 = pos.above();
|
||||||
- BlockState iblockdata1 = world.getBlockState(blockposition1);
|
- BlockState iblockdata1 = world.getBlockState(blockposition1);
|
||||||
+ BlockState iblockdata1 = chunk.getBlockState(blockposition1); // Paper
|
+ BlockState iblockdata1 = chunk.getBlockState(blockposition1); // Paper - Perf: optimize dirt and snow spreading
|
||||||
|
|
||||||
if (iblockdata1.is(Blocks.SNOW) && (Integer) iblockdata1.getValue(SnowLayerBlock.LAYERS) == 1) {
|
if (iblockdata1.is(Blocks.SNOW) && (Integer) iblockdata1.getValue(SnowLayerBlock.LAYERS) == 1) {
|
||||||
return true;
|
return true;
|
||||||
@ -27,29 +27,29 @@ index f38524cbcaa908644d901bf0929331d6dfd99ed9..1acdf9dad2621a20b077c5f88dab5e0f
|
|||||||
protected abstract MapCodec<? extends SpreadingSnowyDirtBlock> codec();
|
protected abstract MapCodec<? extends SpreadingSnowyDirtBlock> codec();
|
||||||
|
|
||||||
private static boolean canPropagate(BlockState state, LevelReader world, BlockPos pos) {
|
private static boolean canPropagate(BlockState state, LevelReader world, BlockPos pos) {
|
||||||
+ // Paper start
|
+ // Paper start - Perf: optimize dirt and snow spreading
|
||||||
+ return canPropagate(world.getChunk(pos), state, world, pos);
|
+ return canPropagate(world.getChunk(pos), state, world, pos);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ private static boolean canPropagate(net.minecraft.world.level.chunk.ChunkAccess chunk, BlockState state, LevelReader world, BlockPos pos) {
|
+ private static boolean canPropagate(net.minecraft.world.level.chunk.ChunkAccess chunk, BlockState state, LevelReader world, BlockPos pos) {
|
||||||
+ // Paper end
|
+ // Paper end - Perf: optimize dirt and snow spreading
|
||||||
BlockPos blockposition1 = pos.above();
|
BlockPos blockposition1 = pos.above();
|
||||||
|
|
||||||
- return SpreadingSnowyDirtBlock.canBeGrass(state, world, pos) && !world.getFluidState(blockposition1).is(FluidTags.WATER);
|
- return SpreadingSnowyDirtBlock.canBeGrass(state, world, pos) && !world.getFluidState(blockposition1).is(FluidTags.WATER);
|
||||||
+ return SpreadingSnowyDirtBlock.canBeGrass(chunk, state, world, pos) && !chunk.getFluidState(blockposition1).is(FluidTags.WATER); // Paper
|
+ return SpreadingSnowyDirtBlock.canBeGrass(chunk, state, world, pos) && !chunk.getFluidState(blockposition1).is(FluidTags.WATER); // Paper - Perf: optimize dirt and snow spreading
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
|
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
|
||||||
if (this instanceof GrassBlock && world.paperConfig().tickRates.grassSpread != 1 && (world.paperConfig().tickRates.grassSpread < 1 || (MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig().tickRates.grassSpread != 0)) { return; } // Paper
|
if (this instanceof GrassBlock && world.paperConfig().tickRates.grassSpread != 1 && (world.paperConfig().tickRates.grassSpread < 1 || (MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig().tickRates.grassSpread != 0)) { return; } // Paper
|
||||||
- if (!SpreadingSnowyDirtBlock.canBeGrass(state, world, pos)) {
|
- if (!SpreadingSnowyDirtBlock.canBeGrass(state, world, pos)) {
|
||||||
+ // Paper start
|
+ // Paper start - Perf: optimize dirt and snow spreading
|
||||||
+ net.minecraft.world.level.chunk.ChunkAccess cachedBlockChunk = world.getChunkIfLoaded(pos);
|
+ net.minecraft.world.level.chunk.ChunkAccess cachedBlockChunk = world.getChunkIfLoaded(pos);
|
||||||
+ if (cachedBlockChunk == null) { // Is this needed?
|
+ if (cachedBlockChunk == null) { // Is this needed?
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
+ if (!SpreadingSnowyDirtBlock.canBeGrass(cachedBlockChunk, state, world, pos)) {
|
+ if (!SpreadingSnowyDirtBlock.canBeGrass(cachedBlockChunk, state, world, pos)) {
|
||||||
+ // Paper end
|
+ // Paper end - Perf: optimize dirt and snow spreading
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world, pos, Blocks.DIRT.defaultBlockState()).isCancelled()) {
|
if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world, pos, Blocks.DIRT.defaultBlockState()).isCancelled()) {
|
||||||
return;
|
return;
|
||||||
@ -60,7 +60,7 @@ index f38524cbcaa908644d901bf0929331d6dfd99ed9..1acdf9dad2621a20b077c5f88dab5e0f
|
|||||||
-
|
-
|
||||||
- if (world.getBlockState(blockposition1).is(Blocks.DIRT) && SpreadingSnowyDirtBlock.canPropagate(iblockdata1, world, blockposition1)) {
|
- if (world.getBlockState(blockposition1).is(Blocks.DIRT) && SpreadingSnowyDirtBlock.canPropagate(iblockdata1, world, blockposition1)) {
|
||||||
- org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(world, pos, blockposition1, (BlockState) iblockdata1.setValue(SpreadingSnowyDirtBlock.SNOWY, world.getBlockState(blockposition1.above()).is(Blocks.SNOW))); // CraftBukkit
|
- org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(world, pos, blockposition1, (BlockState) iblockdata1.setValue(SpreadingSnowyDirtBlock.SNOWY, world.getBlockState(blockposition1.above()).is(Blocks.SNOW))); // CraftBukkit
|
||||||
+ // Paper start
|
+ // Paper start - Perf: optimize dirt and snow spreading
|
||||||
+ if (pos.getX() == blockposition1.getX() && pos.getY() == blockposition1.getY() && pos.getZ() == blockposition1.getZ()) {
|
+ if (pos.getX() == blockposition1.getX() && pos.getY() == blockposition1.getY() && pos.getZ() == blockposition1.getZ()) {
|
||||||
+ continue;
|
+ continue;
|
||||||
+ }
|
+ }
|
||||||
@ -72,7 +72,7 @@ index f38524cbcaa908644d901bf0929331d6dfd99ed9..1acdf9dad2621a20b077c5f88dab5e0f
|
|||||||
+ }
|
+ }
|
||||||
+ if (access.getBlockState(blockposition1).is(Blocks.DIRT) && SpreadingSnowyDirtBlock.canPropagate(access, iblockdata1, world, blockposition1)) {
|
+ if (access.getBlockState(blockposition1).is(Blocks.DIRT) && SpreadingSnowyDirtBlock.canPropagate(access, iblockdata1, world, blockposition1)) {
|
||||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(world, pos, blockposition1, (BlockState) iblockdata1.setValue(SpreadingSnowyDirtBlock.SNOWY, access.getBlockState(blockposition1.above()).is(Blocks.SNOW))); // CraftBukkit
|
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(world, pos, blockposition1, (BlockState) iblockdata1.setValue(SpreadingSnowyDirtBlock.SNOWY, access.getBlockState(blockposition1.above()).is(Blocks.SNOW))); // CraftBukkit
|
||||||
+ // Paper end
|
+ // Paper end - Perf: optimize dirt and snow spreading
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,11 +1,11 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: KyGuy2002 <IEatBeans#1165>
|
From: KyGuy2002 <IEatBeans#1165>
|
||||||
Date: Fri, 11 Mar 2022 15:33:10 +0000
|
Date: Fri, 11 Mar 2022 15:33:10 +0000
|
||||||
Subject: [PATCH] Added EntityToggleSitEvent
|
Subject: [PATCH] Add EntityToggleSitEvent
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/TamableAnimal.java b/src/main/java/net/minecraft/world/entity/TamableAnimal.java
|
diff --git a/src/main/java/net/minecraft/world/entity/TamableAnimal.java b/src/main/java/net/minecraft/world/entity/TamableAnimal.java
|
||||||
index 1999cda5876bb12283d8c91a1b3e737c0d27bc38..1611a54bb68af34bfcbfd17028f564b7332aa489 100644
|
index 1999cda5876bb12283d8c91a1b3e737c0d27bc38..4d32db04040014dba8935d1cb601e0da1a5d5b02 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/TamableAnimal.java
|
--- a/src/main/java/net/minecraft/world/entity/TamableAnimal.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/TamableAnimal.java
|
+++ b/src/main/java/net/minecraft/world/entity/TamableAnimal.java
|
||||||
@@ -67,7 +67,7 @@ public abstract class TamableAnimal extends Animal implements OwnableEntity {
|
@@ -67,7 +67,7 @@ public abstract class TamableAnimal extends Animal implements OwnableEntity {
|
||||||
@ -13,7 +13,7 @@ index 1999cda5876bb12283d8c91a1b3e737c0d27bc38..1611a54bb68af34bfcbfd17028f564b7
|
|||||||
|
|
||||||
this.orderedToSit = nbt.getBoolean("Sitting");
|
this.orderedToSit = nbt.getBoolean("Sitting");
|
||||||
- this.setInSittingPose(this.orderedToSit);
|
- this.setInSittingPose(this.orderedToSit);
|
||||||
+ this.setInSittingPose(this.orderedToSit, false); // Paper - Don't fire event
|
+ this.setInSittingPose(this.orderedToSit, false); // Paper - Add EntityToggleSitEvent
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -21,17 +21,17 @@ index 1999cda5876bb12283d8c91a1b3e737c0d27bc38..1611a54bb68af34bfcbfd17028f564b7
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setInSittingPose(boolean inSittingPose) {
|
public void setInSittingPose(boolean inSittingPose) {
|
||||||
+ // Paper start
|
+ // Paper start - Add EntityToggleSitEvent
|
||||||
+ this.setInSittingPose(inSittingPose, true);
|
+ this.setInSittingPose(inSittingPose, true);
|
||||||
+ }
|
+ }
|
||||||
+ public void setInSittingPose(boolean inSittingPose, boolean callEvent) {
|
+ public void setInSittingPose(boolean inSittingPose, boolean callEvent) {
|
||||||
+ // Paper end
|
+ if (callEvent && !new io.papermc.paper.event.entity.EntityToggleSitEvent(this.getBukkitEntity(), inSittingPose).callEvent()) return;
|
||||||
+ if (callEvent && !new io.papermc.paper.event.entity.EntityToggleSitEvent(this.getBukkitEntity(), inSittingPose).callEvent()) return; // Paper start - call EntityToggleSitEvent
|
+ // Paper end - Add EntityToggleSitEvent
|
||||||
byte b = this.entityData.get(DATA_FLAGS_ID);
|
byte b = this.entityData.get(DATA_FLAGS_ID);
|
||||||
if (inSittingPose) {
|
if (inSittingPose) {
|
||||||
this.entityData.set(DATA_FLAGS_ID, (byte)(b | 1));
|
this.entityData.set(DATA_FLAGS_ID, (byte)(b | 1));
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Fox.java b/src/main/java/net/minecraft/world/entity/animal/Fox.java
|
diff --git a/src/main/java/net/minecraft/world/entity/animal/Fox.java b/src/main/java/net/minecraft/world/entity/animal/Fox.java
|
||||||
index 96799179b0dd1886f0cdc386f04e152a19b3337d..d17c69a857f083350cc9e9ec2b5dbe0a1482c85f 100644
|
index 96799179b0dd1886f0cdc386f04e152a19b3337d..a1c28f9590908df5dd9d850dd3f0cadbe83b05c6 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/animal/Fox.java
|
--- a/src/main/java/net/minecraft/world/entity/animal/Fox.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Fox.java
|
+++ b/src/main/java/net/minecraft/world/entity/animal/Fox.java
|
||||||
@@ -433,7 +433,7 @@ public class Fox extends Animal implements VariantHolder<Fox.Type> {
|
@@ -433,7 +433,7 @@ public class Fox extends Animal implements VariantHolder<Fox.Type> {
|
||||||
@ -39,7 +39,7 @@ index 96799179b0dd1886f0cdc386f04e152a19b3337d..d17c69a857f083350cc9e9ec2b5dbe0a
|
|||||||
this.setSleeping(nbt.getBoolean("Sleeping"));
|
this.setSleeping(nbt.getBoolean("Sleeping"));
|
||||||
this.setVariant(Fox.Type.byName(nbt.getString("Type")));
|
this.setVariant(Fox.Type.byName(nbt.getString("Type")));
|
||||||
- this.setSitting(nbt.getBoolean("Sitting"));
|
- this.setSitting(nbt.getBoolean("Sitting"));
|
||||||
+ this.setSitting(nbt.getBoolean("Sitting"), false); // Paper
|
+ this.setSitting(nbt.getBoolean("Sitting"), false); // Paper - Add EntityToggleSitEvent
|
||||||
this.setIsCrouching(nbt.getBoolean("Crouching"));
|
this.setIsCrouching(nbt.getBoolean("Crouching"));
|
||||||
if (this.level() instanceof ServerLevel) {
|
if (this.level() instanceof ServerLevel) {
|
||||||
this.setTargetGoals();
|
this.setTargetGoals();
|
||||||
@ -47,29 +47,29 @@ index 96799179b0dd1886f0cdc386f04e152a19b3337d..d17c69a857f083350cc9e9ec2b5dbe0a
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setSitting(boolean sitting) {
|
public void setSitting(boolean sitting) {
|
||||||
|
+ // Paper start
|
||||||
+ this.setSitting(sitting, true);
|
+ this.setSitting(sitting, true);
|
||||||
+ }
|
+ }
|
||||||
+ // Paper start
|
|
||||||
+ public void setSitting(boolean sitting, boolean fireEvent) {
|
+ public void setSitting(boolean sitting, boolean fireEvent) {
|
||||||
+ if (fireEvent && !new io.papermc.paper.event.entity.EntityToggleSitEvent(this.getBukkitEntity(), sitting).callEvent()) return;
|
+ if (fireEvent && !new io.papermc.paper.event.entity.EntityToggleSitEvent(this.getBukkitEntity(), sitting).callEvent()) return;
|
||||||
+ // Paper end
|
+ // Paper end - Add EntityToggleSitEvent
|
||||||
this.setFlag(1, sitting);
|
this.setFlag(1, sitting);
|
||||||
}
|
}
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Panda.java b/src/main/java/net/minecraft/world/entity/animal/Panda.java
|
diff --git a/src/main/java/net/minecraft/world/entity/animal/Panda.java b/src/main/java/net/minecraft/world/entity/animal/Panda.java
|
||||||
index 130761afcaa6723e0a9d9a518f1b526c344484b4..683cc5f9f066d554383fcd30e3654ac06ec76510 100644
|
index 130761afcaa6723e0a9d9a518f1b526c344484b4..25a7602670b9f736b3b9ff4523bc867e65c0998a 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/animal/Panda.java
|
--- a/src/main/java/net/minecraft/world/entity/animal/Panda.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Panda.java
|
+++ b/src/main/java/net/minecraft/world/entity/animal/Panda.java
|
||||||
@@ -138,6 +138,7 @@ public class Panda extends Animal {
|
@@ -138,6 +138,7 @@ public class Panda extends Animal {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sit(boolean sitting) {
|
public void sit(boolean sitting) {
|
||||||
+ if (!new io.papermc.paper.event.entity.EntityToggleSitEvent(this.getBukkitEntity(), sitting).callEvent()) return; // Paper start - call EntityToggleSitEvent
|
+ if (!new io.papermc.paper.event.entity.EntityToggleSitEvent(this.getBukkitEntity(), sitting).callEvent()) return; // Paper - Add EntityToggleSitEvent
|
||||||
this.setFlag(8, sitting);
|
this.setFlag(8, sitting);
|
||||||
}
|
}
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
|
diff --git a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
|
||||||
index faf3e31f23d71bbc345bf98d4240490ac4677843..1d9427da270edb447a2c8e031c4f05fe5d39603b 100644
|
index faf3e31f23d71bbc345bf98d4240490ac4677843..17cff1a4657f688ed704404f76f6ceead3be3be1 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
|
--- a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
|
+++ b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
|
||||||
@@ -556,7 +556,7 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Saddl
|
@@ -556,7 +556,7 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Saddl
|
||||||
@ -77,7 +77,7 @@ index faf3e31f23d71bbc345bf98d4240490ac4677843..1d9427da270edb447a2c8e031c4f05fe
|
|||||||
|
|
||||||
public void sitDown() {
|
public void sitDown() {
|
||||||
- if (!this.isCamelSitting()) {
|
- if (!this.isCamelSitting()) {
|
||||||
+ if (!this.isCamelSitting() && new io.papermc.paper.event.entity.EntityToggleSitEvent(this.getBukkitEntity(), true).callEvent()) { // Paper
|
+ if (!this.isCamelSitting() && new io.papermc.paper.event.entity.EntityToggleSitEvent(this.getBukkitEntity(), true).callEvent()) { // Paper - Add EntityToggleSitEvent
|
||||||
this.playSound(SoundEvents.CAMEL_SIT, 1.0F, this.getVoicePitch());
|
this.playSound(SoundEvents.CAMEL_SIT, 1.0F, this.getVoicePitch());
|
||||||
this.setPose(Pose.SITTING);
|
this.setPose(Pose.SITTING);
|
||||||
this.gameEvent(GameEvent.ENTITY_ACTION);
|
this.gameEvent(GameEvent.ENTITY_ACTION);
|
||||||
@ -86,7 +86,7 @@ index faf3e31f23d71bbc345bf98d4240490ac4677843..1d9427da270edb447a2c8e031c4f05fe
|
|||||||
|
|
||||||
public void standUp() {
|
public void standUp() {
|
||||||
- if (this.isCamelSitting()) {
|
- if (this.isCamelSitting()) {
|
||||||
+ if (this.isCamelSitting() && new io.papermc.paper.event.entity.EntityToggleSitEvent(this.getBukkitEntity(), false).callEvent()) { // Paper
|
+ if (this.isCamelSitting() && new io.papermc.paper.event.entity.EntityToggleSitEvent(this.getBukkitEntity(), false).callEvent()) { // Paper - Add EntityToggleSitEvent
|
||||||
this.playSound(SoundEvents.CAMEL_STAND, 1.0F, this.getVoicePitch());
|
this.playSound(SoundEvents.CAMEL_STAND, 1.0F, this.getVoicePitch());
|
||||||
this.setPose(Pose.STANDING);
|
this.setPose(Pose.STANDING);
|
||||||
this.gameEvent(GameEvent.ENTITY_ACTION);
|
this.gameEvent(GameEvent.ENTITY_ACTION);
|
||||||
@ -94,7 +94,7 @@ index faf3e31f23d71bbc345bf98d4240490ac4677843..1d9427da270edb447a2c8e031c4f05fe
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void standUpInstantly() {
|
public void standUpInstantly() {
|
||||||
+ if (this.isCamelSitting() && !new io.papermc.paper.event.entity.EntityToggleSitEvent(this.getBukkitEntity(), false).callEvent()) return; // Paper
|
+ if (this.isCamelSitting() && !new io.papermc.paper.event.entity.EntityToggleSitEvent(this.getBukkitEntity(), false).callEvent()) return; // Paper - Add EntityToggleSitEvent
|
||||||
this.setPose(Pose.STANDING);
|
this.setPose(Pose.STANDING);
|
||||||
this.gameEvent(GameEvent.ENTITY_ACTION);
|
this.gameEvent(GameEvent.ENTITY_ACTION);
|
||||||
this.resetLastPoseChangeTickToFullStand(this.level().getGameTime());
|
this.resetLastPoseChangeTickToFullStand(this.level().getGameTime());
|
@ -5,7 +5,7 @@ Subject: [PATCH] Add fire-tick-delay option
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/FireBlock.java b/src/main/java/net/minecraft/world/level/block/FireBlock.java
|
diff --git a/src/main/java/net/minecraft/world/level/block/FireBlock.java b/src/main/java/net/minecraft/world/level/block/FireBlock.java
|
||||||
index 3fb197ee3bfd3f36881b7d67f7a37f035bb27daf..8c0db5219ff30bdfae61b4b9f6033c8e28d21ee1 100644
|
index 3fb197ee3bfd3f36881b7d67f7a37f035bb27daf..03310fe5d05bc9c61df221977c071757a488c352 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/FireBlock.java
|
--- a/src/main/java/net/minecraft/world/level/block/FireBlock.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/FireBlock.java
|
+++ b/src/main/java/net/minecraft/world/level/block/FireBlock.java
|
||||||
@@ -172,7 +172,7 @@ public class FireBlock extends BaseFireBlock {
|
@@ -172,7 +172,7 @@ public class FireBlock extends BaseFireBlock {
|
||||||
@ -13,7 +13,7 @@ index 3fb197ee3bfd3f36881b7d67f7a37f035bb27daf..8c0db5219ff30bdfae61b4b9f6033c8e
|
|||||||
@Override
|
@Override
|
||||||
public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
|
public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
|
||||||
- world.scheduleTick(pos, (Block) this, FireBlock.getFireTickDelay(world.random));
|
- world.scheduleTick(pos, (Block) this, FireBlock.getFireTickDelay(world.random));
|
||||||
+ world.scheduleTick(pos, (Block) this, FireBlock.getFireTickDelay(world)); // Paper
|
+ world.scheduleTick(pos, (Block) this, FireBlock.getFireTickDelay(world)); // Paper - Add fire-tick-delay option
|
||||||
if (world.getGameRules().getBoolean(GameRules.RULE_DOFIRETICK)) {
|
if (world.getGameRules().getBoolean(GameRules.RULE_DOFIRETICK)) {
|
||||||
if (!state.canSurvive(world, pos)) {
|
if (!state.canSurvive(world, pos)) {
|
||||||
this.fireExtinguished(world, pos); // CraftBukkit - invalid place location
|
this.fireExtinguished(world, pos); // CraftBukkit - invalid place location
|
||||||
@ -22,15 +22,15 @@ index 3fb197ee3bfd3f36881b7d67f7a37f035bb27daf..8c0db5219ff30bdfae61b4b9f6033c8e
|
|||||||
super.onPlace(iblockdata, world, blockposition, iblockdata1, flag, itemActionContext);
|
super.onPlace(iblockdata, world, blockposition, iblockdata1, flag, itemActionContext);
|
||||||
// Paper end
|
// Paper end
|
||||||
- world.scheduleTick(blockposition, this, getFireTickDelay(world.random));
|
- world.scheduleTick(blockposition, this, getFireTickDelay(world.random));
|
||||||
+ world.scheduleTick(blockposition, this, getFireTickDelay(world)); // Paper
|
+ world.scheduleTick(blockposition, this, getFireTickDelay(world)); // Paper - Add fire-tick-delay option
|
||||||
}
|
}
|
||||||
|
|
||||||
- private static int getFireTickDelay(RandomSource random) {
|
- private static int getFireTickDelay(RandomSource random) {
|
||||||
- return 30 + random.nextInt(10);
|
- return 30 + random.nextInt(10);
|
||||||
+ // Paper start - customisable fire tick delay
|
+ // Paper start - Add fire-tick-delay option
|
||||||
+ private static int getFireTickDelay(Level world) {
|
+ private static int getFireTickDelay(Level world) {
|
||||||
+ return world.paperConfig().environment.fireTickDelay + world.random.nextInt(10);
|
+ return world.paperConfig().environment.fireTickDelay + world.random.nextInt(10);
|
||||||
+ // Paper end
|
+ // Paper end - Add fire-tick-delay option
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -5,14 +5,14 @@ Subject: [PATCH] Track projectile source for fireworks from dispensers
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
||||||
index d9077127757886e5d5e8d63a46fe27f2bfba1420..b65d0c2ac5b4f7eb3da85b693c354463c6f49694 100644
|
index d9077127757886e5d5e8d63a46fe27f2bfba1420..764ba041a6be42202d0bcda07ef194ca6909f9d9 100644
|
||||||
--- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
--- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
||||||
+++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
+++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
||||||
@@ -517,6 +517,7 @@ public interface DispenseItemBehavior {
|
@@ -517,6 +517,7 @@ public interface DispenseItemBehavior {
|
||||||
itemstack1 = CraftItemStack.asNMSCopy(event.getItem());
|
itemstack1 = CraftItemStack.asNMSCopy(event.getItem());
|
||||||
Vec3 vec3d = DispenseItemBehavior.getEntityPokingOutOfBlockPos(pointer, EntityType.FIREWORK_ROCKET, enumdirection);
|
Vec3 vec3d = DispenseItemBehavior.getEntityPokingOutOfBlockPos(pointer, EntityType.FIREWORK_ROCKET, enumdirection);
|
||||||
FireworkRocketEntity entityfireworks = new FireworkRocketEntity(pointer.level(), itemstack1, vec3d.x(), vec3d.y(), vec3d.z(), true); // Paper - GH-2871 - fix last firework in stack having no effects when dispensed
|
FireworkRocketEntity entityfireworks = new FireworkRocketEntity(pointer.level(), itemstack1, vec3d.x(), vec3d.y(), vec3d.z(), true); // Paper - GH-2871 - fix last firework in stack having no effects when dispensed
|
||||||
+ entityfireworks.projectileSource = new org.bukkit.craftbukkit.projectiles.CraftBlockProjectileSource(pointer.blockEntity()); // Paper - track projectile source for fireworks
|
+ entityfireworks.projectileSource = new org.bukkit.craftbukkit.projectiles.CraftBlockProjectileSource(pointer.blockEntity()); // PaperTrack projectile source for fireworks from dispensers
|
||||||
|
|
||||||
entityfireworks.shoot((double) enumdirection.getStepX(), (double) enumdirection.getStepY(), (double) enumdirection.getStepZ(), 0.5F, 1.0F);
|
entityfireworks.shoot((double) enumdirection.getStepX(), (double) enumdirection.getStepY(), (double) enumdirection.getStepZ(), 0.5F, 1.0F);
|
||||||
pointer.level().addFreshEntity(entityfireworks);
|
pointer.level().addFreshEntity(entityfireworks);
|
||||||
|
@ -9,7 +9,7 @@ suggestions, which especially matters when we force suggestions to
|
|||||||
the server for this type
|
the server for this type
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/commands/arguments/EntityArgument.java b/src/main/java/net/minecraft/commands/arguments/EntityArgument.java
|
diff --git a/src/main/java/net/minecraft/commands/arguments/EntityArgument.java b/src/main/java/net/minecraft/commands/arguments/EntityArgument.java
|
||||||
index a71726cee91fb406875a4540c9fb7c0ecf757294..150daf6bf4b27a6ff984d872a28002f19beef51c 100644
|
index a71726cee91fb406875a4540c9fb7c0ecf757294..21dfc4812414f6a75fdae7082c0fce788ebe095b 100644
|
||||||
--- a/src/main/java/net/minecraft/commands/arguments/EntityArgument.java
|
--- a/src/main/java/net/minecraft/commands/arguments/EntityArgument.java
|
||||||
+++ b/src/main/java/net/minecraft/commands/arguments/EntityArgument.java
|
+++ b/src/main/java/net/minecraft/commands/arguments/EntityArgument.java
|
||||||
@@ -128,7 +128,12 @@ public class EntityArgument implements ArgumentType<EntitySelector> {
|
@@ -128,7 +128,12 @@ public class EntityArgument implements ArgumentType<EntitySelector> {
|
||||||
@ -17,12 +17,12 @@ index a71726cee91fb406875a4540c9fb7c0ecf757294..150daf6bf4b27a6ff984d872a28002f1
|
|||||||
|
|
||||||
stringreader.setCursor(suggestionsbuilder.getStart());
|
stringreader.setCursor(suggestionsbuilder.getStart());
|
||||||
- EntitySelectorParser argumentparserselector = new EntitySelectorParser(stringreader, icompletionprovider.hasPermission(2), true); // Paper
|
- EntitySelectorParser argumentparserselector = new EntitySelectorParser(stringreader, icompletionprovider.hasPermission(2), true); // Paper
|
||||||
+ // Paper start
|
+ // Paper start - Fix EntityArgument suggestion permissions
|
||||||
+ final boolean permission = object instanceof CommandSourceStack stack
|
+ final boolean permission = object instanceof CommandSourceStack stack
|
||||||
+ ? stack.bypassSelectorPermissions || stack.hasPermission(2, "minecraft.command.selector")
|
+ ? stack.bypassSelectorPermissions || stack.hasPermission(2, "minecraft.command.selector")
|
||||||
+ : icompletionprovider.hasPermission(2);
|
+ : icompletionprovider.hasPermission(2);
|
||||||
+ EntitySelectorParser argumentparserselector = new EntitySelectorParser(stringreader, permission, true); // Paper
|
+ EntitySelectorParser argumentparserselector = new EntitySelectorParser(stringreader, permission, true); // Paper
|
||||||
+ // Paper end
|
+ // Paper end - Fix EntityArgument suggestion permissions
|
||||||
|
|
||||||
try {
|
try {
|
||||||
argumentparserselector.parse();
|
argumentparserselector.parse();
|
||||||
|
@ -6,32 +6,32 @@ Subject: [PATCH] Fix EntityCombustEvent cancellation cant fully prevent
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
index fcef36f5314107f416953fbd0f891da7348c2243..d5322f344b65c4442958eb4e36ddae1f9cfca974 100644
|
index fcef36f5314107f416953fbd0f891da7348c2243..f46640f3e3305b133bd49271377cedae4fe31ab5 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
@@ -3378,6 +3378,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
@@ -3378,6 +3378,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||||
pluginManager.callEvent(entityCombustEvent);
|
pluginManager.callEvent(entityCombustEvent);
|
||||||
if (!entityCombustEvent.isCancelled()) {
|
if (!entityCombustEvent.isCancelled()) {
|
||||||
this.setSecondsOnFire(entityCombustEvent.getDuration(), false);
|
this.setSecondsOnFire(entityCombustEvent.getDuration(), false);
|
||||||
+ // Paper start - fix EntityCombustEvent cancellation.
|
+ // Paper start - fix EntityCombustEvent cancellation
|
||||||
+ } else {
|
+ } else {
|
||||||
+ this.setRemainingFireTicks(this.remainingFireTicks - 1);
|
+ this.setRemainingFireTicks(this.remainingFireTicks - 1);
|
||||||
+ // Paper end
|
+ // Paper end - fix EntityCombustEvent cancellation
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java b/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java
|
diff --git a/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java b/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java
|
||||||
index 02cbb25b8b1fdaf6e2b771067ca132245eab13dc..116dc2ac4c0176244eb8fc22a471d2b9ede72822 100644
|
index 02cbb25b8b1fdaf6e2b771067ca132245eab13dc..c203aa71acc01fa802c2b1ebd253c0e1718ec4cd 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java
|
--- a/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java
|
+++ b/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java
|
||||||
@@ -134,6 +134,10 @@ public abstract class BaseFireBlock extends Block {
|
@@ -134,6 +134,10 @@ public abstract class BaseFireBlock extends Block {
|
||||||
|
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
entity.setSecondsOnFire(event.getDuration(), false);
|
entity.setSecondsOnFire(event.getDuration(), false);
|
||||||
+ // Paper start - fix EntityCombustEvent cancellation.
|
+ // Paper start - fix EntityCombustEvent cancellation
|
||||||
+ } else {
|
+ } else {
|
||||||
+ entity.setRemainingFireTicks(entity.getRemainingFireTicks() - 1);
|
+ entity.setRemainingFireTicks(entity.getRemainingFireTicks() - 1);
|
||||||
+ // Paper end
|
+ // Paper end - fix EntityCombustEvent cancellation
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Prevent compass from loading chunks
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/item/CompassItem.java b/src/main/java/net/minecraft/world/item/CompassItem.java
|
diff --git a/src/main/java/net/minecraft/world/item/CompassItem.java b/src/main/java/net/minecraft/world/item/CompassItem.java
|
||||||
index 5d3047a420efe59063e90bfc7b42392127e0ad7d..7c4a2f8bb3efd11db2f8711952cc26a067c6d56b 100644
|
index 5d3047a420efe59063e90bfc7b42392127e0ad7d..b3c67c954acf7e518d89d6af65a55d6f22dac059 100644
|
||||||
--- a/src/main/java/net/minecraft/world/item/CompassItem.java
|
--- a/src/main/java/net/minecraft/world/item/CompassItem.java
|
||||||
+++ b/src/main/java/net/minecraft/world/item/CompassItem.java
|
+++ b/src/main/java/net/minecraft/world/item/CompassItem.java
|
||||||
@@ -77,7 +77,7 @@ public class CompassItem extends Item implements Vanishable {
|
@@ -77,7 +77,7 @@ public class CompassItem extends Item implements Vanishable {
|
||||||
@ -13,7 +13,7 @@ index 5d3047a420efe59063e90bfc7b42392127e0ad7d..7c4a2f8bb3efd11db2f8711952cc26a0
|
|||||||
if (optional.isPresent() && optional.get() == world.dimension() && compoundTag.contains("LodestonePos")) {
|
if (optional.isPresent() && optional.get() == world.dimension() && compoundTag.contains("LodestonePos")) {
|
||||||
BlockPos blockPos = NbtUtils.readBlockPos(compoundTag.getCompound("LodestonePos"));
|
BlockPos blockPos = NbtUtils.readBlockPos(compoundTag.getCompound("LodestonePos"));
|
||||||
- if (!world.isInWorldBounds(blockPos) || !((ServerLevel)world).getPoiManager().existsAtPosition(PoiTypes.LODESTONE, blockPos)) {
|
- if (!world.isInWorldBounds(blockPos) || !((ServerLevel)world).getPoiManager().existsAtPosition(PoiTypes.LODESTONE, blockPos)) {
|
||||||
+ if (!world.isInWorldBounds(blockPos) || (world.hasChunkAt(blockPos) && !((ServerLevel)world).getPoiManager().existsAtPosition(PoiTypes.LODESTONE, blockPos))) { // Paper
|
+ if (!world.isInWorldBounds(blockPos) || (world.hasChunkAt(blockPos) && !((ServerLevel)world).getPoiManager().existsAtPosition(PoiTypes.LODESTONE, blockPos))) { // Paper - Prevent compass from loading chunks
|
||||||
compoundTag.remove("LodestonePos");
|
compoundTag.remove("LodestonePos");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Add PrePlayerAttackEntityEvent
|
|||||||
|
|
||||||
|
|
||||||
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 7a984f531d3ebb6e055f07227b2ef8247fb3a842..28fa46f29639a6b643b475912133d601028facb2 100644
|
index 7a984f531d3ebb6e055f07227b2ef8247fb3a842..13a443d942aee77f18e91669b207d8ec54bbaf65 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
|
||||||
@@ -1240,8 +1240,17 @@ public abstract class Player extends LivingEntity {
|
@@ -1240,8 +1240,17 @@ public abstract class Player extends LivingEntity {
|
||||||
@ -24,7 +24,7 @@ index 7a984f531d3ebb6e055f07227b2ef8247fb3a842..28fa46f29639a6b643b475912133d601
|
|||||||
+
|
+
|
||||||
+ if (playerAttackEntityEvent.callEvent() && willAttack) { // Logic moved to willAttack local variable.
|
+ if (playerAttackEntityEvent.callEvent() && willAttack) { // Logic moved to willAttack local variable.
|
||||||
+ {
|
+ {
|
||||||
+ // Paper end
|
+ // Paper end - PlayerAttackEntityEvent
|
||||||
float f = (float) this.getAttributeValue(Attributes.ATTACK_DAMAGE);
|
float f = (float) this.getAttributeValue(Attributes.ATTACK_DAMAGE);
|
||||||
float f1;
|
float f1;
|
||||||
|
|
||||||
|
@ -6,14 +6,14 @@ Subject: [PATCH] ensure reset EnderDragon boss event name
|
|||||||
Fix MC-257487
|
Fix MC-257487
|
||||||
|
|
||||||
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
|
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 44f799d595d7150f00dfdfa2f85c87386f896607..390542c42fe957e8e2d21c879c1c8908c8970b44 100644
|
index 44f799d595d7150f00dfdfa2f85c87386f896607..1469ad613e71bcf0fa8fb9b3389eb830dbd72ca0 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
|
--- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
|
+++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
|
||||||
@@ -73,6 +73,7 @@ public class EndDragonFight {
|
@@ -73,6 +73,7 @@ public class EndDragonFight {
|
||||||
private static final int GATEWAY_DISTANCE = 96;
|
private static final int GATEWAY_DISTANCE = 96;
|
||||||
public static final int DRAGON_SPAWN_Y = 128;
|
public static final int DRAGON_SPAWN_Y = 128;
|
||||||
private final Predicate<Entity> validPlayer;
|
private final Predicate<Entity> validPlayer;
|
||||||
+ private static final Component DEFAULT_BOSS_EVENT_NAME = Component.translatable("entity.minecraft.ender_dragon"); // Paper
|
+ private static final Component DEFAULT_BOSS_EVENT_NAME = Component.translatable("entity.minecraft.ender_dragon"); // Paper - ensure reset EnderDragon boss event name
|
||||||
public final ServerBossEvent dragonEvent;
|
public final ServerBossEvent dragonEvent;
|
||||||
public final ServerLevel level;
|
public final ServerLevel level;
|
||||||
private final BlockPos origin;
|
private final BlockPos origin;
|
||||||
@ -22,7 +22,7 @@ index 44f799d595d7150f00dfdfa2f85c87386f896607..390542c42fe957e8e2d21c879c1c8908
|
|||||||
|
|
||||||
public EndDragonFight(ServerLevel world, long gatewaysSeed, EndDragonFight.Data data, BlockPos origin) {
|
public EndDragonFight(ServerLevel world, long gatewaysSeed, EndDragonFight.Data data, BlockPos origin) {
|
||||||
- this.dragonEvent = (ServerBossEvent) (new ServerBossEvent(Component.translatable("entity.minecraft.ender_dragon"), BossEvent.BossBarColor.PINK, BossEvent.BossBarOverlay.PROGRESS)).setPlayBossMusic(true).setCreateWorldFog(true);
|
- this.dragonEvent = (ServerBossEvent) (new ServerBossEvent(Component.translatable("entity.minecraft.ender_dragon"), BossEvent.BossBarColor.PINK, BossEvent.BossBarOverlay.PROGRESS)).setPlayBossMusic(true).setCreateWorldFog(true);
|
||||||
+ this.dragonEvent = (ServerBossEvent) (new ServerBossEvent(DEFAULT_BOSS_EVENT_NAME, BossEvent.BossBarColor.PINK, BossEvent.BossBarOverlay.PROGRESS)).setPlayBossMusic(true).setCreateWorldFog(true); // Paper
|
+ this.dragonEvent = (ServerBossEvent) (new ServerBossEvent(DEFAULT_BOSS_EVENT_NAME, BossEvent.BossBarColor.PINK, BossEvent.BossBarOverlay.PROGRESS)).setPlayBossMusic(true).setCreateWorldFog(true); // Paper - ensure reset EnderDragon boss event name
|
||||||
this.gateways = new ObjectArrayList();
|
this.gateways = new ObjectArrayList();
|
||||||
this.ticksSinceLastPlayerScan = 21;
|
this.ticksSinceLastPlayerScan = 21;
|
||||||
this.skipArenaLoadedCheck = false;
|
this.skipArenaLoadedCheck = false;
|
||||||
@ -30,10 +30,10 @@ index 44f799d595d7150f00dfdfa2f85c87386f896607..390542c42fe957e8e2d21c879c1c8908
|
|||||||
this.ticksSinceDragonSeen = 0;
|
this.ticksSinceDragonSeen = 0;
|
||||||
if (dragon.hasCustomName()) {
|
if (dragon.hasCustomName()) {
|
||||||
this.dragonEvent.setName(dragon.getDisplayName());
|
this.dragonEvent.setName(dragon.getDisplayName());
|
||||||
+ // Paper start - reset to default name
|
+ // Paper start - ensure reset EnderDragon boss event name
|
||||||
+ } else {
|
+ } else {
|
||||||
+ this.dragonEvent.setName(DEFAULT_BOSS_EVENT_NAME);
|
+ this.dragonEvent.setName(DEFAULT_BOSS_EVENT_NAME);
|
||||||
+ // Paper end
|
+ // Paper end - ensure reset EnderDragon boss event name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ Subject: [PATCH] fix MC-252817 (green map markers do not disappear).
|
|||||||
this bug is caused by the fact that the itemframe's item is set to empty before the green marker is requested to be removed. this is fixed by getting the mapid from this method's parameter, rather than the air block now stored by the item frame.
|
this bug is caused by the fact that the itemframe's item is set to empty before the green marker is requested to be removed. this is fixed by getting the mapid from this method's parameter, rather than the air block now stored by the item frame.
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
|
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 6849429c3577f36eb699083375824ae5633f8d06..9c11d0af958ec47408d238d34d30750d29ecdd88 100644
|
index 6849429c3577f36eb699083375824ae5633f8d06..1ef8bbade35c3e18f53808a9955ba69750b7d30f 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
|
--- a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
|
+++ b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
|
||||||
@@ -291,7 +291,9 @@ public class ItemFrame extends HangingEntity {
|
@@ -291,7 +291,9 @@ public class ItemFrame extends HangingEntity {
|
||||||
@ -16,7 +16,7 @@ index 6849429c3577f36eb699083375824ae5633f8d06..9c11d0af958ec47408d238d34d30750d
|
|||||||
- this.getFramedMapId().ifPresent((i) -> {
|
- this.getFramedMapId().ifPresent((i) -> {
|
||||||
+ // Paper start - fix MC-252817 (green map markers do not disappear)
|
+ // Paper start - fix MC-252817 (green map markers do not disappear)
|
||||||
+ this.getFramedMapIdFromItem(itemstack).ifPresent((i) -> {
|
+ this.getFramedMapIdFromItem(itemstack).ifPresent((i) -> {
|
||||||
+ // Paper end
|
+ // Paper end - fix MC-252817
|
||||||
MapItemSavedData worldmap = MapItem.getSavedData(i, this.level());
|
MapItemSavedData worldmap = MapItem.getSavedData(i, this.level());
|
||||||
|
|
||||||
if (worldmap != null) {
|
if (worldmap != null) {
|
||||||
@ -29,7 +29,7 @@ index 6849429c3577f36eb699083375824ae5633f8d06..9c11d0af958ec47408d238d34d30750d
|
|||||||
+ }
|
+ }
|
||||||
|
|
||||||
+ public OptionalInt getFramedMapIdFromItem(ItemStack itemstack) {
|
+ public OptionalInt getFramedMapIdFromItem(ItemStack itemstack) {
|
||||||
+ // Paper end
|
+ // Paper end - fix MC-252817
|
||||||
if (itemstack.is(Items.FILLED_MAP)) {
|
if (itemstack.is(Items.FILLED_MAP)) {
|
||||||
Integer integer = MapItem.getMapId(itemstack);
|
Integer integer = MapItem.getMapId(itemstack);
|
||||||
|
|
||||||
|
@ -5,19 +5,19 @@ Subject: [PATCH] More vanilla friendly methods to update trades
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java
|
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 363d1f469862c2e980624ff69f74be015c19412d..11935e5b16324af572b07c5b173708f5a91f8289 100644
|
index 363d1f469862c2e980624ff69f74be015c19412d..e12f1f11386fa723f62b51ed0cc5715c1812d2bf 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java
|
--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java
|
+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java
|
||||||
@@ -944,6 +944,12 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
@@ -944,6 +944,12 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void updateTrades() {
|
protected void updateTrades() {
|
||||||
+ // Paper start
|
+ // Paper start - More vanilla friendly methods to update trades
|
||||||
+ updateTrades(TRADES_PER_LEVEL);
|
+ updateTrades(TRADES_PER_LEVEL);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ public boolean updateTrades(int amount) {
|
+ public boolean updateTrades(int amount) {
|
||||||
+ // Paper end
|
+ // Paper end - More vanilla friendly methods to update trades
|
||||||
VillagerData villagerdata = this.getVillagerData();
|
VillagerData villagerdata = this.getVillagerData();
|
||||||
Int2ObjectMap int2objectmap;
|
Int2ObjectMap int2objectmap;
|
||||||
|
|
||||||
@ -26,11 +26,11 @@ index 363d1f469862c2e980624ff69f74be015c19412d..11935e5b16324af572b07c5b173708f5
|
|||||||
MerchantOffers merchantrecipelist = this.getOffers();
|
MerchantOffers merchantrecipelist = this.getOffers();
|
||||||
|
|
||||||
- this.addOffersFromItemListings(merchantrecipelist, avillagertrades_imerchantrecipeoption, 2);
|
- this.addOffersFromItemListings(merchantrecipelist, avillagertrades_imerchantrecipeoption, 2);
|
||||||
+ this.addOffersFromItemListings(merchantrecipelist, avillagertrades_imerchantrecipeoption, amount); // Paper
|
+ this.addOffersFromItemListings(merchantrecipelist, avillagertrades_imerchantrecipeoption, amount); // Paper - More vanilla friendly methods to update trades
|
||||||
+ return true; // Paper
|
+ return true; // Paper - More vanilla friendly methods to update trades
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+ return false; // Paper
|
+ return false; // Paper - More vanilla friendly methods to update trades
|
||||||
}
|
}
|
||||||
|
|
||||||
public void gossip(ServerLevel world, Villager villager, long time) {
|
public void gossip(ServerLevel world, Villager villager, long time) {
|
||||||
|
@ -7,7 +7,7 @@ Makes certain entities check all players when searching for a player
|
|||||||
instead of just checking players in their world.
|
instead of just checking players in their world.
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
index c3ee52f2ad47c6f92b0e8cb284a14a3376fabba7..4e8e1f4562b3edb7041e299b6719e965df975636 100644
|
index c3ee52f2ad47c6f92b0e8cb284a14a3376fabba7..0bf8cf88a3385f21ffc00096a4af5ce76070614e 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
@@ -2764,4 +2764,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@@ -2764,4 +2764,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||||
@ -15,16 +15,16 @@ index c3ee52f2ad47c6f92b0e8cb284a14a3376fabba7..4e8e1f4562b3edb7041e299b6719e965
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
+
|
+
|
||||||
+ // Paper start
|
+ // Paper start - check global player list where appropriate
|
||||||
+ @Override
|
+ @Override
|
||||||
+ @Nullable
|
+ @Nullable
|
||||||
+ public Player getGlobalPlayerByUUID(UUID uuid) {
|
+ public Player getGlobalPlayerByUUID(UUID uuid) {
|
||||||
+ return this.server.getPlayerList().getPlayer(uuid);
|
+ return this.server.getPlayerList().getPlayer(uuid);
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end - check global player list where appropriate
|
||||||
}
|
}
|
||||||
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 0d0299482be6c906575626dc352cd13ae8be4569..944463496a9c2757e8ddb0104c77bbfb40e0d4ca 100644
|
index 0d0299482be6c906575626dc352cd13ae8be4569..f3d201cba18be448a52304a43ec05b109010bb98 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
|
||||||
@@ -3678,7 +3678,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
@@ -3678,7 +3678,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||||
@ -32,12 +32,12 @@ index 0d0299482be6c906575626dc352cd13ae8be4569..944463496a9c2757e8ddb0104c77bbfb
|
|||||||
|
|
||||||
public void onItemPickup(ItemEntity item) {
|
public void onItemPickup(ItemEntity item) {
|
||||||
- Entity entity = item.getOwner();
|
- Entity entity = item.getOwner();
|
||||||
+ Entity entity = item.thrower != null ? this.level().getGlobalPlayerByUUID(item.thrower) : null; // Paper - check all players
|
+ Entity entity = item.thrower != null ? this.level().getGlobalPlayerByUUID(item.thrower) : null; // Paper - check global player list where appropriate
|
||||||
|
|
||||||
if (entity instanceof ServerPlayer) {
|
if (entity instanceof ServerPlayer) {
|
||||||
CriteriaTriggers.THROWN_ITEM_PICKED_UP_BY_ENTITY.trigger((ServerPlayer) entity, item.getItem(), this);
|
CriteriaTriggers.THROWN_ITEM_PICKED_UP_BY_ENTITY.trigger((ServerPlayer) entity, item.getItem(), this);
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java b/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
|
diff --git a/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java b/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
|
||||||
index d4ac3e566b47cfc8688bcc2ab08385b6de4693f8..94396ad1a3c280787d36c6c18256d10340ace488 100644
|
index d4ac3e566b47cfc8688bcc2ab08385b6de4693f8..7de9d012e7416eaa0189b513a0972c846e93c4b6 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
|
--- a/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
|
+++ b/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
|
||||||
@@ -272,7 +272,7 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder {
|
@@ -272,7 +272,7 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder {
|
||||||
@ -45,12 +45,12 @@ index d4ac3e566b47cfc8688bcc2ab08385b6de4693f8..94396ad1a3c280787d36c6c18256d103
|
|||||||
entityvillager.refreshBrain(world);
|
entityvillager.refreshBrain(world);
|
||||||
if (this.conversionStarter != null) {
|
if (this.conversionStarter != null) {
|
||||||
- Player entityhuman = world.getPlayerByUUID(this.conversionStarter);
|
- Player entityhuman = world.getPlayerByUUID(this.conversionStarter);
|
||||||
+ Player entityhuman = world.getGlobalPlayerByUUID(this.conversionStarter); // Paper - check all players
|
+ Player entityhuman = world.getGlobalPlayerByUUID(this.conversionStarter); // Paper - check global player list where appropriate
|
||||||
|
|
||||||
if (entityhuman instanceof ServerPlayer) {
|
if (entityhuman instanceof ServerPlayer) {
|
||||||
CriteriaTriggers.CURED_ZOMBIE_VILLAGER.trigger((ServerPlayer) entityhuman, this, entityvillager);
|
CriteriaTriggers.CURED_ZOMBIE_VILLAGER.trigger((ServerPlayer) entityhuman, this, entityvillager);
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/EntityGetter.java b/src/main/java/net/minecraft/world/level/EntityGetter.java
|
diff --git a/src/main/java/net/minecraft/world/level/EntityGetter.java b/src/main/java/net/minecraft/world/level/EntityGetter.java
|
||||||
index 9f892de55ab03367daed4c30cc44c9dd8adc29ed..b3293a722fb5c5262a777402140c764c03367800 100644
|
index 9f892de55ab03367daed4c30cc44c9dd8adc29ed..a3d15f30eaab29d85cb6b3d693df9980a880f686 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/EntityGetter.java
|
--- a/src/main/java/net/minecraft/world/level/EntityGetter.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/EntityGetter.java
|
+++ b/src/main/java/net/minecraft/world/level/EntityGetter.java
|
||||||
@@ -280,4 +280,11 @@ public interface EntityGetter {
|
@@ -280,4 +280,11 @@ public interface EntityGetter {
|
||||||
@ -58,28 +58,28 @@ index 9f892de55ab03367daed4c30cc44c9dd8adc29ed..b3293a722fb5c5262a777402140c764c
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
+
|
+
|
||||||
+ // Paper start
|
+ // Paper start - check global player list where appropriate
|
||||||
+ @Nullable
|
+ @Nullable
|
||||||
+ default Player getGlobalPlayerByUUID(UUID uuid) {
|
+ default Player getGlobalPlayerByUUID(UUID uuid) {
|
||||||
+ return this.getPlayerByUUID(uuid);
|
+ return this.getPlayerByUUID(uuid);
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end - check global player list where appropriate
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java
|
||||||
index ee11a52e82091911aa3a196bcc1f7ab829626cef..bcb9556314ccfcf54ec49860f46b309c72be0714 100644
|
index ee11a52e82091911aa3a196bcc1f7ab829626cef..f35939f3ef42591cfa8ed7de7599695b9d9d0067 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java
|
--- a/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java
|
||||||
@@ -100,6 +100,13 @@ public class SculkShriekerBlockEntity extends BlockEntity implements GameEventLi
|
@@ -100,6 +100,13 @@ public class SculkShriekerBlockEntity extends BlockEntity implements GameEventLi
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public static ServerPlayer tryGetPlayer(@Nullable Entity entity) {
|
public static ServerPlayer tryGetPlayer(@Nullable Entity entity) {
|
||||||
+ // Paper start - ensure level is the same for sculk events
|
+ // Paper start - check global player list where appropriate; ensure level is the same for sculk events
|
||||||
+ final ServerPlayer player = tryGetPlayer0(entity);
|
+ final ServerPlayer player = tryGetPlayer0(entity);
|
||||||
+ return player != null && player.level() == entity.level() ? player : null;
|
+ return player != null && player.level() == entity.level() ? player : null;
|
||||||
+ }
|
+ }
|
||||||
+ @Nullable
|
+ @Nullable
|
||||||
+ private static ServerPlayer tryGetPlayer0(@Nullable Entity entity) {
|
+ private static ServerPlayer tryGetPlayer0(@Nullable Entity entity) {
|
||||||
+ // Paper end
|
+ // Paper end - check global player list where appropriate
|
||||||
if (entity instanceof ServerPlayer serverPlayer) {
|
if (entity instanceof ServerPlayer serverPlayer) {
|
||||||
return serverPlayer;
|
return serverPlayer;
|
||||||
} else {
|
} else {
|
||||||
|
@ -5,19 +5,19 @@ Subject: [PATCH] Fix async entity add due to fungus trees
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/WorldGenRegion.java b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
|
diff --git a/src/main/java/net/minecraft/server/level/WorldGenRegion.java b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
|
||||||
index 49c7825156afd053df1b7721a63070b51427aff2..14a5492428eac823a295ef3746d0aca6fbdab4ec 100644
|
index 49c7825156afd053df1b7721a63070b51427aff2..277c8e429481ca9763ddac9e700735d25aba78e9 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/WorldGenRegion.java
|
--- a/src/main/java/net/minecraft/server/level/WorldGenRegion.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
|
+++ b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
|
||||||
@@ -249,6 +249,7 @@ public class WorldGenRegion implements WorldGenLevel {
|
@@ -249,6 +249,7 @@ public class WorldGenRegion implements WorldGenLevel {
|
||||||
if (iblockdata.isAir()) {
|
if (iblockdata.isAir()) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
+ if (drop) LOGGER.warn("Potential async entity add during worldgen", new Throwable()); // Paper - log when this happens
|
+ if (drop) LOGGER.warn("Potential async entity add during worldgen", new Throwable()); // Paper - Fix async entity add due to fungus trees; log when this happens
|
||||||
if (false) { // CraftBukkit - SPIGOT-6833: Do not drop during world generation
|
if (false) { // CraftBukkit - SPIGOT-6833: Do not drop during world generation
|
||||||
BlockEntity tileentity = iblockdata.hasBlockEntity() ? this.getBlockEntity(pos) : null;
|
BlockEntity tileentity = iblockdata.hasBlockEntity() ? this.getBlockEntity(pos) : null;
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
||||||
index 884343c4ecdecdecb4117ce61d14e05787195656..ef56e0346228b2c26e356d4b631fbc49274a8aec 100644
|
index 884343c4ecdecdecb4117ce61d14e05787195656..99b890e8650356fc059a89a4164ca3f9a80f9d1f 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
||||||
@@ -257,10 +257,10 @@ public abstract class CraftRegionAccessor implements RegionAccessor {
|
@@ -257,10 +257,10 @@ public abstract class CraftRegionAccessor implements RegionAccessor {
|
||||||
@ -25,11 +25,11 @@ index 884343c4ecdecdecb4117ce61d14e05787195656..ef56e0346228b2c26e356d4b631fbc49
|
|||||||
return true;
|
return true;
|
||||||
case CRIMSON_FUNGUS:
|
case CRIMSON_FUNGUS:
|
||||||
- gen = TreeFeatures.CRIMSON_FUNGUS_PLANTED;
|
- gen = TreeFeatures.CRIMSON_FUNGUS_PLANTED;
|
||||||
+ gen = this.isNormalWorld() ? TreeFeatures.CRIMSON_FUNGUS_PLANTED : TreeFeatures.CRIMSON_FUNGUS; // Paper - if world gen, don't use planted version
|
+ gen = this.isNormalWorld() ? TreeFeatures.CRIMSON_FUNGUS_PLANTED : TreeFeatures.CRIMSON_FUNGUS; // Paper - Fix async entity add due to fungus trees; if world gen, don't use planted version
|
||||||
break;
|
break;
|
||||||
case WARPED_FUNGUS:
|
case WARPED_FUNGUS:
|
||||||
- gen = TreeFeatures.WARPED_FUNGUS_PLANTED;
|
- gen = TreeFeatures.WARPED_FUNGUS_PLANTED;
|
||||||
+ gen = this.isNormalWorld() ? TreeFeatures.WARPED_FUNGUS_PLANTED : TreeFeatures.WARPED_FUNGUS; // Paper - if world gen, don't use planted version
|
+ gen = this.isNormalWorld() ? TreeFeatures.WARPED_FUNGUS_PLANTED : TreeFeatures.WARPED_FUNGUS; // Paper - Fix async entity add due to fungus trees; if world gen, don't use planted version
|
||||||
break;
|
break;
|
||||||
case AZALEA:
|
case AZALEA:
|
||||||
gen = TreeFeatures.AZALEA_TREE;
|
gen = TreeFeatures.AZALEA_TREE;
|
||||||
|
@ -5,14 +5,14 @@ Subject: [PATCH] Friction API
|
|||||||
|
|
||||||
|
|
||||||
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 944463496a9c2757e8ddb0104c77bbfb40e0d4ca..a833036642b35e23b6887e0413d214ce0a6a4287 100644
|
index f3d201cba18be448a52304a43ec05b109010bb98..38d0def27625f5b7918cc2cebad0d9db2596ff3b 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
|
||||||
@@ -261,6 +261,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
@@ -261,6 +261,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||||
public boolean bukkitPickUpLoot;
|
public boolean bukkitPickUpLoot;
|
||||||
public org.bukkit.craftbukkit.entity.CraftLivingEntity getBukkitLivingEntity() { return (org.bukkit.craftbukkit.entity.CraftLivingEntity) super.getBukkitEntity(); } // Paper
|
public org.bukkit.craftbukkit.entity.CraftLivingEntity getBukkitLivingEntity() { return (org.bukkit.craftbukkit.entity.CraftLivingEntity) super.getBukkitEntity(); } // Paper
|
||||||
public boolean silentDeath = false; // Paper - mark entity as dying silently for cancellable death event
|
public boolean silentDeath = false; // Paper - mark entity as dying silently for cancellable death event
|
||||||
+ public net.kyori.adventure.util.TriState frictionState = net.kyori.adventure.util.TriState.NOT_SET; // Paper
|
+ public net.kyori.adventure.util.TriState frictionState = net.kyori.adventure.util.TriState.NOT_SET; // Paper - Friction API
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getBukkitYaw() {
|
public float getBukkitYaw() {
|
||||||
@ -21,7 +21,7 @@ index 944463496a9c2757e8ddb0104c77bbfb40e0d4ca..a833036642b35e23b6887e0413d214ce
|
|||||||
|
|
||||||
public boolean shouldDiscardFriction() {
|
public boolean shouldDiscardFriction() {
|
||||||
- return this.discardFriction;
|
- return this.discardFriction;
|
||||||
+ return !this.frictionState.toBooleanOrElse(!this.discardFriction); // Paper
|
+ return !this.frictionState.toBooleanOrElse(!this.discardFriction); // Paper - Friction API
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDiscardFriction(boolean noDrag) {
|
public void setDiscardFriction(boolean noDrag) {
|
||||||
@ -29,19 +29,19 @@ index 944463496a9c2757e8ddb0104c77bbfb40e0d4ca..a833036642b35e23b6887e0413d214ce
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addAdditionalSaveData(CompoundTag nbt) {
|
public void addAdditionalSaveData(CompoundTag nbt) {
|
||||||
+ // Paper start
|
+ // Paper start - Friction API
|
||||||
+ if (this.frictionState != net.kyori.adventure.util.TriState.NOT_SET) {
|
+ if (this.frictionState != net.kyori.adventure.util.TriState.NOT_SET) {
|
||||||
+ nbt.putString("Paper.FrictionState", this.frictionState.toString());
|
+ nbt.putString("Paper.FrictionState", this.frictionState.toString());
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end - Friction API
|
||||||
nbt.putFloat("Health", this.getHealth());
|
nbt.putFloat("Health", this.getHealth());
|
||||||
nbt.putShort("HurtTime", (short) this.hurtTime);
|
nbt.putShort("HurtTime", (short) this.hurtTime);
|
||||||
nbt.putInt("HurtByTimestamp", this.lastHurtByMobTimestamp);
|
nbt.putInt("HurtByTimestamp", this.lastHurtByMobTimestamp);
|
||||||
@@ -802,6 +808,15 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
@@ -802,6 +808,16 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||||
absorptionAmount = 0;
|
absorptionAmount = 0;
|
||||||
}
|
}
|
||||||
this.internalSetAbsorptionAmount(absorptionAmount);
|
this.internalSetAbsorptionAmount(absorptionAmount);
|
||||||
+
|
+ // Paper start - Friction API
|
||||||
+ if (nbt.contains("Paper.FrictionState")) {
|
+ if (nbt.contains("Paper.FrictionState")) {
|
||||||
+ String fs = nbt.getString("Paper.FrictionState");
|
+ String fs = nbt.getString("Paper.FrictionState");
|
||||||
+ try {
|
+ try {
|
||||||
@ -50,18 +50,19 @@ index 944463496a9c2757e8ddb0104c77bbfb40e0d4ca..a833036642b35e23b6887e0413d214ce
|
|||||||
+ LOGGER.error("Unknown friction state " + fs + " for " + this);
|
+ LOGGER.error("Unknown friction state " + fs + " for " + this);
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
|
+ // Paper end - Friction API
|
||||||
// Paper end
|
// Paper end
|
||||||
if (nbt.contains("Attributes", 9) && this.level() != null && !this.level().isClientSide) {
|
if (nbt.contains("Attributes", 9) && this.level() != null && !this.level().isClientSide) {
|
||||||
this.getAttributes().load(nbt.getList("Attributes", 10));
|
this.getAttributes().load(nbt.getList("Attributes", 10));
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||||
index 6b18f23b57c7000dce9726df98a509ee9477f6d2..a39db702063887cf530f272deaf4f334047cc7d4 100644
|
index 6b18f23b57c7000dce9726df98a509ee9477f6d2..c34c698d389da29c9cfaa56cb8023e30416a14ba 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||||
@@ -57,6 +57,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
@@ -57,6 +57,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
||||||
private int lastTick = MinecraftServer.currentTick - 1; // CraftBukkit
|
private int lastTick = MinecraftServer.currentTick - 1; // CraftBukkit
|
||||||
public boolean canMobPickup = true; // Paper
|
public boolean canMobPickup = true; // Paper
|
||||||
private int despawnRate = -1; // Paper
|
private int despawnRate = -1; // Paper
|
||||||
+ public net.kyori.adventure.util.TriState frictionState = net.kyori.adventure.util.TriState.NOT_SET; // Paper
|
+ public net.kyori.adventure.util.TriState frictionState = net.kyori.adventure.util.TriState.NOT_SET; // Paper - Friction API
|
||||||
|
|
||||||
public ItemEntity(EntityType<? extends ItemEntity> type, Level world) {
|
public ItemEntity(EntityType<? extends ItemEntity> type, Level world) {
|
||||||
super(type, world);
|
super(type, world);
|
||||||
@ -70,11 +71,11 @@ index 6b18f23b57c7000dce9726df98a509ee9477f6d2..a39db702063887cf530f272deaf4f334
|
|||||||
float f1 = 0.98F;
|
float f1 = 0.98F;
|
||||||
|
|
||||||
- if (this.onGround()) {
|
- if (this.onGround()) {
|
||||||
+ // Paper start
|
+ // Paper start - Friction API
|
||||||
+ if (frictionState == net.kyori.adventure.util.TriState.FALSE) {
|
+ if (frictionState == net.kyori.adventure.util.TriState.FALSE) {
|
||||||
+ f1 = 1F;
|
+ f1 = 1F;
|
||||||
+ } else if (this.onGround()) {
|
+ } else if (this.onGround()) {
|
||||||
+ // Paper end
|
+ // Paper end - Friction API
|
||||||
f1 = this.level().getBlockState(this.getBlockPosBelowThatAffectsMyMovement()).getBlock().getFriction() * 0.98F;
|
f1 = this.level().getBlockState(this.getBlockPosBelowThatAffectsMyMovement()).getBlock().getFriction() * 0.98F;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,11 +83,11 @@ index 6b18f23b57c7000dce9726df98a509ee9477f6d2..a39db702063887cf530f272deaf4f334
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addAdditionalSaveData(CompoundTag nbt) {
|
public void addAdditionalSaveData(CompoundTag nbt) {
|
||||||
+ // Paper start
|
+ // Paper start - Friction API
|
||||||
+ if (this.frictionState != net.kyori.adventure.util.TriState.NOT_SET) {
|
+ if (this.frictionState != net.kyori.adventure.util.TriState.NOT_SET) {
|
||||||
+ nbt.putString("Paper.FrictionState", this.frictionState.toString());
|
+ nbt.putString("Paper.FrictionState", this.frictionState.toString());
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end - Friction API
|
||||||
nbt.putShort("Health", (short) this.health);
|
nbt.putShort("Health", (short) this.health);
|
||||||
nbt.putShort("Age", (short) this.age);
|
nbt.putShort("Age", (short) this.age);
|
||||||
nbt.putShort("PickupDelay", (short) this.pickupDelay);
|
nbt.putShort("PickupDelay", (short) this.pickupDelay);
|
||||||
@ -94,7 +95,7 @@ index 6b18f23b57c7000dce9726df98a509ee9477f6d2..a39db702063887cf530f272deaf4f334
|
|||||||
this.cachedThrower = null;
|
this.cachedThrower = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ // Paper start
|
+ // Paper start - Friction API
|
||||||
+ if (nbt.contains("Paper.FrictionState")) {
|
+ if (nbt.contains("Paper.FrictionState")) {
|
||||||
+ String fs = nbt.getString("Paper.FrictionState");
|
+ String fs = nbt.getString("Paper.FrictionState");
|
||||||
+ try {
|
+ try {
|
||||||
@ -103,7 +104,7 @@ index 6b18f23b57c7000dce9726df98a509ee9477f6d2..a39db702063887cf530f272deaf4f334
|
|||||||
+ com.mojang.logging.LogUtils.getLogger().error("Unknown friction state " + fs + " for " + this);
|
+ com.mojang.logging.LogUtils.getLogger().error("Unknown friction state " + fs + " for " + this);
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end - Friction API
|
||||||
+
|
+
|
||||||
CompoundTag nbttagcompound1 = nbt.getCompound("Item");
|
CompoundTag nbttagcompound1 = nbt.getCompound("Item");
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Ability to control player's insomnia and phantoms
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/EntitySelector.java b/src/main/java/net/minecraft/world/entity/EntitySelector.java
|
diff --git a/src/main/java/net/minecraft/world/entity/EntitySelector.java b/src/main/java/net/minecraft/world/entity/EntitySelector.java
|
||||||
index 93a41156a01a1638f3ef469b1518a07e7961f378..2986c3b1c9dd7f3a00ed7f25b25bfc2b513b35eb 100644
|
index 93a41156a01a1638f3ef469b1518a07e7961f378..dbbce471c35849ea7d7ad07e9db9b7d8d85690df 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/EntitySelector.java
|
--- a/src/main/java/net/minecraft/world/entity/EntitySelector.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/EntitySelector.java
|
+++ b/src/main/java/net/minecraft/world/entity/EntitySelector.java
|
||||||
@@ -28,7 +28,18 @@ public final class EntitySelector {
|
@@ -28,7 +28,18 @@ public final class EntitySelector {
|
||||||
@ -13,7 +13,7 @@ index 93a41156a01a1638f3ef469b1518a07e7961f378..2986c3b1c9dd7f3a00ed7f25b25bfc2b
|
|||||||
};
|
};
|
||||||
public static final Predicate<Entity> CAN_BE_COLLIDED_WITH = EntitySelector.NO_SPECTATORS.and(Entity::canBeCollidedWith);
|
public static final Predicate<Entity> CAN_BE_COLLIDED_WITH = EntitySelector.NO_SPECTATORS.and(Entity::canBeCollidedWith);
|
||||||
- public static Predicate<Player> IS_INSOMNIAC = (player) -> net.minecraft.util.Mth.clamp(((net.minecraft.server.level.ServerPlayer) player).getStats().getValue(net.minecraft.stats.Stats.CUSTOM.get(net.minecraft.stats.Stats.TIME_SINCE_REST)), 1, Integer.MAX_VALUE) >= 72000; // Paper
|
- public static Predicate<Player> IS_INSOMNIAC = (player) -> net.minecraft.util.Mth.clamp(((net.minecraft.server.level.ServerPlayer) player).getStats().getValue(net.minecraft.stats.Stats.CUSTOM.get(net.minecraft.stats.Stats.TIME_SINCE_REST)), 1, Integer.MAX_VALUE) >= 72000; // Paper
|
||||||
+ // Paper start
|
+ // Paper start - Ability to control player's insomnia and phantoms
|
||||||
+ public static Predicate<Player> IS_INSOMNIAC = (player) -> {
|
+ public static Predicate<Player> IS_INSOMNIAC = (player) -> {
|
||||||
+ net.minecraft.server.level.ServerPlayer serverPlayer = (net.minecraft.server.level.ServerPlayer) player;
|
+ net.minecraft.server.level.ServerPlayer serverPlayer = (net.minecraft.server.level.ServerPlayer) player;
|
||||||
+ int playerInsomniaTicks = serverPlayer.level().paperConfig().entities.behavior.playerInsomniaStartTicks;
|
+ int playerInsomniaTicks = serverPlayer.level().paperConfig().entities.behavior.playerInsomniaStartTicks;
|
||||||
@ -24,23 +24,23 @@ index 93a41156a01a1638f3ef469b1518a07e7961f378..2986c3b1c9dd7f3a00ed7f25b25bfc2b
|
|||||||
+
|
+
|
||||||
+ return net.minecraft.util.Mth.clamp(serverPlayer.getStats().getValue(net.minecraft.stats.Stats.CUSTOM.get(net.minecraft.stats.Stats.TIME_SINCE_REST)), 1, Integer.MAX_VALUE) >= playerInsomniaTicks;
|
+ return net.minecraft.util.Mth.clamp(serverPlayer.getStats().getValue(net.minecraft.stats.Stats.CUSTOM.get(net.minecraft.stats.Stats.TIME_SINCE_REST)), 1, Integer.MAX_VALUE) >= playerInsomniaTicks;
|
||||||
+ };
|
+ };
|
||||||
+ // Paper end
|
+ // Paper end - Ability to control player's insomnia and phantoms
|
||||||
|
|
||||||
private EntitySelector() {}
|
private EntitySelector() {}
|
||||||
// Paper start
|
// Paper start
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java b/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java
|
diff --git a/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java b/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java
|
||||||
index b1fc786970b5288a02cc3a46e3fe7784ac566c07..dfeb3e336e06ef01f5401a362755030db942bb07 100644
|
index b1fc786970b5288a02cc3a46e3fe7784ac566c07..7d7d37334321c844958ce09e77547dd61dcba6c8 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java
|
--- a/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java
|
+++ b/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java
|
||||||
@@ -33,13 +33,22 @@ public class PhantomSpawner implements CustomSpawner {
|
@@ -33,13 +33,22 @@ public class PhantomSpawner implements CustomSpawner {
|
||||||
} else if (!world.getGameRules().getBoolean(GameRules.RULE_DOINSOMNIA)) {
|
} else if (!world.getGameRules().getBoolean(GameRules.RULE_DOINSOMNIA)) {
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
+ // Paper start
|
+ // Paper start - Ability to control player's insomnia and phantoms
|
||||||
+ if (world.paperConfig().entities.behavior.phantomsSpawnAttemptMaxSeconds <= 0) {
|
+ if (world.paperConfig().entities.behavior.phantomsSpawnAttemptMaxSeconds <= 0) {
|
||||||
+ return 0;
|
+ return 0;
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end - Ability to control player's insomnia and phantoms
|
||||||
RandomSource randomsource = world.random;
|
RandomSource randomsource = world.random;
|
||||||
|
|
||||||
--this.nextTick;
|
--this.nextTick;
|
||||||
@ -48,11 +48,11 @@ index b1fc786970b5288a02cc3a46e3fe7784ac566c07..dfeb3e336e06ef01f5401a362755030d
|
|||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
- this.nextTick += (60 + randomsource.nextInt(60)) * 20;
|
- this.nextTick += (60 + randomsource.nextInt(60)) * 20;
|
||||||
+ // Paper start
|
+ // Paper start - Ability to control player's insomnia and phantoms
|
||||||
+ int spawnAttemptMinSeconds = world.paperConfig().entities.behavior.phantomsSpawnAttemptMinSeconds;
|
+ int spawnAttemptMinSeconds = world.paperConfig().entities.behavior.phantomsSpawnAttemptMinSeconds;
|
||||||
+ int spawnAttemptMaxSeconds = world.paperConfig().entities.behavior.phantomsSpawnAttemptMaxSeconds;
|
+ int spawnAttemptMaxSeconds = world.paperConfig().entities.behavior.phantomsSpawnAttemptMaxSeconds;
|
||||||
+ this.nextTick += (spawnAttemptMinSeconds + randomsource.nextInt(spawnAttemptMaxSeconds - spawnAttemptMinSeconds + 1)) * 20;
|
+ this.nextTick += (spawnAttemptMinSeconds + randomsource.nextInt(spawnAttemptMaxSeconds - spawnAttemptMinSeconds + 1)) * 20;
|
||||||
+ // Paper end
|
+ // Paper end - Ability to control player's insomnia and phantoms
|
||||||
if (world.getSkyDarken() < 5 && world.dimensionType().hasSkyLight()) {
|
if (world.getSkyDarken() < 5 && world.dimensionType().hasSkyLight()) {
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
@ -61,7 +61,7 @@ index b1fc786970b5288a02cc3a46e3fe7784ac566c07..dfeb3e336e06ef01f5401a362755030d
|
|||||||
boolean flag2 = true;
|
boolean flag2 = true;
|
||||||
|
|
||||||
- if (randomsource.nextInt(j) >= 72000) {
|
- if (randomsource.nextInt(j) >= 72000) {
|
||||||
+ if (randomsource.nextInt(j) >= world.paperConfig().entities.behavior.playerInsomniaStartTicks) { // Paper
|
+ if (randomsource.nextInt(j) >= world.paperConfig().entities.behavior.playerInsomniaStartTicks) { // Paper - Ability to control player's insomnia and phantoms
|
||||||
BlockPos blockposition1 = blockposition.above(20 + randomsource.nextInt(15)).east(-10 + randomsource.nextInt(21)).south(-10 + randomsource.nextInt(21));
|
BlockPos blockposition1 = blockposition.above(20 + randomsource.nextInt(15)).east(-10 + randomsource.nextInt(21)).south(-10 + randomsource.nextInt(21));
|
||||||
BlockState iblockdata = world.getBlockState(blockposition1);
|
BlockState iblockdata = world.getBlockState(blockposition1);
|
||||||
FluidState fluid = world.getFluidState(blockposition1);
|
FluidState fluid = world.getFluidState(blockposition1);
|
||||||
|
@ -9,7 +9,7 @@ also check if all packets are ignored during the shutdown process.
|
|||||||
See net.minecraft.network.Connection#channelRead0(ChannelHandlerContext, Packet) and net.minecraft.util.thread.BlockableEventLoop#executeIfPossible(Runnable)
|
See net.minecraft.network.Connection#channelRead0(ChannelHandlerContext, Packet) and net.minecraft.util.thread.BlockableEventLoop#executeIfPossible(Runnable)
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/network/protocol/PacketUtils.java b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
|
diff --git a/src/main/java/net/minecraft/network/protocol/PacketUtils.java b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
|
||||||
index 7297bca9224c12d7ace0e1967340d99436afafc1..c5c734b9eb80d1cdf0e9fd8a043f2b6d1f4cbffe 100644
|
index 7297bca9224c12d7ace0e1967340d99436afafc1..3e2d5dcd62775b6ed7c0ce0ba51a71b635b1d644 100644
|
||||||
--- a/src/main/java/net/minecraft/network/protocol/PacketUtils.java
|
--- a/src/main/java/net/minecraft/network/protocol/PacketUtils.java
|
||||||
+++ b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
|
+++ b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
|
||||||
@@ -44,7 +44,7 @@ public class PacketUtils {
|
@@ -44,7 +44,7 @@ public class PacketUtils {
|
||||||
@ -17,7 +17,7 @@ index 7297bca9224c12d7ace0e1967340d99436afafc1..c5c734b9eb80d1cdf0e9fd8a043f2b6d
|
|||||||
public static <T extends PacketListener> void ensureRunningOnSameThread(Packet<T> packet, T listener, BlockableEventLoop<?> engine) throws RunningOnDifferentThreadException {
|
public static <T extends PacketListener> void ensureRunningOnSameThread(Packet<T> packet, T listener, BlockableEventLoop<?> engine) throws RunningOnDifferentThreadException {
|
||||||
if (!engine.isSameThread()) {
|
if (!engine.isSameThread()) {
|
||||||
- engine.executeIfPossible(() -> {
|
- engine.executeIfPossible(() -> {
|
||||||
+ engine.execute(() -> { // Paper - Fix preemptive player kick on a server shutdown.
|
+ engine.execute(() -> { // Paper - Fix preemptive player kick on a server shutdown
|
||||||
packetProcessing.push(listener); // Paper - detailed watchdog information
|
packetProcessing.push(listener); // Paper - detailed watchdog information
|
||||||
try { // Paper - detailed watchdog information
|
try { // Paper - detailed watchdog information
|
||||||
if (MinecraftServer.getServer().hasStopped() || (listener instanceof ServerCommonPacketListenerImpl && ((ServerCommonPacketListenerImpl) listener).processedDisconnect)) return; // CraftBukkit, MC-142590
|
if (MinecraftServer.getServer().hasStopped() || (listener instanceof ServerCommonPacketListenerImpl && ((ServerCommonPacketListenerImpl) listener).processedDisconnect)) return; // CraftBukkit, MC-142590
|
||||||
|
@ -8,44 +8,44 @@ offhand slot isn't sent. This is not correct because you *can* put stuff into th
|
|||||||
by pressing the offhand swap item
|
by pressing the offhand swap item
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||||
index 24e6808e325bd80a55c94309aeab835804b03973..de27b8d578d429564038e01cef5f46d4d3d7e81c 100644
|
index 24e6808e325bd80a55c94309aeab835804b03973..2c3a6cee9519f44c40227c5d9cbd63cc483d2d60 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||||
@@ -348,6 +348,13 @@ public class ServerPlayer extends Player {
|
@@ -348,6 +348,13 @@ public class ServerPlayer extends Player {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
+ // Paper start
|
+ // Paper start - Sync offhand slot in menus
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public void sendOffHandSlotChange() {
|
+ public void sendOffHandSlotChange() {
|
||||||
+ ServerPlayer.this.connection.send(new ClientboundContainerSetSlotPacket(ServerPlayer.this.inventoryMenu.containerId, ServerPlayer.this.inventoryMenu.incrementStateId(), net.minecraft.world.inventory.InventoryMenu.SHIELD_SLOT, ServerPlayer.this.inventoryMenu.getSlot(net.minecraft.world.inventory.InventoryMenu.SHIELD_SLOT).getItem().copy()));
|
+ ServerPlayer.this.connection.send(new ClientboundContainerSetSlotPacket(ServerPlayer.this.inventoryMenu.containerId, ServerPlayer.this.inventoryMenu.incrementStateId(), net.minecraft.world.inventory.InventoryMenu.SHIELD_SLOT, ServerPlayer.this.inventoryMenu.getSlot(net.minecraft.world.inventory.InventoryMenu.SHIELD_SLOT).getItem().copy()));
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end - Sync offhand slot in menus
|
||||||
+
|
+
|
||||||
@Override
|
@Override
|
||||||
public void sendSlotChange(AbstractContainerMenu handler, int slot, ItemStack stack) {
|
public void sendSlotChange(AbstractContainerMenu handler, int slot, ItemStack stack) {
|
||||||
ServerPlayer.this.connection.send(new ClientboundContainerSetSlotPacket(handler.containerId, handler.incrementStateId(), slot, stack));
|
ServerPlayer.this.connection.send(new ClientboundContainerSetSlotPacket(handler.containerId, handler.incrementStateId(), slot, stack));
|
||||||
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 c18348f4ea79b15b081cf7ba3bd9d77212aa086e..9ee3c2e0dcfaa4280be4973479c6490ded33809c 100644
|
index c18348f4ea79b15b081cf7ba3bd9d77212aa086e..cd82b7e83f79e813d9d87d074bbccad4d2712d60 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
|
||||||
@@ -200,6 +200,7 @@ public abstract class AbstractContainerMenu {
|
@@ -200,6 +200,7 @@ public abstract class AbstractContainerMenu {
|
||||||
|
|
||||||
if (this.synchronizer != null) {
|
if (this.synchronizer != null) {
|
||||||
this.synchronizer.sendInitialData(this, this.remoteSlots, this.remoteCarried, this.remoteDataSlots.toIntArray());
|
this.synchronizer.sendInitialData(this, this.remoteSlots, this.remoteCarried, this.remoteDataSlots.toIntArray());
|
||||||
+ this.synchronizer.sendOffHandSlotChange(); // Paper - update player's offhand since the offhand slot is not added to the slots for menus but can be changed by swapping from a menu slot
|
+ this.synchronizer.sendOffHandSlotChange(); // Paper - Sync offhand slot in menus; update player's offhand since the offhand slot is not added to the slots for menus but can be changed by swapping from a menu slot
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/net/minecraft/world/inventory/ContainerSynchronizer.java b/src/main/java/net/minecraft/world/inventory/ContainerSynchronizer.java
|
diff --git a/src/main/java/net/minecraft/world/inventory/ContainerSynchronizer.java b/src/main/java/net/minecraft/world/inventory/ContainerSynchronizer.java
|
||||||
index ff4fa86f9408e83e505f7e27692d3423f8570c48..db6c290dcbb8f5cb502f85e154b42ac89350a460 100644
|
index ff4fa86f9408e83e505f7e27692d3423f8570c48..a45ef5fcffc05e4e30801b73e82d29c6dbf5b8fd 100644
|
||||||
--- a/src/main/java/net/minecraft/world/inventory/ContainerSynchronizer.java
|
--- a/src/main/java/net/minecraft/world/inventory/ContainerSynchronizer.java
|
||||||
+++ b/src/main/java/net/minecraft/world/inventory/ContainerSynchronizer.java
|
+++ b/src/main/java/net/minecraft/world/inventory/ContainerSynchronizer.java
|
||||||
@@ -6,6 +6,7 @@ import net.minecraft.world.item.ItemStack;
|
@@ -6,6 +6,7 @@ import net.minecraft.world.item.ItemStack;
|
||||||
public interface ContainerSynchronizer {
|
public interface ContainerSynchronizer {
|
||||||
void sendInitialData(AbstractContainerMenu handler, NonNullList<ItemStack> stacks, ItemStack cursorStack, int[] properties);
|
void sendInitialData(AbstractContainerMenu handler, NonNullList<ItemStack> stacks, ItemStack cursorStack, int[] properties);
|
||||||
|
|
||||||
+ default void sendOffHandSlotChange() {} // Paper
|
+ default void sendOffHandSlotChange() {} // Paper - Sync offhand slot in menus
|
||||||
void sendSlotChange(AbstractContainerMenu handler, int slot, ItemStack stack);
|
void sendSlotChange(AbstractContainerMenu handler, int slot, ItemStack stack);
|
||||||
|
|
||||||
void sendCarriedChange(AbstractContainerMenu handler, ItemStack stack);
|
void sendCarriedChange(AbstractContainerMenu handler, ItemStack stack);
|
||||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Player Entity Tracking Events
|
|||||||
|
|
||||||
|
|
||||||
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 982750fd4f3f474514194df9b76388311c052b29..526b52bbf7c5d82645d26710f05e62b781e3cb0e 100644
|
index 982750fd4f3f474514194df9b76388311c052b29..a9c94645a4bf3837bce5622b76f0d24a5a4ef065 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
|
||||||
@@ -1409,7 +1409,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
@@ -1409,7 +1409,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||||
@ -16,12 +16,12 @@ index 982750fd4f3f474514194df9b76388311c052b29..526b52bbf7c5d82645d26710f05e62b7
|
|||||||
+ if (io.papermc.paper.event.player.PlayerTrackEntityEvent.getHandlerList().getRegisteredListeners().length == 0 || new io.papermc.paper.event.player.PlayerTrackEntityEvent(player.getBukkitEntity(), this.entity.getBukkitEntity()).callEvent()) {
|
+ if (io.papermc.paper.event.player.PlayerTrackEntityEvent.getHandlerList().getRegisteredListeners().length == 0 || new io.papermc.paper.event.player.PlayerTrackEntityEvent(player.getBukkitEntity(), this.entity.getBukkitEntity()).callEvent()) {
|
||||||
this.serverEntity.addPairing(player);
|
this.serverEntity.addPairing(player);
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end - entity tracking events
|
||||||
}
|
}
|
||||||
} else if (this.seenBy.remove(player.connection)) {
|
} else if (this.seenBy.remove(player.connection)) {
|
||||||
this.serverEntity.removePairing(player);
|
this.serverEntity.removePairing(player);
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
index d5322f344b65c4442958eb4e36ddae1f9cfca974..5968a555ce7cc4681f5c096bda7d007005e2a8bf 100644
|
index f46640f3e3305b133bd49271377cedae4fe31ab5..1a44341de58519dff830afce72707c286ac51364 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
@@ -4107,7 +4107,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
@@ -4107,7 +4107,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||||
@ -36,7 +36,7 @@ index d5322f344b65c4442958eb4e36ddae1f9cfca974..5968a555ce7cc4681f5c096bda7d0070
|
|||||||
+ new io.papermc.paper.event.player.PlayerUntrackEntityEvent(player.getBukkitEntity(), this.getBukkitEntity()).callEvent();
|
+ new io.papermc.paper.event.player.PlayerUntrackEntityEvent(player.getBukkitEntity(), this.getBukkitEntity()).callEvent();
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end - entity tracking events
|
||||||
|
|
||||||
public float rotate(Rotation rotation) {
|
public float rotate(Rotation rotation) {
|
||||||
float f = Mth.wrapDegrees(this.getYRot());
|
float f = Mth.wrapDegrees(this.getYRot());
|
||||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Limit pet look distance
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/FollowOwnerGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/FollowOwnerGoal.java
|
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/FollowOwnerGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/FollowOwnerGoal.java
|
||||||
index 0a3f7dcc0e205a85dbaa6dee1fc9ae2c7fa9e02d..689bbc0feb700cfd6b10601d2c5a237ec40ed756 100644
|
index 0a3f7dcc0e205a85dbaa6dee1fc9ae2c7fa9e02d..8e2f7e2385588224018f7f94ed9686415bc91deb 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/ai/goal/FollowOwnerGoal.java
|
--- a/src/main/java/net/minecraft/world/entity/ai/goal/FollowOwnerGoal.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/FollowOwnerGoal.java
|
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/FollowOwnerGoal.java
|
||||||
@@ -93,7 +93,7 @@ public class FollowOwnerGoal extends Goal {
|
@@ -93,7 +93,7 @@ public class FollowOwnerGoal extends Goal {
|
||||||
@ -13,7 +13,7 @@ index 0a3f7dcc0e205a85dbaa6dee1fc9ae2c7fa9e02d..689bbc0feb700cfd6b10601d2c5a237e
|
|||||||
@Override
|
@Override
|
||||||
public void tick() {
|
public void tick() {
|
||||||
- this.tamable.getLookControl().setLookAt(this.owner, 10.0F, (float) this.tamable.getMaxHeadXRot());
|
- this.tamable.getLookControl().setLookAt(this.owner, 10.0F, (float) this.tamable.getMaxHeadXRot());
|
||||||
+ if (this.tamable.distanceToSqr(this.owner) <= 16 * 16) this.tamable.getLookControl().setLookAt(this.owner, 10.0F, (float) this.tamable.getMaxHeadXRot()); // Paper
|
+ if (this.tamable.distanceToSqr(this.owner) <= 16 * 16) this.tamable.getLookControl().setLookAt(this.owner, 10.0F, (float) this.tamable.getMaxHeadXRot()); // Paper - Limit pet look distance
|
||||||
if (--this.timeToRecalcPath <= 0) {
|
if (--this.timeToRecalcPath <= 0) {
|
||||||
this.timeToRecalcPath = this.adjustedTickDelay(10);
|
this.timeToRecalcPath = this.adjustedTickDelay(10);
|
||||||
if (this.tamable.distanceToSqr((Entity) this.owner) >= 144.0D) {
|
if (this.tamable.distanceToSqr((Entity) this.owner) >= 144.0D) {
|
||||||
|
@ -21,7 +21,7 @@ index 823f3b3093cffb49ccdcbcfbe6d348009a553ad7..e754a294645e1af9e39bde32dd1387cd
|
|||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/DragonFireball.java b/src/main/java/net/minecraft/world/entity/projectile/DragonFireball.java
|
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 9652e3385ad10e5d825dd141f6be3522c596916d..6256ce68d6ecada66745fb09360cba2bf991360c 100644
|
index 9652e3385ad10e5d825dd141f6be3522c596916d..baea154a24d1b888af18b9b792db9edebe60ebc6 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/projectile/DragonFireball.java
|
--- a/src/main/java/net/minecraft/world/entity/projectile/DragonFireball.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/DragonFireball.java
|
+++ b/src/main/java/net/minecraft/world/entity/projectile/DragonFireball.java
|
||||||
@@ -54,7 +54,7 @@ public class DragonFireball extends AbstractHurtingProjectile {
|
@@ -54,7 +54,7 @@ public class DragonFireball extends AbstractHurtingProjectile {
|
||||||
@ -29,12 +29,12 @@ index 9652e3385ad10e5d825dd141f6be3522c596916d..6256ce68d6ecada66745fb09360cba2b
|
|||||||
if (new com.destroystokyo.paper.event.entity.EnderDragonFireballHitEvent((org.bukkit.entity.DragonFireball) this.getBukkitEntity(), list.stream().map(LivingEntity::getBukkitLivingEntity).collect(java.util.stream.Collectors.toList()), (org.bukkit.entity.AreaEffectCloud) areaEffectCloud.getBukkitEntity()).callEvent()) { // Paper
|
if (new com.destroystokyo.paper.event.entity.EnderDragonFireballHitEvent((org.bukkit.entity.DragonFireball) this.getBukkitEntity(), list.stream().map(LivingEntity::getBukkitLivingEntity).collect(java.util.stream.Collectors.toList()), (org.bukkit.entity.AreaEffectCloud) areaEffectCloud.getBukkitEntity()).callEvent()) { // Paper
|
||||||
this.level().levelEvent(2006, this.blockPosition(), this.isSilent() ? -1 : 1);
|
this.level().levelEvent(2006, this.blockPosition(), this.isSilent() ? -1 : 1);
|
||||||
- this.level().addFreshEntity(areaEffectCloud);
|
- this.level().addFreshEntity(areaEffectCloud);
|
||||||
+ this.level().addFreshEntity(areaEffectCloud, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.EXPLOSION); // Paper
|
+ this.level().addFreshEntity(areaEffectCloud, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.EXPLOSION); // Paper - use correct spawn reason
|
||||||
} else areaEffectCloud.discard(); // Paper
|
} else areaEffectCloud.discard(); // Paper
|
||||||
this.discard();
|
this.discard();
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java b/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java
|
diff --git a/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java b/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java
|
||||||
index 0a2de99c22cfcc96a664dc2afe7379987ea815db..6fc8d7f93141d85d8aecc97314e747624beb5e6c 100644
|
index 0a2de99c22cfcc96a664dc2afe7379987ea815db..452b3070e68dda1a4c7ba99cbefcaab5c5958bdd 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java
|
--- a/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java
|
+++ b/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java
|
||||||
@@ -117,7 +117,7 @@ public class FrogspawnBlock extends Block {
|
@@ -117,7 +117,7 @@ public class FrogspawnBlock extends Block {
|
||||||
@ -42,12 +42,12 @@ index 0a2de99c22cfcc96a664dc2afe7379987ea815db..6fc8d7f93141d85d8aecc97314e74762
|
|||||||
tadpole.moveTo(d, (double)pos.getY() - 0.5D, e, (float)k, 0.0F);
|
tadpole.moveTo(d, (double)pos.getY() - 0.5D, e, (float)k, 0.0F);
|
||||||
tadpole.setPersistenceRequired();
|
tadpole.setPersistenceRequired();
|
||||||
- world.addFreshEntity(tadpole);
|
- world.addFreshEntity(tadpole);
|
||||||
+ world.addFreshEntity(tadpole, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.EGG); // Paper
|
+ world.addFreshEntity(tadpole, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.EGG); // Paper - use correct spawn reason
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java b/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java
|
diff --git a/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java b/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java
|
||||||
index 3cedc349e79665d3d471c92b5dca25c9e66ca0bf..6c025c0fac9bd6373b99e374b773ca626d47ee6d 100644
|
index 3cedc349e79665d3d471c92b5dca25c9e66ca0bf..4d3dc58750f80d4aacb46c98a8ffc66acb4a2edc 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java
|
--- a/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java
|
+++ b/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java
|
||||||
@@ -88,7 +88,7 @@ public class SnifferEggBlock extends Block {
|
@@ -88,7 +88,7 @@ public class SnifferEggBlock extends Block {
|
||||||
@ -55,7 +55,7 @@ index 3cedc349e79665d3d471c92b5dca25c9e66ca0bf..6c025c0fac9bd6373b99e374b773ca62
|
|||||||
sniffer.setBaby(true);
|
sniffer.setBaby(true);
|
||||||
sniffer.moveTo(vec3.x(), vec3.y(), vec3.z(), Mth.wrapDegrees(world.random.nextFloat() * 360.0F), 0.0F);
|
sniffer.moveTo(vec3.x(), vec3.y(), vec3.z(), Mth.wrapDegrees(world.random.nextFloat() * 360.0F), 0.0F);
|
||||||
- world.addFreshEntity(sniffer);
|
- world.addFreshEntity(sniffer);
|
||||||
+ world.addFreshEntity(sniffer, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.EGG); // Paper
|
+ world.addFreshEntity(sniffer, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.EGG); // Paper - use correct spawn reason
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ Subject: [PATCH] Improve inlining for some hot BlockBehavior and FluidState
|
|||||||
|
|
||||||
|
|
||||||
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 d91a82428a435a65bc55ad466ccebe91e0d905e0..17d2b90441d7513d7907b988610be8604ac05282 100644
|
index d91a82428a435a65bc55ad466ccebe91e0d905e0..88d7973e83ee828fa71d95924a9134935e80954d 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
|
||||||
@@ -1078,15 +1078,15 @@ public abstract class BlockBehaviour implements FeatureElement {
|
@@ -1078,15 +1078,15 @@ public abstract class BlockBehaviour implements FeatureElement {
|
||||||
@ -14,17 +14,17 @@ index d91a82428a435a65bc55ad466ccebe91e0d905e0..17d2b90441d7513d7907b988610be860
|
|||||||
}
|
}
|
||||||
|
|
||||||
- public boolean useShapeForLightOcclusion() {
|
- public boolean useShapeForLightOcclusion() {
|
||||||
+ public final boolean useShapeForLightOcclusion() { // Paper
|
+ public final boolean useShapeForLightOcclusion() { // Paper - Perf: Final for inlining
|
||||||
return this.useShapeForLightOcclusion;
|
return this.useShapeForLightOcclusion;
|
||||||
}
|
}
|
||||||
|
|
||||||
- public int getLightEmission() {
|
- public int getLightEmission() {
|
||||||
+ public final int getLightEmission() { // Paper
|
+ public final int getLightEmission() { // Paper - Perf: Final for inlining
|
||||||
return this.lightEmission;
|
return this.lightEmission;
|
||||||
}
|
}
|
||||||
|
|
||||||
- public boolean isAir() {
|
- public boolean isAir() {
|
||||||
+ public final boolean isAir() { // Paper
|
+ public final boolean isAir() { // Paper - Perf: Final for inlining
|
||||||
return this.isAir;
|
return this.isAir;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ index d91a82428a435a65bc55ad466ccebe91e0d905e0..17d2b90441d7513d7907b988610be860
|
|||||||
}
|
}
|
||||||
|
|
||||||
- public boolean canOcclude() {
|
- public boolean canOcclude() {
|
||||||
+ public final boolean canOcclude() { // Paper
|
+ public final boolean canOcclude() { // Paper - Perf: Final for inlining
|
||||||
return this.canOcclude;
|
return this.canOcclude;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,29 +42,29 @@ index d91a82428a435a65bc55ad466ccebe91e0d905e0..17d2b90441d7513d7907b988610be860
|
|||||||
}
|
}
|
||||||
|
|
||||||
- public FluidState getFluidState() {
|
- public FluidState getFluidState() {
|
||||||
+ public final FluidState getFluidState() { // Paper
|
+ public final FluidState getFluidState() { // Paper - Perf: Final for inlining
|
||||||
return this.fluidState;
|
return this.fluidState;
|
||||||
}
|
}
|
||||||
|
|
||||||
- public boolean isRandomlyTicking() {
|
- public boolean isRandomlyTicking() {
|
||||||
+ public final boolean isRandomlyTicking() { // Paper
|
+ public final boolean isRandomlyTicking() { // Paper - Perf: Final for inlining
|
||||||
return this.isRandomlyTicking;
|
return this.isRandomlyTicking;
|
||||||
}
|
}
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/material/FluidState.java b/src/main/java/net/minecraft/world/level/material/FluidState.java
|
diff --git a/src/main/java/net/minecraft/world/level/material/FluidState.java b/src/main/java/net/minecraft/world/level/material/FluidState.java
|
||||||
index ea2a04e5298832177fac93568656ac45784d5eb6..27f136815afc360387704fa1f2773e3816cccff6 100644
|
index ea2a04e5298832177fac93568656ac45784d5eb6..b4d4082c5488e7cb48166c8bf4443b4ffbbaa761 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/material/FluidState.java
|
--- a/src/main/java/net/minecraft/world/level/material/FluidState.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/material/FluidState.java
|
+++ b/src/main/java/net/minecraft/world/level/material/FluidState.java
|
||||||
@@ -26,8 +26,12 @@ public final class FluidState extends StateHolder<Fluid, FluidState> {
|
@@ -26,8 +26,12 @@ public final class FluidState extends StateHolder<Fluid, FluidState> {
|
||||||
public static final int AMOUNT_MAX = 9;
|
public static final int AMOUNT_MAX = 9;
|
||||||
public static final int AMOUNT_FULL = 8;
|
public static final int AMOUNT_FULL = 8;
|
||||||
|
|
||||||
+ // Paper start
|
+ // Paper start - Perf: moved from isEmpty()
|
||||||
+ protected final boolean isEmpty;
|
+ protected final boolean isEmpty;
|
||||||
+ // Paper end
|
+ // Paper end - Perf: moved from isEmpty()
|
||||||
public FluidState(Fluid fluid, ImmutableMap<Property<?>, Comparable<?>> propertiesMap, MapCodec<FluidState> codec) {
|
public FluidState(Fluid fluid, ImmutableMap<Property<?>, Comparable<?>> propertiesMap, MapCodec<FluidState> codec) {
|
||||||
super(fluid, propertiesMap, codec);
|
super(fluid, propertiesMap, codec);
|
||||||
+ this.isEmpty = fluid.isEmpty(); // Paper - moved from isEmpty()
|
+ this.isEmpty = fluid.isEmpty(); // Paper - Perf: moved from isEmpty()
|
||||||
}
|
}
|
||||||
|
|
||||||
public Fluid getType() {
|
public Fluid getType() {
|
||||||
@ -73,7 +73,7 @@ index ea2a04e5298832177fac93568656ac45784d5eb6..27f136815afc360387704fa1f2773e38
|
|||||||
|
|
||||||
public boolean isEmpty() {
|
public boolean isEmpty() {
|
||||||
- return this.getType().isEmpty();
|
- return this.getType().isEmpty();
|
||||||
+ return this.isEmpty; // Paper - moved into constructor
|
+ return this.isEmpty; // Paper - Perf: moved into constructor
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getHeight(BlockGetter world, BlockPos pos) {
|
public float getHeight(BlockGetter world, BlockPos pos) {
|
||||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Add BlockLockCheckEvent
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java
|
||||||
index fce3a45d09a93ca68a3d49f2e666afa4c860d042..c134d089e55ea2ffb180f92aea020bd7647259c9 100644
|
index fce3a45d09a93ca68a3d49f2e666afa4c860d042..b8b4d74076fa5ed6eb3b2045384db77e165931b2 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java
|
--- a/src/main/java/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java
|
||||||
@@ -69,17 +69,44 @@ public abstract class BaseContainerBlockEntity extends BlockEntity implements Co
|
@@ -69,17 +69,44 @@ public abstract class BaseContainerBlockEntity extends BlockEntity implements Co
|
||||||
@ -13,12 +13,12 @@ index fce3a45d09a93ca68a3d49f2e666afa4c860d042..c134d089e55ea2ffb180f92aea020bd7
|
|||||||
|
|
||||||
public boolean canOpen(Player player) {
|
public boolean canOpen(Player player) {
|
||||||
- return BaseContainerBlockEntity.canUnlock(player, this.lockKey, this.getDisplayName());
|
- return BaseContainerBlockEntity.canUnlock(player, this.lockKey, this.getDisplayName());
|
||||||
+ return BaseContainerBlockEntity.canUnlock(player, this.lockKey, this.getDisplayName(), this); // Paper
|
+ return BaseContainerBlockEntity.canUnlock(player, this.lockKey, this.getDisplayName(), this); // Paper - Add BlockLockCheckEvent
|
||||||
}
|
}
|
||||||
|
|
||||||
+ @Deprecated @io.papermc.paper.annotation.DoNotUse // Paper
|
+ @Deprecated @io.papermc.paper.annotation.DoNotUse // Paper - Add BlockLockCheckEvent
|
||||||
public static boolean canUnlock(Player player, LockCode lock, Component containerName) {
|
public static boolean canUnlock(Player player, LockCode lock, Component containerName) {
|
||||||
+ // Paper start
|
+ // Paper start - Add BlockLockCheckEvent
|
||||||
+ return canUnlock(player, lock, containerName, null);
|
+ return canUnlock(player, lock, containerName, null);
|
||||||
+ }
|
+ }
|
||||||
+ public static boolean canUnlock(Player player, LockCode lock, Component containerName, @Nullable BlockEntity blockEntity) {
|
+ public static boolean canUnlock(Player player, LockCode lock, Component containerName, @Nullable BlockEntity blockEntity) {
|
||||||
@ -42,7 +42,7 @@ index fce3a45d09a93ca68a3d49f2e666afa4c860d042..c134d089e55ea2ffb180f92aea020bd7
|
|||||||
+ return true;
|
+ return true;
|
||||||
+ }
|
+ }
|
||||||
+ } else { // logic below is replaced by logic above
|
+ } else { // logic below is replaced by logic above
|
||||||
+ // Paper end
|
+ // Paper end - Add BlockLockCheckEvent
|
||||||
if (!player.isSpectator() && !lock.unlocksWith(player.getMainHandItem())) {
|
if (!player.isSpectator() && !lock.unlocksWith(player.getMainHandItem())) {
|
||||||
- player.displayClientMessage(Component.translatable("container.isLocked", containerName), true);
|
- player.displayClientMessage(Component.translatable("container.isLocked", containerName), true);
|
||||||
+ player.displayClientMessage(Component.translatable("container.isLocked", containerName), true); // Paper - diff on change
|
+ player.displayClientMessage(Component.translatable("container.isLocked", containerName), true); // Paper - diff on change
|
||||||
@ -51,12 +51,12 @@ index fce3a45d09a93ca68a3d49f2e666afa4c860d042..c134d089e55ea2ffb180f92aea020bd7
|
|||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
+ } // Paper
|
+ } // Paper - Add BlockLockCheckEvent
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
||||||
index db38c178543e221251ae8c6ad618ad9372af7f40..2f12a1054c9c9e311e02dc5c3244ad3688db15ba 100644
|
index db38c178543e221251ae8c6ad618ad9372af7f40..afb20f58655e958bd64efd1a1265da9c94857f79 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
--- a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
||||||
@@ -470,7 +470,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name
|
@@ -470,7 +470,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name
|
||||||
@ -64,7 +64,7 @@ index db38c178543e221251ae8c6ad618ad9372af7f40..2f12a1054c9c9e311e02dc5c3244ad36
|
|||||||
@Override
|
@Override
|
||||||
public AbstractContainerMenu createMenu(int syncId, Inventory playerInventory, Player player) {
|
public AbstractContainerMenu createMenu(int syncId, Inventory playerInventory, Player player) {
|
||||||
- return BaseContainerBlockEntity.canUnlock(player, this.lockKey, this.getDisplayName()) ? new BeaconMenu(syncId, playerInventory, this.dataAccess, ContainerLevelAccess.create(this.level, this.getBlockPos())) : null;
|
- return BaseContainerBlockEntity.canUnlock(player, this.lockKey, this.getDisplayName()) ? new BeaconMenu(syncId, playerInventory, this.dataAccess, ContainerLevelAccess.create(this.level, this.getBlockPos())) : null;
|
||||||
+ return BaseContainerBlockEntity.canUnlock(player, this.lockKey, this.getDisplayName(), this) ? new BeaconMenu(syncId, playerInventory, this.dataAccess, ContainerLevelAccess.create(this.level, this.getBlockPos())) : null;
|
+ return BaseContainerBlockEntity.canUnlock(player, this.lockKey, this.getDisplayName(), this) ? new BeaconMenu(syncId, playerInventory, this.dataAccess, ContainerLevelAccess.create(this.level, this.getBlockPos())) : null; // Paper - Add BlockLockCheckEvent
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -6,7 +6,7 @@ Subject: [PATCH] Improve logging and errors
|
|||||||
Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
|
Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/advancements/AdvancementTree.java b/src/main/java/net/minecraft/advancements/AdvancementTree.java
|
diff --git a/src/main/java/net/minecraft/advancements/AdvancementTree.java b/src/main/java/net/minecraft/advancements/AdvancementTree.java
|
||||||
index 938fe76677139e7e99698b61691bfcadf70dbd87..5cf3732d2197b381ae9256d8bed03a755d8539f4 100644
|
index 938fe76677139e7e99698b61691bfcadf70dbd87..a017ebf550e3430c14a7159baa9a644530a0b5ab 100644
|
||||||
--- a/src/main/java/net/minecraft/advancements/AdvancementTree.java
|
--- a/src/main/java/net/minecraft/advancements/AdvancementTree.java
|
||||||
+++ b/src/main/java/net/minecraft/advancements/AdvancementTree.java
|
+++ b/src/main/java/net/minecraft/advancements/AdvancementTree.java
|
||||||
@@ -35,7 +35,7 @@ public class AdvancementTree {
|
@@ -35,7 +35,7 @@ public class AdvancementTree {
|
||||||
@ -14,7 +14,7 @@ index 938fe76677139e7e99698b61691bfcadf70dbd87..5cf3732d2197b381ae9256d8bed03a75
|
|||||||
}
|
}
|
||||||
|
|
||||||
- AdvancementTree.LOGGER.info("Forgot about advancement {}", advancement.holder());
|
- AdvancementTree.LOGGER.info("Forgot about advancement {}", advancement.holder());
|
||||||
+ AdvancementTree.LOGGER.debug("Forgot about advancement {}", advancement.holder()); // Paper
|
+ AdvancementTree.LOGGER.debug("Forgot about advancement {}", advancement.holder()); // Paper - Improve logging and errors
|
||||||
this.nodes.remove(advancement.holder().id());
|
this.nodes.remove(advancement.holder().id());
|
||||||
if (advancement.parent() == null) {
|
if (advancement.parent() == null) {
|
||||||
this.roots.remove(advancement);
|
this.roots.remove(advancement);
|
||||||
@ -23,24 +23,24 @@ index 938fe76677139e7e99698b61691bfcadf70dbd87..5cf3732d2197b381ae9256d8bed03a75
|
|||||||
}
|
}
|
||||||
|
|
||||||
- // AdvancementTree.LOGGER.info("Loaded {} advancements", this.nodes.size()); // CraftBukkit - moved to AdvancementDataWorld#reload
|
- // AdvancementTree.LOGGER.info("Loaded {} advancements", this.nodes.size()); // CraftBukkit - moved to AdvancementDataWorld#reload
|
||||||
+ // AdvancementTree.LOGGER.info("Loaded {} advancements", this.nodes.size()); // CraftBukkit - moved to AdvancementDataWorld#reload // Paper - you say it was moved... but it wasn't :) it should be moved however, since this is called when the API creates an advancement
|
+ // AdvancementTree.LOGGER.info("Loaded {} advancements", this.nodes.size()); // CraftBukkit - moved to AdvancementDataWorld#reload // Paper - Improve logging and errors; you say it was moved... but it wasn't :) it should be moved however, since this is called when the API creates an advancement
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean tryInsert(AdvancementHolder advancement) {
|
private boolean tryInsert(AdvancementHolder advancement) {
|
||||||
diff --git a/src/main/java/net/minecraft/server/ServerAdvancementManager.java b/src/main/java/net/minecraft/server/ServerAdvancementManager.java
|
diff --git a/src/main/java/net/minecraft/server/ServerAdvancementManager.java b/src/main/java/net/minecraft/server/ServerAdvancementManager.java
|
||||||
index 536f0c496ce36ca3248fc6eeac9bbd77214a36f9..5e24c1e712eb16d0d5343760a65310bd79d1020c 100644
|
index 536f0c496ce36ca3248fc6eeac9bbd77214a36f9..31718823250a1490b783f426fff65bf5a067b6f4 100644
|
||||||
--- a/src/main/java/net/minecraft/server/ServerAdvancementManager.java
|
--- a/src/main/java/net/minecraft/server/ServerAdvancementManager.java
|
||||||
+++ b/src/main/java/net/minecraft/server/ServerAdvancementManager.java
|
+++ b/src/main/java/net/minecraft/server/ServerAdvancementManager.java
|
||||||
@@ -66,6 +66,7 @@ public class ServerAdvancementManager extends SimpleJsonResourceReloadListener {
|
@@ -66,6 +66,7 @@ public class ServerAdvancementManager extends SimpleJsonResourceReloadListener {
|
||||||
AdvancementTree advancementtree = new AdvancementTree();
|
AdvancementTree advancementtree = new AdvancementTree();
|
||||||
|
|
||||||
advancementtree.addAll(this.advancements.values());
|
advancementtree.addAll(this.advancements.values());
|
||||||
+ LOGGER.info("Loaded {} advancements", advancementtree.nodes().size()); // Paper - moved from AdvancementTree#addAll
|
+ LOGGER.info("Loaded {} advancements", advancementtree.nodes().size()); // Paper - Improve logging and errors; moved from AdvancementTree#addAll
|
||||||
Iterator iterator = advancementtree.roots().iterator();
|
Iterator iterator = advancementtree.roots().iterator();
|
||||||
|
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
index 2fdc9fcc8f88d78fd4b06bfae947c5cb28f8eea7..e602a3b5182e68e7cb20395169bb392d49a23e89 100644
|
index 2fdc9fcc8f88d78fd4b06bfae947c5cb28f8eea7..c64cbcd11362ad3e4cf63d769732a5158d616c4c 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
@@ -3395,7 +3395,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
@@ -3395,7 +3395,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||||
@ -48,29 +48,29 @@ index 2fdc9fcc8f88d78fd4b06bfae947c5cb28f8eea7..e602a3b5182e68e7cb20395169bb392d
|
|||||||
this.resetPlayerChatState(remotechatsession_a.validate(this.player.getGameProfile(), signaturevalidator));
|
this.resetPlayerChatState(remotechatsession_a.validate(this.player.getGameProfile(), signaturevalidator));
|
||||||
} catch (ProfilePublicKey.ValidationException profilepublickey_b) {
|
} catch (ProfilePublicKey.ValidationException profilepublickey_b) {
|
||||||
- ServerGamePacketListenerImpl.LOGGER.error("Failed to validate profile key: {}", profilepublickey_b.getMessage());
|
- ServerGamePacketListenerImpl.LOGGER.error("Failed to validate profile key: {}", profilepublickey_b.getMessage());
|
||||||
+ // ServerGamePacketListenerImpl.LOGGER.error("Failed to validate profile key: {}", profilepublickey_b.getMessage()); // Paper - unnecessary log
|
+ // ServerGamePacketListenerImpl.LOGGER.error("Failed to validate profile key: {}", profilepublickey_b.getMessage()); // Paper - Improve logging and errors
|
||||||
this.disconnect(profilepublickey_b.getComponent(), profilepublickey_b.kickCause); // Paper - kick event causes
|
this.disconnect(profilepublickey_b.getComponent(), profilepublickey_b.kickCause); // Paper - kick event causes
|
||||||
}
|
}
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/packs/PathPackResources.java b/src/main/java/net/minecraft/server/packs/PathPackResources.java
|
diff --git a/src/main/java/net/minecraft/server/packs/PathPackResources.java b/src/main/java/net/minecraft/server/packs/PathPackResources.java
|
||||||
index 89aa86a49eda563c82ccedc99641e699f8e578b0..4822f94ce183a99ad9e0d1bdc6c5708d958f6104 100644
|
index 89aa86a49eda563c82ccedc99641e699f8e578b0..3edd14ce90edf98798b89921ad18547809de5d2c 100644
|
||||||
--- a/src/main/java/net/minecraft/server/packs/PathPackResources.java
|
--- a/src/main/java/net/minecraft/server/packs/PathPackResources.java
|
||||||
+++ b/src/main/java/net/minecraft/server/packs/PathPackResources.java
|
+++ b/src/main/java/net/minecraft/server/packs/PathPackResources.java
|
||||||
@@ -108,6 +108,12 @@ public class PathPackResources extends AbstractPackResources {
|
@@ -108,6 +108,12 @@ public class PathPackResources extends AbstractPackResources {
|
||||||
try (DirectoryStream<Path> directoryStream = Files.newDirectoryStream(path)) {
|
try (DirectoryStream<Path> directoryStream = Files.newDirectoryStream(path)) {
|
||||||
for(Path path2 : directoryStream) {
|
for(Path path2 : directoryStream) {
|
||||||
String string = path2.getFileName().toString();
|
String string = path2.getFileName().toString();
|
||||||
+ // Paper start
|
+ // Paper start - Improve logging and errors
|
||||||
+ if (!Files.isDirectory(path2)) {
|
+ if (!Files.isDirectory(path2)) {
|
||||||
+ LOGGER.error("Invalid directory entry: {} in {}.", string, this.root, new java.nio.file.NotDirectoryException(string));
|
+ LOGGER.error("Invalid directory entry: {} in {}.", string, this.root, new java.nio.file.NotDirectoryException(string));
|
||||||
+ continue;
|
+ continue;
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end - Improve logging and errors
|
||||||
if (ResourceLocation.isValidNamespace(string)) {
|
if (ResourceLocation.isValidNamespace(string)) {
|
||||||
set.add(string);
|
set.add(string);
|
||||||
} else {
|
} else {
|
||||||
diff --git a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
|
diff --git a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
|
||||||
index 4259181bab2dc4f2d0409b56fdf81d966003376d..93e7d350a4176250d9ae3f0e1e7e6a4197d613b0 100644
|
index 4259181bab2dc4f2d0409b56fdf81d966003376d..a0ab3c55826af292d1cdac05648139b4d31f1376 100644
|
||||||
--- a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
|
--- a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
|
||||||
+++ b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
|
+++ b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
|
||||||
@@ -84,7 +84,7 @@ public class RecipeManager extends SimpleJsonResourceReloadListener {
|
@@ -84,7 +84,7 @@ public class RecipeManager extends SimpleJsonResourceReloadListener {
|
||||||
@ -78,19 +78,19 @@ index 4259181bab2dc4f2d0409b56fdf81d966003376d..93e7d350a4176250d9ae3f0e1e7e6a41
|
|||||||
}));
|
}));
|
||||||
this.byName = Maps.newHashMap(builder.build()); // CraftBukkit
|
this.byName = Maps.newHashMap(builder.build()); // CraftBukkit
|
||||||
- RecipeManager.LOGGER.info("Loaded {} recipes", map1.size());
|
- RecipeManager.LOGGER.info("Loaded {} recipes", map1.size());
|
||||||
+ RecipeManager.LOGGER.info("Loaded {} recipes", this.byName.size()); // Paper - log correct number of recipes
|
+ RecipeManager.LOGGER.info("Loaded {} recipes", this.byName.size()); // Paper - Improve logging and errors; log correct number of recipes
|
||||||
}
|
}
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java b/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java b/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java
|
||||||
index 080cca90f15d90249b7a38f33286ae2f735ba7d9..2677e21d8239bf0361a3bc5c9a50c328e54d70f6 100644
|
index 080cca90f15d90249b7a38f33286ae2f735ba7d9..fde9aadd6c688b9797a6755f9d214918047598a0 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java
|
--- a/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java
|
||||||
@@ -44,6 +44,7 @@ import org.bukkit.material.MaterialData;
|
@@ -44,6 +44,7 @@ import org.bukkit.material.MaterialData;
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public final class CraftLegacy {
|
public final class CraftLegacy {
|
||||||
+ private static final org.slf4j.Logger LOGGER = com.mojang.logging.LogUtils.getLogger(); // Paper
|
+ private static final org.slf4j.Logger LOGGER = com.mojang.logging.LogUtils.getLogger(); // Paper - Improve logging and errors
|
||||||
|
|
||||||
private static final Map<Byte, Material> SPAWN_EGGS = new HashMap<>();
|
private static final Map<Byte, Material> SPAWN_EGGS = new HashMap<>();
|
||||||
private static final Set<String> whitelistedStates = new HashSet<>(Arrays.asList("explode", "check_decay", "decayable", "facing"));
|
private static final Set<String> whitelistedStates = new HashSet<>(Arrays.asList("explode", "check_decay", "decayable", "facing"));
|
||||||
@ -99,7 +99,7 @@ index 080cca90f15d90249b7a38f33286ae2f735ba7d9..2677e21d8239bf0361a3bc5c9a50c328
|
|||||||
|
|
||||||
static {
|
static {
|
||||||
- System.err.println("Initializing Legacy Material Support. Unless you have legacy plugins and/or data this is a bug!");
|
- System.err.println("Initializing Legacy Material Support. Unless you have legacy plugins and/or data this is a bug!");
|
||||||
+ LOGGER.warn("Initializing Legacy Material Support. Unless you have legacy plugins and/or data this is a bug!"); // Paper - doesn't need to be an error
|
+ LOGGER.warn("Initializing Legacy Material Support. Unless you have legacy plugins and/or data this is a bug!"); // Paper - Improve logging and errors; doesn't need to be an error
|
||||||
if (MinecraftServer.getServer() != null && MinecraftServer.getServer().isDebugging()) {
|
if (MinecraftServer.getServer() != null && MinecraftServer.getServer().isDebugging()) {
|
||||||
new Exception().printStackTrace();
|
new Exception().printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -5,16 +5,16 @@ Subject: [PATCH] Add missing SpigotConfig logCommands check
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
index e602a3b5182e68e7cb20395169bb392d49a23e89..b9d6f38df243bbdd55639716cfaff24eb95aaa74 100644
|
index c64cbcd11362ad3e4cf63d769732a5158d616c4c..6d8d07f30cc18357b2b3a6aa50c54deb1c52f2b7 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
@@ -2139,7 +2139,9 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
@@ -2139,7 +2139,9 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||||
private void performChatCommand(ServerboundChatCommandPacket packet, LastSeenMessages lastSeenMessages) {
|
private void performChatCommand(ServerboundChatCommandPacket packet, LastSeenMessages lastSeenMessages) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
String command = "/" + packet.command();
|
String command = "/" + packet.command();
|
||||||
+ if (org.spigotmc.SpigotConfig.logCommands) { // Paper
|
+ if (org.spigotmc.SpigotConfig.logCommands) { // Paper - Add missing SpigotConfig logCommands check
|
||||||
ServerGamePacketListenerImpl.LOGGER.info(this.player.getScoreboardName() + " issued server command: " + command);
|
ServerGamePacketListenerImpl.LOGGER.info(this.player.getScoreboardName() + " issued server command: " + command);
|
||||||
+ } // Paper
|
+ } // Paper - Add missing SpigotConfig logCommands check
|
||||||
|
|
||||||
PlayerCommandPreprocessEvent event = new PlayerCommandPreprocessEvent(this.getCraftPlayer(), command, new LazyPlayerSet(this.server));
|
PlayerCommandPreprocessEvent event = new PlayerCommandPreprocessEvent(this.getCraftPlayer(), command, new LazyPlayerSet(this.server));
|
||||||
this.cserver.getPluginManager().callEvent(event);
|
this.cserver.getPluginManager().callEvent(event);
|
||||||
|
@ -5,14 +5,14 @@ Subject: [PATCH] Flying Fall Damage
|
|||||||
|
|
||||||
|
|
||||||
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 28fa46f29639a6b643b475912133d601028facb2..7f3466340891b4409d1399ebeb2ca865d77841cd 100644
|
index 13a443d942aee77f18e91669b207d8ec54bbaf65..9851d5803caa33cbf740f1ef91d71255d9c3b018 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
|
||||||
@@ -181,6 +181,7 @@ public abstract class Player extends LivingEntity {
|
@@ -181,6 +181,7 @@ public abstract class Player extends LivingEntity {
|
||||||
public float hurtDir; // Paper - protected -> public
|
public float hurtDir; // Paper - protected -> public
|
||||||
// Paper start
|
// Paper start
|
||||||
public boolean affectsSpawning = true;
|
public boolean affectsSpawning = true;
|
||||||
+ public net.kyori.adventure.util.TriState flyingFallDamage = net.kyori.adventure.util.TriState.NOT_SET;
|
+ public net.kyori.adventure.util.TriState flyingFallDamage = net.kyori.adventure.util.TriState.NOT_SET; // Paper - flying fall damage
|
||||||
// Paper end
|
// Paper end
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
@ -26,7 +26,7 @@ index 28fa46f29639a6b643b475912133d601028facb2..7f3466340891b4409d1399ebeb2ca865
|
|||||||
} else {
|
} else {
|
||||||
if (fallDistance >= 2.0F) {
|
if (fallDistance >= 2.0F) {
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||||
index a0c6902955296da171548618bfcbf629944f8737..b8b23105d37ac2d461d87d0c8e3c83c6fd09c960 100644
|
index a0c6902955296da171548618bfcbf629944f8737..a917c616043f7e17144a52ff4cfe0cc0217087b8 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||||
@@ -2472,6 +2472,19 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
@@ -2472,6 +2472,19 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||||
@ -44,7 +44,7 @@ index a0c6902955296da171548618bfcbf629944f8737..b8b23105d37ac2d461d87d0c8e3c83c6
|
|||||||
+ public net.kyori.adventure.util.TriState hasFlyingFallDamage() {
|
+ public net.kyori.adventure.util.TriState hasFlyingFallDamage() {
|
||||||
+ return getHandle().flyingFallDamage;
|
+ return getHandle().flyingFallDamage;
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end - flying fall damage
|
||||||
+
|
+
|
||||||
@Override
|
@Override
|
||||||
public int getNoDamageTicks() {
|
public int getNoDamageTicks() {
|
||||||
|
@ -18,17 +18,17 @@ index 1a0f86b5a632469942e33c237c247d2d1dee4a3d..25a5a3b949a0eb632611355e74ccd486
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
return "DamageSource (" + this.type().msgId() + ")";
|
return "DamageSource (" + this.type().msgId() + ")";
|
||||||
diff --git a/src/main/java/net/minecraft/world/damagesource/DamageSources.java b/src/main/java/net/minecraft/world/damagesource/DamageSources.java
|
diff --git a/src/main/java/net/minecraft/world/damagesource/DamageSources.java b/src/main/java/net/minecraft/world/damagesource/DamageSources.java
|
||||||
index 8bde8c581796ed11809b80b9a30a33df86116745..4604f8b38460e9113e966889a679d4547f24aff6 100644
|
index 8bde8c581796ed11809b80b9a30a33df86116745..f339475185645f7be30963e4f980ce81a6f7e536 100644
|
||||||
--- a/src/main/java/net/minecraft/world/damagesource/DamageSources.java
|
--- a/src/main/java/net/minecraft/world/damagesource/DamageSources.java
|
||||||
+++ b/src/main/java/net/minecraft/world/damagesource/DamageSources.java
|
+++ b/src/main/java/net/minecraft/world/damagesource/DamageSources.java
|
||||||
@@ -247,8 +247,17 @@ public class DamageSources {
|
@@ -247,8 +247,17 @@ public class DamageSources {
|
||||||
return this.source(DamageTypes.SONIC_BOOM, attacker);
|
return this.source(DamageTypes.SONIC_BOOM, attacker);
|
||||||
}
|
}
|
||||||
|
|
||||||
+ @Deprecated @io.papermc.paper.annotation.DoNotUse // Paper
|
+ @Deprecated @io.papermc.paper.annotation.DoNotUse // Paper - add exploded state
|
||||||
public DamageSource badRespawnPointExplosion(Vec3 position) {
|
public DamageSource badRespawnPointExplosion(Vec3 position) {
|
||||||
- return new DamageSource(this.damageTypes.getHolderOrThrow(DamageTypes.BAD_RESPAWN_POINT), position);
|
- return new DamageSource(this.damageTypes.getHolderOrThrow(DamageTypes.BAD_RESPAWN_POINT), position);
|
||||||
+ // Paper start
|
+ // Paper start - add exploded state
|
||||||
+ return this.badRespawnPointExplosion(position, null);
|
+ return this.badRespawnPointExplosion(position, null);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
@ -36,12 +36,12 @@ index 8bde8c581796ed11809b80b9a30a33df86116745..4604f8b38460e9113e966889a679d454
|
|||||||
+ DamageSource source = new DamageSource(this.damageTypes.getHolderOrThrow(DamageTypes.BAD_RESPAWN_POINT), position);
|
+ DamageSource source = new DamageSource(this.damageTypes.getHolderOrThrow(DamageTypes.BAD_RESPAWN_POINT), position);
|
||||||
+ source.explodedBlockState = explodedBlockState;
|
+ source.explodedBlockState = explodedBlockState;
|
||||||
+ return source;
|
+ return source;
|
||||||
+ // Paper end
|
+ // Paper end - add exploded state
|
||||||
}
|
}
|
||||||
|
|
||||||
public DamageSource outOfBorder() {
|
public DamageSource outOfBorder() {
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||||
index 5a2e322d349340fa58f133c2034765f90319b2be..dbe679bb81a903668262cdf629469e971b49e088 100644
|
index 5a2e322d349340fa58f133c2034765f90319b2be..7bb8dc1f4697960cdc6bac0daec4b7a06a2dd7c4 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||||
@@ -368,7 +368,7 @@ public class Explosion {
|
@@ -368,7 +368,7 @@ public class Explosion {
|
||||||
@ -49,19 +49,19 @@ index 5a2e322d349340fa58f133c2034765f90319b2be..dbe679bb81a903668262cdf629469e97
|
|||||||
this.yield = event.getYield();
|
this.yield = event.getYield();
|
||||||
} else {
|
} else {
|
||||||
- BlockExplodeEvent event = new BlockExplodeEvent(location.getBlock(), blockList, this.yield);
|
- BlockExplodeEvent event = new BlockExplodeEvent(location.getBlock(), blockList, this.yield);
|
||||||
+ BlockExplodeEvent event = new BlockExplodeEvent(location.getBlock(), blockList, this.yield, this.damageSource.explodedBlockState); // Paper - exploded block state
|
+ BlockExplodeEvent event = new BlockExplodeEvent(location.getBlock(), blockList, this.yield, this.damageSource.explodedBlockState); // Paper - add exploded state
|
||||||
this.level.getCraftServer().getPluginManager().callEvent(event);
|
this.level.getCraftServer().getPluginManager().callEvent(event);
|
||||||
this.wasCanceled = event.isCancelled();
|
this.wasCanceled = event.isCancelled();
|
||||||
bukkitBlocks = event.blockList();
|
bukkitBlocks = event.blockList();
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/BedBlock.java b/src/main/java/net/minecraft/world/level/block/BedBlock.java
|
diff --git a/src/main/java/net/minecraft/world/level/block/BedBlock.java b/src/main/java/net/minecraft/world/level/block/BedBlock.java
|
||||||
index 0e63fa3b49b1a275254cf108a51ab18e816aad49..2deb0d861a5f66d177068f37dd56da5cf692633e 100644
|
index 0e63fa3b49b1a275254cf108a51ab18e816aad49..e302fdf76d013826804108cb6444e2de5658b84f 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/BedBlock.java
|
--- a/src/main/java/net/minecraft/world/level/block/BedBlock.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/BedBlock.java
|
+++ b/src/main/java/net/minecraft/world/level/block/BedBlock.java
|
||||||
@@ -96,6 +96,7 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock
|
@@ -96,6 +96,7 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock
|
||||||
|
|
||||||
// CraftBukkit - moved world and biome check into EntityHuman
|
// CraftBukkit - moved world and biome check into EntityHuman
|
||||||
if (false && !BedBlock.canSetSpawn(world)) {
|
if (false && !BedBlock.canSetSpawn(world)) {
|
||||||
+ final org.bukkit.block.BlockState explodedBlockState = org.bukkit.craftbukkit.block.CraftBlockStates.getUnplacedBlockState(world, pos, state); // Paper - exploded block state (this won't be called due to the false, but it's good for reference)
|
+ final org.bukkit.block.BlockState explodedBlockState = org.bukkit.craftbukkit.block.CraftBlockStates.getUnplacedBlockState(world, pos, state); // Paper - add exploded state (this won't be called due to the false, but it's good for reference)
|
||||||
world.removeBlock(pos, false);
|
world.removeBlock(pos, false);
|
||||||
BlockPos blockposition1 = pos.relative(((Direction) state.getValue(BedBlock.FACING)).getOpposite());
|
BlockPos blockposition1 = pos.relative(((Direction) state.getValue(BedBlock.FACING)).getOpposite());
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ index 0e63fa3b49b1a275254cf108a51ab18e816aad49..2deb0d861a5f66d177068f37dd56da5c
|
|||||||
Vec3 vec3d = pos.getCenter();
|
Vec3 vec3d = pos.getCenter();
|
||||||
|
|
||||||
- world.explode((Entity) null, world.damageSources().badRespawnPointExplosion(vec3d), (ExplosionDamageCalculator) null, vec3d, 5.0F, true, Level.ExplosionInteraction.BLOCK);
|
- world.explode((Entity) null, world.damageSources().badRespawnPointExplosion(vec3d), (ExplosionDamageCalculator) null, vec3d, 5.0F, true, Level.ExplosionInteraction.BLOCK);
|
||||||
+ world.explode((Entity) null, world.damageSources().badRespawnPointExplosion(vec3d, explodedBlockState), (ExplosionDamageCalculator) null, vec3d, 5.0F, true, Level.ExplosionInteraction.BLOCK);
|
+ world.explode((Entity) null, world.damageSources().badRespawnPointExplosion(vec3d, explodedBlockState), (ExplosionDamageCalculator) null, vec3d, 5.0F, true, Level.ExplosionInteraction.BLOCK); // Paper - add exploded state
|
||||||
return InteractionResult.SUCCESS;
|
return InteractionResult.SUCCESS;
|
||||||
} else if ((Boolean) state.getValue(BedBlock.OCCUPIED)) {
|
} else if ((Boolean) state.getValue(BedBlock.OCCUPIED)) {
|
||||||
if (!this.kickVillagerOutOfBed(world, pos)) {
|
if (!this.kickVillagerOutOfBed(world, pos)) {
|
||||||
@ -78,7 +78,7 @@ index 0e63fa3b49b1a275254cf108a51ab18e816aad49..2deb0d861a5f66d177068f37dd56da5c
|
|||||||
private InteractionResult explodeBed(BlockState iblockdata, Level world, BlockPos blockposition) {
|
private InteractionResult explodeBed(BlockState iblockdata, Level world, BlockPos blockposition) {
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
+ final org.bukkit.block.BlockState explodedBlockState = org.bukkit.craftbukkit.block.CraftBlockStates.getUnplacedBlockState(world, blockposition, iblockdata); // Paper - exploded block state
|
+ final org.bukkit.block.BlockState explodedBlockState = org.bukkit.craftbukkit.block.CraftBlockStates.getUnplacedBlockState(world, blockposition, iblockdata); // Paper - add exploded state
|
||||||
world.removeBlock(blockposition, false);
|
world.removeBlock(blockposition, false);
|
||||||
BlockPos blockposition1 = blockposition.relative(((Direction) iblockdata.getValue(BedBlock.FACING)).getOpposite());
|
BlockPos blockposition1 = blockposition.relative(((Direction) iblockdata.getValue(BedBlock.FACING)).getOpposite());
|
||||||
|
|
||||||
@ -87,19 +87,19 @@ index 0e63fa3b49b1a275254cf108a51ab18e816aad49..2deb0d861a5f66d177068f37dd56da5c
|
|||||||
Vec3 vec3d = blockposition.getCenter();
|
Vec3 vec3d = blockposition.getCenter();
|
||||||
|
|
||||||
- world.explode((Entity) null, world.damageSources().badRespawnPointExplosion(vec3d), (ExplosionDamageCalculator) null, vec3d, 5.0F, true, Level.ExplosionInteraction.BLOCK);
|
- world.explode((Entity) null, world.damageSources().badRespawnPointExplosion(vec3d), (ExplosionDamageCalculator) null, vec3d, 5.0F, true, Level.ExplosionInteraction.BLOCK);
|
||||||
+ world.explode((Entity) null, world.damageSources().badRespawnPointExplosion(vec3d, explodedBlockState), (ExplosionDamageCalculator) null, vec3d, 5.0F, true, Level.ExplosionInteraction.BLOCK);
|
+ world.explode((Entity) null, world.damageSources().badRespawnPointExplosion(vec3d, explodedBlockState), (ExplosionDamageCalculator) null, vec3d, 5.0F, true, Level.ExplosionInteraction.BLOCK); // Paper - add exploded state
|
||||||
return InteractionResult.SUCCESS;
|
return InteractionResult.SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java b/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
|
diff --git a/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java b/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
|
||||||
index c83ffba568f33323b0f8b9a03fa0b7bbbfed4355..797ece59c10bdb60a86f71ca3b7bb95dbe0f1078 100644
|
index c83ffba568f33323b0f8b9a03fa0b7bbbfed4355..ec7b5e089c2911c7833e3fd7db4018ca2e0d4e85 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
|
--- a/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
|
+++ b/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
|
||||||
@@ -131,6 +131,7 @@ public class RespawnAnchorBlock extends Block {
|
@@ -131,6 +131,7 @@ public class RespawnAnchorBlock extends Block {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void explode(BlockState state, Level world, final BlockPos explodedPos) {
|
private void explode(BlockState state, Level world, final BlockPos explodedPos) {
|
||||||
+ final org.bukkit.block.BlockState explodedBlockState = org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(explodedPos, state, null); // Paper - exploded block state
|
+ final org.bukkit.block.BlockState explodedBlockState = org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(explodedPos, state, null); // Paper - add exploded state
|
||||||
world.removeBlock(explodedPos, false);
|
world.removeBlock(explodedPos, false);
|
||||||
Stream<Direction> stream = Direction.Plane.HORIZONTAL.stream(); // CraftBukkit - decompile error
|
Stream<Direction> stream = Direction.Plane.HORIZONTAL.stream(); // CraftBukkit - decompile error
|
||||||
|
|
||||||
@ -108,29 +108,29 @@ index c83ffba568f33323b0f8b9a03fa0b7bbbfed4355..797ece59c10bdb60a86f71ca3b7bb95d
|
|||||||
Vec3 vec3d = explodedPos.getCenter();
|
Vec3 vec3d = explodedPos.getCenter();
|
||||||
|
|
||||||
- world.explode((Entity) null, world.damageSources().badRespawnPointExplosion(vec3d), explosiondamagecalculator, vec3d, 5.0F, true, Level.ExplosionInteraction.BLOCK);
|
- world.explode((Entity) null, world.damageSources().badRespawnPointExplosion(vec3d), explosiondamagecalculator, vec3d, 5.0F, true, Level.ExplosionInteraction.BLOCK);
|
||||||
+ world.explode((Entity) null, world.damageSources().badRespawnPointExplosion(vec3d, explodedBlockState), explosiondamagecalculator, vec3d, 5.0F, true, Level.ExplosionInteraction.BLOCK); // Paper
|
+ world.explode((Entity) null, world.damageSources().badRespawnPointExplosion(vec3d, explodedBlockState), explosiondamagecalculator, vec3d, 5.0F, true, Level.ExplosionInteraction.BLOCK); // Paper - add exploded state
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean canSetSpawn(Level world) {
|
public static boolean canSetSpawn(Level world) {
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java
|
||||||
index f81c0d07a5efc92942d8ab5c50a8260db033307d..d3dd58ccb350d849f1d169e015369c183625c0b6 100644
|
index f81c0d07a5efc92942d8ab5c50a8260db033307d..8afc396c162d928902a9d9beb9f039b06630f755 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java
|
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java
|
||||||
@@ -276,6 +276,12 @@ public final class CraftBlockStates {
|
@@ -276,6 +276,12 @@ public final class CraftBlockStates {
|
||||||
BlockEntity tileEntity = (blockEntityTag == null) ? null : BlockEntity.loadStatic(blockPosition, blockData, blockEntityTag);
|
BlockEntity tileEntity = (blockEntityTag == null) ? null : BlockEntity.loadStatic(blockPosition, blockData, blockEntityTag);
|
||||||
return CraftBlockStates.getBlockState(null, blockPosition, blockData, tileEntity);
|
return CraftBlockStates.getBlockState(null, blockPosition, blockData, tileEntity);
|
||||||
}
|
}
|
||||||
+ // Paper start
|
+ // Paper start - add exploded state
|
||||||
+ public static BlockState getUnplacedBlockState(net.minecraft.world.level.BlockGetter levelAccessor, BlockPos blockPos, net.minecraft.world.level.block.state.BlockState blockData) {
|
+ public static BlockState getUnplacedBlockState(net.minecraft.world.level.BlockGetter levelAccessor, BlockPos blockPos, net.minecraft.world.level.block.state.BlockState blockData) {
|
||||||
+ BlockEntity tileEntity = levelAccessor.getBlockEntity(blockPos);
|
+ BlockEntity tileEntity = levelAccessor.getBlockEntity(blockPos);
|
||||||
+ return CraftBlockStates.getBlockState(null, blockPos, blockData, tileEntity);
|
+ return CraftBlockStates.getBlockState(null, blockPos, blockData, tileEntity);
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end - add exploded state
|
||||||
|
|
||||||
// See BlockStateFactory#createBlockState(World, BlockPosition, IBlockData, TileEntity)
|
// See BlockStateFactory#createBlockState(World, BlockPosition, IBlockData, TileEntity)
|
||||||
private static CraftBlockState getBlockState(World world, BlockPos blockPosition, net.minecraft.world.level.block.state.BlockState blockData, BlockEntity tileEntity) {
|
private static CraftBlockState getBlockState(World world, BlockPos blockPosition, net.minecraft.world.level.block.state.BlockState blockData, BlockEntity tileEntity) {
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||||
index 38fc706dabbeb93959638deb22311e226a48a6ee..ef7d6f898c2c94d0697e38230564e110948b0460 100644
|
index 38fc706dabbeb93959638deb22311e226a48a6ee..f5a1ff50e8943d7ea75f8b8534b17f7788d094e2 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||||
@@ -1045,7 +1045,7 @@ public class CraftEventFactory {
|
@@ -1045,7 +1045,7 @@ public class CraftEventFactory {
|
||||||
@ -138,7 +138,7 @@ index 38fc706dabbeb93959638deb22311e226a48a6ee..ef7d6f898c2c94d0697e38230564e110
|
|||||||
EntityDamageEvent event;
|
EntityDamageEvent event;
|
||||||
if (damager == null) {
|
if (damager == null) {
|
||||||
- event = new EntityDamageByBlockEvent(null, entity.getBukkitEntity(), DamageCause.BLOCK_EXPLOSION, modifiers, modifierFunctions);
|
- event = new EntityDamageByBlockEvent(null, entity.getBukkitEntity(), DamageCause.BLOCK_EXPLOSION, modifiers, modifierFunctions);
|
||||||
+ event = new EntityDamageByBlockEvent(null, entity.getBukkitEntity(), DamageCause.BLOCK_EXPLOSION, modifiers, modifierFunctions, source.explodedBlockState); // Paper - handle block state in damage
|
+ event = new EntityDamageByBlockEvent(null, entity.getBukkitEntity(), DamageCause.BLOCK_EXPLOSION, modifiers, modifierFunctions, source.explodedBlockState); // Paper - add exploded state
|
||||||
} else if (entity instanceof EnderDragon && /*PAIL FIXME ((EntityEnderDragon) entity).target == damager*/ false) {
|
} else if (entity instanceof EnderDragon && /*PAIL FIXME ((EntityEnderDragon) entity).target == damager*/ false) {
|
||||||
event = new EntityDamageEvent(entity.getBukkitEntity(), DamageCause.ENTITY_EXPLOSION, modifiers, modifierFunctions);
|
event = new EntityDamageEvent(entity.getBukkitEntity(), DamageCause.ENTITY_EXPLOSION, modifiers, modifierFunctions);
|
||||||
} else {
|
} else {
|
||||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] config for disabling entity tag tags
|
|||||||
|
|
||||||
|
|
||||||
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 e754a294645e1af9e39bde32dd1387cd54335e7e..940b8d0b89d7e55c938aefbe80ee71b0db3dacb8 100644
|
index e754a294645e1af9e39bde32dd1387cd54335e7e..82695b6f25011a315027bd7a5cb305af31663d4a 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
|
||||||
@@ -497,6 +497,13 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
|
@@ -497,6 +497,13 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
|
||||||
@ -18,7 +18,7 @@ index e754a294645e1af9e39bde32dd1387cd54335e7e..940b8d0b89d7e55c938aefbe80ee71b0
|
|||||||
+ tag.remove(itemNbt.getCompound("EntityTag"));
|
+ tag.remove(itemNbt.getCompound("EntityTag"));
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end - filter out protected tags
|
||||||
|
|
||||||
nbttagcompound1.merge(itemNbt.getCompound("EntityTag"));
|
nbttagcompound1.merge(itemNbt.getCompound("EntityTag"));
|
||||||
entity.setUUID(uuid);
|
entity.setUUID(uuid);
|
||||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Use single player info update packet on join
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
index b9d6f38df243bbdd55639716cfaff24eb95aaa74..ab5b354b0fb42535e8d176a219876e23f08c1f3d 100644
|
index 6d8d07f30cc18357b2b3a6aa50c54deb1c52f2b7..19c1c398ca8e91faa23e8dc3736cd0945a540419 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
@@ -3425,7 +3425,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
@@ -3425,7 +3425,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||||
@ -13,19 +13,19 @@ index b9d6f38df243bbdd55639716cfaff24eb95aaa74..ab5b354b0fb42535e8d176a219876e23
|
|||||||
this.chatMessageChain.append(() -> {
|
this.chatMessageChain.append(() -> {
|
||||||
this.player.setChatSession(session);
|
this.player.setChatSession(session);
|
||||||
- this.server.getPlayerList().broadcastAll(new ClientboundPlayerInfoUpdatePacket(EnumSet.of(ClientboundPlayerInfoUpdatePacket.Action.INITIALIZE_CHAT), List.of(this.player)));
|
- this.server.getPlayerList().broadcastAll(new ClientboundPlayerInfoUpdatePacket(EnumSet.of(ClientboundPlayerInfoUpdatePacket.Action.INITIALIZE_CHAT), List.of(this.player)));
|
||||||
+ this.server.getPlayerList().broadcastAll(new ClientboundPlayerInfoUpdatePacket(EnumSet.of(ClientboundPlayerInfoUpdatePacket.Action.INITIALIZE_CHAT), List.of(this.player)), this.player); // Paper
|
+ this.server.getPlayerList().broadcastAll(new ClientboundPlayerInfoUpdatePacket(EnumSet.of(ClientboundPlayerInfoUpdatePacket.Action.INITIALIZE_CHAT), List.of(this.player)), this.player); // Paper - Use single player info update packet on join
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||||
index 85ed7d2134902e2b3455efdb0defbbc8627933bf..a9cc3d7213f51a2a2cdc915fd9ab3cf97767b698 100644
|
index 85ed7d2134902e2b3455efdb0defbbc8627933bf..a34377fb8774e3c43db9e460c88239e2a5b41f5d 100644
|
||||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||||
@@ -358,6 +358,7 @@ public abstract class PlayerList {
|
@@ -358,6 +358,7 @@ public abstract class PlayerList {
|
||||||
// CraftBukkit start - sendAll above replaced with this loop
|
// CraftBukkit start - sendAll above replaced with this loop
|
||||||
ClientboundPlayerInfoUpdatePacket packet = ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(List.of(player));
|
ClientboundPlayerInfoUpdatePacket packet = ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(List.of(player));
|
||||||
|
|
||||||
+ final List<ServerPlayer> onlinePlayers = Lists.newArrayListWithExpectedSize(this.players.size() - 1); // Paper - use single player info update packet
|
+ final List<ServerPlayer> onlinePlayers = Lists.newArrayListWithExpectedSize(this.players.size() - 1); // Paper - Use single player info update packet on join
|
||||||
for (int i = 0; i < this.players.size(); ++i) {
|
for (int i = 0; i < this.players.size(); ++i) {
|
||||||
ServerPlayer entityplayer1 = (ServerPlayer) this.players.get(i);
|
ServerPlayer entityplayer1 = (ServerPlayer) this.players.get(i);
|
||||||
|
|
||||||
@ -34,18 +34,18 @@ index 85ed7d2134902e2b3455efdb0defbbc8627933bf..a9cc3d7213f51a2a2cdc915fd9ab3cf9
|
|||||||
}
|
}
|
||||||
|
|
||||||
- if (!bukkitPlayer.canSee(entityplayer1.getBukkitEntity())) {
|
- if (!bukkitPlayer.canSee(entityplayer1.getBukkitEntity())) {
|
||||||
+ if (entityplayer1 == player || !bukkitPlayer.canSee(entityplayer1.getBukkitEntity())) { // Paper - don't include joining player
|
+ if (entityplayer1 == player || !bukkitPlayer.canSee(entityplayer1.getBukkitEntity())) { // Paper - Use single player info update packet on join; Don't include joining player
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
- player.connection.send(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(List.of(entityplayer1)));
|
- player.connection.send(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(List.of(entityplayer1)));
|
||||||
+ onlinePlayers.add(entityplayer1); // Paper - use single player info update packet
|
+ onlinePlayers.add(entityplayer1); // Pape - Use single player info update packet on join
|
||||||
}
|
}
|
||||||
+ // Paper start - use single player info update packet
|
+ // Paper start - Use single player info update packet on join
|
||||||
+ if (!onlinePlayers.isEmpty()) {
|
+ if (!onlinePlayers.isEmpty()) {
|
||||||
+ player.connection.send(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(onlinePlayers));
|
+ player.connection.send(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(onlinePlayers));
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end - Use single player info update packet on join
|
||||||
player.sentListPacket = true;
|
player.sentListPacket = true;
|
||||||
player.supressTrackerForLogin = false; // Paper
|
player.supressTrackerForLogin = false; // Paper
|
||||||
((ServerLevel)player.level()).getChunkSource().chunkMap.addEntity(player); // Paper - track entity now
|
((ServerLevel)player.level()).getChunkSource().chunkMap.addEntity(player); // Paper - track entity now
|
||||||
|
@ -22,10 +22,10 @@ This patch corrects this behaviour by only shrinking the item if a totem
|
|||||||
of undying was found and the event was called uncancelled.
|
of undying was found and the event was called uncancelled.
|
||||||
|
|
||||||
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 a833036642b35e23b6887e0413d214ce0a6a4287..2b034ff26e8d6b28910945dc4e72a8a0d4b82a6f 100644
|
index 38d0def27625f5b7918cc2cebad0d9db2596ff3b..4b6858596f03233bf432329c1cdfe306cd0781ac 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
|
||||||
@@ -1610,7 +1610,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
@@ -1611,7 +1611,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||||
this.level().getCraftServer().getPluginManager().callEvent(event);
|
this.level().getCraftServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
|
@ -23,10 +23,10 @@ index f054d67a637b204de604fadc0d321f5c9816d808..fc5f1e1b445f0a55a35a31d58a90920a
|
|||||||
|
|
||||||
return !this.getResponse();
|
return !this.getResponse();
|
||||||
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 2b034ff26e8d6b28910945dc4e72a8a0d4b82a6f..070d9630af6d8c29de9df3b59ce14c57637ebf6d 100644
|
index 4b6858596f03233bf432329c1cdfe306cd0781ac..a89b49052556cb26accc1957aaef2aea63f6f583 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
|
||||||
@@ -2301,7 +2301,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
@@ -2302,7 +2302,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||||
// Duplicate triggers if blocking
|
// Duplicate triggers if blocking
|
||||||
if (event.getDamage(DamageModifier.BLOCKING) < 0) {
|
if (event.getDamage(DamageModifier.BLOCKING) < 0) {
|
||||||
if (this instanceof ServerPlayer) {
|
if (this instanceof ServerPlayer) {
|
||||||
@ -35,7 +35,7 @@ index 2b034ff26e8d6b28910945dc4e72a8a0d4b82a6f..070d9630af6d8c29de9df3b59ce14c57
|
|||||||
f2 = (float) -event.getDamage(DamageModifier.BLOCKING);
|
f2 = (float) -event.getDamage(DamageModifier.BLOCKING);
|
||||||
if (f2 > 0.0F && f2 < 3.4028235E37F) {
|
if (f2 > 0.0F && f2 < 3.4028235E37F) {
|
||||||
((ServerPlayer) this).awardStat(Stats.DAMAGE_BLOCKED_BY_SHIELD, Math.round(originalDamage * 10.0F));
|
((ServerPlayer) this).awardStat(Stats.DAMAGE_BLOCKED_BY_SHIELD, Math.round(originalDamage * 10.0F));
|
||||||
@@ -2309,7 +2309,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
@@ -2310,7 +2310,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (damagesource.getEntity() instanceof ServerPlayer) {
|
if (damagesource.getEntity() instanceof ServerPlayer) {
|
||||||
|
@ -10,11 +10,11 @@ but then replaced it with a bed, you could respawn
|
|||||||
at the bed in that world.
|
at the bed in that world.
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/BedBlock.java b/src/main/java/net/minecraft/world/level/block/BedBlock.java
|
diff --git a/src/main/java/net/minecraft/world/level/block/BedBlock.java b/src/main/java/net/minecraft/world/level/block/BedBlock.java
|
||||||
index 2deb0d861a5f66d177068f37dd56da5cf692633e..04b1aa22ac1df39d274f27d9c93e0492a8a673f8 100644
|
index e302fdf76d013826804108cb6444e2de5658b84f..2c1d03237d5b24b93807c7e97d969ace13d6a917 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/BedBlock.java
|
--- a/src/main/java/net/minecraft/world/level/block/BedBlock.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/BedBlock.java
|
+++ b/src/main/java/net/minecraft/world/level/block/BedBlock.java
|
||||||
@@ -109,6 +109,7 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock
|
@@ -109,6 +109,7 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock
|
||||||
world.explode((Entity) null, world.damageSources().badRespawnPointExplosion(vec3d, explodedBlockState), (ExplosionDamageCalculator) null, vec3d, 5.0F, true, Level.ExplosionInteraction.BLOCK);
|
world.explode((Entity) null, world.damageSources().badRespawnPointExplosion(vec3d, explodedBlockState), (ExplosionDamageCalculator) null, vec3d, 5.0F, true, Level.ExplosionInteraction.BLOCK); // Paper - add exploded state
|
||||||
return InteractionResult.SUCCESS;
|
return InteractionResult.SUCCESS;
|
||||||
} else if ((Boolean) state.getValue(BedBlock.OCCUPIED)) {
|
} else if ((Boolean) state.getValue(BedBlock.OCCUPIED)) {
|
||||||
+ if (!BedBlock.canSetSpawn(world)) return this.explodeBed(state, world, pos); // Paper - check explode first
|
+ if (!BedBlock.canSetSpawn(world)) return this.explodeBed(state, world, pos); // Paper - check explode first
|
||||||
|
@ -7,7 +7,7 @@ This logic hooks into the neighbour update which should be invoked
|
|||||||
as a result of redstone powering the trap door.
|
as a result of redstone powering the trap door.
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/TrapDoorBlock.java b/src/main/java/net/minecraft/world/level/block/TrapDoorBlock.java
|
diff --git a/src/main/java/net/minecraft/world/level/block/TrapDoorBlock.java b/src/main/java/net/minecraft/world/level/block/TrapDoorBlock.java
|
||||||
index 98566a0d8776bd460abc28d56c5df7d6b7ff0506..ab5d25e2e1e86804c91885739c4f86770c40143c 100644
|
index 98566a0d8776bd460abc28d56c5df7d6b7ff0506..1027e5e8da4323714a3e7fed8d39264b8b9e50e7 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/TrapDoorBlock.java
|
--- a/src/main/java/net/minecraft/world/level/block/TrapDoorBlock.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/TrapDoorBlock.java
|
+++ b/src/main/java/net/minecraft/world/level/block/TrapDoorBlock.java
|
||||||
@@ -153,7 +153,26 @@ public class TrapDoorBlock extends HorizontalDirectionalBlock implements SimpleW
|
@@ -153,7 +153,26 @@ public class TrapDoorBlock extends HorizontalDirectionalBlock implements SimpleW
|
||||||
@ -15,8 +15,8 @@ index 98566a0d8776bd460abc28d56c5df7d6b7ff0506..ab5d25e2e1e86804c91885739c4f8677
|
|||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
- if ((Boolean) state.getValue(TrapDoorBlock.OPEN) != flag1) {
|
- if ((Boolean) state.getValue(TrapDoorBlock.OPEN) != flag1) {
|
||||||
+ boolean open = (Boolean) state.getValue(TrapDoorBlock.OPEN) != flag1; // Paper - break redstone on trapdoors early
|
|
||||||
+ // Paper start - break redstone on trapdoors early
|
+ // Paper start - break redstone on trapdoors early
|
||||||
|
+ boolean open = (Boolean) state.getValue(TrapDoorBlock.OPEN) != flag1;
|
||||||
+ // note: this must run before any state for this block/its neighborus are written to the world
|
+ // note: this must run before any state for this block/its neighborus are written to the world
|
||||||
+ // we allow the redstone event to fire so that plugins can block
|
+ // we allow the redstone event to fire so that plugins can block
|
||||||
+ if (flag1 && open) { // if we are now powered and it caused the trap door to open
|
+ if (flag1 && open) { // if we are now powered and it caused the trap door to open
|
||||||
@ -33,8 +33,8 @@ index 98566a0d8776bd460abc28d56c5df7d6b7ff0506..ab5d25e2e1e86804c91885739c4f8677
|
|||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
|
+ if (open) {
|
||||||
+ // Paper end - break redstone on trapdoors early
|
+ // Paper end - break redstone on trapdoors early
|
||||||
+ if (open) { // Paper - break redstone on trapdoors early
|
|
||||||
state = (BlockState) state.setValue(TrapDoorBlock.OPEN, flag1);
|
state = (BlockState) state.setValue(TrapDoorBlock.OPEN, flag1);
|
||||||
this.playSound((Player) null, world, pos, flag1);
|
this.playSound((Player) null, world, pos, flag1);
|
||||||
}
|
}
|
||||||
|
@ -11,14 +11,17 @@ more than one Netty IO thread.
|
|||||||
Fixes https://github.com/PaperMC/Folia/issues/11
|
Fixes https://github.com/PaperMC/Folia/issues/11
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/resources/RegistryOps.java b/src/main/java/net/minecraft/resources/RegistryOps.java
|
diff --git a/src/main/java/net/minecraft/resources/RegistryOps.java b/src/main/java/net/minecraft/resources/RegistryOps.java
|
||||||
index 7709eeac907c4895a264cec0a3d453aa8b194c18..29182c49b30110809f786ae99b47fcc67976562f 100644
|
index 7709eeac907c4895a264cec0a3d453aa8b194c18..c7cfc3ca58f9439142fe5828117f6d576d7df10e 100644
|
||||||
--- a/src/main/java/net/minecraft/resources/RegistryOps.java
|
--- a/src/main/java/net/minecraft/resources/RegistryOps.java
|
||||||
+++ b/src/main/java/net/minecraft/resources/RegistryOps.java
|
+++ b/src/main/java/net/minecraft/resources/RegistryOps.java
|
||||||
@@ -19,11 +19,11 @@ public class RegistryOps<T> extends DelegatingOps<T> {
|
@@ -19,11 +19,14 @@ public class RegistryOps<T> extends DelegatingOps<T> {
|
||||||
|
|
||||||
private static RegistryOps.RegistryInfoLookup memoizeLookup(final RegistryOps.RegistryInfoLookup registryInfoGetter) {
|
private static RegistryOps.RegistryInfoLookup memoizeLookup(final RegistryOps.RegistryInfoLookup registryInfoGetter) {
|
||||||
return new RegistryOps.RegistryInfoLookup() {
|
return new RegistryOps.RegistryInfoLookup() {
|
||||||
- private final Map<ResourceKey<? extends Registry<?>>, Optional<? extends RegistryOps.RegistryInfo<?>>> lookups = new HashMap<>();
|
- private final Map<ResourceKey<? extends Registry<?>>, Optional<? extends RegistryOps.RegistryInfo<?>>> lookups = new HashMap<>();
|
||||||
|
+ // The concurrent access occurs on the Netty IO threads when serializing packets.
|
||||||
|
+ // Thus, it seems it was an oversight of the implementator of this function as there
|
||||||
|
+ // are typically more than one Netty IO thread.
|
||||||
+ private final Map<ResourceKey<? extends Registry<?>>, Optional<? extends RegistryOps.RegistryInfo<?>>> lookups = new java.util.concurrent.ConcurrentHashMap<>(); // Paper - fix concurrent access to lookups field
|
+ private final Map<ResourceKey<? extends Registry<?>>, Optional<? extends RegistryOps.RegistryInfo<?>>> lookups = new java.util.concurrent.ConcurrentHashMap<>(); // Paper - fix concurrent access to lookups field
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -16,14 +16,14 @@ sections with a ZeroBitStorage data to to take ~20% of the process,
|
|||||||
now it takes <1%.
|
now it takes <1%.
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
|
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
|
||||||
index b39fea80fcb83873b7e7085eaaf935e712f0ede7..f0de72afad4bb571153436399386a6a8a70582a6 100644
|
index b39fea80fcb83873b7e7085eaaf935e712f0ede7..9da74764a91bea7822c0444b48623b23e038d3f2 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
|
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
|
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
|
||||||
@@ -144,6 +144,7 @@ public class LevelChunkSection {
|
@@ -144,6 +144,7 @@ public class LevelChunkSection {
|
||||||
this.nonEmptyBlockCount = 0;
|
this.nonEmptyBlockCount = 0;
|
||||||
this.tickingBlockCount = 0;
|
this.tickingBlockCount = 0;
|
||||||
this.tickingFluidCount = 0;
|
this.tickingFluidCount = 0;
|
||||||
+ if (this.maybeHas((BlockState state) -> !state.isAir() || !state.getFluidState().isEmpty())) { // Paper - do not run forEachLocation on clearly empty sections
|
+ if (this.maybeHas((BlockState state) -> !state.isAir() || !state.getFluidState().isEmpty())) { // Paper - Perf: do not run forEachLocation on clearly empty sections
|
||||||
this.states.forEachLocation((BlockState iblockdata, int i) -> {
|
this.states.forEachLocation((BlockState iblockdata, int i) -> {
|
||||||
FluidState fluid = iblockdata.getFluidState();
|
FluidState fluid = iblockdata.getFluidState();
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ index b39fea80fcb83873b7e7085eaaf935e712f0ede7..f0de72afad4bb571153436399386a6a8
|
|||||||
// Paper end - optimise collisions
|
// Paper end - optimise collisions
|
||||||
|
|
||||||
});
|
});
|
||||||
+ } // Paper - do not run forEachLocation on clearly empty sections
|
+ } // Paper - Perf: do not run forEachLocation on clearly empty sections
|
||||||
// Paper end
|
// Paper end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ index f58386e952d29a16d160b628a23efbe102791277..d0404f7f103b4f98f9d76cf2a5cddec0
|
|||||||
return enuminteractionresult;
|
return enuminteractionresult;
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
index 48bae46261f592923c8c6f1d56c92ce6a121f1b8..589662812bc6f6fb09d50d8793c7ed4cb1140af8 100644
|
index caa9fd305c90fe84b2eebca0f244c818800021ca..3f9106eb34db5df10961a44f56f2110fec8bd3c6 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
@@ -1955,6 +1955,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
@@ -1955,6 +1955,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||||
@ -46,10 +46,10 @@ index 48bae46261f592923c8c6f1d56c92ce6a121f1b8..589662812bc6f6fb09d50d8793c7ed4c
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
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 070d9630af6d8c29de9df3b59ce14c57637ebf6d..668297b8978cbde6635254122f8f29f4a7ead45b 100644
|
index a89b49052556cb26accc1957aaef2aea63f6f583..fe5c46c9bb6130a29ec9cbb65e9e7142a79a157e 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
|
||||||
@@ -3813,6 +3813,11 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
@@ -3814,6 +3814,11 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||||
return ((Byte) this.entityData.get(LivingEntity.DATA_LIVING_ENTITY_FLAGS) & 2) > 0 ? InteractionHand.OFF_HAND : InteractionHand.MAIN_HAND;
|
return ((Byte) this.entityData.get(LivingEntity.DATA_LIVING_ENTITY_FLAGS) & 2) > 0 ? InteractionHand.OFF_HAND : InteractionHand.MAIN_HAND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ For larger ranges, it's better to iterate over the player list
|
|||||||
than the entity slices.
|
than the entity slices.
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
||||||
index 2f12a1054c9c9e311e02dc5c3244ad3688db15ba..f13943db6f2fb923c52dcf9e8bf7000041d0a362 100644
|
index afb20f58655e958bd64efd1a1265da9c94857f79..5a1da6316ff56ea94a1ba1b68ce51bdffcee9736 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
--- a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
||||||
@@ -329,7 +329,22 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name
|
@@ -329,7 +329,22 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name
|
||||||
@ -15,7 +15,7 @@ index 2f12a1054c9c9e311e02dc5c3244ad3688db15ba..f13943db6f2fb923c52dcf9e8bf70000
|
|||||||
|
|
||||||
AABB axisalignedbb = (new AABB(blockposition)).inflate(d0).expandTowards(0.0D, (double) world.getHeight(), 0.0D);
|
AABB axisalignedbb = (new AABB(blockposition)).inflate(d0).expandTowards(0.0D, (double) world.getHeight(), 0.0D);
|
||||||
- List<Player> list = world.getEntitiesOfClass(Player.class, axisalignedbb);
|
- List<Player> list = world.getEntitiesOfClass(Player.class, axisalignedbb);
|
||||||
+ // Paper start - optimize player lookup for beacons
|
+ // Paper start - Perf: optimize player lookup for beacons
|
||||||
+ List<Player> list;
|
+ List<Player> list;
|
||||||
+ if (d0 <= 128.0) {
|
+ if (d0 <= 128.0) {
|
||||||
+ list = world.getEntitiesOfClass(Player.class, axisalignedbb);
|
+ list = world.getEntitiesOfClass(Player.class, axisalignedbb);
|
||||||
@ -30,7 +30,7 @@ index 2f12a1054c9c9e311e02dc5c3244ad3688db15ba..f13943db6f2fb923c52dcf9e8bf70000
|
|||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end - optimize player lookup for beacons
|
+ // Paper end - Perf: optimize player lookup for beacons
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
@ -6,18 +6,18 @@ Subject: [PATCH] Array backed synched entity data
|
|||||||
Original code by jellysquid3 in Lithium, licensed under the GNU Lesser General Public License v3.0 (https://www.gnu.org/licenses/lgpl-3.0.html)
|
Original code by jellysquid3 in Lithium, licensed under the GNU Lesser General Public License v3.0 (https://www.gnu.org/licenses/lgpl-3.0.html)
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java b/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java
|
diff --git a/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java b/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java
|
||||||
index ccb7d92b6c36b6225a2e640f8cea6c0da37464c8..fa3faf436dc1c5ed2d53abaec6e126d3e3c22c36 100644
|
index ccb7d92b6c36b6225a2e640f8cea6c0da37464c8..58b602e550258c1062ee940bc46538dac95d8979 100644
|
||||||
--- a/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java
|
--- a/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java
|
||||||
+++ b/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java
|
+++ b/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java
|
||||||
@@ -34,6 +34,11 @@ public class SynchedEntityData {
|
@@ -34,6 +34,11 @@ public class SynchedEntityData {
|
||||||
private final Int2ObjectMap<SynchedEntityData.DataItem<?>> itemsById = new Int2ObjectOpenHashMap();
|
private final Int2ObjectMap<SynchedEntityData.DataItem<?>> itemsById = new Int2ObjectOpenHashMap();
|
||||||
// private final ReadWriteLock lock = new ReentrantReadWriteLock(); // Spigot - not required
|
// private final ReadWriteLock lock = new ReentrantReadWriteLock(); // Spigot - not required
|
||||||
private boolean isDirty;
|
private boolean isDirty;
|
||||||
+ // Paper start - array backed synched entity data
|
+ // Paper start - Perf: array backed synched entity data
|
||||||
+ private static final int DEFAULT_ENTRY_COUNT = 10;
|
+ private static final int DEFAULT_ENTRY_COUNT = 10;
|
||||||
+ private static final int GROW_FACTOR = 8;
|
+ private static final int GROW_FACTOR = 8;
|
||||||
+ private SynchedEntityData.DataItem<?>[] itemsArray = new SynchedEntityData.DataItem<?>[DEFAULT_ENTRY_COUNT];
|
+ private SynchedEntityData.DataItem<?>[] itemsArray = new SynchedEntityData.DataItem<?>[DEFAULT_ENTRY_COUNT];
|
||||||
+ // Paper end - array backed synched entity data
|
+ // Paper end - Perf: array backed synched entity data
|
||||||
|
|
||||||
public SynchedEntityData(Entity trackedEntity) {
|
public SynchedEntityData(Entity trackedEntity) {
|
||||||
this.entity = trackedEntity;
|
this.entity = trackedEntity;
|
||||||
@ -25,7 +25,7 @@ index ccb7d92b6c36b6225a2e640f8cea6c0da37464c8..fa3faf436dc1c5ed2d53abaec6e126d3
|
|||||||
// this.lock.writeLock().lock(); // Spigot - not required
|
// this.lock.writeLock().lock(); // Spigot - not required
|
||||||
this.itemsById.put(key.getId(), datawatcher_item);
|
this.itemsById.put(key.getId(), datawatcher_item);
|
||||||
// this.lock.writeLock().unlock(); // Spigot - not required
|
// this.lock.writeLock().unlock(); // Spigot - not required
|
||||||
+ // Paper start - array backed synched entity data
|
+ // Paper start - Perf: array backed synched entity data
|
||||||
+ if (this.itemsArray.length <= key.getId()) {
|
+ if (this.itemsArray.length <= key.getId()) {
|
||||||
+ final int newSize = Math.min(key.getId() + GROW_FACTOR, MAX_ID_VALUE);
|
+ final int newSize = Math.min(key.getId() + GROW_FACTOR, MAX_ID_VALUE);
|
||||||
+
|
+
|
||||||
@ -33,7 +33,7 @@ index ccb7d92b6c36b6225a2e640f8cea6c0da37464c8..fa3faf436dc1c5ed2d53abaec6e126d3
|
|||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ this.itemsArray[key.getId()] = datawatcher_item;
|
+ this.itemsArray[key.getId()] = datawatcher_item;
|
||||||
+ // Paper end - array backed synched entity data
|
+ // Paper end - Perf: array backed synched entity data
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T> boolean hasItem(EntityDataAccessor<T> key) {
|
public <T> boolean hasItem(EntityDataAccessor<T> key) {
|
||||||
@ -42,7 +42,7 @@ index ccb7d92b6c36b6225a2e640f8cea6c0da37464c8..fa3faf436dc1c5ed2d53abaec6e126d3
|
|||||||
return datawatcher_item;
|
return datawatcher_item;
|
||||||
*/
|
*/
|
||||||
- return (SynchedEntityData.DataItem) this.itemsById.get(key.getId());
|
- return (SynchedEntityData.DataItem) this.itemsById.get(key.getId());
|
||||||
+ // Paper start - array backed synched entity data
|
+ // Paper start - Perf: array backed synched entity data
|
||||||
+ final int id = key.getId();
|
+ final int id = key.getId();
|
||||||
+
|
+
|
||||||
+ if (id < 0 || id >= this.itemsArray.length) {
|
+ if (id < 0 || id >= this.itemsArray.length) {
|
||||||
@ -50,7 +50,7 @@ index ccb7d92b6c36b6225a2e640f8cea6c0da37464c8..fa3faf436dc1c5ed2d53abaec6e126d3
|
|||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ return (DataItem<T>) this.itemsArray[id];
|
+ return (DataItem<T>) this.itemsArray[id];
|
||||||
+ // Paper end - array backed synched entity data
|
+ // Paper end - Perf: array backed synched entity data
|
||||||
// Spigot end
|
// Spigot end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,14 +7,15 @@ The lists are only supposed to contain ticks for the 1 radius
|
|||||||
neighbours of the chunk.
|
neighbours of the chunk.
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/UpgradeData.java b/src/main/java/net/minecraft/world/level/chunk/UpgradeData.java
|
diff --git a/src/main/java/net/minecraft/world/level/chunk/UpgradeData.java b/src/main/java/net/minecraft/world/level/chunk/UpgradeData.java
|
||||||
index 8943081f270d5328b4f333b7bc1ae1a449d1788c..0f94af3502ef517c33d04841a80ea2ace077f0af 100644
|
index 8943081f270d5328b4f333b7bc1ae1a449d1788c..a5b90222cfad5b282f3f2db4dd5d1b201761fb72 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/chunk/UpgradeData.java
|
--- a/src/main/java/net/minecraft/world/level/chunk/UpgradeData.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/chunk/UpgradeData.java
|
+++ b/src/main/java/net/minecraft/world/level/chunk/UpgradeData.java
|
||||||
@@ -99,6 +99,24 @@ public class UpgradeData {
|
@@ -99,6 +99,25 @@ public class UpgradeData {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
+ // Paper start - filter out relocated neighbour ticks
|
+ // Paper start - filter out relocated neighbour ticks
|
||||||
|
+ // The lists are only supposed to contain ticks for the 1 radius neighbours of the chunk
|
||||||
+ private static <T> void filterTickList(int chunkX, int chunkZ, List<SavedTick<T>> ticks) {
|
+ private static <T> void filterTickList(int chunkX, int chunkZ, List<SavedTick<T>> ticks) {
|
||||||
+ for (java.util.Iterator<SavedTick<T>> iterator = ticks.iterator(); iterator.hasNext();) {
|
+ for (java.util.Iterator<SavedTick<T>> iterator = ticks.iterator(); iterator.hasNext();) {
|
||||||
+ SavedTick<T> tick = iterator.next();
|
+ SavedTick<T> tick = iterator.next();
|
||||||
@ -35,7 +36,7 @@ index 8943081f270d5328b4f333b7bc1ae1a449d1788c..0f94af3502ef517c33d04841a80ea2ac
|
|||||||
public void upgrade(LevelChunk chunk) {
|
public void upgrade(LevelChunk chunk) {
|
||||||
this.upgradeInside(chunk);
|
this.upgradeInside(chunk);
|
||||||
|
|
||||||
@@ -106,6 +124,11 @@ public class UpgradeData {
|
@@ -106,6 +125,11 @@ public class UpgradeData {
|
||||||
upgradeSides(chunk, direction8);
|
upgradeSides(chunk, direction8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ index d43106eb89b14667e85cd6e8fa047d64f2e8ec87..56eddd28429cf42c02d88b8bf79f8b61
|
|||||||
|
|
||||||
static class EntryBuilder {
|
static class EntryBuilder {
|
||||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||||
index b33f6f3ceb279eb5a36df7d37d56bfce951c3de7..7535ff5f5495879a66085fa9e67c26efbdedb825 100644
|
index 359fb75e1ea580bfd5c1b9400000c0c4c8fa08c8..77f585edf113033dc3d7de874d388f4de209fd3b 100644
|
||||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||||
@@ -356,14 +356,22 @@ public abstract class PlayerList {
|
@@ -356,14 +356,22 @@ public abstract class PlayerList {
|
||||||
@ -84,7 +84,7 @@ index b33f6f3ceb279eb5a36df7d37d56bfce951c3de7..7535ff5f5495879a66085fa9e67c26ef
|
|||||||
- ClientboundPlayerInfoUpdatePacket packet = ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(List.of(player));
|
- ClientboundPlayerInfoUpdatePacket packet = ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(List.of(player));
|
||||||
+ ClientboundPlayerInfoUpdatePacket packet = ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(List.of(player)); // Paper - Add Listing API for Player
|
+ ClientboundPlayerInfoUpdatePacket packet = ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(List.of(player)); // Paper - Add Listing API for Player
|
||||||
|
|
||||||
final List<ServerPlayer> onlinePlayers = Lists.newArrayListWithExpectedSize(this.players.size() - 1); // Paper - use single player info update packet
|
final List<ServerPlayer> onlinePlayers = Lists.newArrayListWithExpectedSize(this.players.size() - 1); // Paper - Use single player info update packet on join
|
||||||
for (int i = 0; i < this.players.size(); ++i) {
|
for (int i = 0; i < this.players.size(); ++i) {
|
||||||
ServerPlayer entityplayer1 = (ServerPlayer) this.players.get(i);
|
ServerPlayer entityplayer1 = (ServerPlayer) this.players.get(i);
|
||||||
|
|
||||||
@ -100,18 +100,18 @@ index b33f6f3ceb279eb5a36df7d37d56bfce951c3de7..7535ff5f5495879a66085fa9e67c26ef
|
|||||||
+ // Paper end - Add Listing API for Player
|
+ // Paper end - Add Listing API for Player
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entityplayer1 == player || !bukkitPlayer.canSee(entityplayer1.getBukkitEntity())) { // Paper - don't include joining player
|
if (entityplayer1 == player || !bukkitPlayer.canSee(entityplayer1.getBukkitEntity())) { // Paper - Use single player info update packet on join; Don't include joining player
|
||||||
@@ -374,7 +382,7 @@ public abstract class PlayerList {
|
@@ -374,7 +382,7 @@ public abstract class PlayerList {
|
||||||
}
|
}
|
||||||
// Paper start - use single player info update packet
|
// Paper start - Use single player info update packet on join
|
||||||
if (!onlinePlayers.isEmpty()) {
|
if (!onlinePlayers.isEmpty()) {
|
||||||
- player.connection.send(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(onlinePlayers));
|
- player.connection.send(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(onlinePlayers));
|
||||||
+ player.connection.send(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(onlinePlayers, player)); // Paper - Add Listing API for Player
|
+ player.connection.send(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(onlinePlayers, player)); // Paper - Add Listing API for Player
|
||||||
}
|
}
|
||||||
// Paper end
|
// Paper end - Use single player info update packet on join
|
||||||
player.sentListPacket = true;
|
player.sentListPacket = true;
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||||
index b9431260c928c264eac9b4d64f5692945a5a0b1b..d9a0ee62892a2f8044d874d262125ea03ee60057 100644
|
index 8bc528408164427380277f3805d5275ebd7c7bb4..5c3a9c7d6b2d9a810edbb356fb3cdde40b3194b1 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||||
@@ -182,6 +182,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
@@ -182,6 +182,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||||
|
@ -20,7 +20,7 @@ After this patch, the full iteration over all recipes checking for a match shoul
|
|||||||
initial recipe match. Then that recipe will be checked first for all future recipe match checks.
|
initial recipe match. Then that recipe will be checked first for all future recipe match checks.
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/inventory/CraftingMenu.java b/src/main/java/net/minecraft/world/inventory/CraftingMenu.java
|
diff --git a/src/main/java/net/minecraft/world/inventory/CraftingMenu.java b/src/main/java/net/minecraft/world/inventory/CraftingMenu.java
|
||||||
index a7aa2a4845cbf5a0843dcb93f7bdc5501f62a145..4c8ce073094e55ea0df67fe02c0d1cc8aef76562 100644
|
index a7aa2a4845cbf5a0843dcb93f7bdc5501f62a145..1b05847cd5ec69ecaf75a2d3803089efbb89d165 100644
|
||||||
--- a/src/main/java/net/minecraft/world/inventory/CraftingMenu.java
|
--- a/src/main/java/net/minecraft/world/inventory/CraftingMenu.java
|
||||||
+++ b/src/main/java/net/minecraft/world/inventory/CraftingMenu.java
|
+++ b/src/main/java/net/minecraft/world/inventory/CraftingMenu.java
|
||||||
@@ -76,7 +76,8 @@ public class CraftingMenu extends RecipeBookMenu<CraftingContainer> {
|
@@ -76,7 +76,8 @@ public class CraftingMenu extends RecipeBookMenu<CraftingContainer> {
|
||||||
@ -28,13 +28,13 @@ index a7aa2a4845cbf5a0843dcb93f7bdc5501f62a145..4c8ce073094e55ea0df67fe02c0d1cc8
|
|||||||
ServerPlayer entityplayer = (ServerPlayer) player;
|
ServerPlayer entityplayer = (ServerPlayer) player;
|
||||||
ItemStack itemstack = ItemStack.EMPTY;
|
ItemStack itemstack = ItemStack.EMPTY;
|
||||||
- Optional<RecipeHolder<CraftingRecipe>> optional = world.getServer().getRecipeManager().getRecipeFor(RecipeType.CRAFTING, craftingInventory, world);
|
- Optional<RecipeHolder<CraftingRecipe>> optional = world.getServer().getRecipeManager().getRecipeFor(RecipeType.CRAFTING, craftingInventory, world);
|
||||||
+ final RecipeHolder<?> currentRecipe = craftingInventory.getCurrentRecipe(); // Paper - check last recipe used first
|
+ final RecipeHolder<?> currentRecipe = craftingInventory.getCurrentRecipe(); // Paper - Perf: Improve mass crafting; check last recipe used first
|
||||||
+ Optional<RecipeHolder<CraftingRecipe>> optional = currentRecipe == null ? world.getServer().getRecipeManager().getRecipeFor(RecipeType.CRAFTING, craftingInventory, world) : world.getServer().getRecipeManager().getRecipeFor(RecipeType.CRAFTING, craftingInventory, world, currentRecipe.id()).map(com.mojang.datafixers.util.Pair::getSecond); // Paper - check last recipe used first
|
+ Optional<RecipeHolder<CraftingRecipe>> optional = currentRecipe == null ? world.getServer().getRecipeManager().getRecipeFor(RecipeType.CRAFTING, craftingInventory, world) : world.getServer().getRecipeManager().getRecipeFor(RecipeType.CRAFTING, craftingInventory, world, currentRecipe.id()).map(com.mojang.datafixers.util.Pair::getSecond); // Paper - Perf: Improve mass crafting; check last recipe used first
|
||||||
|
|
||||||
if (optional.isPresent()) {
|
if (optional.isPresent()) {
|
||||||
RecipeHolder<CraftingRecipe> recipeholder = (RecipeHolder) optional.get();
|
RecipeHolder<CraftingRecipe> recipeholder = (RecipeHolder) optional.get();
|
||||||
diff --git a/src/main/java/net/minecraft/world/inventory/ResultSlot.java b/src/main/java/net/minecraft/world/inventory/ResultSlot.java
|
diff --git a/src/main/java/net/minecraft/world/inventory/ResultSlot.java b/src/main/java/net/minecraft/world/inventory/ResultSlot.java
|
||||||
index 7b2ac37e8bd305919f04ded043e50f13b3fe4253..8c97a7269040436cacc65fd182fa8e5f931b6c16 100644
|
index 7b2ac37e8bd305919f04ded043e50f13b3fe4253..245731757f2593c736916ac6ee59e2c91d179934 100644
|
||||||
--- a/src/main/java/net/minecraft/world/inventory/ResultSlot.java
|
--- a/src/main/java/net/minecraft/world/inventory/ResultSlot.java
|
||||||
+++ b/src/main/java/net/minecraft/world/inventory/ResultSlot.java
|
+++ b/src/main/java/net/minecraft/world/inventory/ResultSlot.java
|
||||||
@@ -59,7 +59,7 @@ public class ResultSlot extends Slot {
|
@@ -59,7 +59,7 @@ public class ResultSlot extends Slot {
|
||||||
@ -42,28 +42,28 @@ index 7b2ac37e8bd305919f04ded043e50f13b3fe4253..8c97a7269040436cacc65fd182fa8e5f
|
|||||||
public void onTake(Player player, ItemStack stack) {
|
public void onTake(Player player, ItemStack stack) {
|
||||||
this.checkTakeAchievements(stack);
|
this.checkTakeAchievements(stack);
|
||||||
- NonNullList<ItemStack> nonNullList = player.level().getRecipeManager().getRemainingItemsFor(RecipeType.CRAFTING, this.craftSlots, player.level());
|
- NonNullList<ItemStack> nonNullList = player.level().getRecipeManager().getRemainingItemsFor(RecipeType.CRAFTING, this.craftSlots, player.level());
|
||||||
+ NonNullList<ItemStack> nonNullList = player.level().getRecipeManager().getRemainingItemsFor(RecipeType.CRAFTING, this.craftSlots, player.level(), this.craftSlots.getCurrentRecipe() != null ? this.craftSlots.getCurrentRecipe().id() : null); // Paper - check last recipe used first
|
+ NonNullList<ItemStack> nonNullList = player.level().getRecipeManager().getRemainingItemsFor(RecipeType.CRAFTING, this.craftSlots, player.level(), this.craftSlots.getCurrentRecipe() != null ? this.craftSlots.getCurrentRecipe().id() : null); // Paper - Perf: Improve mass crafting; check last recipe used first
|
||||||
|
|
||||||
for(int i = 0; i < nonNullList.size(); ++i) {
|
for(int i = 0; i < nonNullList.size(); ++i) {
|
||||||
ItemStack itemStack = this.craftSlots.getItem(i);
|
ItemStack itemStack = this.craftSlots.getItem(i);
|
||||||
diff --git a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
|
diff --git a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
|
||||||
index 93e7d350a4176250d9ae3f0e1e7e6a4197d613b0..b81e1802c8dcc8ebdef96d70088c18379598a66b 100644
|
index a0ab3c55826af292d1cdac05648139b4d31f1376..d87124f5356180a37e581febc6141fdc5f1395a7 100644
|
||||||
--- a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
|
--- a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
|
||||||
+++ b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
|
+++ b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
|
||||||
@@ -122,13 +122,16 @@ public class RecipeManager extends SimpleJsonResourceReloadListener {
|
@@ -122,13 +122,16 @@ public class RecipeManager extends SimpleJsonResourceReloadListener {
|
||||||
RecipeHolder<T> recipeholder = (RecipeHolder) map.get(id);
|
RecipeHolder<T> recipeholder = (RecipeHolder) map.get(id);
|
||||||
|
|
||||||
if (recipeholder != null && recipeholder.value().matches(inventory, world)) {
|
if (recipeholder != null && recipeholder.value().matches(inventory, world)) {
|
||||||
+ inventory.setCurrentRecipe(recipeholder); // Paper
|
+ inventory.setCurrentRecipe(recipeholder); // Paper - Perf: Improve mass crafting
|
||||||
return Optional.of(Pair.of(id, recipeholder));
|
return Optional.of(Pair.of(id, recipeholder));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
+ inventory.setCurrentRecipe(null); // Paper - clear before it might be set again
|
+ inventory.setCurrentRecipe(null); // Paper - Perf: Improve mass crafting;; clear before it might be set again
|
||||||
return map.entrySet().stream().filter((entry) -> {
|
return map.entrySet().stream().filter((entry) -> {
|
||||||
return ((RecipeHolder) entry.getValue()).value().matches(inventory, world);
|
return ((RecipeHolder) entry.getValue()).value().matches(inventory, world);
|
||||||
}).findFirst().map((entry) -> {
|
}).findFirst().map((entry) -> {
|
||||||
+ inventory.setCurrentRecipe(entry.getValue()); // Paper
|
+ inventory.setCurrentRecipe(entry.getValue()); // Paper - Perf: Improve mass crafting
|
||||||
return Pair.of((ResourceLocation) entry.getKey(), (RecipeHolder) entry.getValue());
|
return Pair.of((ResourceLocation) entry.getKey(), (RecipeHolder) entry.getValue());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -72,12 +72,12 @@ index 93e7d350a4176250d9ae3f0e1e7e6a4197d613b0..b81e1802c8dcc8ebdef96d70088c1837
|
|||||||
|
|
||||||
public <C extends Container, T extends Recipe<C>> NonNullList<ItemStack> getRemainingItemsFor(RecipeType<T> type, C inventory, Level world) {
|
public <C extends Container, T extends Recipe<C>> NonNullList<ItemStack> getRemainingItemsFor(RecipeType<T> type, C inventory, Level world) {
|
||||||
- Optional<RecipeHolder<T>> optional = this.getRecipeFor(type, inventory, world);
|
- Optional<RecipeHolder<T>> optional = this.getRecipeFor(type, inventory, world);
|
||||||
+ // Paper start - check last recipe used first
|
+ // Paper start - Perf: Improve mass crafting;; check last recipe used first
|
||||||
+ return this.getRemainingItemsFor(type, inventory, world, null);
|
+ return this.getRemainingItemsFor(type, inventory, world, null);
|
||||||
+ }
|
+ }
|
||||||
+ public <C extends Container, T extends Recipe<C>> NonNullList<ItemStack> getRemainingItemsFor(RecipeType<T> type, C inventory, Level world, @Nullable ResourceLocation firstToCheck) {
|
+ public <C extends Container, T extends Recipe<C>> NonNullList<ItemStack> getRemainingItemsFor(RecipeType<T> type, C inventory, Level world, @Nullable ResourceLocation firstToCheck) {
|
||||||
+ Optional<RecipeHolder<T>> optional = firstToCheck == null ? this.getRecipeFor(type, inventory, world) : this.getRecipeFor(type, inventory, world, firstToCheck).map(Pair::getSecond);
|
+ Optional<RecipeHolder<T>> optional = firstToCheck == null ? this.getRecipeFor(type, inventory, world) : this.getRecipeFor(type, inventory, world, firstToCheck).map(Pair::getSecond);
|
||||||
+ // Paper end
|
+ // Paper end - Perf: Improve mass crafting
|
||||||
|
|
||||||
if (optional.isPresent()) {
|
if (optional.isPresent()) {
|
||||||
return ((RecipeHolder) optional.get()).value().getRemainingItems(inventory);
|
return ((RecipeHolder) optional.get()).value().getRemainingItems(inventory);
|
||||||
|
@ -14,7 +14,7 @@ ensure that the returned found structure (which may for example be a buried
|
|||||||
treasure that will be marked on a treasure map) is the same as in vanilla.
|
treasure that will be marked on a treasure map) is the same as in vanilla.
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
|
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
|
||||||
index e9239f90e59d1429fc7a2618e0fd3b8a57633b87..59ba71da7f679e53aab2a84cb991b77d1abf6578 100644
|
index e9239f90e59d1429fc7a2618e0fd3b8a57633b87..a21db714971025448dd915b2281a1d9121eaf758 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
|
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
|
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
|
||||||
@@ -260,12 +260,15 @@ public abstract class ChunkGenerator {
|
@@ -260,12 +260,15 @@ public abstract class ChunkGenerator {
|
||||||
@ -22,7 +22,7 @@ index e9239f90e59d1429fc7a2618e0fd3b8a57633b87..59ba71da7f679e53aab2a84cb991b77d
|
|||||||
|
|
||||||
for (int j1 = -radius; j1 <= radius; ++j1) {
|
for (int j1 = -radius; j1 <= radius; ++j1) {
|
||||||
- boolean flag1 = j1 == -radius || j1 == radius;
|
- boolean flag1 = j1 == -radius || j1 == radius;
|
||||||
+ // Paper start - iterate over border chunks instead of entire square chunk area
|
+ // Paper start - Perf: iterate over border chunks instead of entire square chunk area
|
||||||
+ boolean flag1 = j1 == -radius || j1 == radius; final boolean onBorderAlongZAxis = flag1; // Paper - OBFHELPER
|
+ boolean flag1 = j1 == -radius || j1 == radius; final boolean onBorderAlongZAxis = flag1; // Paper - OBFHELPER
|
||||||
|
|
||||||
- for (int k1 = -radius; k1 <= radius; ++k1) {
|
- for (int k1 = -radius; k1 <= radius; ++k1) {
|
||||||
@ -33,7 +33,7 @@ index e9239f90e59d1429fc7a2618e0fd3b8a57633b87..59ba71da7f679e53aab2a84cb991b77d
|
|||||||
- if (flag1 || flag2) {
|
- if (flag1 || flag2) {
|
||||||
+ // if (flag1 || flag2) {
|
+ // if (flag1 || flag2) {
|
||||||
+ if (true) {
|
+ if (true) {
|
||||||
+ // Paper end - iterate over border chunks instead of entire square chunk area
|
+ // Paper end - Perf: iterate over border chunks instead of entire square chunk area
|
||||||
int l1 = centerChunkX + i1 * j1;
|
int l1 = centerChunkX + i1 * j1;
|
||||||
int i2 = centerChunkZ + i1 * k1;
|
int i2 = centerChunkZ + i1 * k1;
|
||||||
ChunkPos chunkcoordintpair = placement.getPotentialStructureChunk(seed, l1, i2);
|
ChunkPos chunkcoordintpair = placement.getPotentialStructureChunk(seed, l1, i2);
|
||||||
|
@ -10,7 +10,7 @@ which would cause a crash on Folia but would appear to function
|
|||||||
fine on Paper.
|
fine on Paper.
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
|
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
|
||||||
index df9ae808c5a59ea25145c9df62f42fb33d159021..daa7525074facfbf31c1183e872f083a02697700 100644
|
index df9ae808c5a59ea25145c9df62f42fb33d159021..11eb5fc65ea0dccbb38c7d47a4dfd5cf3b46c79e 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
|
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
|
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
|
||||||
@@ -381,6 +381,13 @@ public class ChunkSerializer {
|
@@ -381,6 +381,13 @@ public class ChunkSerializer {
|
||||||
@ -32,7 +32,7 @@ index df9ae808c5a59ea25145c9df62f42fb33d159021..daa7525074facfbf31c1183e872f083a
|
|||||||
boolean flag = nbttagcompound1.getBoolean("keepPacked");
|
boolean flag = nbttagcompound1.getBoolean("keepPacked");
|
||||||
|
|
||||||
+ // Paper start - do not read tile entities positioned outside the chunk
|
+ // Paper start - do not read tile entities positioned outside the chunk
|
||||||
+ BlockPos blockposition = BlockEntity.getPosFromTag(nbttagcompound1); // moved up
|
+ BlockPos blockposition = BlockEntity.getPosFromTag(nbttagcompound1); // moved up
|
||||||
+ ChunkPos chunkPos = chunk.getPos();
|
+ ChunkPos chunkPos = chunk.getPos();
|
||||||
+ if ((blockposition.getX() >> 4) != chunkPos.x || (blockposition.getZ() >> 4) != chunkPos.z) {
|
+ if ((blockposition.getX() >> 4) != chunkPos.x || (blockposition.getZ() >> 4) != chunkPos.z) {
|
||||||
+ LOGGER.warn("Tile entity serialized in chunk " + chunkPos + " in world '" + world.getWorld().getName() + "' positioned at " + blockposition + " is located outside of the chunk");
|
+ LOGGER.warn("Tile entity serialized in chunk " + chunkPos + " in world '" + world.getWorld().getName() + "' positioned at " + blockposition + " is located outside of the chunk");
|
||||||
@ -44,7 +44,7 @@ index df9ae808c5a59ea25145c9df62f42fb33d159021..daa7525074facfbf31c1183e872f083a
|
|||||||
chunk.setBlockEntityNbt(nbttagcompound1);
|
chunk.setBlockEntityNbt(nbttagcompound1);
|
||||||
} else {
|
} else {
|
||||||
- BlockPos blockposition = BlockEntity.getPosFromTag(nbttagcompound1);
|
- BlockPos blockposition = BlockEntity.getPosFromTag(nbttagcompound1);
|
||||||
+ // Paper - do not read tile entities positioned outside the chunk - move up
|
+ // Paper - do not read tile entities positioned outside the chunk; move up
|
||||||
BlockEntity tileentity = BlockEntity.loadStatic(blockposition, chunk.getBlockState(blockposition), nbttagcompound1);
|
BlockEntity tileentity = BlockEntity.loadStatic(blockposition, chunk.getBlockState(blockposition), nbttagcompound1);
|
||||||
|
|
||||||
if (tileentity != null) {
|
if (tileentity != null) {
|
||||||
|
@ -30,7 +30,7 @@ index d34f0d5abd93ed1729a00405d78a34a1873ba086..016b7628b289fb882f3ec15dd5b0cb4e
|
|||||||
net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = worldserver.paperConfig().hopper.disableMoveEvent || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper - Perf: Optimize Hoppers
|
net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = worldserver.paperConfig().hopper.disableMoveEvent || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper - Perf: Optimize Hoppers
|
||||||
worldserver.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper
|
worldserver.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
index dae52be48e9789db2fbbff699f3e0c44086c864f..2e293fb94024d21769faf0e60e79e91efac79007 100644
|
index eff2a7e25a7b99613c1e208058c316f1e3586995..973a9deba3b11399cafb3482f4c56c9c648c4d5f 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
@@ -570,6 +570,17 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@@ -570,6 +570,17 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||||
@ -65,10 +65,10 @@ index 8bfd31ce3b4f88f0b32adb242c53771d9930b855..921d9d8bc6265631073d105fb8de6856
|
|||||||
|
|
||||||
if (this.hasDelayedDestroy) {
|
if (this.hasDelayedDestroy) {
|
||||||
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 668297b8978cbde6635254122f8f29f4a7ead45b..ceb3bfbd955111af183eb16c0946109251289d40 100644
|
index fe5c46c9bb6130a29ec9cbb65e9e7142a79a157e..484609925cc8cbed7b31d3c7780b6d30f6ad454c 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
|
||||||
@@ -3818,6 +3818,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
@@ -3819,6 +3819,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||||
this.getEntityData().resendPossiblyDesyncedDataValues(java.util.List.of(DATA_LIVING_ENTITY_FLAGS), serverPlayer);
|
this.getEntityData().resendPossiblyDesyncedDataValues(java.util.List.of(DATA_LIVING_ENTITY_FLAGS), serverPlayer);
|
||||||
}
|
}
|
||||||
// Paper end - Properly cancel usable items
|
// Paper end - Properly cancel usable items
|
||||||
@ -79,7 +79,7 @@ index 668297b8978cbde6635254122f8f29f4a7ead45b..ceb3bfbd955111af183eb16c09461092
|
|||||||
private void updatingUsingItem() {
|
private void updatingUsingItem() {
|
||||||
if (this.isUsingItem()) {
|
if (this.isUsingItem()) {
|
||||||
if (ItemStack.isSameItem(this.getItemInHand(this.getUsedItemHand()), this.useItem)) {
|
if (ItemStack.isSameItem(this.getItemInHand(this.getUsedItemHand()), this.useItem)) {
|
||||||
@@ -3836,7 +3840,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
@@ -3837,7 +3841,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||||
this.triggerItemUseEffects(stack, 5);
|
this.triggerItemUseEffects(stack, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ index 668297b8978cbde6635254122f8f29f4a7ead45b..ceb3bfbd955111af183eb16c09461092
|
|||||||
this.completeUsingItem();
|
this.completeUsingItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3884,7 +3893,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
@@ -3885,7 +3894,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||||
|
|
||||||
if (!itemstack.isEmpty() && !this.isUsingItem() || forceUpdate) { // Paper use override flag
|
if (!itemstack.isEmpty() && !this.isUsingItem() || forceUpdate) { // Paper use override flag
|
||||||
this.useItem = itemstack;
|
this.useItem = itemstack;
|
||||||
@ -105,7 +105,7 @@ index 668297b8978cbde6635254122f8f29f4a7ead45b..ceb3bfbd955111af183eb16c09461092
|
|||||||
if (!this.level().isClientSide) {
|
if (!this.level().isClientSide) {
|
||||||
this.setLivingEntityFlag(1, true);
|
this.setLivingEntityFlag(1, true);
|
||||||
this.setLivingEntityFlag(2, hand == InteractionHand.OFF_HAND);
|
this.setLivingEntityFlag(2, hand == InteractionHand.OFF_HAND);
|
||||||
@@ -3909,7 +3921,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
@@ -3910,7 +3922,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||||
}
|
}
|
||||||
} else if (!this.isUsingItem() && !this.useItem.isEmpty()) {
|
} else if (!this.isUsingItem() && !this.useItem.isEmpty()) {
|
||||||
this.useItem = ItemStack.EMPTY;
|
this.useItem = ItemStack.EMPTY;
|
||||||
@ -117,7 +117,7 @@ index 668297b8978cbde6635254122f8f29f4a7ead45b..ceb3bfbd955111af183eb16c09461092
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4044,7 +4059,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
@@ -4045,7 +4060,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.useItem = ItemStack.EMPTY;
|
this.useItem = ItemStack.EMPTY;
|
||||||
|
@ -14,10 +14,10 @@ field by calling any method on the class, and for convenience
|
|||||||
we use values().
|
we use values().
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/UpgradeData.java b/src/main/java/net/minecraft/world/level/chunk/UpgradeData.java
|
diff --git a/src/main/java/net/minecraft/world/level/chunk/UpgradeData.java b/src/main/java/net/minecraft/world/level/chunk/UpgradeData.java
|
||||||
index 0f94af3502ef517c33d04841a80ea2ace077f0af..f9c1012216928b16feb14f0bf78fb328a443a7ee 100644
|
index a5b90222cfad5b282f3f2db4dd5d1b201761fb72..4a2c233898c00e09a7e1b75d3a9a82b572b849d6 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/chunk/UpgradeData.java
|
--- a/src/main/java/net/minecraft/world/level/chunk/UpgradeData.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/chunk/UpgradeData.java
|
+++ b/src/main/java/net/minecraft/world/level/chunk/UpgradeData.java
|
||||||
@@ -138,6 +138,7 @@ public class UpgradeData {
|
@@ -139,6 +139,7 @@ public class UpgradeData {
|
||||||
Fluid fluid = tick.type() == Fluids.EMPTY ? level.getFluidState(tick.pos()).getType() : tick.type();
|
Fluid fluid = tick.type() == Fluids.EMPTY ? level.getFluidState(tick.pos()).getType() : tick.type();
|
||||||
level.scheduleTick(tick.pos(), fluid, tick.delay(), tick.priority());
|
level.scheduleTick(tick.pos(), fluid, tick.delay(), tick.priority());
|
||||||
});
|
});
|
||||||
|
@ -6,10 +6,10 @@ Subject: [PATCH] Broadcast take item packets with collector as source
|
|||||||
This fixes players (which can't view the collector) seeing item pickups with themselves as the target.
|
This fixes players (which can't view the collector) seeing item pickups with themselves as the target.
|
||||||
|
|
||||||
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 ceb3bfbd955111af183eb16c0946109251289d40..c30ae7d8b5ee601db30111054c74ce60625d8203 100644
|
index 484609925cc8cbed7b31d3c7780b6d30f6ad454c..03ca9ae4a195a6caacf2424e069a9644357e7e06 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
|
||||||
@@ -3703,7 +3703,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
@@ -3704,7 +3704,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||||
|
|
||||||
public void take(Entity item, int count) {
|
public void take(Entity item, int count) {
|
||||||
if (!item.isRemoved() && !this.level().isClientSide && (item instanceof ItemEntity || item instanceof AbstractArrow || item instanceof ExperienceOrb)) {
|
if (!item.isRemoved() && !this.level().isClientSide && (item instanceof ItemEntity || item instanceof AbstractArrow || item instanceof ExperienceOrb)) {
|
||||||
|
@ -8,7 +8,7 @@ For each player on each tick, enter block triggers are invoked, and these create
|
|||||||
To avoid this, we now lazily create the LootContext if the criterion passes the predicate AND if any of the listener triggers require a loot context instance
|
To avoid this, we now lazily create the LootContext if the criterion passes the predicate AND if any of the listener triggers require a loot context instance
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java b/src/main/java/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java
|
diff --git a/src/main/java/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java b/src/main/java/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java
|
||||||
index 0a22ed467d04c6421f4f8ef227a665ae135a5b0b..31fa6a0cb00139bfcb71f4fd30da8b736bf491f2 100644
|
index 0a22ed467d04c6421f4f8ef227a665ae135a5b0b..00bf770559d9c628119658cb027eb0b970c04e1b 100644
|
||||||
--- a/src/main/java/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java
|
--- a/src/main/java/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java
|
||||||
+++ b/src/main/java/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java
|
+++ b/src/main/java/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java
|
||||||
@@ -45,14 +45,14 @@ public abstract class SimpleCriterionTrigger<T extends SimpleCriterionTrigger.Si
|
@@ -45,14 +45,14 @@ public abstract class SimpleCriterionTrigger<T extends SimpleCriterionTrigger.Si
|
||||||
@ -16,7 +16,7 @@ index 0a22ed467d04c6421f4f8ef227a665ae135a5b0b..31fa6a0cb00139bfcb71f4fd30da8b73
|
|||||||
Set<CriterionTrigger.Listener<T>> set = (Set) playerAdvancements.criterionData.get(this); // Paper - fix AdvancementDataPlayer leak
|
Set<CriterionTrigger.Listener<T>> set = (Set) playerAdvancements.criterionData.get(this); // Paper - fix AdvancementDataPlayer leak
|
||||||
if (set != null && !set.isEmpty()) {
|
if (set != null && !set.isEmpty()) {
|
||||||
- LootContext lootContext = EntityPredicate.createContext(player, player);
|
- LootContext lootContext = EntityPredicate.createContext(player, player);
|
||||||
+ LootContext lootContext = null; // EntityPredicate.createContext(player, player); // Paper - lazily create LootContext for criterions
|
+ LootContext lootContext = null; // EntityPredicate.createContext(player, player); // Paper - Perf: lazily create LootContext for criterions
|
||||||
List<CriterionTrigger.Listener<T>> list = null;
|
List<CriterionTrigger.Listener<T>> list = null;
|
||||||
|
|
||||||
for(CriterionTrigger.Listener<T> listener : set) {
|
for(CriterionTrigger.Listener<T> listener : set) {
|
||||||
@ -24,7 +24,7 @@ index 0a22ed467d04c6421f4f8ef227a665ae135a5b0b..31fa6a0cb00139bfcb71f4fd30da8b73
|
|||||||
if (predicate.test(simpleInstance)) {
|
if (predicate.test(simpleInstance)) {
|
||||||
Optional<ContextAwarePredicate> optional = simpleInstance.player();
|
Optional<ContextAwarePredicate> optional = simpleInstance.player();
|
||||||
- if (optional.isEmpty() || optional.get().matches(lootContext)) {
|
- if (optional.isEmpty() || optional.get().matches(lootContext)) {
|
||||||
+ if (optional.isEmpty() || optional.get().matches(lootContext = (lootContext == null ? EntityPredicate.createContext(player, player) : lootContext))) { // Paper - lazily create LootContext for criterions
|
+ if (optional.isEmpty() || optional.get().matches(lootContext = (lootContext == null ? EntityPredicate.createContext(player, player) : lootContext))) { // Paper - Perf: lazily create LootContext for criterions
|
||||||
if (list == null) {
|
if (list == null) {
|
||||||
list = Lists.newArrayList();
|
list = Lists.newArrayList();
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ where generation happened directly to a ServerLevel and the
|
|||||||
entity still has the flag set.
|
entity still has the flag set.
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
index ad4a987c1de4265f9f0d6a8769aaed95d0a66786..a1fd04399ef61d0257d1e4a6bb627e4a1b7a7ceb 100644
|
index 01c7b3623314bb0e6fa0a135de3db7c42ca5e373..e0dae41eb94da08649cba607975798dc2ac328ad 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
@@ -1681,6 +1681,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@@ -1681,6 +1681,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||||
@ -31,7 +31,7 @@ index ad4a987c1de4265f9f0d6a8769aaed95d0a66786..a1fd04399ef61d0257d1e4a6bb627e4a
|
|||||||
if (entity.valid) {
|
if (entity.valid) {
|
||||||
MinecraftServer.LOGGER.error("Attempted Double World add on " + entity, new Throwable());
|
MinecraftServer.LOGGER.error("Attempted Double World add on " + entity, new Throwable());
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
index aef714923ff1e9d476aacd9bfaa80f85dc84890b..d77faa799de1b7cc23adb91d82a45a05532532f1 100644
|
index 47857a43753e86d1c7c535e69ed07b31d753ad99..b240dc6a1e45b534a017806b41ddb76423691ee7 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
@@ -713,7 +713,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
@@ -713,7 +713,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||||
@ -48,7 +48,7 @@ index aef714923ff1e9d476aacd9bfaa80f85dc84890b..d77faa799de1b7cc23adb91d82a45a05
|
|||||||
this.entityData.set(Entity.DATA_POSE, pose);
|
this.entityData.set(Entity.DATA_POSE, pose);
|
||||||
}
|
}
|
||||||
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 940b8d0b89d7e55c938aefbe80ee71b0db3dacb8..abb2a02e0fc1deedb0ad76aec64f74ce355129cc 100644
|
index 82695b6f25011a315027bd7a5cb305af31663d4a..d362a06d0600003d40f632eac602ff552cafb9da 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
|
||||||
@@ -588,9 +588,15 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
|
@@ -588,9 +588,15 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
|
||||||
@ -68,10 +68,10 @@ index 940b8d0b89d7e55c938aefbe80ee71b0db3dacb8..abb2a02e0fc1deedb0ad76aec64f74ce
|
|||||||
}, () -> {
|
}, () -> {
|
||||||
EntityType.LOGGER.warn("Skipping Entity with id {}", nbt.getString("id"));
|
EntityType.LOGGER.warn("Skipping Entity with id {}", nbt.getString("id"));
|
||||||
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 c30ae7d8b5ee601db30111054c74ce60625d8203..7204fc4d535fb7cf5579aa51148e6a1262f3124d 100644
|
index 03ca9ae4a195a6caacf2424e069a9644357e7e06..a42023793805b294dc167ec2cd5445f32b0c51eb 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
|
||||||
@@ -1133,6 +1133,11 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
@@ -1134,6 +1134,11 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean addEffect(MobEffectInstance mobeffect, @Nullable Entity entity, EntityPotionEffectEvent.Cause cause) {
|
public boolean addEffect(MobEffectInstance mobeffect, @Nullable Entity entity, EntityPotionEffectEvent.Cause cause) {
|
||||||
@ -83,7 +83,7 @@ index c30ae7d8b5ee601db30111054c74ce60625d8203..7204fc4d535fb7cf5579aa51148e6a12
|
|||||||
// org.spigotmc.AsyncCatcher.catchOp("effect add"); // Spigot // Paper - move to API
|
// org.spigotmc.AsyncCatcher.catchOp("effect add"); // Spigot // Paper - move to API
|
||||||
if (this.isTickingEffects) {
|
if (this.isTickingEffects) {
|
||||||
this.effectsToProcess.add(new ProcessableEffect(mobeffect, cause));
|
this.effectsToProcess.add(new ProcessableEffect(mobeffect, cause));
|
||||||
@@ -1152,10 +1157,13 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
@@ -1153,10 +1158,13 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||||
override = new MobEffectInstance(mobeffect1).update(mobeffect);
|
override = new MobEffectInstance(mobeffect1).update(mobeffect);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,7 +97,7 @@ index c30ae7d8b5ee601db30111054c74ce60625d8203..7204fc4d535fb7cf5579aa51148e6a12
|
|||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
if (mobeffect1 == null) {
|
if (mobeffect1 == null) {
|
||||||
@@ -1163,7 +1171,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
@@ -1164,7 +1172,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||||
this.onEffectAdded(mobeffect, entity);
|
this.onEffectAdded(mobeffect, entity);
|
||||||
flag = true;
|
flag = true;
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
|
@ -26,10 +26,10 @@ index 3fec07b250a8f145e30c8c41888e47d2a3c902e1..2ddd033e1c3a2e5c8950b93c83849192
|
|||||||
x = to.getX();
|
x = to.getX();
|
||||||
y = to.getY();
|
y = to.getY();
|
||||||
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 3b7459226ae022c9e1de6dbf775046a767b409c9..97dbd1c8c8b6301bb607079575589dcceab0f881 100644
|
index 38793c3ab6db7e311866de88ba272b8e98178a4b..4cbb1f5d904191e59395df0177e76e94faae764c 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
|
||||||
@@ -4204,7 +4204,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
@@ -4205,7 +4205,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||||
if (!(this instanceof ServerPlayer)) {
|
if (!(this instanceof ServerPlayer)) {
|
||||||
EntityTeleportEvent teleport = new EntityTeleportEvent(this.getBukkitEntity(), new Location(this.level().getWorld(), d3, d4, d5), new Location(this.level().getWorld(), d0, d6, d2));
|
EntityTeleportEvent teleport = new EntityTeleportEvent(this.getBukkitEntity(), new Location(this.level().getWorld(), d3, d4, d5), new Location(this.level().getWorld(), d0, d6, d2));
|
||||||
this.level().getCraftServer().getPluginManager().callEvent(teleport);
|
this.level().getCraftServer().getPluginManager().callEvent(teleport);
|
||||||
@ -39,7 +39,7 @@ index 3b7459226ae022c9e1de6dbf775046a767b409c9..97dbd1c8c8b6301bb607079575589dcc
|
|||||||
this.teleportTo(to.getX(), to.getY(), to.getZ());
|
this.teleportTo(to.getX(), to.getY(), to.getZ());
|
||||||
} else {
|
} else {
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/FollowOwnerGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/FollowOwnerGoal.java
|
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/FollowOwnerGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/FollowOwnerGoal.java
|
||||||
index 689bbc0feb700cfd6b10601d2c5a237ec40ed756..ca0a2191f5bfb3c44c1ddacab8b7a874c2f44cc1 100644
|
index 8e2f7e2385588224018f7f94ed9686415bc91deb..c0da573e3818a1dd2c1ef5a61c7cb34934b0a252 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/ai/goal/FollowOwnerGoal.java
|
--- a/src/main/java/net/minecraft/world/entity/ai/goal/FollowOwnerGoal.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/FollowOwnerGoal.java
|
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/FollowOwnerGoal.java
|
||||||
@@ -129,7 +129,7 @@ public class FollowOwnerGoal extends Goal {
|
@@ -129,7 +129,7 @@ public class FollowOwnerGoal extends Goal {
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren