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/Boat.java b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java index 5036941829e4d98adbcfb0354b35244c52fc4472..76ef5000bbd805c40e0c927dc709c20c17d72f79 100644 --- a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java @@ -338,7 +338,18 @@ public class Boat extends VehicleEntity implements VariantHolder { } 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) { @@ -853,7 +864,13 @@ public class Boat extends VehicleEntity implements VariantHolder { @Override public InteractionResult interact(Player player, InteractionHand hand) { - return player.isSecondaryUseActive() ? InteractionResult.PASS : (this.outOfControlTicks < 60.0F ? (!this.level().isClientSide ? (player.startRiding(this) ? InteractionResult.CONSUME : InteractionResult.PASS) : InteractionResult.SUCCESS) : InteractionResult.PASS); + // DivineMC start - always allow to enter the boat + if (this.level().divinemcConfig.alwaysAllowToEnterTheBoat) { + return player.isSecondaryUseActive() ? InteractionResult.PASS : (true || this.outOfControlTicks < 60.0F ? (!this.level().isClientSide ? (player.startRiding(this) ? InteractionResult.CONSUME : InteractionResult.PASS) : InteractionResult.SUCCESS) : InteractionResult.PASS); + } else { + return player.isSecondaryUseActive() ? InteractionResult.PASS : (this.outOfControlTicks < 60.0F ? (!this.level().isClientSide ? (player.startRiding(this) ? InteractionResult.CONSUME : InteractionResult.PASS) : InteractionResult.SUCCESS) : InteractionResult.PASS); + } + // DivineMC end } @Override @@ -925,7 +942,13 @@ public class Boat extends VehicleEntity implements VariantHolder { @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); + } }