From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> Date: Sat, 10 Jun 2023 13:01:08 +0300 Subject: [PATCH] Boat Settings diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractBoat.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractBoat.java index 1a4fb057025689a22b3dd05f531f0d8639d7e47b..c1bdc94a7c0084341fe857a0caff0764fc9e8b1e 100644 --- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractBoat.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractBoat.java @@ -296,7 +296,18 @@ public abstract class AbstractBoat extends VehicleEntity implements Leashable { } if (!this.level().isClientSide && this.outOfControlTicks >= 60.0F) { - this.ejectPassengers(); + // DivineMC start - Don't eject players + if (this.level().divinemcConfig.dontEjectPlayerFromBoatUnderwater) { + for (int i = this.passengers.size() - 1; i >= 0; --i) { + Entity passenger = this.passengers.get(i); + if (!(passenger instanceof Player)) { + passenger.stopRiding(); + } + } + } else { + this.ejectPassengers(); + } + // DivineMC end } if (this.getHurtTime() > 0) { @@ -839,7 +850,13 @@ public abstract class AbstractBoat extends VehicleEntity implements Leashable { public InteractionResult interact(Player player, InteractionHand hand) { InteractionResult enuminteractionresult = super.interact(player, hand); - return (InteractionResult) (enuminteractionresult != InteractionResult.PASS ? enuminteractionresult : (!player.isSecondaryUseActive() && this.outOfControlTicks < 60.0F && (this.level().isClientSide || player.startRiding(this)) ? InteractionResult.SUCCESS : InteractionResult.PASS)); + // DivineMC start - always allow to enter the boat + if (this.level().divinemcConfig.alwaysAllowToEnterTheBoat) { + return enuminteractionresult != InteractionResult.PASS ? enuminteractionresult : (player.isSecondaryUseActive() ? InteractionResult.PASS : (!this.level().isClientSide ? (player.startRiding(this) ? InteractionResult.CONSUME : InteractionResult.PASS) : InteractionResult.SUCCESS)); + } else { + return enuminteractionresult != InteractionResult.PASS ? enuminteractionresult : (!player.isSecondaryUseActive() && this.outOfControlTicks < 60.0F && (this.level().isClientSide || player.startRiding(this)) ? InteractionResult.SUCCESS : InteractionResult.PASS); + } + // DivineMC end } @Override @@ -889,7 +906,13 @@ public abstract class AbstractBoat extends VehicleEntity implements Leashable { @Override protected boolean canAddPassenger(Entity passenger) { - return this.getPassengers().size() < this.getMaxPassengers() && !this.isEyeInFluid(FluidTags.WATER); + // DivineMC start - always allow to enter the boat + if (this.level().divinemcConfig.alwaysAllowToEnterTheBoat) { + return this.getPassengers().size() < this.getMaxPassengers()/* && !this.isEyeInFluid(FluidTags.WATER)*/; + } else { + return this.getPassengers().size() < this.getMaxPassengers() && !this.isEyeInFluid(FluidTags.WATER); + } + // DivineMC end } protected int getMaxPassengers() { diff --git a/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java b/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java index 243b3d4379f4f6f273222a3611d8a463053d3e70..e1274fe3b0ff369d1f6f229026ced2e03ea335ca 100644 --- a/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java +++ b/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java @@ -82,4 +82,11 @@ public class DivineWorldConfig { private void saveFireworks() { saveFireworks = getBoolean("gameplay-mechanics.should-save-fireworks", saveFireworks); } + + public boolean dontEjectPlayerFromBoatUnderwater = true; + public boolean alwaysAllowToEnterTheBoat = true; + private void boatFeatures() { + dontEjectPlayerFromBoatUnderwater = getBoolean("gameplay-mechanics.boat.dont-eject-players-from-boat-underwater", dontEjectPlayerFromBoatUnderwater); + alwaysAllowToEnterTheBoat = getBoolean("gameplay-mechanics.boat.always-allow-to-enter-the-boat", alwaysAllowToEnterTheBoat); + } }