Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 04:20:04 +01:00
0cdce89d59
If a playerdata doesn't contain a valid, loaded world, reset to the main world spawn point
71 Zeilen
5.0 KiB
Diff
71 Zeilen
5.0 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
|
Date: Sat, 21 Aug 2021 18:53:03 -0700
|
|
Subject: [PATCH] Only capture actual tree growth
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
|
index e9b748a81ec223a701b56d2dc890c9eb223d8474..a0c7c6208314d981e8577ad69ef1c5193290a085 100644
|
|
--- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
|
+++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
|
@@ -862,6 +862,7 @@ public interface DispenseItemBehavior {
|
|
if (!fertilizeEvent.isCancelled()) {
|
|
for (org.bukkit.block.BlockState blockstate : blocks) {
|
|
blockstate.update(true);
|
|
+ worldserver.checkCapturedTreeStateForObserverNotify(blockposition, (org.bukkit.craftbukkit.block.CraftBlockState) blockstate); // Paper - notify observers even if grow failed
|
|
}
|
|
}
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
|
|
index 21b3be35da5636fa726f36f569142de5d16ac1f3..4697df75fdee2023c41260bed211e3e3d90d2b9b 100644
|
|
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
|
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
|
@@ -401,6 +401,7 @@ public final class ItemStack {
|
|
}
|
|
for (CraftBlockState blockstate : blocks) {
|
|
world.setBlock(blockstate.getPosition(),blockstate.getHandle(), blockstate.getFlag()); // SPIGOT-7248 - manual update to avoid physics where appropriate
|
|
+ world.checkCapturedTreeStateForObserverNotify(blockposition, blockstate); // Paper - notify observers even if grow failed
|
|
if (blockstate instanceof org.bukkit.craftbukkit.block.CapturedBlockState capturedBlockState) capturedBlockState.checkTreeBlockHack(); // Paper
|
|
}
|
|
entityhuman.awardStat(Stats.ITEM_USED.get(item)); // SPIGOT-7236 - award stat
|
|
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
|
index 169fc7b1aaf2cefec3ddab53fcec912e0ec0117a..f2f93761985a78b563dd1eda57f9a08b1cc8893a 100644
|
|
--- a/src/main/java/net/minecraft/world/level/Level.java
|
|
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
|
@@ -1868,4 +1868,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
|
return null;
|
|
}
|
|
// Paper end - optimize redstone (Alternate Current)
|
|
+ // Paper start - notify observers even if grow failed
|
|
+ public void checkCapturedTreeStateForObserverNotify(final BlockPos pos, final CraftBlockState craftBlockState) {
|
|
+ if (craftBlockState.getPosition().getY() == pos.getY() && this.getBlockState(craftBlockState.getPosition()) == craftBlockState.getHandle()) { // notify observers if the block state is the same and the Y level equals the original y level (for mega trees)
|
|
+ this.notifyAndUpdatePhysics(craftBlockState.getPosition(), null, craftBlockState.getHandle(), craftBlockState.getHandle(), craftBlockState.getHandle(), craftBlockState.getFlag(), 512);
|
|
+ }
|
|
+ }
|
|
+ // Paper end - notify observers even if grow failed
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/SaplingBlock.java b/src/main/java/net/minecraft/world/level/block/SaplingBlock.java
|
|
index f43e6fe77e943239c1f1d6fa3e31235949f79546..53ac4e618fec3fe384d8a106c521f3eace0b5b35 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/SaplingBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/SaplingBlock.java
|
|
@@ -73,6 +73,7 @@ public class SaplingBlock extends BushBlock implements BonemealableBlock {
|
|
if (event == null || !event.isCancelled()) {
|
|
for (BlockState blockstate : blocks) {
|
|
blockstate.update(true);
|
|
+ world.checkCapturedTreeStateForObserverNotify(pos, (org.bukkit.craftbukkit.block.CraftBlockState) blockstate); // Paper - notify observers even if grow failed
|
|
}
|
|
}
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
|
index 11cc7e640774c6098c247382da8520d62ba19c32..bec8e6b62dba2bd0e4e85a7d1fb51287384f1290 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
|
@@ -565,6 +565,7 @@ public class CraftBlock implements Block {
|
|
if (!event.isCancelled()) {
|
|
for (BlockState blockstate : blocks) {
|
|
blockstate.update(true);
|
|
+ world.checkCapturedTreeStateForObserverNotify(this.position, (org.bukkit.craftbukkit.block.CraftBlockState) blockstate); // Paper - notify observers even if grow failed
|
|
}
|
|
}
|
|
}
|