-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Configurable fix tripwire dupe patch
- Loading branch information
1 parent
714571a
commit 67947bc
Showing
3 changed files
with
90 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
group = org.dreeam.leaf | ||
mcVersion = 1.20.1 | ||
version = 1.20.1-R0.1-SNAPSHOT | ||
|
||
galeCommit = 94acff5e6757d9ad569983f3683a8f3b06dcaf57 | ||
|
||
org.gradle.caching = true | ||
org.gradle.parallel = true | ||
org.gradle.vfs.watch = false | ||
org.gradle.jvmargs = -Xmx4G | ||
org.gradle.jvmargs = -Xmx4G -Dfile.encoding=UTF8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,34 +3,69 @@ From: Dreeam <[email protected]> | |
Date: Sun, 18 Feb 2024 16:00:43 -0500 | ||
Subject: [PATCH] Configurable fix tripwire dupe | ||
|
||
Backported from PaperMC/Paper ver/1.20.6 branch Fix-tripwire-disarming-not-working-as-intended.patch | ||
|
||
diff --git a/src/main/java/net/minecraft/world/level/block/TripWireBlock.java b/src/main/java/net/minecraft/world/level/block/TripWireBlock.java | ||
index eb1ecbbb5c0f887ee1c7de85a6137f2f182b3fc0..602952934e49227c9aa96ffc0b7342e85791cecb 100644 | ||
index eb1ecbbb5c0f887ee1c7de85a6137f2f182b3fc0..641a0c65f95acb7ca180bd6e1933cdbbb3b59df4 100644 | ||
--- a/src/main/java/net/minecraft/world/level/block/TripWireBlock.java | ||
+++ b/src/main/java/net/minecraft/world/level/block/TripWireBlock.java | ||
@@ -78,7 +78,7 @@ public class TripWireBlock extends Block { | ||
public void onRemove(BlockState state, Level world, BlockPos pos, BlockState newState, boolean moved) { | ||
if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableTripwireUpdates) return; // Paper - prevent adjacent tripwires from updating | ||
if (!moved && !state.is(newState.getBlock())) { | ||
- this.updateSource(world, pos, (BlockState) state.setValue(TripWireBlock.POWERED, true), world.galeConfig().gameplayMechanics.fixes.tripwireDuping); // Paper - fix state inconsistency // Gale - Leaf - make tripwire duping fix configurable | ||
+ this.updateSource(world, pos, (BlockState) state.setValue(TripWireBlock.POWERED, true), true); // Paper - fix state inconsistency // Gale - Leaf - make tripwire duping fix configurable // Leaf - Configurable fix tripwire dupe | ||
+ this.updateSource(world, pos, (BlockState) state.setValue(TripWireBlock.POWERED, true)); // Paper - fix state inconsistency // Gale - Leaf - make tripwire duping fix configurable // Leaf - Configurable fix tripwire dupe - Revert | ||
} | ||
} | ||
|
||
@@ -95,12 +95,6 @@ public class TripWireBlock extends Block { | ||
|
||
private void updateSource(Level world, BlockPos pos, BlockState state) { | ||
if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableTripwireUpdates) return; // Paper - prevent adjacent tripwires from updating | ||
- // Paper start - fix state inconsistency | ||
- this.updateSource(world, pos, state, false); | ||
- } | ||
- | ||
- private void updateSource(Level world, BlockPos pos, BlockState state, boolean beingRemoved) { | ||
- // Paper end | ||
Direction[] aenumdirection = new Direction[]{Direction.SOUTH, Direction.WEST}; | ||
int i = aenumdirection.length; | ||
int j = 0; | ||
@@ -116,7 +110,7 @@ public class TripWireBlock extends Block { | ||
|
||
if (iblockdata1.is((Block) this.hook)) { | ||
if (iblockdata1.getValue(TripWireHookBlock.FACING) == enumdirection.getOpposite()) { | ||
- this.hook.calculateState(world, blockposition1, iblockdata1, false, true, k, state, beingRemoved); // Paper - fix state inconsistency | ||
+ this.hook.calculateState(world, blockposition1, iblockdata1, false, true, k, state); // Paper - fix state inconsistency // Leaf - Configurable fix tripwire dupe - Revert | ||
} | ||
} else if (iblockdata1.is((Block) this)) { | ||
++k; | ||
diff --git a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java b/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java | ||
index 004dce26ff073f1de52a84cd425c4f60fdab5e50..a02d4233c9dbb4e37532c3ab6c20bb1cdfbdceef 100644 | ||
index 004dce26ff073f1de52a84cd425c4f60fdab5e50..65ce625e80949788ceb7e33a02b0fb19ed480382 100644 | ||
--- a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java | ||
+++ b/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java | ||
@@ -147,7 +147,7 @@ public class TripWireHookBlock extends Block { | ||
@@ -108,12 +108,6 @@ public class TripWireHookBlock extends Block { | ||
} | ||
|
||
public void calculateState(Level world, BlockPos pos, BlockState state, boolean beingRemoved, boolean flag1, int i, @Nullable BlockState iblockdata1) { | ||
- // Paper start - fix tripwire inconsistency | ||
- this.calculateState(world, pos, state, beingRemoved, flag1, i, iblockdata1, false); | ||
- } | ||
- | ||
- public void calculateState(Level world, BlockPos pos, BlockState state, boolean beingRemoved, boolean flag1, int i, @Nullable BlockState iblockdata1, boolean tripWireBeingRemoved) { | ||
- // Paper end | ||
Direction enumdirection = (Direction) state.getValue(TripWireHookBlock.FACING); | ||
boolean flag2 = (Boolean) state.getValue(TripWireHookBlock.ATTACHED); | ||
boolean flag3 = (Boolean) state.getValue(TripWireHookBlock.POWERED); | ||
@@ -147,7 +141,6 @@ public class TripWireHookBlock extends Block { | ||
boolean flag7 = (Boolean) iblockdata2.getValue(TripWireBlock.POWERED); | ||
|
||
flag5 |= flag6 && flag7; | ||
- if (k != i || !tripWireBeingRemoved || !flag6) // Paper - don't update the tripwire again if being removed and not disarmed | ||
+ if (!org.dreeam.leaf.LeafConfig.fixTripwireDupe || k != i || !tripWireBeingRemoved || !flag6) // Paper - don't update the tripwire again if being removed and not disarmed // Leaf - Configurable fix tripwire dupe | ||
aiblockdata[k] = iblockdata2; | ||
if (k == i) { | ||
world.scheduleTick(pos, (Block) this, 10); | ||
@@ -182,7 +182,7 @@ public class TripWireHookBlock extends Block { | ||
@@ -182,7 +175,7 @@ public class TripWireHookBlock extends Block { | ||
|
||
this.emitState(world, pos, flag4, flag5, flag2, flag3); | ||
if (!beingRemoved) { | ||
|
@@ -39,20 +74,50 @@ index 004dce26ff073f1de52a84cd425c4f60fdab5e50..a02d4233c9dbb4e37532c3ab6c20bb1c | |
world.setBlock(pos, (BlockState) iblockdata3.setValue(TripWireHookBlock.FACING, enumdirection), 3); | ||
if (flag1) { | ||
this.notifyNeighbors(world, pos, enumdirection); | ||
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java | ||
index 4974ba174afe8cfd30e4dbbd59d4e88f62f45380..e25b4f2ad080d0fbd6782cee305a7c5f4f206a2a 100644 | ||
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java | ||
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java | ||
@@ -293,4 +293,9 @@ public class LeafConfig { | ||
gg.pufferfish.pufferfish.sentry.SentryManager.init(); | ||
} | ||
} | ||
@@ -195,9 +188,8 @@ public class TripWireHookBlock extends Block { | ||
BlockState iblockdata4 = aiblockdata[l]; | ||
|
||
if (iblockdata4 != null) { | ||
+ if (!org.dreeam.leaf.config.modules.gameplay.FixTripwireDupe.enabled || world.getBlockState(blockposition2).is(Blocks.TRIPWIRE)) { // Paper - Fix tripwire disarming not working as intended // Leaf - Configurable fix tripwire dupe | ||
world.setBlock(blockposition2, (BlockState) iblockdata4.setValue(TripWireHookBlock.ATTACHED, flag4), 3); | ||
- if (!world.getBlockState(blockposition2).isAir()) { | ||
- ; | ||
} | ||
} | ||
} | ||
diff --git a/src/main/java/org/dreeam/leaf/config/modules/gameplay/FixTripwireDupe.java b/src/main/java/org/dreeam/leaf/config/modules/gameplay/FixTripwireDupe.java | ||
new file mode 100644 | ||
index 0000000000000000000000000000000000000000..4528fa6ec8689c07f8e9f4d11307bf2d6b5f5ae1 | ||
--- /dev/null | ||
+++ b/src/main/java/org/dreeam/leaf/config/modules/gameplay/FixTripwireDupe.java | ||
@@ -0,0 +1,27 @@ | ||
+package org.dreeam.leaf.config.modules.gameplay; | ||
+ | ||
+import com.electronwill.nightconfig.core.file.CommentedFileConfig; | ||
+import org.dreeam.leaf.config.ConfigInfo; | ||
+import org.dreeam.leaf.config.EnumConfigCategory; | ||
+import org.dreeam.leaf.config.IConfigModule; | ||
+ | ||
+public class FixTripwireDupe implements IConfigModule { | ||
+ | ||
+ @Override | ||
+ public EnumConfigCategory getCategory() { | ||
+ return EnumConfigCategory.GAMEPLAY; | ||
+ } | ||
+ | ||
+ @Override | ||
+ public String getBaseName() { | ||
+ return "fix_tripwire_dupe"; | ||
+ } | ||
+ | ||
+ @ConfigInfo(baseName = "enabled") | ||
+ public static boolean enabled = true; | ||
+ | ||
+ public static boolean fixTripwireDupe = true; | ||
+ private static void tripwireDupe() { | ||
+ fixTripwireDupe = getBoolean("gameplay.fix-tripwire-dupe", fixTripwireDupe); | ||
+ @Override | ||
+ public void onLoaded(CommentedFileConfig config) { | ||
+ config.setComment("gameplay.fix_tripwire_dupe", "Enable to fix tripwire dupe"); | ||
+ } | ||
} | ||
+} | ||
diff --git a/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java b/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java | ||
index 582640872ead7b9b4107fa5cc8f4e204b9d8bcc7..5d51c4609cbdebbd3ab5d8df051f3ec00862de8d 100644 | ||
--- a/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java | ||
|