Skip to content

Commit 441a581

Browse files
committed
pages for break settings
1 parent fa9a42c commit 441a581

File tree

3 files changed

+47
-41
lines changed

3 files changed

+47
-41
lines changed

common/src/main/kotlin/com/lambda/config/groups/BreakSettings.kt

Lines changed: 45 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -29,45 +29,52 @@ class BreakSettings(
2929
priority: Priority = 0,
3030
vis: () -> Boolean = { true }
3131
) : BreakConfig(priority) {
32-
override val breakMode by c.setting("Break Mode", BreakMode.Packet, visibility = vis)
33-
override val reBreak by c.setting("ReBreak", true, "Re-breaks blocks after they've been broken once", visibility = vis)
34-
override val unsafeCancels by c.setting("Unsafe Cancels", true, "Allows cancelling block breaking even if the server might continue breaking sever side, potentially causing unexpected state changes", visibility = vis)
35-
override val breakThreshold by c.setting("Break Threshold", 0.70f, 0.1f..1.0f, 0.01f, "The break amount at which the block is considered broken", visibility = vis)
36-
override val doubleBreak by c.setting("Double Break", true, "Allows breaking two blocks at once", visibility = vis)
37-
override val fudgeFactor by c.setting("Fudge Factor", 2, 0..5, 1, "The amount of ticks to give double, aka secondary breaks extra for the server to recognise the break", visibility = vis)
38-
override val desyncFix by c.setting("Desync Fix", false, "Predicts if the players breaking will be slowed next tick as block break packets are processed using the players next position", visibility = vis)
39-
override val breakDelay by c.setting("Break Delay", 0, 0..6, 1, "The delay between breaking blocks", " ticks", visibility = vis)
40-
override val breakStageMask by c.setting("Break Stage Mask", setOf(TickEvent.Input.Pre, TickEvent.Input.Post, TickEvent.Player.Post), "The sub-tick timing at which break actions can be performed", visibility = vis)
41-
override val swing by c.setting("Swing Mode", SwingMode.Constant, "The times at which to swing the players hand", visibility = vis)
42-
override val swingType by c.setting("Break Swing Type", BuildConfig.SwingType.Vanilla, "The style of swing") { vis() && swing != SwingMode.None }
43-
override val sounds by c.setting("Break Sounds", true, "Plays the breaking sounds", visibility = vis)
44-
override val particles by c.setting("Particles", true, "Renders the breaking particles", visibility = vis)
45-
override val breakingTexture by c.setting("Breaking Overlay", true, "Overlays the breaking texture at its different stages", visibility = vis)
46-
override val rotateForBreak by c.setting("Rotate For Break", false, "Rotate towards block while breaking", visibility = vis)
47-
override val ignoredBlocks by c.setting("Ignored Blocks", allSigns, "Blocks that wont be broken", visibility = vis)
48-
override val breakConfirmation by c.setting("Break Confirmation", BreakConfirmationMode.BreakThenAwait, "The style of confirmation used when breaking", visibility = vis)
49-
override val maxPendingBreaks by c.setting("Max Pending Breaks", 15, 1..30, 1, "The maximum amount of pending breaks", visibility = vis)
50-
override val breaksPerTick by c.setting("Breaks Per Tick", 5, 1..30, 1, "Maximum instant block breaks per tick", visibility = vis)
51-
override val suitableToolsOnly by c.setting("Suitable Tools Only", false, "Places a restriction to only use tools suitable for the given block", visibility = vis)
52-
override val avoidLiquids by c.setting("Avoid Liquids", true, "Avoids breaking blocks that would cause liquid to spill", visibility = vis)
53-
override val breakWeakBlocks by c.setting("Break Weak Blocks", false, "Break blocks that dont have structural integrity (e.g: grass)", visibility = vis)
54-
override val forceSilkTouch by c.setting("Force Silk Touch", false, "Force silk touch when breaking blocks", visibility = vis)
55-
override val forceFortunePickaxe by c.setting("Force Fortune Pickaxe", false, "Force fortune pickaxe when breaking blocks", visibility = vis)
56-
override val minFortuneLevel by c.setting("Min Fortune Level", 1, 1..3, 1, "The minimum fortune level to use") { vis() && forceFortunePickaxe }
32+
val page by c.setting("Break Page", Page.General, visibility = vis)
33+
override val breakMode by c.setting("Break Mode", BreakMode.Packet) { vis() && page == Page.General }
34+
override val reBreak by c.setting("ReBreak", true, "Re-breaks blocks after they've been broken once") { vis() && page == Page.General }
35+
override val unsafeCancels by c.setting("Unsafe Cancels", true, "Allows cancelling block breaking even if the server might continue breaking sever side, potentially causing unexpected state changes") { vis() && page == Page.General }
36+
override val breakThreshold by c.setting("Break Threshold", 0.70f, 0.1f..1.0f, 0.01f, "The break amount at which the block is considered broken") { vis() && page == Page.General }
37+
override val doubleBreak by c.setting("Double Break", true, "Allows breaking two blocks at once") { vis() && page == Page.General }
38+
override val fudgeFactor by c.setting("Fudge Factor", 2, 0..5, 1, "The amount of ticks to give double, aka secondary breaks extra for the server to recognise the break") { vis() && page == Page.General }
39+
override val desyncFix by c.setting("Desync Fix", false, "Predicts if the players breaking will be slowed next tick as block break packets are processed using the players next position") { vis() && page == Page.General }
40+
override val breakDelay by c.setting("Break Delay", 0, 0..6, 1, "The delay between breaking blocks", " ticks") { vis() && page == Page.General }
41+
override val breakStageMask by c.setting("Break Stage Mask", setOf(TickEvent.Input.Pre, TickEvent.Input.Post, TickEvent.Player.Post), "The sub-tick timing at which break actions can be performed") { vis() && page == Page.General }
42+
override val swing by c.setting("Swing Mode", SwingMode.Constant, "The times at which to swing the players hand") { vis() && page == Page.General }
43+
override val swingType by c.setting("Break Swing Type", BuildConfig.SwingType.Vanilla, "The style of swing") { vis() && page == Page.General && swing != SwingMode.None }
44+
override val rotateForBreak by c.setting("Rotate For Break", false, "Rotate towards block while breaking") { vis() && page == Page.General }
45+
override val ignoredBlocks by c.setting("Ignored Blocks", allSigns, "Blocks that wont be broken") { vis() && page == Page.General }
46+
override val breakConfirmation by c.setting("Break Confirmation", BreakConfirmationMode.BreakThenAwait, "The style of confirmation used when breaking") { vis() && page == Page.General }
47+
override val maxPendingBreaks by c.setting("Max Pending Breaks", 15, 1..30, 1, "The maximum amount of pending breaks") { vis() && page == Page.General }
48+
override val breaksPerTick by c.setting("Breaks Per Tick", 5, 1..30, 1, "Maximum instant block breaks per tick") { vis() && page == Page.General }
49+
override val suitableToolsOnly by c.setting("Suitable Tools Only", false, "Places a restriction to only use tools suitable for the given block") { vis() && page == Page.General }
50+
override val avoidLiquids by c.setting("Avoid Liquids", true, "Avoids breaking blocks that would cause liquid to spill") { vis() && page == Page.General }
51+
override val breakWeakBlocks by c.setting("Break Weak Blocks", false, "Break blocks that dont have structural integrity (e.g: grass)") { vis() && page == Page.General }
52+
override val forceSilkTouch by c.setting("Force Silk Touch", false, "Force silk touch when breaking blocks") { vis() && page == Page.General }
53+
override val forceFortunePickaxe by c.setting("Force Fortune Pickaxe", false, "Force fortune pickaxe when breaking blocks") { vis() && page == Page.General }
54+
override val minFortuneLevel by c.setting("Min Fortune Level", 1, 1..3, 1, "The minimum fortune level to use") { vis() && page == Page.General && forceFortunePickaxe }
5755

58-
override val renders by c.setting("Renders", true, "Enables the render settings for breaking progress", visibility = vis)
59-
override val fill by c.setting("Fill", true, "Renders the sides of the box to display break progress") { vis() && renders }
60-
override val outline by c.setting("Outline", true, "Renders the lines of the box to display break progress") { vis() && renders }
61-
override val outlineWidth by c.setting("Outline Width", 2, 0..5, 1, "The width of the outline") { vis() && renders && outline }
62-
override val animation by c.setting("Animation", AnimationMode.Out, "The style of animation used for the box") { vis() && renders }
56+
override val sounds by c.setting("Break Sounds", true, "Plays the breaking sounds") { vis() && page == Page.Cosmetic }
57+
override val particles by c.setting("Particles", true, "Renders the breaking particles") { vis() && page == Page.Cosmetic }
58+
override val breakingTexture by c.setting("Breaking Overlay", true, "Overlays the breaking texture at its different stages") { vis() && page == Page.Cosmetic }
6359

64-
override val dynamicFillColor by c.setting("Dynamic Colour", true, "Enables fill color interpolation from start to finish for fill when breaking a block") { vis() && renders && fill }
65-
override val staticFillColor by c.setting("Fill Color", Color(255, 0, 0, 60), "The color of the fill") { vis() && renders && !dynamicFillColor && fill }
66-
override val startFillColor by c.setting("Start Fill Color", Color(255, 0, 0, 60), "The color of the fill at the start of breaking") { vis() && renders && dynamicFillColor && fill }
67-
override val endFillColor by c.setting("End Fill Color", Color(0, 255, 0, 60), "The color of the fill at the end of breaking") { vis() && renders && dynamicFillColor && fill }
60+
override val renders by c.setting("Renders", true, "Enables the render settings for breaking progress") { vis() && page == Page.Cosmetic }
61+
override val animation by c.setting("Animation", AnimationMode.Out, "The style of animation used for the box") { vis() && page == Page.Cosmetic && renders }
6862

69-
override val dynamicOutlineColor by c.setting("Dynamic Outline Color", true, "Enables color interpolation from start to finish for the outline when breaking a block") { vis() && renders && outline }
70-
override val staticOutlineColor by c.setting("Outline Color", Color(255, 0, 0, 255), "The Color of the outline at the start of breaking") { vis() && renders && !dynamicOutlineColor && outline }
71-
override val startOutlineColor by c.setting("Start Outline Color", Color(255, 0, 0, 255), "The color of the outline at the start of breaking") { vis() && renders && dynamicOutlineColor && outline }
72-
override val endOutlineColor by c.setting("End Outline Color", Color(0, 255, 0, 255), "The color of the outline at the end of breaking") { vis() && renders && dynamicOutlineColor && outline }
63+
override val fill by c.setting("Fill", true, "Renders the sides of the box to display break progress") { vis() && page == Page.Cosmetic && renders }
64+
override val dynamicFillColor by c.setting("Dynamic Colour", true, "Enables fill color interpolation from start to finish for fill when breaking a block") { vis() && page == Page.Cosmetic && renders && fill }
65+
override val staticFillColor by c.setting("Fill Color", Color(255, 0, 0, 60), "The color of the fill") { vis() && page == Page.Cosmetic && renders && !dynamicFillColor && fill }
66+
override val startFillColor by c.setting("Start Fill Color", Color(255, 0, 0, 60), "The color of the fill at the start of breaking") { vis() && page == Page.Cosmetic && renders && dynamicFillColor && fill }
67+
override val endFillColor by c.setting("End Fill Color", Color(0, 255, 0, 60), "The color of the fill at the end of breaking") { vis() && page == Page.Cosmetic && renders && dynamicFillColor && fill }
68+
69+
override val outline by c.setting("Outline", true, "Renders the lines of the box to display break progress") { vis() && page == Page.Cosmetic && renders }
70+
override val outlineWidth by c.setting("Outline Width", 2, 0..5, 1, "The width of the outline") { vis() && page == Page.Cosmetic && renders && outline }
71+
override val dynamicOutlineColor by c.setting("Dynamic Outline Color", true, "Enables color interpolation from start to finish for the outline when breaking a block") { vis() && page == Page.Cosmetic && renders && outline }
72+
override val staticOutlineColor by c.setting("Outline Color", Color(255, 0, 0, 255), "The Color of the outline at the start of breaking") { vis() && page == Page.Cosmetic && renders && !dynamicOutlineColor && outline }
73+
override val startOutlineColor by c.setting("Start Outline Color", Color(255, 0, 0, 255), "The color of the outline at the start of breaking") { vis() && page == Page.Cosmetic && renders && dynamicOutlineColor && outline }
74+
override val endOutlineColor by c.setting("End Outline Color", Color(0, 255, 0, 255), "The color of the outline at the end of breaking") { vis() && page == Page.Cosmetic && renders && dynamicOutlineColor && outline }
75+
76+
enum class Page {
77+
General,
78+
Cosmetic
79+
}
7380
}

common/src/main/kotlin/com/lambda/config/groups/BuildSettings.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class BuildSettings(
3535
override val pathing by c.setting("Pathing", true, "Path to blocks") { vis() && page == Page.General }
3636
override val stayInRange by c.setting("Stay In Range", true, "Stay in range of blocks") { vis() && page == Page.General && pathing }
3737
override val collectDrops by c.setting("Collect All Drops", false, "Collect all drops when breaking blocks") { vis() && page == Page.General }
38-
override val interactionsPerTick by c.setting("Interactions Per Tick", 5, 1..30, 1, "The amount of interactions that can happen per tick", visibility = vis)
38+
override val interactionsPerTick by c.setting("Interactions Per Tick", 5, 1..30, 1, "The amount of interactions that can happen per tick") { vis() && page == Page.General }
3939
override val maxPendingInteractions by c.setting("Max Pending Interactions", 20, 1..30, 1, "Dont wait for this many interactions for the server response") { vis() && page == Page.General }
4040

4141
// Breaking

common/src/main/kotlin/com/lambda/interaction/construction/simulation/BuildSimulator.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ import net.minecraft.state.property.Properties
8383
import net.minecraft.util.Hand
8484
import net.minecraft.util.hit.BlockHitResult
8585
import net.minecraft.util.math.BlockPos
86-
import net.minecraft.util.math.Box
8786
import net.minecraft.util.math.Direction
8887
import net.minecraft.util.math.Vec3d
8988
import net.minecraft.util.shape.VoxelShapes
@@ -578,7 +577,7 @@ object BuildSimulator {
578577
val state = blockState(pos)
579578

580579
/* is a block that will be destroyed by breaking adjacent blocks */
581-
if (breaking.breakWeakBlocks && state.block.hardness == 0f && state.isNotEmpty) {
580+
if (!breaking.breakWeakBlocks && state.block.hardness == 0f && state.isNotEmpty) {
582581
acc.add(BuildResult.Ignored(pos))
583582
return acc
584583
}

0 commit comments

Comments
 (0)