aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/com/dulkirfabric/features
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/com/dulkirfabric/features')
-rw-r--r--src/main/kotlin/com/dulkirfabric/features/CullExplosionParticles.kt2
-rw-r--r--src/main/kotlin/com/dulkirfabric/features/InventoryScale.kt30
-rw-r--r--src/main/kotlin/com/dulkirfabric/features/KeyShortCutImpl.kt9
-rw-r--r--src/main/kotlin/com/dulkirfabric/features/RenderTest.kt18
4 files changed, 23 insertions, 36 deletions
diff --git a/src/main/kotlin/com/dulkirfabric/features/CullExplosionParticles.kt b/src/main/kotlin/com/dulkirfabric/features/CullExplosionParticles.kt
index 8c034b6..302beb9 100644
--- a/src/main/kotlin/com/dulkirfabric/features/CullExplosionParticles.kt
+++ b/src/main/kotlin/com/dulkirfabric/features/CullExplosionParticles.kt
@@ -1,5 +1,6 @@
package com.dulkirfabric.features
+import com.dulkirfabric.config.DulkirConfig
import com.dulkirfabric.events.AddParticleEvent
import meteordevelopment.orbit.EventHandler
import net.minecraft.client.particle.ExplosionLargeParticle
@@ -11,6 +12,7 @@ object CullExplosionParticles {
@EventHandler
fun onParticle(event: AddParticleEvent) {
+ if (!DulkirConfig.configOptions.disableExplosionParticles) return
val particle = event.particle
if (particle is ExplosionLargeParticle) {
event.cancel()
diff --git a/src/main/kotlin/com/dulkirfabric/features/InventoryScale.kt b/src/main/kotlin/com/dulkirfabric/features/InventoryScale.kt
index 80442c3..8e5e712 100644
--- a/src/main/kotlin/com/dulkirfabric/features/InventoryScale.kt
+++ b/src/main/kotlin/com/dulkirfabric/features/InventoryScale.kt
@@ -2,48 +2,18 @@ package com.dulkirfabric.features
import com.dulkirfabric.DulkirModFabric.mc
import com.dulkirfabric.config.DulkirConfig
-import com.dulkirfabric.events.ClientTickEvent
-import com.dulkirfabric.events.MouseScrollEvent
-import meteordevelopment.orbit.EventHandler
-import net.minecraft.client.MinecraftClient
import net.minecraft.client.gui.screen.ingame.HandledScreen
-import net.minecraft.client.util.InputUtil
-import org.lwjgl.glfw.GLFW
-import kotlin.math.max
object InventoryScale {
- var scaleBuffer = DulkirConfig.configOptions.inventoryScale
- var prevTickScale = DulkirConfig.configOptions.inventoryScale
- var tickScale = DulkirConfig.configOptions.inventoryScale
- var frameScale = DulkirConfig.configOptions.inventoryScale
-
-
/**
* Called every render frame, so don't put anything expensive in here.
*/
fun getScale(): Float {
if (DulkirConfig.configOptions.invScaleBool && mc.currentScreen is HandledScreen<*>) {
- val partialTicks = MinecraftClient.getInstance().tickDelta
- DulkirConfig.configOptions.inventoryScale = prevTickScale + ((tickScale - prevTickScale) * partialTicks)
return DulkirConfig.configOptions.inventoryScale
}
return 1f
}
- @EventHandler
- fun onScroll(event: MouseScrollEvent) {
- // TODO: ignore input in config screen
- if (event.verticalScrollAmount == 0.0) return
- val handle = MinecraftClient.getInstance().window.handle
- if (InputUtil.isKeyPressed(handle, GLFW.GLFW_KEY_LEFT_CONTROL) && InputUtil.isKeyPressed(handle, GLFW.GLFW_KEY_LEFT_ALT))
- scaleBuffer = max(scaleBuffer + (.05 * event.verticalScrollAmount).toFloat(), .1f)
- }
-
- @EventHandler
- fun onTick(event: ClientTickEvent) {
- // flushes the buffer to a scroll amount this tick, will be interpolated in calculatePos
- prevTickScale = tickScale
- tickScale = scaleBuffer
- }
} \ No newline at end of file
diff --git a/src/main/kotlin/com/dulkirfabric/features/KeyShortCutImpl.kt b/src/main/kotlin/com/dulkirfabric/features/KeyShortCutImpl.kt
index 8e2112a..f0ca052 100644
--- a/src/main/kotlin/com/dulkirfabric/features/KeyShortCutImpl.kt
+++ b/src/main/kotlin/com/dulkirfabric/features/KeyShortCutImpl.kt
@@ -21,7 +21,14 @@ object KeyShortCutImpl {
lastCommandHandle = System.currentTimeMillis()
prevCode = event.key
- TextUtils.sendCommand(it.command.trimStart('/'))
+ // This conditional allows for these shortcuts to work for commands or normal messages
+ // You have to do it this way because the messages are handled differently on the client
+ // side in modern versions of Minecraft.
+ if (it.command.startsWith("/")) {
+ TextUtils.sendCommand(it.command.trimStart('/'))
+ } else {
+ TextUtils.sendMessage(it.command)
+ }
}
}
diff --git a/src/main/kotlin/com/dulkirfabric/features/RenderTest.kt b/src/main/kotlin/com/dulkirfabric/features/RenderTest.kt
index 1f96a7b..7b6c5e6 100644
--- a/src/main/kotlin/com/dulkirfabric/features/RenderTest.kt
+++ b/src/main/kotlin/com/dulkirfabric/features/RenderTest.kt
@@ -1,12 +1,15 @@
package com.dulkirfabric.features
+import com.dulkirfabric.events.EntityLoadEvent
import com.dulkirfabric.events.WorldRenderLastEvent
+import com.dulkirfabric.util.GlowingEntityInterface
import com.dulkirfabric.util.WorldRenderUtils
import meteordevelopment.orbit.EventHandler
import net.minecraft.text.Style
import net.minecraft.text.Text
import net.minecraft.util.math.Vec3d
import java.awt.Color
+import kotlin.random.Random
object RenderTest {
@@ -16,11 +19,16 @@ object RenderTest {
Text.literal("Home Base").setStyle(Style.EMPTY.withColor(Color(255, 100, 150, 255).rgb)), event.context,
Vec3d(-183.5, 79.0, -465.5)
)
+
+// mc.world?.entities?.forEach {
+// if (it is GlowingEntityInterface)
+// it.setDulkirEntityGlow(true, Color(255, 255, 255, 255), Random(it.id).nextBoolean())
+// }
}
-// @EventHandler
-// fun onLoadEnt(event: EntityLoadEvent) {
-// if (event.entity !is GlowingEntityInterface) return
-// event.entity.setDulkirEntityGlow(true, Color(255, 255, 255, 255), true)
-// }
+ @EventHandler
+ fun onLoadEnt(event: EntityLoadEvent) {
+ if (event.entity !is GlowingEntityInterface) return
+ event.entity.setDulkirEntityGlow(true, Color(255, 255, 255, 255), Random(event.entity.id).nextBoolean())
+ }
} \ No newline at end of file