mirror of
https://github.com/BX-Team/DivineMC.git
synced 2025-12-20 23:39:16 +00:00
77 lines
4.6 KiB
Diff
77 lines
4.6 KiB
Diff
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 294b337ebbefa964975988be3a5476b21adced9e..45e803c67339abf9fe0dfc23173263b216ee4cf0 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
|
@@ -335,7 +335,18 @@ public class Boat extends VehicleEntity implements Leashable, VariantHolder<Boat
|
|
}
|
|
|
|
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) {
|
|
@@ -888,7 +899,13 @@ public class Boat extends VehicleEntity implements Leashable, VariantHolder<Boat
|
|
public InteractionResult interact(Player player, InteractionHand hand) {
|
|
InteractionResult enuminteractionresult = super.interact(player, hand);
|
|
|
|
- return enuminteractionresult != InteractionResult.PASS ? enuminteractionresult : (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 enuminteractionresult != InteractionResult.PASS ? enuminteractionresult : (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 enuminteractionresult != InteractionResult.PASS ? enuminteractionresult : (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
|
|
@@ -976,7 +993,13 @@ public class Boat extends VehicleEntity implements Leashable, VariantHolder<Boat
|
|
|
|
@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);
|
|
+ }
|
|
}
|