No fall damage + toggle
This commit is contained in:
@ -8,7 +8,7 @@ org.gradle.jvmargs=-Xmx1G
|
|||||||
loader_version=0.16.0
|
loader_version=0.16.0
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 1.0
|
mod_version = 1.1
|
||||||
maven_group = com.kasetoatz
|
maven_group = com.kasetoatz
|
||||||
archives_base_name = RiptideHacks
|
archives_base_name = RiptideHacks
|
||||||
|
|
||||||
|
@ -1,20 +1,42 @@
|
|||||||
package com.kasetoatz.riptidehacks;
|
package com.kasetoatz.riptidehacks;
|
||||||
|
|
||||||
import net.fabricmc.api.ClientModInitializer;
|
import net.fabricmc.api.ClientModInitializer;
|
||||||
|
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
||||||
|
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
import net.minecraft.client.option.KeyBinding;
|
||||||
|
import net.minecraft.client.util.InputUtil;
|
||||||
|
import net.minecraft.text.Text;
|
||||||
|
import net.minecraft.util.Formatting;
|
||||||
|
import org.lwjgl.glfw.GLFW;
|
||||||
|
|
||||||
public class RiptideHacks implements ClientModInitializer {
|
public class RiptideHacks implements ClientModInitializer {
|
||||||
public static MinecraftClient client;
|
public static MinecraftClient client;
|
||||||
|
public static boolean toggled = false;
|
||||||
|
public static boolean onGround = true;
|
||||||
|
private static KeyBinding keyBinding;
|
||||||
private static long lastTridentUse = 0;
|
private static long lastTridentUse = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInitializeClient() {
|
public void onInitializeClient() {
|
||||||
client = MinecraftClient.getInstance();
|
client = MinecraftClient.getInstance();
|
||||||
|
keyBinding = KeyBindingHelper.registerKeyBinding(new KeyBinding("Toggle Riptide", InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_RIGHT_ALT, "RiptideHacks"));
|
||||||
|
ClientTickEvents.END_CLIENT_TICK.register(client -> {
|
||||||
|
while (keyBinding.wasPressed()) {
|
||||||
|
toggled = !toggled;
|
||||||
|
client.inGameHud.setOverlayMessage(Text.literal("Riptide ").append((toggled) ? Text.literal("ON").styled((style -> style.withColor(Formatting.GREEN))) : Text.literal("OFF").styled((style -> style.withColor(Formatting.RED)))), false);
|
||||||
|
}
|
||||||
|
if (!onGround && client.player != null && client.player.isOnGround())
|
||||||
|
{
|
||||||
|
onGround = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setLastTridentUse()
|
public static void setLastTridentUse()
|
||||||
{
|
{
|
||||||
lastTridentUse = System.currentTimeMillis();
|
lastTridentUse = System.currentTimeMillis();
|
||||||
|
onGround = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean shouldAnimate()
|
public static boolean shouldAnimate()
|
||||||
|
@ -6,6 +6,7 @@ import net.minecraft.item.Items;
|
|||||||
import net.minecraft.network.ClientConnection;
|
import net.minecraft.network.ClientConnection;
|
||||||
import net.minecraft.network.packet.Packet;
|
import net.minecraft.network.packet.Packet;
|
||||||
import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket;
|
import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket;
|
||||||
|
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
@ -16,13 +17,20 @@ public abstract class ClientConnectionMixin {
|
|||||||
@Inject(method="send*", at=@At("HEAD"), cancellable = true)
|
@Inject(method="send*", at=@At("HEAD"), cancellable = true)
|
||||||
private void send(Packet<?> packet, CallbackInfo ci)
|
private void send(Packet<?> packet, CallbackInfo ci)
|
||||||
{
|
{
|
||||||
if (packet instanceof PlayerActionC2SPacket)
|
if (RiptideHacks.toggled)
|
||||||
{
|
{
|
||||||
ClientPlayerEntity player = RiptideHacks.client.player;
|
ClientPlayerEntity player = RiptideHacks.client.player;
|
||||||
if (player != null && player.getActiveItem().getItem() == Items.TRIDENT)
|
if (player != null)
|
||||||
|
{
|
||||||
|
if (packet instanceof PlayerActionC2SPacket && player.getActiveItem().getItem() == Items.TRIDENT)
|
||||||
{
|
{
|
||||||
ci.cancel();
|
ci.cancel();
|
||||||
}
|
}
|
||||||
|
else if (packet instanceof PlayerMoveC2SPacket && !RiptideHacks.onGround)
|
||||||
|
{
|
||||||
|
((PlayerMoveC2SPacketMixin)packet).setOnGround(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,5 +1,6 @@
|
|||||||
package com.kasetoatz.riptidehacks.mixin;
|
package com.kasetoatz.riptidehacks.mixin;
|
||||||
|
|
||||||
|
import com.kasetoatz.riptidehacks.RiptideHacks;
|
||||||
import net.minecraft.enchantment.EnchantmentHelper;
|
import net.minecraft.enchantment.EnchantmentHelper;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
@ -10,7 +11,10 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|||||||
public abstract class EnchantmentHelperMixin {
|
public abstract class EnchantmentHelperMixin {
|
||||||
@Inject(method="getTridentSpinAttackStrength", at=@At("HEAD"), cancellable = true)
|
@Inject(method="getTridentSpinAttackStrength", at=@At("HEAD"), cancellable = true)
|
||||||
private static void getTridentSpinAttackStrength(CallbackInfoReturnable<Float> cir)
|
private static void getTridentSpinAttackStrength(CallbackInfoReturnable<Float> cir)
|
||||||
|
{
|
||||||
|
if (RiptideHacks.toggled)
|
||||||
{
|
{
|
||||||
cir.setReturnValue(3.f);
|
cir.setReturnValue(3.f);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -11,10 +11,13 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|||||||
public abstract class EntityMixin {
|
public abstract class EntityMixin {
|
||||||
@Inject(method="isTouchingWaterOrRain", at=@At("HEAD"), cancellable = true)
|
@Inject(method="isTouchingWaterOrRain", at=@At("HEAD"), cancellable = true)
|
||||||
private void isTouchingWaterOrRain(CallbackInfoReturnable<Boolean> cir)
|
private void isTouchingWaterOrRain(CallbackInfoReturnable<Boolean> cir)
|
||||||
|
{
|
||||||
|
if (RiptideHacks.toggled)
|
||||||
{
|
{
|
||||||
if (((Entity)(Object)this) == RiptideHacks.client.player)
|
if (((Entity)(Object)this) == RiptideHacks.client.player)
|
||||||
{
|
{
|
||||||
cir.setReturnValue(true);
|
cir.setReturnValue(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -13,9 +13,12 @@ public abstract class LivingEntityMixin {
|
|||||||
private void isUsingRiptide(CallbackInfoReturnable<Boolean> cir)
|
private void isUsingRiptide(CallbackInfoReturnable<Boolean> cir)
|
||||||
{
|
{
|
||||||
LivingEntity entity = (LivingEntity)(Object)this;
|
LivingEntity entity = (LivingEntity)(Object)this;
|
||||||
if (RiptideHacks.shouldAnimate() && entity == RiptideHacks.client.player)
|
if (RiptideHacks.toggled && RiptideHacks.shouldAnimate())
|
||||||
|
{
|
||||||
|
if (entity == RiptideHacks.client.player)
|
||||||
{
|
{
|
||||||
cir.setReturnValue(true);
|
cir.setReturnValue(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
package com.kasetoatz.riptidehacks.mixin;
|
||||||
|
|
||||||
|
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Mutable;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||||
|
|
||||||
|
@Mixin(PlayerMoveC2SPacket.class)
|
||||||
|
public interface PlayerMoveC2SPacketMixin {
|
||||||
|
@Accessor("onGround")
|
||||||
|
@Mutable
|
||||||
|
void setOnGround(boolean onGround);
|
||||||
|
}
|
@ -17,7 +17,7 @@ public class TridentItemMixin {
|
|||||||
@Inject(method="onStoppedUsing", at=@At("HEAD"))
|
@Inject(method="onStoppedUsing", at=@At("HEAD"))
|
||||||
private void onStoppedUsing(ItemStack stack, World world, LivingEntity user, int remainingUseTicks, CallbackInfo ci)
|
private void onStoppedUsing(ItemStack stack, World world, LivingEntity user, int remainingUseTicks, CallbackInfo ci)
|
||||||
{
|
{
|
||||||
if (user == RiptideHacks.client.player && user.getItemUseTime() > 10)
|
if (RiptideHacks.toggled && user == RiptideHacks.client.player && user.getItemUseTime() > 10)
|
||||||
{
|
{
|
||||||
world.playSoundFromEntity(user, SoundEvents.ITEM_TRIDENT_RIPTIDE_3.value(), SoundCategory.AMBIENT, 1.f, 1.f);
|
world.playSoundFromEntity(user, SoundEvents.ITEM_TRIDENT_RIPTIDE_3.value(), SoundCategory.AMBIENT, 1.f, 1.f);
|
||||||
RiptideHacks.setLastTridentUse();
|
RiptideHacks.setLastTridentUse();
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
"EnchantmentHelperMixin",
|
"EnchantmentHelperMixin",
|
||||||
"EntityMixin",
|
"EntityMixin",
|
||||||
"LivingEntityMixin",
|
"LivingEntityMixin",
|
||||||
|
"PlayerMoveC2SPacketMixin",
|
||||||
"TridentItemMixin",
|
"TridentItemMixin",
|
||||||
"ClientConnectionMixin"
|
"ClientConnectionMixin"
|
||||||
],
|
],
|
||||||
|
Reference in New Issue
Block a user