mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-23 08:59:31 +00:00
87 lines
5.0 KiB
Diff
87 lines
5.0 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
|
Date: Tue, 27 Jun 2023 09:26:58 +0800
|
|
Subject: [PATCH] Creative fly no clip
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
|
index 7f3466340891b4409d1399ebeb2ca865d77841cd..1f87de025be6f29339c5e472cd37d5b97c145764 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
|
@@ -238,8 +238,8 @@ public abstract class Player extends LivingEntity {
|
|
|
|
@Override
|
|
public void tick() {
|
|
- this.noPhysics = this.isSpectator();
|
|
- if (this.isSpectator()) {
|
|
+ this.noPhysics = this.isCreativeFlyOrSpectator(); // Leaves - creative no clip
|
|
+ if (this.isCreativeFlyOrSpectator()) { // Leaves - creative no clip
|
|
this.setOnGround(false);
|
|
}
|
|
|
|
@@ -416,7 +416,7 @@ public abstract class Player extends LivingEntity {
|
|
|
|
Pose entitypose1;
|
|
|
|
- if (!this.isSpectator() && !this.isPassenger() && !this.canPlayerFitWithinBlocksAndEntitiesWhen(entitypose)) {
|
|
+ if (!this.isCreativeFlyOrSpectator() && !this.isPassenger() && !this.canPlayerFitWithinBlocksAndEntitiesWhen(entitypose)) { // Leaves - creative no clip
|
|
if (this.canPlayerFitWithinBlocksAndEntitiesWhen(Pose.CROUCHING)) {
|
|
entitypose1 = Pose.CROUCHING;
|
|
} else {
|
|
@@ -576,7 +576,7 @@ public abstract class Player extends LivingEntity {
|
|
}
|
|
|
|
this.bob += (f - this.bob) * 0.4F;
|
|
- if (this.getHealth() > 0.0F && !this.isSpectator()) {
|
|
+ if (this.getHealth() > 0.0F && !this.isCreativeFlyOrSpectator()) { // Leaves - creative no clip
|
|
AABB axisalignedbb;
|
|
|
|
if (this.isPassenger() && !this.getVehicle().isRemoved()) {
|
|
@@ -2051,6 +2051,12 @@ public abstract class Player extends LivingEntity {
|
|
@Override
|
|
public abstract boolean isSpectator();
|
|
|
|
+ // Leaves start - creative no clip
|
|
+ public boolean isCreativeFlyOrSpectator() {
|
|
+ return isSpectator() || (top.leavesmc.leaves.LeavesConfig.creativeNoClip && isCreative() && getAbilities().flying);
|
|
+ }
|
|
+ // Leaves end - creative no clip
|
|
+
|
|
@Override
|
|
public boolean canBeHitByProjectile() {
|
|
return !this.isSpectator() && super.canBeHitByProjectile();
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java
|
|
index 5c311270a39f6b4996c8b58822d24556c67adc41..cb40179236952edcc1678a58a5886b1916349314 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java
|
|
@@ -162,7 +162,7 @@ public class ShulkerBoxBlockEntity extends RandomizableContainerBlockEntity impl
|
|
while (iterator.hasNext()) {
|
|
Entity entity = (Entity) iterator.next();
|
|
|
|
- if (entity.getPistonPushReaction() != PushReaction.IGNORE) {
|
|
+ if (entity.getPistonPushReaction() != PushReaction.IGNORE && !(entity instanceof Player player && player.isCreativeFlyOrSpectator())) { // Leaves - creative no clip
|
|
entity.move(MoverType.SHULKER_BOX, new Vec3((axisalignedbb.getXsize() + 0.01D) * (double) enumdirection.getStepX(), (axisalignedbb.getYsize() + 0.01D) * (double) enumdirection.getStepY(), (axisalignedbb.getZsize() + 0.01D) * (double) enumdirection.getStepZ()));
|
|
}
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
|
|
index 7491e075baebc7d412d35593bb844b200e304447..e5c4deb9a921b90b7e0760955e90e815db95d3a1 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
|
|
@@ -18,6 +18,7 @@ import net.minecraft.util.Mth;
|
|
import net.minecraft.util.RandomSource;
|
|
import net.minecraft.world.entity.Entity;
|
|
import net.minecraft.world.entity.EntitySelector;
|
|
+import net.minecraft.world.entity.player.Player;
|
|
import net.minecraft.world.entity.projectile.ThrownEnderpearl;
|
|
import net.minecraft.world.level.BlockGetter;
|
|
import net.minecraft.world.level.ChunkPos;
|
|
@@ -127,7 +128,7 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity {
|
|
}
|
|
|
|
public static boolean canEntityTeleport(Entity entity) {
|
|
- return EntitySelector.NO_SPECTATORS.test(entity) && !entity.getRootVehicle().isOnPortalCooldown();
|
|
+ return EntitySelector.NO_SPECTATORS.test(entity) && !entity.getRootVehicle().isOnPortalCooldown() && !(entity instanceof Player player && player.isCreativeFlyOrSpectator()); // Leaves - creative no clip
|
|
}
|
|
|
|
public boolean isSpawning() {
|