Skip to content
This repository has been archived by the owner on Jul 20, 2024. It is now read-only.

Commit

Permalink
delete unused imports and semicolons lol
Browse files Browse the repository at this point in the history
  • Loading branch information
TomJuri committed Sep 4, 2023
1 parent 201a0fe commit 685405a
Show file tree
Hide file tree
Showing 13 changed files with 26 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ package dev.macrohq.swiftslayer.command
import cc.polyfrost.oneconfig.utils.commands.annotations.Command
import cc.polyfrost.oneconfig.utils.commands.annotations.Main
import cc.polyfrost.oneconfig.utils.commands.annotations.SubCommand
import dev.macrohq.swiftslayer.util.*
import net.minecraft.init.Blocks
import net.minecraft.util.MovingObjectPosition
import dev.macrohq.swiftslayer.util.bossSpawner


@Command(value = "bossspawner", aliases = ["bs", "bsp"])
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package dev.macrohq.swiftslayer.config

import cc.polyfrost.oneconfig.config.Config
import cc.polyfrost.oneconfig.config.annotations.Switch
import cc.polyfrost.oneconfig.config.data.Mod
import cc.polyfrost.oneconfig.config.data.ModType

Expand Down
4 changes: 0 additions & 4 deletions src/main/kotlin/dev/macrohq/swiftslayer/macro/Macro.kt
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
package dev.macrohq.swiftslayer.macro

import net.minecraft.entity.monster.EntityZombie

abstract class Macro {
abstract fun run()
abstract fun onEnable()
abstract fun onDisable()
fun a() {
}
}
2 changes: 0 additions & 2 deletions src/main/kotlin/dev/macrohq/swiftslayer/macro/MacroManager.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package dev.macrohq.swiftslayer.macro

import dev.macrohq.swiftslayer.util.config

object MacroManager {
private val macros = mutableListOf<Macro>()
private val activeMacro = null
Expand Down
13 changes: 5 additions & 8 deletions src/main/kotlin/dev/macrohq/swiftslayer/macro/MobKiller.kt
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
package dev.macrohq.swiftslayer.macro

import cc.polyfrost.oneconfig.utils.dsl.tick
import dev.macrohq.swiftslayer.util.*
import dev.macrohq.swiftslayer.util.Logger.info
import kotlinx.coroutines.currentCoroutineContext
import net.minecraft.entity.Entity
import net.minecraft.entity.EntityLiving
import net.minecraft.entity.monster.EntityZombie
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.gameevent.TickEvent
import javax.swing.text.JTextComponent.KeyBinding
import kotlin.math.abs

class MobKiller {
private var blacklist = mutableListOf<EntityLiving>()
private var mobKiller = false
private var state: State = State.NONE;
private var state: State = State.NONE
private var targetEntity: Entity? = null
private var ticks: Int = 0
private var stuckCounter: Int = 0
Expand Down Expand Up @@ -48,7 +45,7 @@ class MobKiller {
if(ticks>=60){
info("BlackList Cleared.")
blacklist.clear()
ticks = 0;
ticks = 0
}
val targetEntityList = EntityUtil.getMobs(EntityZombie::class.java, 1999).toMutableList()
if(targetEntity!=null) targetEntityList.remove(targetEntity)
Expand Down Expand Up @@ -79,12 +76,12 @@ class MobKiller {
State.LOOKING ->{
RotationUtil.ease(RotationUtil.Rotation(AngleUtil.getAngles(targetEntity!!).yaw, 45f), 400)
state = State.LOOKING_VERIFY
return;
return
}
State.LOOKING_VERIFY -> {
val yp = RotationUtil.Rotation(AngleUtil.getAngles(targetEntity!!).yaw, 45f)
val yawDiff = abs(AngleUtil.yawTo360(player.rotationYaw)-AngleUtil.yawTo360(yp.yaw));
val pitchDiff = abs(mc.thePlayer.rotationPitch - yp.pitch);
val yawDiff = abs(AngleUtil.yawTo360(player.rotationYaw)-AngleUtil.yawTo360(yp.yaw))
val pitchDiff = abs(mc.thePlayer.rotationPitch - yp.pitch)
if(pitchDiff < 2){
RotationUtil.stop()
InventoryUtil.holdItem("Spirit")
Expand Down
8 changes: 4 additions & 4 deletions src/main/kotlin/dev/macrohq/swiftslayer/pathfinding/AStar.kt
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,14 @@ class AStar(startPos: BlockPos, endPos: BlockPos) {
private var yaw: Float = 0f

fun getFCost(): Float {
return gCost + hCost;
return gCost + hCost
}

private fun angleCost(bp1: BlockPos, bp2: BlockPos): Float {
val dx = bp2.x - bp1.x
val dz = bp2.z - bp1.z
val yaw = -Math.toDegrees(atan2(dx.toDouble(), dz.toDouble())).toFloat()
return AngleUtil.yawTo360(yaw);
return AngleUtil.yawTo360(yaw)
}

fun calculateCost(endNode: Node) {
Expand All @@ -106,7 +106,7 @@ class AStar(startPos: BlockPos, endPos: BlockPos) {
if (this.parent!!.position.y < this.position.y
&& !BlockUtil.isStairSlab(this.position)
) {
cost += 1.4f;
cost += 1.4f
}

}
Expand Down Expand Up @@ -140,7 +140,7 @@ class AStar(startPos: BlockPos, endPos: BlockPos) {
return allowedBlocks.contains(world.getBlockState(position.up()).block)
&& allowedBlocks.contains(world.getBlockState(position.up().up()).block)
&& world.getBlockState(position).block.material.isSolid
&& !collision;
&& !collision
}

private val allowedBlocks = listOf(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package dev.macrohq.swiftslayer.pathfinding

import dev.macrohq.swiftslayer.util.*
import net.minecraft.block.BlockStairs
import dev.macrohq.swiftslayer.util.AngleUtil
import dev.macrohq.swiftslayer.util.BlockUtil
import dev.macrohq.swiftslayer.util.world
import net.minecraft.init.Blocks
import net.minecraft.util.BlockPos
import net.minecraft.util.MathHelper
Expand Down Expand Up @@ -86,7 +87,7 @@ class AStarPathfinder(startPos: BlockPos, endPos: BlockPos) {
val dx = bp2.x - bp1.x
val dz = bp2.z - bp1.z
val yaw = -Math.toDegrees(atan2(dx.toDouble(), dz.toDouble())).toFloat()
return AngleUtil.yawTo360(yaw);
return AngleUtil.yawTo360(yaw)
}
fun calculateCost(endNode: Node) {
var cost = 0f
Expand All @@ -98,7 +99,7 @@ class AStarPathfinder(startPos: BlockPos, endPos: BlockPos) {
if (this.parent.position.y < this.position.y
&& !BlockUtil.isStairSlab(this.position)
) {
cost += 1.5f;
cost += 1.5f
}
}
BlockUtil.neighbourGenerator(this.position.up().up().up(), 1).forEach{
Expand Down Expand Up @@ -132,7 +133,7 @@ class AStarPathfinder(startPos: BlockPos, endPos: BlockPos) {
return allowedBlocks.contains(world.getBlockState(position.up()).block)
&& allowedBlocks.contains(world.getBlockState(position.up().up()).block)
&& world.getBlockState(position).block.material.isSolid
&& !collision;
&& !collision
}

fun isIn(nodes: List<Node>): Boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import kotlin.math.sqrt
class PathExecutor {
private var path = listOf<BlockPos>()
private var current: BlockPos? = null
private var pathFailCounter = 0;
private var pathFailCounter = 0
private var done = false
private var aotving = false
var running = false
Expand Down Expand Up @@ -58,7 +58,7 @@ class PathExecutor {
if(aotving && sqrt(player.lastTickPosition().distanceSq(player.getStandingOnCeil()))>4){aotving = false;}
when (state) {
State.STARTING -> {
state = State.CALCULATING;
state = State.CALCULATING
}

State.CALCULATING -> {
Expand All @@ -72,15 +72,15 @@ class PathExecutor {
path[path.indexOf(path.find { it.x == player.getStandingOnCeil().x && it.z == player.getStandingOnCeil().z }) + 1]
RotationUtil.ease(RotationUtil.Rotation(AngleUtil.getAngles(current!!).yaw, 20f), 500)

RenderUtil.markers.clear();
current?.let { RenderUtil.markers.add(it) };
RenderUtil.markers.clear()
current?.let { RenderUtil.markers.add(it) }

} else if (player.onGround) pathFailCounter++
if ((pathFailCounter >= 100 && player.onGround)) {
pathFailCounter = 0
running = false
PathingUtil.goto(path[path.size - 1])
return;
return
}
state = if(sqrt(player.getDistanceSqToCenter(current)) > 12 && !aotving && path.indexOf(current) != path.size-1) {
InventoryUtil.holdItem("of the void")
Expand All @@ -92,8 +92,8 @@ class PathExecutor {
State.AOTV -> {
val yp = AngleUtil.getAngles(current!!.up().up())
RotationUtil.ease(yp, 200)
val yawDiff = abs(AngleUtil.yawTo360(player.rotationYaw)-AngleUtil.yawTo360(yp.yaw));
val pitchDiff = abs(mc.thePlayer.rotationPitch - yp.pitch);
val yawDiff = abs(AngleUtil.yawTo360(player.rotationYaw)-AngleUtil.yawTo360(yp.yaw))
val pitchDiff = abs(mc.thePlayer.rotationPitch - yp.pitch)
if(yawDiff < 5 && pitchDiff < 2){
aotving = true
KeyBindUtil.rightClick()
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/dev/macrohq/swiftslayer/util/AngleUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ object AngleUtil {
}

fun getYawChange(entity: Entity): Float{
val startRot = RotationUtil.Rotation(player.rotationYaw, player.rotationPitch)
val startRot = Rotation(player.rotationYaw, player.rotationPitch)
val endRot = Rotation(getAngles(entity.positionVector).yaw, 0f)
return getNeededChange(startRot, endRot).yaw
}
Expand Down
2 changes: 0 additions & 2 deletions src/main/kotlin/dev/macrohq/swiftslayer/util/BlockUtil.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package dev.macrohq.swiftslayer.util

import dev.macrohq.swiftslayer.pathfinding.AStar
import dev.macrohq.swiftslayer.pathfinding.AStarPathfinder
import net.minecraft.block.BlockStairs
import net.minecraft.util.BlockPos
import net.minecraft.util.EnumFacing
import net.minecraft.util.MathHelper
import net.minecraft.util.Vec3
import kotlin.math.floor

object BlockUtil {
fun neighbourGenerator(mainBlock: BlockPos, size: Int): List<BlockPos> {
Expand Down
5 changes: 1 addition & 4 deletions src/main/kotlin/dev/macrohq/swiftslayer/util/EntityUtil.kt
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package dev.macrohq.swiftslayer.util

import dev.macrohq.swiftslayer.util.Logger.info
import net.minecraft.entity.Entity
import net.minecraft.entity.EntityLiving
import net.minecraft.entity.monster.EntityZombie
import net.minecraft.util.MathHelper
import kotlin.math.abs
import kotlin.math.sqrt
Expand All @@ -23,6 +20,6 @@ object EntityUtil {
}

fun getRevCost(entity: EntityLiving): Int{
return 1;
return 1
}
}
2 changes: 0 additions & 2 deletions src/main/kotlin/dev/macrohq/swiftslayer/util/InventoryUtil.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package dev.macrohq.swiftslayer.util

import java.util.*

object InventoryUtil {

fun holdItem(name: String): Boolean{
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/dev/macrohq/swiftslayer/util/SoundUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ object SoundUtil {
val volumeControl = clip.getControl(FloatControl.Type.MASTER_GAIN) as FloatControl
val volumePercentage = volumePercent.toFloat() / 100f
val dB = (ln(volumePercentage.toDouble()) / ln(10.0) * 20.0).toFloat()
volumeControl.setValue(dB)
volumeControl.value = dB
clip.start()
}.start()
}
Expand Down

0 comments on commit 685405a

Please sign in to comment.