geforkt von Mirrors/Paper
Call StructureGrowEvent for mangrove propagule (#8023)
Dieser Commit ist enthalten in:
Ursprung
8d19ec3f2b
Commit
71cd2d00b6
39
patches/server/Call-StructureGrowEvent-for-mangrove-propagule.patch
Normale Datei
39
patches/server/Call-StructureGrowEvent-for-mangrove-propagule.patch
Normale Datei
@ -0,0 +1,39 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Noah van der Aa <ndvdaa@gmail.com>
|
||||
Date: Mon, 20 Jun 2022 15:46:46 +0200
|
||||
Subject: [PATCH] Call StructureGrowEvent for mangrove propagule
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/MangrovePropaguleBlock.java b/src/main/java/net/minecraft/world/level/block/MangrovePropaguleBlock.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/MangrovePropaguleBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/MangrovePropaguleBlock.java
|
||||
@@ -0,0 +0,0 @@ public class MangrovePropaguleBlock extends SaplingBlock implements SimpleWaterl
|
||||
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
|
||||
if (!isHanging(state)) {
|
||||
if (random.nextInt(7) == 0) {
|
||||
+ world.captureTreeGeneration = true; // Paper
|
||||
this.advanceTree(world, pos, state, random);
|
||||
+ // Paper start
|
||||
+ world.captureTreeGeneration = false;
|
||||
+ if (world.capturedBlockStates.size() > 0) {
|
||||
+ org.bukkit.TreeType treeType = SaplingBlock.treeType;
|
||||
+ SaplingBlock.treeType = null;
|
||||
+ org.bukkit.Location location = new org.bukkit.Location(world.getWorld(), pos.getX(), pos.getY(), pos.getZ());
|
||||
+ java.util.List<org.bukkit.block.BlockState> blocks = new java.util.ArrayList<>(world.capturedBlockStates.values());
|
||||
+ world.capturedBlockStates.clear();
|
||||
+ org.bukkit.event.world.StructureGrowEvent event = null;
|
||||
+ if (treeType != null) {
|
||||
+ event = new org.bukkit.event.world.StructureGrowEvent(location, treeType, false, null, blocks);
|
||||
+ org.bukkit.Bukkit.getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+ if (event == null || !event.isCancelled()) {
|
||||
+ for (org.bukkit.block.BlockState blockstate : blocks) {
|
||||
+ blockstate.update(true);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
} else {
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren