mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2024-12-29 08:26:37 +01:00
Make fan and nozzles not push players flying in creative
This commit is contained in:
parent
0cd49317d7
commit
3f31b765dd
2 changed files with 12 additions and 8 deletions
|
@ -89,8 +89,7 @@ public class AirCurrent {
|
||||||
protected void tickAffectedEntities(World world, Direction facing) {
|
protected void tickAffectedEntities(World world, Direction facing) {
|
||||||
for (Iterator<Entity> iterator = caughtEntities.iterator(); iterator.hasNext();) {
|
for (Iterator<Entity> iterator = caughtEntities.iterator(); iterator.hasNext();) {
|
||||||
Entity entity = iterator.next();
|
Entity entity = iterator.next();
|
||||||
if (!entity.isAlive() || !entity.getBoundingBox()
|
if (!entity.isAlive() || !entity.getBoundingBox().intersects(bounds) || isPlayerCreativeFlying(entity)) {
|
||||||
.intersects(bounds)) {
|
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -389,4 +388,12 @@ public class AirCurrent {
|
||||||
isClientPlayerInAirCurrent = false;
|
isClientPlayerInAirCurrent = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isPlayerCreativeFlying(Entity entity) {
|
||||||
|
if (entity instanceof PlayerEntity) {
|
||||||
|
PlayerEntity player = (PlayerEntity) entity;
|
||||||
|
return player.isCreative() && player.abilities.isFlying;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class NozzleTileEntity extends SmartTileEntity {
|
||||||
compound.putFloat("Range", range);
|
compound.putFloat("Range", range);
|
||||||
compound.putBoolean("Pushing", pushing);
|
compound.putBoolean("Pushing", pushing);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void fromTag(BlockState state, CompoundNBT compound, boolean clientPacket) {
|
protected void fromTag(BlockState state, CompoundNBT compound, boolean clientPacket) {
|
||||||
super.fromTag(state, compound, clientPacket);
|
super.fromTag(state, compound, clientPacket);
|
||||||
|
@ -95,8 +95,7 @@ public class NozzleTileEntity extends SmartTileEntity {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
double distance = diff.length();
|
double distance = diff.length();
|
||||||
if (distance > range || entity.isSneaking()
|
if (distance > range || entity.isSneaking() || AirCurrent.isPlayerCreativeFlying(entity)) {
|
||||||
|| (entity instanceof PlayerEntity && ((PlayerEntity) entity).isCreative())) {
|
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -153,10 +152,8 @@ public class NozzleTileEntity extends SmartTileEntity {
|
||||||
.subtract(center);
|
.subtract(center);
|
||||||
|
|
||||||
double distance = diff.length();
|
double distance = diff.length();
|
||||||
if (distance > range || entity.isSneaking()
|
if (distance > range || entity.isSneaking() || AirCurrent.isPlayerCreativeFlying(entity))
|
||||||
|| (entity instanceof PlayerEntity && ((PlayerEntity) entity).isCreative())) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
boolean canSee = canSee(entity);
|
boolean canSee = canSee(entity);
|
||||||
if (!canSee) {
|
if (!canSee) {
|
||||||
|
|
Loading…
Reference in a new issue