Skip to content

Commit

Permalink
Fix block place not check canSurvival
Browse files Browse the repository at this point in the history
  • Loading branch information
s-yh-china committed Jan 15, 2024
1 parent 5edac6e commit 02d6b82
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions patches/server/0065-Creative-fly-no-clip.patch
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ index ccc1caafb0ada52c7b99b7358253826f5390843e..a37e5fccd714bc52a13132bcd6565c35
public boolean canBeHitByProjectile() {
return !this.isSpectator() && super.canBeHitByProjectile();
diff --git a/src/main/java/net/minecraft/world/item/BlockItem.java b/src/main/java/net/minecraft/world/item/BlockItem.java
index ef484b74c8e3eedba18978534b70b396810880f8..4d18319bb7e3799bcb829830adcc828eea401848 100644
index ef484b74c8e3eedba18978534b70b396810880f8..d1697d1de87632eabedb32dba6d73ee25107d7c7 100644
--- a/src/main/java/net/minecraft/world/item/BlockItem.java
+++ b/src/main/java/net/minecraft/world/item/BlockItem.java
@@ -228,7 +228,7 @@ public class BlockItem extends Item {
CollisionContext voxelshapecollision = entityhuman == null ? CollisionContext.empty() : CollisionContext.of(entityhuman);
// CraftBukkit start - store default return
Level world = context.getLevel(); // Paper
- boolean defaultReturn = (!this.mustSurvive() || state.canSurvive(context.getLevel(), context.getClickedPos())) && world.checkEntityCollision(state, entityhuman, voxelshapecollision, context.getClickedPos(), true); // Paper
+ boolean defaultReturn = (!this.mustSurvive() || state.canSurvive(context.getLevel(), context.getClickedPos())) && top.leavesmc.leaves.LeavesConfig.creativeNoClip ? context.getPlayer().canSpectatingPlace(world, state, context.getClickedPos(), voxelshapecollision) : world.checkEntityCollision(state, entityhuman, voxelshapecollision, context.getClickedPos(), true); // Paper // Leaves - creative no clip
+ boolean defaultReturn = (!this.mustSurvive() || state.canSurvive(context.getLevel(), context.getClickedPos())) && (top.leavesmc.leaves.LeavesConfig.creativeNoClip ? context.getPlayer().canSpectatingPlace(world, state, context.getClickedPos(), voxelshapecollision) : world.checkEntityCollision(state, entityhuman, voxelshapecollision, context.getClickedPos(), true)); // Paper // Leaves - creative no clip
org.bukkit.entity.Player player = (context.getPlayer() instanceof ServerPlayer) ? (org.bukkit.entity.Player) context.getPlayer().getBukkitEntity() : null;

BlockCanBuildEvent event = new BlockCanBuildEvent(CraftBlock.at(context.getLevel(), context.getClickedPos()), player, CraftBlockData.fromData(state), defaultReturn, org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(context.getHand())); // Paper - expose hand
Expand Down

0 comments on commit 02d6b82

Please sign in to comment.