Skip to content

Commit

Permalink
Fix creative fly no clip
Browse files Browse the repository at this point in the history
  • Loading branch information
s-yh-china authored and Lumine1909 committed Sep 15, 2024
1 parent 745e5c5 commit 87740d5
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 54a77399c1c42a1bcdbb4fd2cc09469a4838bd7c..22d014ec4cc7f3ad5df6cf28988b0bd9
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 247aec2924558e52b460deb36c9a2592a38a98e8..6027e593e41cb4873da22659880047ed9f4e2fcf 100644
index 247aec2924558e52b460deb36c9a2592a38a98e8..7b2a397e8b3f60fe233ae8867af9b020b31c75ed 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() != null ? 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 in BlockCanBuildEvent
Expand Down

0 comments on commit 87740d5

Please sign in to comment.