2024-12-14 21:50:20 +01:00
|
|
|
--- a/net/minecraft/world/item/MinecartItem.java
|
|
|
|
+++ b/net/minecraft/world/item/MinecartItem.java
|
|
|
|
@@ -57,7 +_,13 @@
|
|
|
|
}
|
|
|
|
|
|
|
|
if (level instanceof ServerLevel serverLevel) {
|
|
|
|
- serverLevel.addFreshEntity(abstractMinecart);
|
|
|
|
+ // CraftBukkit start
|
|
|
|
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPlaceEvent(context, abstractMinecart).isCancelled()) {
|
2024-12-15 15:55:13 +01:00
|
|
|
+ if (context.getPlayer() != null) context.getPlayer().containerMenu.sendAllDataToRemote(); // Paper - Fix inventory desync
|
2024-12-14 21:50:20 +01:00
|
|
|
+ return InteractionResult.FAIL;
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
|
|
|
+ if (!serverLevel.addFreshEntity(abstractMinecart)) return InteractionResult.PASS; // CraftBukkit
|
|
|
|
serverLevel.gameEvent(
|
|
|
|
GameEvent.ENTITY_PLACE, clickedPos, GameEvent.Context.of(context.getPlayer(), serverLevel.getBlockState(clickedPos.below()))
|
|
|
|
);
|