From ea1bfad17c65ad9814c9ae8f65aa6aa5468c1cb6 Mon Sep 17 00:00:00 2001 From: Mgazul Date: Sun, 26 Nov 2023 21:43:55 +0800 Subject: [PATCH] Fixed #2826 --- .../net/minecraft/world/World.java.patch | 17 ++++++++++++++++- .../world/server/ServerWorld.java.patch | 6 ++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/patches/minecraft/net/minecraft/world/World.java.patch b/patches/minecraft/net/minecraft/world/World.java.patch index c57ccd5f2e..bc92b232cb 100644 --- a/patches/minecraft/net/minecraft/world/World.java.patch +++ b/patches/minecraft/net/minecraft/world/World.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/World.java +++ b/net/minecraft/world/World.java -@@ -1,11 +_,15 @@ +@@ -1,12 +_,17 @@ package net.minecraft.world; import com.google.common.collect.Lists; @@ -14,8 +14,10 @@ import java.util.List; +import java.util.Map; import java.util.Random; ++import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.Consumer; import java.util.function.Predicate; + import java.util.function.Supplier; @@ -20,6 +_,7 @@ import net.minecraft.crash.ReportedException; import net.minecraft.entity.Entity; @@ -303,6 +305,19 @@ Block.func_220054_a(blockstate, this, p_241212_1_, tileentity, p_241212_3_, ItemStack.field_190927_a); } +@@ -249,7 +_,12 @@ + } + } + ++ // Mohist start ++ public AtomicBoolean callEvent = new AtomicBoolean(false); ++ public BlockState mohist$defaultBlockState; + public boolean func_175656_a(BlockPos p_175656_1_, BlockState p_175656_2_) { ++ mohist$defaultBlockState = p_175656_2_; ++ if (callEvent.getAndSet(false)) return false; + return this.func_180501_a(p_175656_1_, p_175656_2_, 3); + } + @@ -259,6 +_,8 @@ } diff --git a/patches/minecraft/net/minecraft/world/server/ServerWorld.java.patch b/patches/minecraft/net/minecraft/world/server/ServerWorld.java.patch index ae0d4f7268..5735e67f2c 100644 --- a/patches/minecraft/net/minecraft/world/server/ServerWorld.java.patch +++ b/patches/minecraft/net/minecraft/world/server/ServerWorld.java.patch @@ -397,7 +397,7 @@ } } -@@ -475,12 +_,13 @@ +@@ -475,12 +_,15 @@ BlockPos blockpos2 = this.func_205770_a(Heightmap.Type.MOTION_BLOCKING, this.func_217383_a(i, 0, j, 15)); BlockPos blockpos3 = blockpos2.func_177977_b(); Biome biome = this.func_226691_t_(blockpos2); @@ -406,7 +406,9 @@ - } + if (this.isAreaLoaded(blockpos2, 1)) // Forge: check area to avoid loading neighbors in unloaded chunks + if (biome.func_201848_a(this, blockpos3)) { -+ org.bukkit.craftbukkit.v1_16_R3.event.CraftEventFactory.handleBlockFormEvent(this, blockpos3, Blocks.field_150432_aD.func_176223_P(), null); // CraftBukkit ++ this.callEvent.set(true); ++ this.func_175656_a(blockpos3, Blocks.field_150432_aD.func_176223_P()); ++ org.bukkit.craftbukkit.v1_16_R3.event.CraftEventFactory.handleBlockFormEvent(this, blockpos3, this.mohist$defaultBlockState, null); // CraftBukkit // Mohist + } if (flag && biome.func_201850_b(this, blockpos2)) {