Fix wrong variable passing in ThreadedRegionizer
This commit is contained in:
+116
@@ -0,0 +1,116 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Helvetica Volubi <suisuroru@blue-millennium.fun>
|
||||
Date: Thu, 9 Jul 2026 10:05:46 +0800
|
||||
Subject: [PATCH] Add config to modify tripwire behavior
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/level/block/TripWireHookBlock.java b/net/minecraft/world/level/block/TripWireHookBlock.java
|
||||
index 8bcc8b6f83ab4d5a472741185511b5d84f4974be..42dea12934475001dddc8ccad190b3c030b700aa 100644
|
||||
--- a/net/minecraft/world/level/block/TripWireHookBlock.java
|
||||
+++ b/net/minecraft/world/level/block/TripWireHookBlock.java
|
||||
@@ -201,10 +201,17 @@ public class TripWireHookBlock extends Block {
|
||||
BlockPos testPos = pos.relative(direction, i);
|
||||
BlockState wireData = wireStates[i];
|
||||
if (wireData != null) {
|
||||
- BlockState testPosState = level.getBlockState(testPos);
|
||||
- if (testPosState.is(Blocks.TRIPWIRE) || testPosState.is(Blocks.TRIPWIRE_HOOK)) {
|
||||
- if (!io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableTripwireUpdates || !testPosState.is(Blocks.TRIPWIRE)) level.setBlock(testPos, wireData.trySetValue(ATTACHED, attached), Block.UPDATE_ALL); // Paper - prevent tripwire from updating
|
||||
+ // Shiroha start - tripwire and tripwireHook dupe
|
||||
+ if (io.nanachiyo0721.shiroha.config.modules.function.TripwireBehaviorConfig.enabled) {
|
||||
+ level.setBlock(testPos, wireData.trySetValue(ATTACHED, attached), 3);
|
||||
+ level.getBlockState(testPos);
|
||||
+ } else {
|
||||
+ BlockState testPosState = level.getBlockState(testPos);
|
||||
+ if (testPosState.is(Blocks.TRIPWIRE) || testPosState.is(Blocks.TRIPWIRE_HOOK)) {
|
||||
+ if (!io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableTripwireUpdates || !testPosState.is(Blocks.TRIPWIRE)) level.setBlock(testPos, wireData.trySetValue(ATTACHED, attached), Block.UPDATE_ALL); // Paper - prevent tripwire from updating
|
||||
+ }
|
||||
}
|
||||
+ // Shiroha end - tripwire and tripwireHook dupe
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java b/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java
|
||||
index b67f5f7b76037ab77548c37a83e4d0918915223a..01a0ec9f6cbbec0fde198aa0128461287e58db14 100644
|
||||
--- a/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java
|
||||
+++ b/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java
|
||||
@@ -28,15 +28,41 @@ public class EndPlatformFeature extends Feature<NoneFeatureConfiguration> {
|
||||
// CraftBukkit end
|
||||
BlockPos.MutableBlockPos pos = origin.mutable();
|
||||
|
||||
- for (int dz = -2; dz <= 2; dz++) {
|
||||
+ // Shiroha start - tripwire behavior modifier
|
||||
+ java.util.List<BlockPos> blockList1 = new java.util.ArrayList<>();
|
||||
+ java.util.List<BlockPos> blockList2 = new java.util.ArrayList<>();
|
||||
+ boolean flag21 = io.nanachiyo0721.shiroha.config.modules.function.TripwireBehaviorConfig.behaviorMode == io.nanachiyo0721.shiroha.enums.EnumTripwireBehavior.VANILLA21; for (int dz = -2; dz <= 2; dz++) {
|
||||
for (int dx = -2; dx <= 2; dx++) {
|
||||
for (int dy = -1; dy < 3; dy++) {
|
||||
BlockPos blockPos = pos.set(origin).move(dx, dy, dz);
|
||||
Block block = dy == -1 ? Blocks.OBSIDIAN : Blocks.AIR;
|
||||
if (!blockList.getBlockState(blockPos).is(block)) { // CraftBukkit
|
||||
if (dropResources) {
|
||||
- blockList.destroyBlock(blockPos, true, null); // CraftBukkit
|
||||
+ boolean flag = false;
|
||||
+ if (io.nanachiyo0721.shiroha.config.modules.function.TripwireBehaviorConfig.enabled) {
|
||||
+ switch (io.nanachiyo0721.shiroha.config.modules.function.TripwireBehaviorConfig.behaviorMode) {
|
||||
+ case io.nanachiyo0721.shiroha.enums.EnumTripwireBehavior.VANILLA20: {
|
||||
+ flag = true;
|
||||
+ }
|
||||
+ case io.nanachiyo0721.shiroha.enums.EnumTripwireBehavior.MIXED: {
|
||||
+ net.minecraft.world.level.block.state.BlockState state = newLevel.getBlockState(blockPos);
|
||||
+ if (state.is(Blocks.TRIPWIRE)) {
|
||||
+ if (state.getValue(net.minecraft.world.level.block.TripWireBlock.DISARMED)) {
|
||||
+ flag = true;
|
||||
+ blockList2.add(blockPos.immutable());
|
||||
+ }
|
||||
+ if (!flag) {
|
||||
+ flag = checkString(blockList2, blockPos);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ default: {} // 1.21 & default Logic - default empty
|
||||
+ }
|
||||
+ }
|
||||
+ if (flag) blockList1.add(blockPos.immutable());
|
||||
+ else blockList.destroyBlock(blockPos, true, null); // CraftBukkit
|
||||
}
|
||||
+ // Shiroha end - prevent tripwire dupe in end platform generate
|
||||
|
||||
blockList.setBlock(blockPos, block.defaultBlockState(), Block.UPDATE_ALL); // CraftBukkit
|
||||
}
|
||||
@@ -53,11 +79,34 @@ public class EndPlatformFeature extends Feature<NoneFeatureConfiguration> {
|
||||
if (portalEvent.isCancelled()) return;
|
||||
}
|
||||
|
||||
- if (dropResources) {
|
||||
- blockList.placeBlocks(state -> newLevel.destroyBlock(state.getPosition(), true, null));
|
||||
+ // Shiroha start - prevent tripwire dupe in end platform generate
|
||||
+ if (flag21 || !io.nanachiyo0721.shiroha.config.modules.function.TripwireBehaviorConfig.enabled) {
|
||||
+ if (dropResources) {
|
||||
+ blockList.placeBlocks(state -> newLevel.destroyBlock(state.getPosition(), true, null));
|
||||
+ } else {
|
||||
+ blockList.placeBlocks();
|
||||
+ }
|
||||
+ // Shiroha end - prevent tripwire dupe in end platform generate
|
||||
} else {
|
||||
+ // Shiroha start - prevent tripwire dupe in end platform generate
|
||||
+ if (dropResources) {
|
||||
+ blockList.getSnapshotBlocks().forEach((state) -> {
|
||||
+ newLevel.destroyBlock(state.getPosition(), !blockList1.contains(state.getPosition()), null);
|
||||
+ });
|
||||
+ }
|
||||
+ // Shiroha end - prevent tripwire dupe in end platform generate
|
||||
blockList.placeBlocks();
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
+
|
||||
+ // Shiroha start - tripwire behavior modifier
|
||||
+ private static boolean checkString(java.util.List<BlockPos> blockList, BlockPos blockPos) {
|
||||
+ for (BlockPos pos : blockList) {
|
||||
+ if (pos.getY() != blockPos.getY()) continue;
|
||||
+ if (pos.getX() == blockPos.getX() || pos.getZ() == blockPos.getZ()) return true;
|
||||
+ }
|
||||
+ return false;
|
||||
+ }
|
||||
+ // Shiroha end - tripwire behavior modifier
|
||||
}
|
||||
Reference in New Issue
Block a user