Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
58f5351193 | |||
8b87defba8 | |||
f5e9479079 | |||
d9e2b00679 | |||
677a82142f | |||
4a84587f71 | |||
f8dabec863 | |||
1a521a0e1d | |||
6ab4519093 |
@ -1,5 +1,5 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id 'fabric-loom' version '1.6-SNAPSHOT'
|
id 'fabric-loom' version '1.9-SNAPSHOT'
|
||||||
id 'maven-publish'
|
id 'maven-publish'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,15 +3,15 @@ org.gradle.jvmargs=-Xmx1G
|
|||||||
|
|
||||||
# Fabric Properties
|
# Fabric Properties
|
||||||
# check these on https://modmuss50.me/fabric.html
|
# check these on https://modmuss50.me/fabric.html
|
||||||
minecraft_version=1.21
|
minecraft_version=1.21.4
|
||||||
yarn_mappings=1.21+build.9
|
yarn_mappings=1.21.4+build.8
|
||||||
loader_version=0.16.0
|
loader_version=0.16.10
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 1.1
|
mod_version = 1.4
|
||||||
maven_group = com.kasetoatz
|
maven_group = com.kasetoatz
|
||||||
archives_base_name = RiptideHacks
|
archives_base_name = TridentHacks
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
# check this on https://modmuss50.me/fabric.html
|
# check this on https://modmuss50.me/fabric.html
|
||||||
fabric_version=0.100.6+1.21
|
fabric_version=0.114.3+1.21.4
|
||||||
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,6 +1,6 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
validateDistributionUrl=true
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
7
gradlew
vendored
7
gradlew
vendored
@ -15,6 +15,8 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
#
|
#
|
||||||
@ -55,7 +57,7 @@
|
|||||||
# Darwin, MinGW, and NonStop.
|
# Darwin, MinGW, and NonStop.
|
||||||
#
|
#
|
||||||
# (3) This script is generated from the Groovy template
|
# (3) This script is generated from the Groovy template
|
||||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
# within the Gradle project.
|
# within the Gradle project.
|
||||||
#
|
#
|
||||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
@ -84,7 +86,8 @@ done
|
|||||||
# shellcheck disable=SC2034
|
# shellcheck disable=SC2034
|
||||||
APP_BASE_NAME=${0##*/}
|
APP_BASE_NAME=${0##*/}
|
||||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||||
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
|
||||||
|
' "$PWD" ) || exit
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD=maximum
|
MAX_FD=maximum
|
||||||
|
2
gradlew.bat
vendored
2
gradlew.bat
vendored
@ -13,6 +13,8 @@
|
|||||||
@rem See the License for the specific language governing permissions and
|
@rem See the License for the specific language governing permissions and
|
||||||
@rem limitations under the License.
|
@rem limitations under the License.
|
||||||
@rem
|
@rem
|
||||||
|
@rem SPDX-License-Identifier: Apache-2.0
|
||||||
|
@rem
|
||||||
|
|
||||||
@if "%DEBUG%"=="" @echo off
|
@if "%DEBUG%"=="" @echo off
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
package com.kasetoatz.riptidehacks.mixin;
|
|
||||||
|
|
||||||
import com.kasetoatz.riptidehacks.RiptideHacks;
|
|
||||||
import net.minecraft.entity.LivingEntity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.item.TridentItem;
|
|
||||||
import net.minecraft.sound.SoundCategory;
|
|
||||||
import net.minecraft.sound.SoundEvents;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|
||||||
|
|
||||||
@Mixin(TridentItem.class)
|
|
||||||
public class TridentItemMixin {
|
|
||||||
@Inject(method="onStoppedUsing", at=@At("HEAD"))
|
|
||||||
private void onStoppedUsing(ItemStack stack, World world, LivingEntity user, int remainingUseTicks, CallbackInfo ci)
|
|
||||||
{
|
|
||||||
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);
|
|
||||||
RiptideHacks.setLastTridentUse();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,30 +1,35 @@
|
|||||||
package com.kasetoatz.riptidehacks;
|
package com.kasetoatz.tridenthacks;
|
||||||
|
|
||||||
|
import com.kasetoatz.tridenthacks.config.Config;
|
||||||
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.event.lifecycle.v1.ClientTickEvents;
|
||||||
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
|
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.option.KeyBinding;
|
||||||
import net.minecraft.client.util.InputUtil;
|
import net.minecraft.client.util.InputUtil;
|
||||||
|
import net.minecraft.item.Items;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.util.Formatting;
|
|
||||||
import org.lwjgl.glfw.GLFW;
|
import org.lwjgl.glfw.GLFW;
|
||||||
|
|
||||||
public class RiptideHacks implements ClientModInitializer {
|
public class TridentHacks implements ClientModInitializer {
|
||||||
public static MinecraftClient client;
|
public static MinecraftClient client;
|
||||||
public static boolean toggled = false;
|
|
||||||
public static boolean onGround = true;
|
public static boolean onGround = true;
|
||||||
|
public static boolean riptideConditions = false;
|
||||||
|
public static boolean hasRiptide = false;
|
||||||
|
public static int tridentSlot = -1;
|
||||||
private static KeyBinding keyBinding;
|
private static KeyBinding keyBinding;
|
||||||
private static long lastTridentUse = 0;
|
public static long lastTridentUse = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInitializeClient() {
|
public void onInitializeClient() {
|
||||||
|
Config.load();
|
||||||
client = MinecraftClient.getInstance();
|
client = MinecraftClient.getInstance();
|
||||||
keyBinding = KeyBindingHelper.registerKeyBinding(new KeyBinding("Toggle Riptide", InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_RIGHT_ALT, "RiptideHacks"));
|
keyBinding = KeyBindingHelper.registerKeyBinding(new KeyBinding("Toggle Riptide", InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_RIGHT_ALT, "RiptideHacks"));
|
||||||
ClientTickEvents.END_CLIENT_TICK.register(client -> {
|
ClientTickEvents.END_CLIENT_TICK.register(client -> {
|
||||||
while (keyBinding.wasPressed()) {
|
while (keyBinding.wasPressed()) {
|
||||||
toggled = !toggled;
|
Config.toggleRiptide = !Config.toggleRiptide;
|
||||||
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);
|
Config.save();
|
||||||
|
client.inGameHud.setOverlayMessage(Text.of(Config.toggleRiptide ? Config.riptideOnMessage : Config.riptideOffMessage), false);
|
||||||
}
|
}
|
||||||
if (!onGround && client.player != null && client.player.isOnGround())
|
if (!onGround && client.player != null && client.player.isOnGround())
|
||||||
{
|
{
|
||||||
@ -33,14 +38,8 @@ public class RiptideHacks implements ClientModInitializer {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setLastTridentUse()
|
public static boolean noNormalRiptide()
|
||||||
{
|
{
|
||||||
lastTridentUse = System.currentTimeMillis();
|
return client.player == null || !riptideConditions || client.player.getActiveItem().getItem() != Items.TRIDENT || !hasRiptide;
|
||||||
onGround = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean shouldAnimate()
|
|
||||||
{
|
|
||||||
return lastTridentUse > System.currentTimeMillis() - 1000;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
80
src/main/java/com/kasetoatz/tridenthacks/config/Config.java
Normal file
80
src/main/java/com/kasetoatz/tridenthacks/config/Config.java
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
package com.kasetoatz.tridenthacks.config;
|
||||||
|
|
||||||
|
import com.google.gson.GsonBuilder;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.kasetoatz.tridenthacks.TridentHacks;
|
||||||
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
import net.minecraft.util.crash.CrashException;
|
||||||
|
import net.minecraft.util.crash.CrashReport;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileReader;
|
||||||
|
import java.io.FileWriter;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class Config {
|
||||||
|
public static boolean toggleRiptide = true;
|
||||||
|
public static boolean noFallDamage = true;
|
||||||
|
public static boolean returnToSameSlot = true;
|
||||||
|
public static String riptideOnMessage = "Riptide §aON";
|
||||||
|
public static String riptideOffMessage = "Riptide §cOFF";
|
||||||
|
|
||||||
|
private static final File file = new File(MinecraftClient.getInstance().runDirectory, "config/tridenthacks.json");
|
||||||
|
private static final Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||||
|
|
||||||
|
public static void load() {
|
||||||
|
if (!file.exists())
|
||||||
|
{
|
||||||
|
save();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try (FileReader reader = new FileReader(file))
|
||||||
|
{
|
||||||
|
JsonObject json = gson.fromJson(reader, JsonObject.class);
|
||||||
|
if (json.has("toggleRiptide"))
|
||||||
|
{
|
||||||
|
toggleRiptide = json.get("toggleRiptide").getAsBoolean();
|
||||||
|
}
|
||||||
|
if (json.has("noFallDamage"))
|
||||||
|
{
|
||||||
|
noFallDamage = json.get("noFallDamage").getAsBoolean();
|
||||||
|
}
|
||||||
|
if (json.has("returnToSameSlot"))
|
||||||
|
{
|
||||||
|
returnToSameSlot = json.get("returnToSameSlot").getAsBoolean();
|
||||||
|
}
|
||||||
|
if (json.has("riptideOnMessage"))
|
||||||
|
{
|
||||||
|
riptideOnMessage = json.get("riptideOnMessage").getAsString();
|
||||||
|
}
|
||||||
|
if (json.has("riptideOffMessage"))
|
||||||
|
{
|
||||||
|
riptideOffMessage = json.get("riptideOffMessage").getAsString();
|
||||||
|
}
|
||||||
|
save();
|
||||||
|
}
|
||||||
|
catch (IOException exc)
|
||||||
|
{
|
||||||
|
throw new CrashException(CrashReport.create(exc, "Loading config file."));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void save()
|
||||||
|
{
|
||||||
|
JsonObject json = new JsonObject();
|
||||||
|
json.addProperty("toggleRiptide", toggleRiptide);
|
||||||
|
json.addProperty("noFallDamage", noFallDamage);
|
||||||
|
json.addProperty("returnToSameSlot", returnToSameSlot);
|
||||||
|
json.addProperty("riptideOnMessage", riptideOnMessage);
|
||||||
|
json.addProperty("riptideOffMessage", riptideOffMessage);
|
||||||
|
try (FileWriter writer = new FileWriter(file))
|
||||||
|
{
|
||||||
|
gson.toJson(json, writer);
|
||||||
|
}
|
||||||
|
catch (IOException exc)
|
||||||
|
{
|
||||||
|
throw new CrashException(CrashReport.create(exc, "Saving config file."));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,11 +1,12 @@
|
|||||||
package com.kasetoatz.riptidehacks.mixin;
|
package com.kasetoatz.tridenthacks.mixin;
|
||||||
|
|
||||||
import com.kasetoatz.riptidehacks.RiptideHacks;
|
import com.kasetoatz.tridenthacks.config.Config;
|
||||||
|
import com.kasetoatz.tridenthacks.TridentHacks;
|
||||||
import net.minecraft.client.network.ClientPlayerEntity;
|
import net.minecraft.client.network.ClientPlayerEntity;
|
||||||
import net.minecraft.item.Items;
|
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.PlayerInteractItemC2SPacket;
|
||||||
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket;
|
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;
|
||||||
@ -17,16 +18,16 @@ 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 (RiptideHacks.toggled)
|
if (Config.toggleRiptide)
|
||||||
{
|
{
|
||||||
ClientPlayerEntity player = RiptideHacks.client.player;
|
ClientPlayerEntity player = TridentHacks.client.player;
|
||||||
if (player != null)
|
if (player != null)
|
||||||
{
|
{
|
||||||
if (packet instanceof PlayerActionC2SPacket && player.getActiveItem().getItem() == Items.TRIDENT)
|
if (packet instanceof PlayerInteractItemC2SPacket && player.getStackInHand(((PlayerInteractItemC2SPacket)packet).getHand()).getItem() == Items.TRIDENT && TridentHacks.noNormalRiptide())
|
||||||
{
|
{
|
||||||
ci.cancel();
|
ci.cancel();
|
||||||
}
|
}
|
||||||
else if (packet instanceof PlayerMoveC2SPacket && !RiptideHacks.onGround)
|
else if (Config.noFallDamage && packet instanceof PlayerMoveC2SPacket && !TridentHacks.onGround && !player.isGliding())
|
||||||
{
|
{
|
||||||
((PlayerMoveC2SPacketMixin)packet).setOnGround(true);
|
((PlayerMoveC2SPacketMixin)packet).setOnGround(true);
|
||||||
}
|
}
|
@ -1,6 +1,7 @@
|
|||||||
package com.kasetoatz.riptidehacks.mixin;
|
package com.kasetoatz.tridenthacks.mixin;
|
||||||
|
|
||||||
import com.kasetoatz.riptidehacks.RiptideHacks;
|
import com.kasetoatz.tridenthacks.config.Config;
|
||||||
|
import com.kasetoatz.tridenthacks.TridentHacks;
|
||||||
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;
|
||||||
@ -9,11 +10,12 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|||||||
|
|
||||||
@Mixin(EnchantmentHelper.class)
|
@Mixin(EnchantmentHelper.class)
|
||||||
public abstract class EnchantmentHelperMixin {
|
public abstract class EnchantmentHelperMixin {
|
||||||
@Inject(method="getTridentSpinAttackStrength", at=@At("HEAD"), cancellable = true)
|
@Inject(method="getTridentSpinAttackStrength", at=@At("RETURN"), cancellable = true)
|
||||||
private static void getTridentSpinAttackStrength(CallbackInfoReturnable<Float> cir)
|
private static void getTridentSpinAttackStrength(CallbackInfoReturnable<Float> cir)
|
||||||
{
|
{
|
||||||
if (RiptideHacks.toggled)
|
if (Config.toggleRiptide)
|
||||||
{
|
{
|
||||||
|
TridentHacks.hasRiptide = cir.getReturnValue() > 0.0f;
|
||||||
cir.setReturnValue(3.f);
|
cir.setReturnValue(3.f);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,6 +1,7 @@
|
|||||||
package com.kasetoatz.riptidehacks.mixin;
|
package com.kasetoatz.tridenthacks.mixin;
|
||||||
|
|
||||||
import com.kasetoatz.riptidehacks.RiptideHacks;
|
import com.kasetoatz.tridenthacks.config.Config;
|
||||||
|
import com.kasetoatz.tridenthacks.TridentHacks;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
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;
|
||||||
@ -9,13 +10,14 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|||||||
|
|
||||||
@Mixin(Entity.class)
|
@Mixin(Entity.class)
|
||||||
public abstract class EntityMixin {
|
public abstract class EntityMixin {
|
||||||
@Inject(method="isTouchingWaterOrRain", at=@At("HEAD"), cancellable = true)
|
@Inject(method="isTouchingWaterOrRain", at=@At("RETURN"), cancellable = true)
|
||||||
private void isTouchingWaterOrRain(CallbackInfoReturnable<Boolean> cir)
|
private void isTouchingWaterOrRain(CallbackInfoReturnable<Boolean> cir)
|
||||||
{
|
{
|
||||||
if (RiptideHacks.toggled)
|
if (Config.toggleRiptide)
|
||||||
{
|
{
|
||||||
if (((Entity)(Object)this) == RiptideHacks.client.player)
|
if (((Entity)(Object)this) == TridentHacks.client.player)
|
||||||
{
|
{
|
||||||
|
TridentHacks.riptideConditions = cir.getReturnValue();
|
||||||
cir.setReturnValue(true);
|
cir.setReturnValue(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,6 +1,7 @@
|
|||||||
package com.kasetoatz.riptidehacks.mixin;
|
package com.kasetoatz.tridenthacks.mixin;
|
||||||
|
|
||||||
import com.kasetoatz.riptidehacks.RiptideHacks;
|
import com.kasetoatz.tridenthacks.config.Config;
|
||||||
|
import com.kasetoatz.tridenthacks.TridentHacks;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
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;
|
||||||
@ -13,9 +14,9 @@ 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.toggled && RiptideHacks.shouldAnimate())
|
if (Config.toggleRiptide && TridentHacks.noNormalRiptide() && TridentHacks.lastTridentUse > System.currentTimeMillis() - 1000)
|
||||||
{
|
{
|
||||||
if (entity == RiptideHacks.client.player)
|
if (entity == TridentHacks.client.player)
|
||||||
{
|
{
|
||||||
cir.setReturnValue(true);
|
cir.setReturnValue(true);
|
||||||
}
|
}
|
@ -0,0 +1,46 @@
|
|||||||
|
package com.kasetoatz.tridenthacks.mixin;
|
||||||
|
|
||||||
|
import com.kasetoatz.tridenthacks.TridentHacks;
|
||||||
|
import net.minecraft.client.network.ClientPlayerEntity;
|
||||||
|
import net.minecraft.client.network.ClientPlayerInteractionManager;
|
||||||
|
import net.minecraft.entity.player.PlayerInventory;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.Items;
|
||||||
|
import net.minecraft.screen.slot.SlotActionType;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Unique;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
@Mixin(PlayerInventory.class)
|
||||||
|
public abstract class PlayerInventoryMixin {
|
||||||
|
@Inject(method="setStack", at=@At("HEAD"))
|
||||||
|
public void setStack(int slot, ItemStack stack, CallbackInfo ci)
|
||||||
|
{
|
||||||
|
int tridentSlot = TridentHacks.tridentSlot;
|
||||||
|
if (tridentSlot != -1)
|
||||||
|
{
|
||||||
|
ClientPlayerEntity player = TridentHacks.client.player;
|
||||||
|
ClientPlayerInteractionManager interactionManager = TridentHacks.client.interactionManager;
|
||||||
|
if (!stack.isEmpty() && stack.getItem() == Items.TRIDENT && player != null && interactionManager != null)
|
||||||
|
{
|
||||||
|
if (player.getInventory().getStack(TridentHacks.tridentSlot).isEmpty())
|
||||||
|
{
|
||||||
|
interactionManager.clickSlot(player.playerScreenHandler.syncId, this.getSlotID(slot), 0, SlotActionType.PICKUP, player);
|
||||||
|
interactionManager.clickSlot(player.playerScreenHandler.syncId, this.getSlotID(TridentHacks.tridentSlot), 0, SlotActionType.PICKUP, player);
|
||||||
|
if (TridentHacks.tridentSlot == tridentSlot)
|
||||||
|
{
|
||||||
|
TridentHacks.tridentSlot = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Unique
|
||||||
|
private int getSlotID(int index)
|
||||||
|
{
|
||||||
|
return (index == PlayerInventory.OFF_HAND_SLOT) ? 45 : (index < PlayerInventory.getHotbarSize()) ? index + PlayerInventory.MAIN_SIZE : index;
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package com.kasetoatz.riptidehacks.mixin;
|
package com.kasetoatz.tridenthacks.mixin;
|
||||||
|
|
||||||
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket;
|
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
@ -0,0 +1,48 @@
|
|||||||
|
package com.kasetoatz.tridenthacks.mixin;
|
||||||
|
|
||||||
|
import com.kasetoatz.tridenthacks.config.Config;
|
||||||
|
import com.kasetoatz.tridenthacks.TridentHacks;
|
||||||
|
import net.minecraft.client.network.ClientPlayerEntity;
|
||||||
|
import net.minecraft.entity.LivingEntity;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.entity.player.PlayerInventory;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.Items;
|
||||||
|
import net.minecraft.item.TridentItem;
|
||||||
|
import net.minecraft.sound.SoundCategory;
|
||||||
|
import net.minecraft.sound.SoundEvents;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
|
@Mixin(TridentItem.class)
|
||||||
|
public class TridentItemMixin {
|
||||||
|
@Inject(method="onStoppedUsing", at=@At("HEAD"))
|
||||||
|
private void onStoppedUsing(ItemStack stack, World world, LivingEntity user, int remainingUseTicks, CallbackInfoReturnable<Boolean> cir)
|
||||||
|
{
|
||||||
|
if (Config.toggleRiptide)
|
||||||
|
{
|
||||||
|
PlayerEntity player = TridentHacks.client.player;
|
||||||
|
if (user == player && user.getItemUseTime() > 10)
|
||||||
|
{
|
||||||
|
if (TridentHacks.noNormalRiptide())
|
||||||
|
{
|
||||||
|
world.playSoundFromEntity(player, SoundEvents.ITEM_TRIDENT_RIPTIDE_3.value(), SoundCategory.PLAYERS, 1.F, 1.F);
|
||||||
|
TridentHacks.lastTridentUse = System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
TridentHacks.onGround = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (Config.returnToSameSlot && !TridentHacks.hasRiptide)
|
||||||
|
{
|
||||||
|
PlayerEntity player = TridentHacks.client.player;
|
||||||
|
if (player != null)
|
||||||
|
{
|
||||||
|
TridentHacks.tridentSlot = (user.getOffHandStack() == stack) ? PlayerInventory.OFF_HAND_SLOT : player.getInventory().selectedSlot;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,23 +1,23 @@
|
|||||||
{
|
{
|
||||||
"schemaVersion": 1,
|
"schemaVersion": 1,
|
||||||
"id": "riptidehacks",
|
"id": "tridenthacks",
|
||||||
"version": "${version}",
|
"version": "${version}",
|
||||||
"name": "RiptideHacks",
|
"name": "TridentHacks",
|
||||||
"description": "",
|
"description": "",
|
||||||
"authors": [],
|
"authors": [],
|
||||||
"contact": {
|
"contact": {
|
||||||
"repo": "https://github.com/KaseToatz1337/RiptideHacks"
|
"repo": "https://github.com/KaseToatz1337/TridentHacks"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"environment": "*",
|
"environment": "*",
|
||||||
"entrypoints": {
|
"entrypoints": {
|
||||||
"client": [
|
"client": [
|
||||||
"com.kasetoatz.riptidehacks.RiptideHacks"
|
"com.kasetoatz.tridenthacks.TridentHacks"
|
||||||
],
|
],
|
||||||
"main": []
|
"main": []
|
||||||
},
|
},
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"riptidehacks.mixins.json"
|
"tridenthacks.mixins.json"
|
||||||
],
|
],
|
||||||
"depends": {
|
"depends": {
|
||||||
"fabricloader": ">=${loader_version}",
|
"fabricloader": ">=${loader_version}",
|
||||||
|
@ -1,16 +1,17 @@
|
|||||||
{
|
{
|
||||||
"required": true,
|
"required": true,
|
||||||
"minVersion": "0.8",
|
"minVersion": "0.8",
|
||||||
"package": "com.kasetoatz.riptidehacks.mixin",
|
"package": "com.kasetoatz.tridenthacks.mixin",
|
||||||
"compatibilityLevel": "JAVA_21",
|
"compatibilityLevel": "JAVA_21",
|
||||||
"mixins": [],
|
"mixins": [],
|
||||||
"client": [
|
"client": [
|
||||||
|
"ClientConnectionMixin",
|
||||||
"EnchantmentHelperMixin",
|
"EnchantmentHelperMixin",
|
||||||
"EntityMixin",
|
"EntityMixin",
|
||||||
"LivingEntityMixin",
|
"LivingEntityMixin",
|
||||||
|
"PlayerInventoryMixin",
|
||||||
"PlayerMoveC2SPacketMixin",
|
"PlayerMoveC2SPacketMixin",
|
||||||
"TridentItemMixin",
|
"TridentItemMixin"
|
||||||
"ClientConnectionMixin"
|
|
||||||
],
|
],
|
||||||
"injectors": {
|
"injectors": {
|
||||||
"defaultRequire": 1
|
"defaultRequire": 1
|
Reference in New Issue
Block a user