9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2025-12-27 02:49:10 +00:00

Fix creative fly no clip

This commit is contained in:
violetc
2024-01-19 16:49:36 +08:00
parent c8359e5b32
commit a8eca5f35e

View File

@@ -60,7 +60,7 @@ 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 {
@@ -68,7 +68,7 @@ index 247aec2924558e52b460deb36c9a2592a38a98e8..6027e593e41cb4873da22659880047ed
// 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