Implement criticals cheat

main
Charlotte Som 2022-02-04 13:35:08 +00:00
parent 6991269976
commit 0632528416
10 changed files with 69 additions and 3 deletions

View File

@ -64,6 +64,10 @@ dependencies {
modRuntimeOnly(files("vendor/sodium-fabric-mc1.18.1-0.4.0-alpha6+build.14.jar")) modRuntimeOnly(files("vendor/sodium-fabric-mc1.18.1-0.4.0-alpha6+build.14.jar"))
} }
loom {
accessWidenerPath.set(file("src/main/resources/hibiscus.accesswidener"))
}
tasks { tasks {
val javaVersion = JavaVersion.VERSION_17 val javaVersion = JavaVersion.VERSION_17

View File

@ -0,0 +1,11 @@
package codes.som.hibiscus.mixins;
import net.minecraft.network.packet.c2s.play.PlayerInteractEntityC2SPacket;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
@Mixin(PlayerInteractEntityC2SPacket.class)
public interface MixinExtPlayerInteractEntityC2SPacket {
@Accessor("type")
PlayerInteractEntityC2SPacket.InteractTypeHandler getTypeHandler();
}

View File

@ -1,6 +1,7 @@
package codes.som.hibiscus.api.feature package codes.som.hibiscus.api.feature
enum class FeatureCategory(val humanName: String) { enum class FeatureCategory(val humanName: String) {
COMBAT("Combat"),
PLAYER("Player"), PLAYER("Player"),
MOVEMENT("Movement"), MOVEMENT("Movement"),
OVERLAY("Overlay"), OVERLAY("Overlay"),

View File

@ -1,6 +1,7 @@
package codes.som.hibiscus.features package codes.som.hibiscus.features
import codes.som.hibiscus.api.feature.Feature import codes.som.hibiscus.api.feature.Feature
import codes.som.hibiscus.features.combat.Criticals
import codes.som.hibiscus.features.movement.Flight import codes.som.hibiscus.features.movement.Flight
import codes.som.hibiscus.features.movement.Speed import codes.som.hibiscus.features.movement.Speed
import codes.som.hibiscus.features.overlay.FeatureListOverlay import codes.som.hibiscus.features.overlay.FeatureListOverlay
@ -11,4 +12,5 @@ val ALL_FEATURES: Array<() -> Feature> = arrayOf(
::Flight, ::Flight,
::FeatureListOverlay, ::FeatureListOverlay,
::Speed, ::Speed,
::Criticals,
) )

View File

@ -0,0 +1,42 @@
package codes.som.hibiscus.features.combat
import codes.som.hibiscus.api.feature.Feature
import codes.som.hibiscus.api.feature.FeatureCategory
import codes.som.hibiscus.events.SendPacketEvent
import codes.som.hibiscus.mixins.MixinExtPlayerInteractEntityC2SPacket
import codes.som.hibiscus.player
import codes.som.hibiscus.util.ext.requireExtension
import net.minecraft.network.packet.c2s.play.PlayerInteractEntityC2SPacket
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket
class Criticals : Feature("Criticals", FeatureCategory.COMBAT) {
init {
on { event: SendPacketEvent ->
val (packet) = event
if (packet is PlayerInteractEntityC2SPacket) {
requireExtension<MixinExtPlayerInteractEntityC2SPacket>(packet)
if (packet.typeHandler.type != PlayerInteractEntityC2SPacket.InteractType.ATTACK)
return@on
player.networkHandler.sendPacket(
PlayerMoveC2SPacket.PositionAndOnGround(
player.x,
player.y + 0.0625,
player.z,
false
)
)
player.networkHandler.sendPacket(
PlayerMoveC2SPacket.PositionAndOnGround(
player.x,
player.y,
player.z,
false
)
)
}
}
}
}

View File

@ -22,8 +22,8 @@ class FeatureListOverlay : Feature("Feature List", FeatureCategory.OVERLAY) {
if (enabledFeatures.isEmpty()) if (enabledFeatures.isEmpty())
return@on return@on
ImGui.pushStyleColor(ImGuiCol.WindowBg, 10, 10, 10, 104) ImGui.pushStyleColor(ImGuiCol.WindowBg, 10, 10, 10, 170)
ImGui.pushStyleVar(ImGuiStyleVar.WindowPadding, 4f, 4f) ImGui.pushStyleVar(ImGuiStyleVar.WindowPadding, 8f, 8f)
ImGui.pushStyleVar(ImGuiStyleVar.WindowMinSize, 0f, 0f) ImGui.pushStyleVar(ImGuiStyleVar.WindowMinSize, 0f, 0f)
if (ImGui.begin( if (ImGui.begin(

View File

@ -24,7 +24,7 @@ fun applyHibiscusImGuiTheme() {
style.popupBorderSize = 1f style.popupBorderSize = 1f
style.frameBorderSize = 0f style.frameBorderSize = 0f
style.tabBorderSize = 0f style.tabBorderSize = 0f
style.windowRounding = 4f style.windowRounding = 0f
style.childRounding = 0f style.childRounding = 0f
style.frameRounding = 0f style.frameRounding = 0f
style.scrollbarRounding = 0f style.scrollbarRounding = 0f

View File

@ -25,6 +25,7 @@
"hibiscus.mixins.json", "hibiscus.mixins.json",
"unknit.mixins.json" "unknit.mixins.json"
], ],
"accessWidener": "hibiscus.accesswidener",
"depends": { "depends": {
"fabricloader": ">=0.12.12", "fabricloader": ">=0.12.12",
"fabric": "*", "fabric": "*",

View File

@ -0,0 +1,4 @@
accessWidener v1 named
accessible class net/minecraft/network/packet/c2s/play/PlayerInteractEntityC2SPacket$InteractType
accessible class net/minecraft/network/packet/c2s/play/PlayerInteractEntityC2SPacket$InteractTypeHandler

View File

@ -9,6 +9,7 @@
"MixinClientPlayerEntity", "MixinClientPlayerEntity",
"MixinClientPlayNetworkHandler", "MixinClientPlayNetworkHandler",
"MixinExtClientPlayerEntity", "MixinExtClientPlayerEntity",
"MixinExtPlayerInteractEntityC2SPacket",
"MixinExtPlayerMoveC2SPacket", "MixinExtPlayerMoveC2SPacket",
"MixinExtUpdatePlayerAbilitiesC2SPacket", "MixinExtUpdatePlayerAbilitiesC2SPacket",
"MixinKeyboard", "MixinKeyboard",