mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-22 16:39:22 +00:00
86 lines
5.1 KiB
Diff
86 lines
5.1 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
|
Date: Sun, 5 Jul 2020 23:40:16 -0500
|
|
Subject: [PATCH] Purpur: Add allow water in end world option
|
|
|
|
Original license: MIT
|
|
Original project: https://github.com/PurpurMC/Purpur
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/item/BucketItem.java b/src/main/java/net/minecraft/world/item/BucketItem.java
|
|
index 5c6aa9c464784ad5ee366412d080c72d3d22a76f..35d819aa2e660263cf6a5a0c09a6e73f7a89389b 100644
|
|
--- a/src/main/java/net/minecraft/world/item/BucketItem.java
|
|
+++ b/src/main/java/net/minecraft/world/item/BucketItem.java
|
|
@@ -166,7 +166,7 @@ public class BucketItem extends Item implements DispensibleContainerItem {
|
|
// CraftBukkit end
|
|
if (!flag1) {
|
|
return movingobjectpositionblock != null && this.emptyContents(entityhuman, world, movingobjectpositionblock.getBlockPos().relative(movingobjectpositionblock.getDirection()), (BlockHitResult) null, enumdirection, clicked, itemstack, enumhand); // CraftBukkit
|
|
- } else if (world.dimensionType().ultraWarm() && this.content.is(FluidTags.WATER)) {
|
|
+ } else if ((world.dimensionType().ultraWarm() || (world.isTheEnd() && !org.dreeam.leaf.LeafConfig.allowWaterPlacementInTheEnd)) && this.content.is(FluidTags.WATER)) { // Purpur
|
|
int i = blockposition.getX();
|
|
int j = blockposition.getY();
|
|
int k = blockposition.getZ();
|
|
@@ -174,7 +174,7 @@ public class BucketItem extends Item implements DispensibleContainerItem {
|
|
world.playSound(entityhuman, blockposition, SoundEvents.FIRE_EXTINGUISH, SoundSource.BLOCKS, 0.5F, 2.6F + (world.random.nextFloat() - world.random.nextFloat()) * 0.8F);
|
|
|
|
for (int l = 0; l < 8; ++l) {
|
|
- world.addParticle(ParticleTypes.LARGE_SMOKE, (double) i + Math.random(), (double) j + Math.random(), (double) k + Math.random(), 0.0D, 0.0D, 0.0D);
|
|
+ ((ServerLevel) world).sendParticles(null, ParticleTypes.LARGE_SMOKE, (double) i + Math.random(), (double) j + Math.random(), (double) k + Math.random(), 1, 0.0D, 0.0D, 0.0D, 0.0D, true); // Purpur
|
|
}
|
|
|
|
return true;
|
|
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
|
index b19e842be160748a6969e498952eb02ffece2ecc..db412c3409e17eda94290d4f5998d44b6e8220c1 100644
|
|
--- a/src/main/java/net/minecraft/world/level/Level.java
|
|
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
|
@@ -1629,4 +1629,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
|
return null;
|
|
}
|
|
// Paper end
|
|
+
|
|
+ // Purpur start
|
|
+ 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
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/IceBlock.java b/src/main/java/net/minecraft/world/level/block/IceBlock.java
|
|
index 5ecf02ce83b7496c977adfeb203b8eadb05f9da5..a04965be7126a9d94bdd52db91067cb05f3ba15f 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/IceBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/IceBlock.java
|
|
@@ -31,7 +31,7 @@ public class IceBlock extends HalfTransparentBlock {
|
|
public void afterDestroy(Level world, BlockPos pos, ItemStack tool) {
|
|
// Paper end
|
|
if (EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, tool) == 0) {
|
|
- if (world.dimensionType().ultraWarm()) {
|
|
+ if (world.isNether() || (world.isTheEnd() && !org.dreeam.leaf.LeafConfig.allowWaterPlacementInTheEnd)) { // Purpur
|
|
world.removeBlock(pos, false);
|
|
return;
|
|
}
|
|
@@ -59,7 +59,7 @@ public class IceBlock extends HalfTransparentBlock {
|
|
return;
|
|
}
|
|
// CraftBukkit end
|
|
- if (world.dimensionType().ultraWarm()) {
|
|
+ if (world.isNether() || (world.isTheEnd() && !org.dreeam.leaf.LeafConfig.allowWaterPlacementInTheEnd)) { // Purpur
|
|
world.removeBlock(pos, false);
|
|
} else {
|
|
world.setBlockAndUpdate(pos, Blocks.WATER.defaultBlockState());
|
|
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
|
|
index 8fce40f92fb9113e01080ef9b67cf61557f19263..25f97e391c29da7b3b49e6b4724875bd904a9270 100644
|
|
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
|
|
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
|
|
@@ -251,7 +251,9 @@ public class LeafConfig {
|
|
}
|
|
|
|
public static boolean compassItemShowsBossBar = false;
|
|
+ public static boolean allowWaterPlacementInTheEnd = true;
|
|
private static void gameplayMechanicSettings() {
|
|
compassItemShowsBossBar = getBoolean("gameplay-mechanics.item.compass.holding-shows-bossbar", compassItemShowsBossBar);
|
|
+ allowWaterPlacementInTheEnd = getBoolean("gameplay-mechanics.allow-water-placement-in-the-end", allowWaterPlacementInTheEnd);
|
|
}
|
|
}
|