mirror of
https://github.com/BX-Team/DivineMC.git
synced 2025-12-22 08:19:19 +00:00
add some settings options
This commit is contained in:
77
patches/server/0009-Boat-Settings.patch
Normal file
77
patches/server/0009-Boat-Settings.patch
Normal file
@@ -0,0 +1,77 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sun, 2 Apr 2023 22:02:28 +0300
|
||||
Subject: [PATCH] Boat Settings
|
||||
|
||||
|
||||
diff --git a/src/main/java/gq/bxteam/divinemc/configuration/DivineWorldConfig.java b/src/main/java/gq/bxteam/divinemc/configuration/DivineWorldConfig.java
|
||||
index 5d16d2250bae9c982a0af9ad2580a63532b140f7..9eede8eb7fefc414f3a1207cd3ca2b33deb5ea13 100644
|
||||
--- a/src/main/java/gq/bxteam/divinemc/configuration/DivineWorldConfig.java
|
||||
+++ b/src/main/java/gq/bxteam/divinemc/configuration/DivineWorldConfig.java
|
||||
@@ -77,4 +77,11 @@ public class DivineWorldConfig {
|
||||
final Map<String, Object> value = DivineConfig.getMap("world-settings." + worldName + "." + path, null);
|
||||
return value.isEmpty() ? fallback : value;
|
||||
}
|
||||
+
|
||||
+ 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);
|
||||
+ }
|
||||
}
|
||||
\ No newline at end of file
|
||||
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 49660b0b9ee24de96006441a46bf6efa95873db3..ebd35ca6833aa5cfb913be96ca0c8c13cef45872 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
||||
@@ -356,7 +356,18 @@ public class Boat extends Entity implements VariantHolder<Boat.Type> {
|
||||
}
|
||||
|
||||
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) {
|
||||
@@ -897,7 +908,13 @@ public class Boat extends Entity implements VariantHolder<Boat.Type> {
|
||||
|
||||
@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
|
||||
@@ -993,7 +1010,13 @@ public class Boat extends Entity implements VariantHolder<Boat.Type> {
|
||||
|
||||
@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() {
|
||||
@@ -1,45 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Fri, 31 Mar 2023 01:12:40 +0300
|
||||
Subject: [PATCH] Some boat fixes
|
||||
|
||||
This patch always allow to enter the boat and removes that player can be ejected from the boat underwater automatically
|
||||
|
||||
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 49660b0b9ee24de96006441a46bf6efa95873db3..c9050b9c019541557bf0916838cd49e3f6a7bfe9 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
||||
@@ -356,7 +356,14 @@ public class Boat extends Entity implements VariantHolder<Boat.Type> {
|
||||
}
|
||||
|
||||
if (!this.level.isClientSide && this.outOfControlTicks >= 60.0F) {
|
||||
- this.ejectPassengers();
|
||||
+ // DivineMC start - Don't eject players
|
||||
+ for (int i = this.passengers.size() - 1; i >= 0; --i) {
|
||||
+ Entity passenger = this.passengers.get(i);
|
||||
+ if (!(passenger instanceof Player)) {
|
||||
+ passenger.stopRiding();
|
||||
+ }
|
||||
+ }
|
||||
+ // DivineMC end
|
||||
}
|
||||
|
||||
if (this.getHurtTime() > 0) {
|
||||
@@ -897,7 +904,7 @@ public class Boat extends Entity implements VariantHolder<Boat.Type> {
|
||||
|
||||
@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);
|
||||
+ return player.isSecondaryUseActive() ? InteractionResult.PASS : (true || this.outOfControlTicks < 60.0F ? (!this.level.isClientSide ? (player.startRiding(this) ? InteractionResult.CONSUME : InteractionResult.PASS) : InteractionResult.SUCCESS) : InteractionResult.PASS); // DivineMC - always allow to enter the boat
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -993,7 +1000,7 @@ public class Boat extends Entity implements VariantHolder<Boat.Type> {
|
||||
|
||||
@Override
|
||||
protected boolean canAddPassenger(Entity passenger) {
|
||||
- return this.getPassengers().size() < this.getMaxPassengers() && !this.isEyeInFluid(FluidTags.WATER);
|
||||
+ return this.getPassengers().size() < this.getMaxPassengers()/* && !this.isEyeInFluid(FluidTags.WATER)*/; // DivineMC - always allow to enter the boat
|
||||
}
|
||||
|
||||
protected int getMaxPassengers() {
|
||||
@@ -1,32 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Fri, 31 Mar 2023 22:47:12 +0300
|
||||
Subject: [PATCH] Campfires burn out in rain
|
||||
|
||||
It can be annoying, but it adds more realistic. If you want to remove it - i will do this
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java
|
||||
index 91feee1e284c929b008bc2df7ab548df898b3ef7..e0227afe23c69386e181fc9ba681f80a0d21832e 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java
|
||||
@@ -55,6 +55,20 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
|
||||
public static void cookTick(Level world, BlockPos pos, BlockState state, CampfireBlockEntity campfire) {
|
||||
boolean flag = false;
|
||||
|
||||
+ // DivineMC start
|
||||
+ if (world.random.nextDouble() < 0.2) {
|
||||
+ if (state.getValue(CampfireBlock.WATERLOGGED) || world.isRainingAt(pos.above())) {
|
||||
+ world.setBlock(pos, state.setValue(CampfireBlock.LIT, false), 3);
|
||||
+ world.playSound(null, pos.getX() + 0.5, pos.getY() + 1D, pos.getZ() + 0.5, net.minecraft.sounds.SoundEvents.FIRE_EXTINGUISH, net.minecraft.sounds.SoundSource.BLOCKS, 1F, 1F);
|
||||
+ flag = true;
|
||||
+ }
|
||||
+ if (flag) {
|
||||
+ setChanged(world, pos, state);
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ // DivineMC end
|
||||
+
|
||||
for (int i = 0; i < campfire.items.size(); ++i) {
|
||||
ItemStack itemstack = (ItemStack) campfire.items.get(i);
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sun, 2 Apr 2023 21:27:33 +0300
|
||||
Subject: [PATCH] Fallback to Dimension if World UUID is unknown
|
||||
|
||||
|
||||
diff --git a/src/main/java/gq/bxteam/divinemc/configuration/DivineConfig.java b/src/main/java/gq/bxteam/divinemc/configuration/DivineConfig.java
|
||||
index 0a8baeb94ae553c4759b065eafd9e242153cf991..f89cc1a3209b189bce1eca8131b175c8f0419525 100644
|
||||
--- a/src/main/java/gq/bxteam/divinemc/configuration/DivineConfig.java
|
||||
+++ b/src/main/java/gq/bxteam/divinemc/configuration/DivineConfig.java
|
||||
@@ -152,4 +152,9 @@ public class DivineConfig {
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
+
|
||||
+ public static boolean fallbackToDimensionIfWorldUUIDUnknown = true;
|
||||
+ public static void fallbackToDimensionIfWorldUUIDUnknown() {
|
||||
+ fallbackToDimensionIfWorldUUIDUnknown = getBoolean("settings.fallback-to-dimension-if-world-uuid-unknown", fallbackToDimensionIfWorldUUIDUnknown);
|
||||
+ }
|
||||
}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 9d96965d7940fdfe1087ce61c076001bf4d11b4a..0f0fa88a9acf465de0b9659f3ed7f89c551fe010 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -8,6 +8,7 @@ import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.logging.LogUtils;
|
||||
import com.mojang.serialization.DataResult;
|
||||
import com.mojang.serialization.Dynamic;
|
||||
+import gq.bxteam.divinemc.configuration.DivineConfig;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import io.papermc.paper.adventure.PaperAdventure;
|
||||
import java.io.File;
|
||||
@@ -210,7 +211,14 @@ public abstract class PlayerList {
|
||||
if (bWorld != null) {
|
||||
resourcekey = ((CraftWorld) bWorld).getHandle().dimension();
|
||||
} else {
|
||||
- resourcekey = Level.OVERWORLD;
|
||||
+ // DivineMC start - Fallback to Dimension if World UUID is unknown
|
||||
+ if (DivineConfig.fallbackToDimensionIfWorldUUIDUnknown) {
|
||||
+ DataResult<ResourceKey<Level>> dataResult = Level.RESOURCE_KEY_CODEC.parse(new Dynamic<>(NbtOps.INSTANCE, nbttagcompound.get("Dimension")));
|
||||
+ resourcekey = dataResult.result().orElse(Level.OVERWORLD);
|
||||
+ } else {
|
||||
+ resourcekey = Level.OVERWORLD;
|
||||
+ }
|
||||
+ // DivineMC end
|
||||
}
|
||||
} else if (nbttagcompound != null) {
|
||||
// Vanilla migration support
|
||||
Reference in New Issue
Block a user