Skip to content

Commit

Permalink
Fixed #2829
Browse files Browse the repository at this point in the history
  • Loading branch information
Mgazul committed Nov 26, 2023
1 parent 53d3e69 commit 4f3189c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
9 changes: 3 additions & 6 deletions patches/minecraft/net/minecraft/world/IWorld.java.patch
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,10 @@
import net.minecraft.world.storage.IWorldInfo;

public interface IWorld extends IBiomeReader, IDayTimeReader {
@@ -52,5 +_,9 @@

@@ -53,4 +_,6 @@
default void func_217379_c(int p_217379_1_, BlockPos p_217379_2_, int p_217379_3_) {
this.func_217378_a((PlayerEntity)null, p_217379_1_, p_217379_2_, p_217379_3_);
+ }
+
+ default ServerWorld getMinecraftWorld() {
+ return this.getMinecraftWorld();
}
+
+ ServerWorld getMinecraftWorld();
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,17 +104,19 @@ public void onMultiPlace(BlockEvent.EntityMultiPlaceEvent event) {
for (BlockSnapshot snapshot : event.getReplacedBlockSnapshots()) {
placedBlocks.add(CraftCustomSnapshot.fromBlockSnapshot(snapshot, true).getState());
}
CraftBlock againstBlock = CraftBlock.at(event.getWorld(), event.getPos().relative(direction.getOpposite()));
CraftBlock againstBlock = CraftBlock.at((ServerWorld)event.getWorld(), event.getPos().relative(direction.getOpposite()));
ItemStack bukkitStack;
if (hand == Hand.MAIN_HAND) {
bukkitStack = player.getInventory().getItemInMainHand();
} else {
bukkitStack = player.getInventory().getItemInOffHand();
}
BlockPlaceEvent placeEvent = new BlockMultiPlaceEvent(placedBlocks, againstBlock, bukkitStack, player, !event.isCanceled());
placeEvent.setCancelled(event.isCanceled());
Bukkit.getPluginManager().callEvent(placeEvent);
event.setCanceled(placeEvent.isCancelled() || !placeEvent.canBuild());
if (placedBlocks.get(0).isPlaced()) {
BlockPlaceEvent placeEvent = new BlockMultiPlaceEvent(placedBlocks, againstBlock, bukkitStack, player, !event.isCanceled());
placeEvent.setCancelled(event.isCanceled());
Bukkit.getPluginManager().callEvent(placeEvent);
event.setCanceled(placeEvent.isCancelled() || !placeEvent.canBuild());
}
}
}
}
Expand Down

0 comments on commit 4f3189c

Please sign in to comment.