From e70fee69e6b636b3e6d22b8a94f045df3ed9b770 Mon Sep 17 00:00:00 2001 From: Samsuik <40902469+Samsuik@users.noreply.github.com> Date: Sat, 9 Dec 2023 00:15:05 +0000 Subject: [PATCH] Configure fluid breaking redstone --- .../0004-Sakura-Configuration-Files.patch | 12 +++++++---- ...32-Cache-Vanillia-and-Eigen-Redstone.patch | 6 +++--- ...4-Configure-fluids-breaking-redstone.patch | 21 +++++++++++++++++++ 3 files changed, 32 insertions(+), 7 deletions(-) create mode 100644 patches/server/0054-Configure-fluids-breaking-redstone.patch diff --git a/patches/server/0004-Sakura-Configuration-Files.patch b/patches/server/0004-Sakura-Configuration-Files.patch index 2bf52ac..fafc207 100644 --- a/patches/server/0004-Sakura-Configuration-Files.patch +++ b/patches/server/0004-Sakura-Configuration-Files.patch @@ -621,10 +621,10 @@ index 0000000000000000000000000000000000000000..5fc23a0b579d7cbe03baf5324bef887a +} diff --git a/src/main/java/me/samsuik/sakura/configuration/WorldConfiguration.java b/src/main/java/me/samsuik/sakura/configuration/WorldConfiguration.java new file mode 100644 -index 0000000000000000000000000000000000000000..8edf0dd545b0664a8ae0079be7d92678f95374d0 +index 0000000000000000000000000000000000000000..d2549a7907d341bbc7a9a317aa13f2df1a369870 --- /dev/null +++ b/src/main/java/me/samsuik/sakura/configuration/WorldConfiguration.java -@@ -0,0 +1,164 @@ +@@ -0,0 +1,168 @@ +package me.samsuik.sakura.configuration; + +import com.mojang.logging.LogUtils; @@ -732,9 +732,13 @@ index 0000000000000000000000000000000000000000..8edf0dd545b0664a8ae0079be7d92678 + + public Technical technical; + public class Technical extends ConfigurationPart { -+ @NestedSetting({"redstone", "redstone-cache"}) -+ public boolean redstoneCache = false; + public boolean dispenserRandomItemSelection = true; ++ ++ public Redstone redstone = new Redstone(); ++ public class Redstone extends ConfigurationPart { ++ public boolean redstoneCache = false; ++ public boolean fluidsBreakRedstone = true; ++ } + } + + public Players players; diff --git a/patches/server/0032-Cache-Vanillia-and-Eigen-Redstone.patch b/patches/server/0032-Cache-Vanillia-and-Eigen-Redstone.patch index 68a4493..3dbdefd 100644 --- a/patches/server/0032-Cache-Vanillia-and-Eigen-Redstone.patch +++ b/patches/server/0032-Cache-Vanillia-and-Eigen-Redstone.patch @@ -53,7 +53,7 @@ index 22a2547810d0c029f29685faddf7ac21cde2df0b..0fad13769f5727279430ac7f650f3d4d diff --git a/src/main/java/me/samsuik/sakura/redstone/RedstoneTracker.java b/src/main/java/me/samsuik/sakura/redstone/RedstoneTracker.java new file mode 100644 -index 0000000000000000000000000000000000000000..f9ffc75f3c349c6a1cb614ed925b2e90b8bec06f +index 0000000000000000000000000000000000000000..455e51b93c50f8bf3e84d11f373be7b1dc9fc6eb --- /dev/null +++ b/src/main/java/me/samsuik/sakura/redstone/RedstoneTracker.java @@ -0,0 +1,283 @@ @@ -129,7 +129,7 @@ index 0000000000000000000000000000000000000000..f9ffc75f3c349c6a1cb614ed925b2e90 + } + + public boolean applyFromCache(BlockPos position, int previous, int next) { -+ if (this.level.sakuraConfig().technical.redstoneCache) { ++ if (this.level.sakuraConfig().technical.redstone.redstoneCache) { + long key = cacheKey(position, previous, next); + RedstoneCache cache = this.wireCaches.get(key); + @@ -182,7 +182,7 @@ index 0000000000000000000000000000000000000000..f9ffc75f3c349c6a1cb614ed925b2e90 + } + + public void beginTracking(BlockPos position, int previous, int next) { -+ if (++this.depth == 1 && this.level.sakuraConfig().technical.redstoneCache) { ++ if (++this.depth == 1 && this.level.sakuraConfig().technical.redstone.redstoneCache) { + long key = cacheKey(position, previous, next); + + if (this.wireCaches.containsKey(key)) { diff --git a/patches/server/0054-Configure-fluids-breaking-redstone.patch b/patches/server/0054-Configure-fluids-breaking-redstone.patch new file mode 100644 index 0000000..18ac098 --- /dev/null +++ b/patches/server/0054-Configure-fluids-breaking-redstone.patch @@ -0,0 +1,21 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Samsuik <40902469+Samsuik@users.noreply.github.com> +Date: Sat, 9 Dec 2023 00:11:48 +0000 +Subject: [PATCH] Configure fluids breaking redstone + + +diff --git a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java +index 96ccad764cb6424ffe561c558cd11200d89ff541..cc6f05998f2d73b09350c337e10ef3f57a9e0e68 100644 +--- a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java ++++ b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java +@@ -480,6 +480,10 @@ public abstract class FlowingFluid extends Fluid { + LiquidBlockContainer ifluidcontainer = (LiquidBlockContainer) block; + + return ifluidcontainer.canPlaceLiquid((Player) null, world, pos, state, fluid); ++ // Sakura start ++ } else if (world instanceof Level level && !level.sakuraConfig().technical.redstone.fluidsBreakRedstone && state.isSignalSource()) { ++ return false; ++ // Sakura end + } else { + return !(block instanceof DoorBlock) && !state.is(BlockTags.SIGNS) && !state.is(Blocks.LADDER) && !state.is(Blocks.SUGAR_CANE) && !state.is(Blocks.BUBBLE_COLUMN) ? (!state.is(Blocks.NETHER_PORTAL) && !state.is(Blocks.END_PORTAL) && !state.is(Blocks.END_GATEWAY) && !state.is(Blocks.STRUCTURE_VOID) ? !state.blocksMotion() : false) : false; + }