diff --git a/src/main/kotlin/com/lambda/client/activity/activities/construction/core/BreakBlock.kt b/src/main/kotlin/com/lambda/client/activity/activities/construction/core/BreakBlock.kt index d83e8eb24..e79d1cb98 100644 --- a/src/main/kotlin/com/lambda/client/activity/activities/construction/core/BreakBlock.kt +++ b/src/main/kotlin/com/lambda/client/activity/activities/construction/core/BreakBlock.kt @@ -60,6 +60,8 @@ class BreakBlock( override var rotation: Vec2f? = null, override var distance: Double = 1337.0, override var exposedSides: Int = 0, + private var handleLiquids: Boolean = true, + private var allowBreakBeneathPlayer: Boolean = false, ) : BuildActivity, TimeoutActivity, AttemptActivity, RotatingActivity, TimedActivity, RenderAABBActivity, RenderOverlayTextActivity, Activity() { private var side: EnumFacing? = null private var ticksNeeded = 0 @@ -213,7 +215,8 @@ class BreakBlock( val hitVec = getHitVec(blockPos, miningSide) /* prevent breaking the block the player is standing on */ - if (player.flooredPosition.down() == blockPos + if (allowBreakBeneathPlayer + && player.flooredPosition.down() == blockPos && !world.getBlockState(blockPos.down()).isSideSolid(world, blockPos.down(), EnumFacing.UP) ) { availability = BuildActivity.Availability.BLOCKED_BY_PLAYER @@ -363,6 +366,7 @@ class BreakBlock( } private fun SafeClientEvent.checkLiquids(): Boolean { + if (!handleLiquids) return false var foundLiquid = false if (world.getBlockState(blockPos).isLiquid) { @@ -376,7 +380,7 @@ class BreakBlock( return true } - EnumFacing.entries + EnumFacing.values() .filter { it != EnumFacing.DOWN } .map { blockPos.offset(it) } .filter { world.getBlockState(it).isLiquid } diff --git a/src/main/kotlin/com/lambda/client/activity/activities/construction/core/BuildStructure.kt b/src/main/kotlin/com/lambda/client/activity/activities/construction/core/BuildStructure.kt index 50272b728..f79b14f7f 100644 --- a/src/main/kotlin/com/lambda/client/activity/activities/construction/core/BuildStructure.kt +++ b/src/main/kotlin/com/lambda/client/activity/activities/construction/core/BuildStructure.kt @@ -50,7 +50,9 @@ class BuildStructure( private val allowBreakDescend: Boolean = false, override val maximumRepeats: Int = 1, override var repeated: Int = 0, - override val aabbCompounds: MutableSet = mutableSetOf() + override val aabbCompounds: MutableSet = mutableSetOf(), + private var handleLiquids: Boolean = true, + private var allowBreakBeneathPlayer: Boolean = false, ) : RepeatingActivity, RenderAABBActivity, Activity() { private var currentOffset = BlockPos.ORIGIN private var currentGoal: Goal? by Delegates.observable(null) { _, old, new -> @@ -232,7 +234,9 @@ class BuildStructure( /* the only option left is breaking the block */ addSubActivities(BreakBlock( // blockPos, collectDrops = collectAll, minCollectAmount = 64 - blockPos + blockPos, + handleLiquids = handleLiquids, + allowBreakBeneathPlayer = allowBreakBeneathPlayer, ), subscribe = true) } diff --git a/src/main/kotlin/com/lambda/client/activity/activities/inventory/AcquireItemInActiveHand.kt b/src/main/kotlin/com/lambda/client/activity/activities/inventory/AcquireItemInActiveHand.kt index 657c537c5..85d2e2c2f 100644 --- a/src/main/kotlin/com/lambda/client/activity/activities/inventory/AcquireItemInActiveHand.kt +++ b/src/main/kotlin/com/lambda/client/activity/activities/inventory/AcquireItemInActiveHand.kt @@ -68,7 +68,7 @@ class AcquireItemInActiveHand( } // If the item is obsidian, break down ender chests - if (itemInfo.item == Blocks.OBSIDIAN.item) { + if (BuildTools.breakDownEnderChests && itemInfo.item == Blocks.OBSIDIAN.item) { addSubActivities(BreakDownEnderChests(maximumRepeats = BuildTools.breakDownCycles)) return } diff --git a/src/main/kotlin/com/lambda/client/manager/managers/ActivityManager.kt b/src/main/kotlin/com/lambda/client/manager/managers/ActivityManager.kt index d0e2fc6e8..799143348 100644 --- a/src/main/kotlin/com/lambda/client/manager/managers/ActivityManager.kt +++ b/src/main/kotlin/com/lambda/client/manager/managers/ActivityManager.kt @@ -1,7 +1,8 @@ package com.lambda.client.manager.managers import com.lambda.client.activity.Activity -import com.lambda.client.activity.activities.storage.* +import com.lambda.client.activity.activities.storage.ShulkerTransaction +import com.lambda.client.activity.activities.storage.StashTransaction import com.lambda.client.activity.activities.storage.types.* import com.lambda.client.activity.getShulkerInventory import com.lambda.client.activity.types.RenderAABBActivity @@ -30,18 +31,18 @@ import com.lambda.client.util.graphics.ESPRenderer import com.lambda.client.util.graphics.GlStateUtils import com.lambda.client.util.graphics.ProjectionUtils import com.lambda.client.util.graphics.font.FontRenderAdapter -import com.lambda.client.util.items.* +import com.lambda.client.util.items.allSlots +import com.lambda.client.util.items.countEmpty +import com.lambda.client.util.items.countItem +import com.lambda.client.util.items.inventorySlots import com.lambda.client.util.math.CoordinateConverter.asString import com.lambda.client.util.math.VectorUtils.distanceTo import com.lambda.client.util.text.MessageSendHelper import com.lambda.client.util.threads.safeListener -import net.minecraft.init.Blocks import net.minecraft.init.Items import net.minecraft.item.Item import net.minecraftforge.fml.common.gameevent.TickEvent import org.lwjgl.opengl.GL11 -import scala.tools.nsc.backend.icode.analysis.TypeFlowAnalysis.MethodTFA.Gen -import java.util.* object ActivityManager : Manager, Activity() { private val renderer = ESPRenderer() @@ -111,26 +112,28 @@ object ActivityManager : Manager, Activity() { listener { if (hasNoSubActivities) return@listener - GlStateUtils.rescaleActual() + if (BuildTools.showDebugText) { + GlStateUtils.rescaleActual() - RenderOverlayTextActivity.normalizedRender.forEach { renderText -> - GL11.glPushMatrix() - val screenPos = ProjectionUtils.toScreenPos(renderText.origin) - GL11.glTranslated(screenPos.x, screenPos.y, 0.0) - GL11.glScalef(textScale * 2.0f, textScale * 2.0f, 1.0f) + RenderOverlayTextActivity.normalizedRender.forEach { renderText -> + GL11.glPushMatrix() + val screenPos = ProjectionUtils.toScreenPos(renderText.origin) + GL11.glTranslated(screenPos.x, screenPos.y, 0.0) + GL11.glScalef(textScale * 2.0f, textScale * 2.0f, 1.0f) - val halfWidth = FontRenderAdapter.getStringWidth(renderText.text) / -2.0f - val lineHeight = FontRenderAdapter.getFontHeight() + 2.0f - val yLift = lineHeight * 3 / 2 + val halfWidth = FontRenderAdapter.getStringWidth(renderText.text) / -2.0f + val lineHeight = FontRenderAdapter.getFontHeight() + 2.0f + val yLift = lineHeight * 3 / 2 - FontRenderAdapter.drawString( - renderText.text, - halfWidth, - lineHeight * renderText.index - yLift, - color = renderText.color - ) + FontRenderAdapter.drawString( + renderText.text, + halfWidth, + lineHeight * renderText.index - yLift, + color = renderText.color + ) - GL11.glPopMatrix() + GL11.glPopMatrix() + } } GlStateUtils.rescaleMc() } diff --git a/src/main/kotlin/com/lambda/client/module/modules/client/BuildTools.kt b/src/main/kotlin/com/lambda/client/module/modules/client/BuildTools.kt index 1eb679145..e87481004 100644 --- a/src/main/kotlin/com/lambda/client/module/modules/client/BuildTools.kt +++ b/src/main/kotlin/com/lambda/client/module/modules/client/BuildTools.kt @@ -47,7 +47,8 @@ object BuildTools : Module( /* placing */ val placeDelay by setting("Place Delay", 1, 0..20, 1, { page == Page.BUILDING }, description = "Sets the delay ticks between placement tasks", unit = " ticks") - val breakDownCycles by setting("Break Down", 64, 1..200, 1, { page == Page.BUILDING }, description = "", unit = " ender chests") + val breakDownEnderChests by setting("BreakDownEChests", false, {page == Page.BUILDING}) + val breakDownCycles by setting("Break Down", 64, 1..200, 1, { page == Page.BUILDING && breakDownEnderChests }, description = "", unit = " ender chests") val pickBlock by setting("Pick Block Creative", true, { page == Page.BUILDING }, description = "Use pick block to place blocks when in creative mode") val placeStrictness by setting("Placement Strictness", PlacementStrictness.DIRECTION, { page == Page.BUILDING }, description = "ANY: Allow all exposed surfaces. DIRECTION: Only allow surfaces in the direction of the player. VISIBLE: Only allow surfaces that are visible to the player.") // val illegalPlacements by setting("Illegal Placements", false, { page == Page.BUILDING }, description = "Do not use on 2b2t. Tries to interact with invisible surfaces") @@ -93,7 +94,8 @@ object BuildTools : Module( val showDebugRender by setting("Debug Render", false, { page == Page.RENDER }, description = "Render debug info on tasks") val maxDebugRange by setting("Max Debug Range", 8, 0..256, 1, { page == Page.RENDER && showDebugRender }, description = "Max distance to render debug info", unit = " blocks") val maxDebugAmount by setting("Max Debug Amount", 20, 0..256, 1, { page == Page.RENDER && showDebugRender }, description = "Max amount of debug info to render") - val textScale by setting("Text Scale", 1.0f, 0.0f..4.0f, 0.25f, { page == Page.RENDER && showDebugRender }, description = "Scale of debug text") + val showDebugText by setting ("Show Text", true, { page == Page.RENDER && showDebugRender }, description = "Render debug text") + val textScale by setting("Text Scale", 1.0f, 0.0f..4.0f, 0.25f, { page == Page.RENDER && showDebugText && showDebugRender }, description = "Scale of debug text") // val distScaleFactor by setting("Distance Scale Factor", 0.05f, 0.0f..1.0f, 0.05f, { page == Page.RENDER && showDebugRender }) // val minDistScale by setting("Min Distance Scale", 0.35f, 0.0f..1.0f, 0.05f, { page == Page.RENDER && showDebugRender }) val aFilled by setting("Filled Alpha", 26, 0..255, 1, { filled && page == Page.RENDER }, description = "Sets the opacity")