Add allow water in end world option

This commit is contained in:
William Blake Galbreath
2025-01-05 22:08:11 -08:00
committed by granny
parent ce40bab666
commit 89f059a25a
5 changed files with 60 additions and 85 deletions

View File

@@ -0,0 +1,20 @@
--- a/net/minecraft/world/item/BucketItem.java
+++ b/net/minecraft/world/item/BucketItem.java
@@ -147,7 +_,7 @@
// CraftBukkit end
if (!flag) {
return result != null && this.emptyContents(player, level, result.getBlockPos().relative(result.getDirection()), null, enumdirection, clicked, itemstack, enumhand); // CraftBukkit
- } else if (level.dimensionType().ultraWarm() && this.content.is(FluidTags.WATER)) {
+ } else if ((level.dimensionType().ultraWarm() || (level.isTheEnd() && !org.purpurmc.purpur.PurpurConfig.allowWaterPlacementInTheEnd)) && this.content.is(FluidTags.WATER)) { // Purpur - Add allow water in end world option
int x = pos.getX();
int y = pos.getY();
int z = pos.getZ();
@@ -156,7 +_,7 @@
);
for (int i = 0; i < 8; i++) {
- level.addParticle(ParticleTypes.LARGE_SMOKE, x + Math.random(), y + Math.random(), z + Math.random(), 0.0, 0.0, 0.0);
+ ((net.minecraft.server.level.ServerLevel) level).sendParticlesSource(null, ParticleTypes.LARGE_SMOKE, false, true, x + Math.random(), y + Math.random(), z + Math.random(), 1, 0.0D, 0.0D, 0.0D, 0.0D); // Purpur - Add allow water in end world option
}
return true;

View File

@@ -16,3 +16,18 @@
this.generator = gen;
this.world = new CraftWorld((ServerLevel) this, gen, biomeProvider, env);
@@ -2130,4 +_,14 @@
return this.id;
}
}
+
+ // Purpur start - Add allow water in end world option
+ public boolean isNether() {
+ return getWorld().getEnvironment() == org.bukkit.World.Environment.NETHER;
+ }
+
+ public boolean isTheEnd() {
+ return getWorld().getEnvironment() == org.bukkit.World.Environment.THE_END;
+ }
+ // Purpur end - Add allow water in end world option
}

View File

@@ -0,0 +1,20 @@
--- a/net/minecraft/world/level/block/IceBlock.java
+++ b/net/minecraft/world/level/block/IceBlock.java
@@ -40,7 +_,7 @@
public void afterDestroy(Level level, BlockPos pos, ItemStack stack) {
// Paper end - Improve Block#breakNaturally API
if (!EnchantmentHelper.hasTag(stack, EnchantmentTags.PREVENTS_ICE_MELTING)) {
- if (level.dimensionType().ultraWarm()) {
+ if (level.isNether() || (level.isTheEnd() && !org.purpurmc.purpur.PurpurConfig.allowWaterPlacementInTheEnd)) { // Purpur - Add allow water in end world option
level.removeBlock(pos, false);
return;
}
@@ -65,7 +_,7 @@
return;
}
// CraftBukkit end
- if (level.dimensionType().ultraWarm()) {
+ if (level.isNether() || (level.isTheEnd() && !org.purpurmc.purpur.PurpurConfig.allowWaterPlacementInTheEnd)) { // Purpur - Add allow water in end world option
level.removeBlock(pos, false);
} else {
level.setBlockAndUpdate(pos, meltsInto());

View File

@@ -228,6 +228,11 @@ public class PurpurConfig {
enderChestPermissionRows = getBoolean("settings.blocks.ender_chest.use-permissions-for-rows", enderChestPermissionRows);
}
public static boolean allowWaterPlacementInTheEnd = true;
private static void allowWaterPlacementInEnd() {
allowWaterPlacementInTheEnd = getBoolean("settings.allow-water-placement-in-the-end", allowWaterPlacementInTheEnd);
}
public static boolean loggerSuppressInitLegacyMaterialError = false;
public static boolean loggerSuppressIgnoredAdvancementWarnings = false;
public static boolean loggerSuppressUnrecognizedRecipeErrors = false;