From 8e6f72c6ae09ef3276be4bb95cc7d8296034269e Mon Sep 17 00:00:00 2001 From: Hykilpikonna Date: Sun, 3 May 2020 19:15:23 -0400 Subject: [PATCH] [+] Finish project --- src/main/java/org/hydev/fabric/fish/Main.java | 274 ++++++++++++++++++ .../java/org/hydev/fabric/fish/MiscUtils.java | 74 +++++ .../org/hydev/fabric/fish/PlayerUtils.java | 99 +++++++ .../fish/mixin/ClientConnectionMixin.java | 34 +++ .../fish/mixin/ClientPlayerEntityMixin.java | 51 ++++ .../ClientPlayerInteractionManagerMixin.java | 104 +++++++ .../fabric/fish/mixin/KeyBindingMixin.java | 28 ++ .../fish/mixin/MinecraftClientMixin.java | 31 ++ .../ClientPlayerInteractionI.java | 36 +++ .../fish/mixinterfaces/KeyBindingI.java | 16 + .../fish/mixinterfaces/MinecraftClientI.java | 18 ++ src/main/resources/aaautofish.mixins.json | 8 +- 12 files changed, 771 insertions(+), 2 deletions(-) create mode 100644 src/main/java/org/hydev/fabric/fish/Main.java create mode 100644 src/main/java/org/hydev/fabric/fish/MiscUtils.java create mode 100644 src/main/java/org/hydev/fabric/fish/PlayerUtils.java create mode 100644 src/main/java/org/hydev/fabric/fish/mixin/ClientConnectionMixin.java create mode 100644 src/main/java/org/hydev/fabric/fish/mixin/ClientPlayerEntityMixin.java create mode 100644 src/main/java/org/hydev/fabric/fish/mixin/ClientPlayerInteractionManagerMixin.java create mode 100644 src/main/java/org/hydev/fabric/fish/mixin/KeyBindingMixin.java create mode 100644 src/main/java/org/hydev/fabric/fish/mixin/MinecraftClientMixin.java create mode 100644 src/main/java/org/hydev/fabric/fish/mixinterfaces/ClientPlayerInteractionI.java create mode 100644 src/main/java/org/hydev/fabric/fish/mixinterfaces/KeyBindingI.java create mode 100644 src/main/java/org/hydev/fabric/fish/mixinterfaces/MinecraftClientI.java diff --git a/src/main/java/org/hydev/fabric/fish/Main.java b/src/main/java/org/hydev/fabric/fish/Main.java new file mode 100644 index 0000000..ca56c38 --- /dev/null +++ b/src/main/java/org/hydev/fabric/fish/Main.java @@ -0,0 +1,274 @@ +package org.hydev.fabric.fish; + +import net.fabricmc.api.ModInitializer; +import net.minecraft.client.network.ClientPlayerEntity; +import net.minecraft.enchantment.Enchantments; +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.entity.projectile.FishingBobberEntity; +import net.minecraft.item.FishingRodItem; +import net.minecraft.item.ItemStack; +import net.minecraft.network.Packet; +import net.minecraft.network.packet.s2c.play.PlaySoundS2CPacket; +import net.minecraft.sound.SoundEvents; +import org.hydev.fabric.fish.mixinterfaces.KeyBindingI; + +import java.util.Random; + +import static net.minecraft.enchantment.EnchantmentHelper.getLevel; +import static net.minecraft.enchantment.EnchantmentHelper.hasVanishingCurse; +import static org.hydev.fabric.fish.MiscUtils.*; + +/** + * TODO: Write a description for this class! + *

+ * Class created by the HyDEV Team on 2020-03-01! + * + * @author HyDEV Team (https://github.com/HyDevelop) + * @author Hykilpikonna (https://github.com/hykilpikonna) + * @author Vanilla (https://github.com/VergeDX) + * @since 2020-03-01 11:16 + */ +public class Main implements ModInitializer +{ + public static Main instance; + public static Random random = new Random(); + + public boolean enabled; + public boolean walking; + public boolean walkRight; + public int walkTimer; + + private int bestRodValue; + private int bestRodSlot; + + private int castRodTimer; + private int reelInTimer; + + private int scheduledWindowClick; + + @Override + public void onInitialize() + { + instance = this; + + bestRodValue = -1; + bestRodSlot = -1; + castRodTimer = 0; + reelInTimer = -1; + scheduledWindowClick = -1; + + System.out.println("AntiAntiAutofish loaded."); + } + + public void resetTimer() + { + walkTimer = 0; + castRodTimer = generateCastRodTimer(); + reelInTimer = 1200; + } + + public int generateCastRodTimer() + { + return 15 + random.nextInt(15); + } + + /** + * On tick + */ + public void onUpdate() + { + if (!enabled) return; + + ClientPlayerEntity player = mc().player; + PlayerInventory inventory = player.inventory; + + if(scheduledWindowClick != -1) + { + imc().getInteractionManager().windowClick_PICKUP(scheduledWindowClick); + return; + } + + updateBestRod(); + + if (bestRodSlot == -1) + { + print("Out of fishing rods."); + enabled = false; + return; + } + + if (bestRodSlot != inventory.selectedSlot) + { + selectBestRod(); + return; + } + + // AntiAntiAutofish - Walk + if (walkTimer > 0) + { + // Start walking if not already + if (!walking) + { + KeyBindingI key = (KeyBindingI) (walkRight ? mc().options.keyRight : mc().options.keyLeft); + key.setPressed(walking = true); + } + + walkTimer --; + return; + } + else + { + // Finished walking + if (walking) + { + KeyBindingI key = (KeyBindingI) (walkRight ? mc().options.keyRight : mc().options.keyLeft); + key.setPressed(walking = false); + } + } + + // Not casted yet + if (player.fishHook == null) + { + // Wait for timer + if (castRodTimer > 0) + { + castRodTimer --; + } + + // Timer is done + else + { + rightClick(); + resetTimer(); + } + } + + // Casted + else + { + // Auto reel in after 60s + if (reelInTimer > 0) + { + reelInTimer--; + } + else + { + rightClick(); + resetTimer(); + } + } + } + + private void updateBestRod() + { + PlayerInventory inventory = player().inventory; + int selectedSlot = inventory.selectedSlot; + ItemStack selectedStack = inventory.getInvStack(selectedSlot); + + // start with selected rod + bestRodValue = getRodValue(selectedStack); + bestRodSlot = bestRodValue > -1 ? selectedSlot : -1; + + // search inventory for better rod + for(int slot = 0; slot < 36; slot++) + { + ItemStack stack = inventory.getInvStack(slot); + int rodValue = getRodValue(stack); + + if(rodValue > bestRodValue) + { + bestRodValue = rodValue; + bestRodSlot = slot; + } + } + } + + private int getRodValue(ItemStack stack) + { + if(stack.isEmpty() || !(stack.getItem() instanceof FishingRodItem)) + return -1; + + int luckOTSLvl = getLevel(Enchantments.LUCK_OF_THE_SEA, stack); + int lureLvl = getLevel(Enchantments.LURE, stack); + int unbreakingLvl = getLevel(Enchantments.UNBREAKING, stack); + int mendingBonus = getLevel(Enchantments.MENDING, stack); + int noVanishBonus = hasVanishingCurse(stack) ? 0 : 1; + + return luckOTSLvl * 9 + lureLvl * 9 + unbreakingLvl * 2 + mendingBonus + noVanishBonus; + } + + private void selectBestRod() + { + PlayerInventory inventory = player().inventory; + + if(bestRodSlot < 9) + { + inventory.selectedSlot = bestRodSlot; + return; + } + + int firstEmptySlot = inventory.getEmptySlot(); + + if(firstEmptySlot != -1) + { + if(firstEmptySlot >= 9) + { + imc().getInteractionManager().windowClick_QUICK_MOVE(36 + inventory.selectedSlot); + } + + imc().getInteractionManager().windowClick_QUICK_MOVE(bestRodSlot); + + } + else + { + imc().getInteractionManager().windowClick_PICKUP(bestRodSlot); + imc().getInteractionManager().windowClick_PICKUP(36 + inventory.selectedSlot); + + scheduledWindowClick = -bestRodSlot; + } + } + + public void onReceivedPacket(Packet packet) + { + if (!enabled) return; + + double validRange = 1.5; + + if(player() == null || player().fishHook == null) + return; + + if(!(packet instanceof PlaySoundS2CPacket)) + return; + + // check sound type + PlaySoundS2CPacket sound = (PlaySoundS2CPacket) packet; + if(!SoundEvents.ENTITY_FISHING_BOBBER_SPLASH.equals(sound.getSound())) + return; + + // check position + FishingBobberEntity bobber = player().fishHook; + if(Math.abs(sound.getX() - bobber.x) > validRange + || Math.abs(sound.getZ() - bobber.z) > validRange) + return; + + // catch fish + rightClick(); + resetTimer(); + + // Random rotation + PlayerUtils.rotate(new PlayerUtils.Rotation(player().yaw + 180, random.nextFloat() * 50 - 25)); + + walkTimer = 10; + } + + private void rightClick() + { + // check held item + ItemStack stack = player().inventory.getMainHandStack(); + if(stack.isEmpty() || !(stack.getItem() instanceof FishingRodItem)) + return; + + // right click + imc().rightClick(); + } +} diff --git a/src/main/java/org/hydev/fabric/fish/MiscUtils.java b/src/main/java/org/hydev/fabric/fish/MiscUtils.java new file mode 100644 index 0000000..4f96566 --- /dev/null +++ b/src/main/java/org/hydev/fabric/fish/MiscUtils.java @@ -0,0 +1,74 @@ +package org.hydev.fabric.fish; + +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.network.ClientPlayerEntity; +import net.minecraft.client.network.ClientPlayerInteractionManager; +import net.minecraft.client.world.ClientWorld; +import net.minecraft.text.LiteralText; +import net.minecraft.text.Text; +import org.hydev.fabric.fish.mixinterfaces.MinecraftClientI; + +/** + * Miscellaneous utility methods. + *

+ * Class created by the HyDEV Team on 2020-01-24! + * + * @author HyDEV Team (https://github.com/HyDevelop) + * @author Hykilpikonna (https://github.com/hykilpikonna) + * @author Vanilla (https://github.com/VergeDX) + * @since 2020-01-24 18:56 + */ +public class MiscUtils +{ + /** + * Print to player's client side chat box + * + * @param text Text + * @return 1 (For convenience when using commands) + */ + public static int print(Text text) + { + if (player() == null) return 1; + player().addChatMessage(new LiteralText("[AAAutofish] ").append(text), false); + return 1; + } + + /** + * Print to player's client side chat box + * + * @param text Text + * @return 1 (For convenience when using commands) + */ + public static int print(String text) + { + return print(new LiteralText(text)); + } + + /** + * Sleep without exceptions + * + * @param ms Time in ms + */ + public static void sleep(long ms) + { + try + { + Thread.sleep(ms); + } + catch (InterruptedException e) + { + e.printStackTrace(); + } + } + + public static MinecraftClient mc() + { return MinecraftClient.getInstance(); } + public static MinecraftClientI imc() + { return (MinecraftClientI) MinecraftClient.getInstance(); } + public static ClientWorld world() + { return mc().world; } + public static ClientPlayerEntity player() + { return mc().player; } + public static ClientPlayerInteractionManager interactionManager() + { return mc().interactionManager; } +} diff --git a/src/main/java/org/hydev/fabric/fish/PlayerUtils.java b/src/main/java/org/hydev/fabric/fish/PlayerUtils.java new file mode 100644 index 0000000..5a55df7 --- /dev/null +++ b/src/main/java/org/hydev/fabric/fish/PlayerUtils.java @@ -0,0 +1,99 @@ +package org.hydev.fabric.fish; + +import net.minecraft.client.network.ClientPlayerEntity; +import net.minecraft.util.math.Vec3d; + +import static org.hydev.fabric.fish.MiscUtils.player; + +/** + * Utils for controlling the player. + *

+ * Class created by the HyDEV Team on 2020-01-24! + * + * @author HyDEV Team (https://github.com/HyDevelop) + * @author Hykilpikonna (https://github.com/hykilpikonna) + * @author Vanilla (https://github.com/VergeDX) + * @since 2020-01-24 22:34 + */ +public class PlayerUtils +{ + /** + * Get player's eye vector + * + * @return Eye vector + * @author Wurst7 https://github.com/Wurst-Imperium/Wurst7 + */ + public static Vec3d getEyesPos() + { + ClientPlayerEntity player = player(); + + return new Vec3d(player.x, + player.y + player.getEyeHeight(player.getPose()), + player.z); + } + + /** + * Get what does it take to rotate to a direction + * + * @param vec Final direction + * @return Rotation required + * @author Wurst7 https://github.com/Wurst-Imperium/Wurst7 + */ + public static Rotation getNeededRotations(Vec3d vec) + { + Vec3d eyesPos = getEyesPos(); + + double diffX = vec.x - eyesPos.x; + double diffY = vec.y - eyesPos.y; + double diffZ = vec.z - eyesPos.z; + + double diffXZ = Math.sqrt(diffX * diffX + diffZ * diffZ); + + float yaw = (float)Math.toDegrees(Math.atan2(diffZ, diffX)) - 90F; + float pitch = (float)-Math.toDegrees(Math.atan2(diffY, diffXZ)); + + return new Rotation(yaw, pitch); + } + + /** + * Rotate + * + * @param rotation Relative rotation + */ + public static void rotate(Rotation rotation) + { + player().yaw = rotation.getYaw(); + player().pitch = rotation.getPitch(); + } + + /** + * Rotation + */ + public static final class Rotation + { + private final float yaw; + private final float pitch; + + /*public Rotation(float yaw, float pitch) + { + this.yaw = MathHelper.wrapDegrees(yaw); + this.pitch = MathHelper.wrapDegrees(pitch); + }*/ + + public Rotation(float yaw, float pitch) + { + this.yaw = yaw; + this.pitch = pitch; + } + + public float getYaw() + { + return yaw; + } + + public float getPitch() + { + return pitch; + } + } +} diff --git a/src/main/java/org/hydev/fabric/fish/mixin/ClientConnectionMixin.java b/src/main/java/org/hydev/fabric/fish/mixin/ClientConnectionMixin.java new file mode 100644 index 0000000..69214d0 --- /dev/null +++ b/src/main/java/org/hydev/fabric/fish/mixin/ClientConnectionMixin.java @@ -0,0 +1,34 @@ +package org.hydev.fabric.fish.mixin; + +import io.netty.channel.ChannelHandlerContext; +import net.minecraft.network.ClientConnection; +import net.minecraft.network.Packet; +import org.hydev.fabric.fish.Main; +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; + +/** + * TODO: Write a description for this class! + *

+ * Class created by the HyDEV Team on 2020-03-01! + * + * @author HyDEV Team (https://github.com/HyDevelop) + * @author Hykilpikonna (https://github.com/hykilpikonna) + * @author Vanilla (https://github.com/VergeDX) + * @since 2020-03-01 12:38 + */ +@Mixin(ClientConnection.class) +public class ClientConnectionMixin +{ + @Inject(at = {@At(value = "INVOKE", + target = "Lnet/minecraft/network/ClientConnection;handlePacket(Lnet/minecraft/network/Packet;Lnet/minecraft/network/listener/PacketListener;)V", + ordinal = 0)}, + method = "channelRead0(Lio/netty/channel/ChannelHandlerContext;Lnet/minecraft/network/Packet;)V", + cancellable = true) + private void onChannelRead0(ChannelHandlerContext channelHandlerContext, Packet packet, CallbackInfo ci) + { + Main.instance.onReceivedPacket(packet); + } +} diff --git a/src/main/java/org/hydev/fabric/fish/mixin/ClientPlayerEntityMixin.java b/src/main/java/org/hydev/fabric/fish/mixin/ClientPlayerEntityMixin.java new file mode 100644 index 0000000..713aa09 --- /dev/null +++ b/src/main/java/org/hydev/fabric/fish/mixin/ClientPlayerEntityMixin.java @@ -0,0 +1,51 @@ +package org.hydev.fabric.fish.mixin; + +import net.minecraft.client.network.ClientPlayerEntity; +import org.hydev.fabric.fish.Main; +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; + +/** + * TODO: Write a description for this class! + *

+ * Class created by the HyDEV Team on 2020-03-01! + * + * @author HyDEV Team (https://github.com/HyDevelop) + * @author Hykilpikonna (https://github.com/hykilpikonna) + * @author Vanilla (https://github.com/VergeDX) + * @since 2020-03-01 12:34 + */ +@Mixin(ClientPlayerEntity.class) +public class ClientPlayerEntityMixin +{ + @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/AbstractClientPlayerEntity;tick()V", ordinal = 0), method = "tick()V") + private void onTick(CallbackInfo ci) + { + Main.instance.onUpdate(); + } + + @Inject(method = "sendChatMessage", at = @At("HEAD"), cancellable = true) + private void onChatMessage(String msg, CallbackInfo info) + { + // Command + if (msg.toLowerCase().startsWith("/aaa")) + { + // Let it not pass to the server + info.cancel(); + + // Enable + if (msg.equalsIgnoreCase("/aaa enable")) + { + Main.instance.enabled = true; + } + + // Disable + if (msg.equalsIgnoreCase("/aaa disable")) + { + Main.instance.enabled = false; + } + } + } +} diff --git a/src/main/java/org/hydev/fabric/fish/mixin/ClientPlayerInteractionManagerMixin.java b/src/main/java/org/hydev/fabric/fish/mixin/ClientPlayerInteractionManagerMixin.java new file mode 100644 index 0000000..04ac081 --- /dev/null +++ b/src/main/java/org/hydev/fabric/fish/mixin/ClientPlayerInteractionManagerMixin.java @@ -0,0 +1,104 @@ +package org.hydev.fabric.fish.mixin; + +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.network.ClientPlayerEntity; +import net.minecraft.client.network.ClientPlayerInteractionManager; +import net.minecraft.client.world.ClientWorld; +import net.minecraft.container.SlotActionType; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket; +import net.minecraft.util.ActionResult; +import net.minecraft.util.Hand; +import net.minecraft.util.hit.BlockHitResult; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; +import net.minecraft.util.math.Vec3d; +import net.minecraft.world.World; +import org.hydev.fabric.fish.mixinterfaces.ClientPlayerInteractionI; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; + +/** + * TODO: Write a description for this class! + *

+ * Class created by the HyDEV Team on 2020-03-01! + * + * @author HyDEV Team (https://github.com/HyDevelop) + * @author Hykilpikonna (https://github.com/hykilpikonna) + * @author Vanilla (https://github.com/VergeDX) + * @since 2020-03-01 12:26 + */ +@Mixin(ClientPlayerInteractionManager.class) +public abstract class ClientPlayerInteractionManagerMixin implements ClientPlayerInteractionI +{ + @Shadow + private MinecraftClient client; + @Shadow + private float currentBreakingProgress; + @Shadow + private boolean breakingBlock; + + @Override + public float getCurrentBreakingProgress() + { + return currentBreakingProgress; + } + + @Override + public void setBreakingBlock(boolean breakingBlock) + { + this.breakingBlock = breakingBlock; + } + + @Override + public ItemStack windowClick_PICKUP(int slot) + { + return method_2906(0, slot, 0, SlotActionType.PICKUP, client.player); + } + + @Override + public ItemStack windowClick_QUICK_MOVE(int slot) + { + return method_2906(0, slot, 0, SlotActionType.QUICK_MOVE, client.player); + } + + @Override + public ItemStack windowClick_THROW(int slot) + { + return method_2906(0, slot, 1, SlotActionType.THROW, client.player); + } + + @Override + public void rightClickItem() + { + interactItem(client.player, client.world, Hand.MAIN_HAND); + } + + @Override + public void rightClickBlock(BlockPos pos, Direction side, Vec3d hitVec) + { + interactBlock(client.player, client.world, Hand.MAIN_HAND, + new BlockHitResult(hitVec, side, pos, false)); + interactItem(client.player, client.world, Hand.MAIN_HAND); + } + + @Override + public void sendPlayerActionC2SPacket(PlayerActionC2SPacket.Action action, BlockPos blockPos, + Direction direction) + { + method_21706(action, blockPos, direction); + } + + @Shadow + private void method_21706(PlayerActionC2SPacket.Action action, BlockPos blockPos, Direction direction) {} + + @Shadow + public abstract ActionResult interactBlock(ClientPlayerEntity clientPlayerEntity, ClientWorld clientWorld, Hand hand, BlockHitResult blockHitResult); + + @Shadow + public abstract ActionResult interactItem(PlayerEntity playerEntity, World world, Hand hand); + + @Shadow + public abstract ItemStack method_2906(int syncId, int slotId, int mouseButton, SlotActionType actionType, PlayerEntity player); +} diff --git a/src/main/java/org/hydev/fabric/fish/mixin/KeyBindingMixin.java b/src/main/java/org/hydev/fabric/fish/mixin/KeyBindingMixin.java new file mode 100644 index 0000000..51deda4 --- /dev/null +++ b/src/main/java/org/hydev/fabric/fish/mixin/KeyBindingMixin.java @@ -0,0 +1,28 @@ +package org.hydev.fabric.fish.mixin; + +import net.minecraft.client.options.KeyBinding; +import org.hydev.fabric.fish.mixinterfaces.KeyBindingI; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; + +/** + * TODO: Write a description for this class! + *

+ * Class created by the HyDEV Team on 2020-03-01! + * + * @author HyDEV Team (https://github.com/HyDevelop) + * @author Hykilpikonna (https://github.com/hykilpikonna) + * @author Vanilla (https://github.com/VergeDX) + * @since 2020-03-01 14:17 + */ +@Mixin(KeyBinding.class) +public class KeyBindingMixin implements KeyBindingI +{ + @Shadow private boolean pressed; + + @Override + public void setPressed(boolean pressed) + { + this.pressed = pressed; + } +} diff --git a/src/main/java/org/hydev/fabric/fish/mixin/MinecraftClientMixin.java b/src/main/java/org/hydev/fabric/fish/mixin/MinecraftClientMixin.java new file mode 100644 index 0000000..4890f14 --- /dev/null +++ b/src/main/java/org/hydev/fabric/fish/mixin/MinecraftClientMixin.java @@ -0,0 +1,31 @@ +package org.hydev.fabric.fish.mixin; + +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.network.ClientPlayerInteractionManager; +import org.hydev.fabric.fish.mixinterfaces.ClientPlayerInteractionI; +import org.hydev.fabric.fish.mixinterfaces.MinecraftClientI; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; + +/** + * TODO: Write a description for this class! + *

+ * Class created by the HyDEV Team on 2020-03-01! + * + * @author HyDEV Team (https://github.com/HyDevelop) + * @author Hykilpikonna (https://github.com/hykilpikonna) + * @author Vanilla (https://github.com/VergeDX) + * @since 2020-03-01 11:43 + */ +@Mixin(MinecraftClient.class) +public abstract class MinecraftClientMixin implements MinecraftClientI +{ + @Shadow private void doItemUse() {} + @Override public void rightClick() { doItemUse(); } + + @Shadow public ClientPlayerInteractionManager interactionManager; + @Override public ClientPlayerInteractionI getInteractionManager() + { + return (ClientPlayerInteractionI) interactionManager; + } +} diff --git a/src/main/java/org/hydev/fabric/fish/mixinterfaces/ClientPlayerInteractionI.java b/src/main/java/org/hydev/fabric/fish/mixinterfaces/ClientPlayerInteractionI.java new file mode 100644 index 0000000..c1f276c --- /dev/null +++ b/src/main/java/org/hydev/fabric/fish/mixinterfaces/ClientPlayerInteractionI.java @@ -0,0 +1,36 @@ +package org.hydev.fabric.fish.mixinterfaces; + +import net.minecraft.item.ItemStack; +import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; +import net.minecraft.util.math.Vec3d; + +/** + * TODO: Write a description for this class! + *

+ * Class created by the HyDEV Team on 2020-03-01! + * + * @author HyDEV Team (https://github.com/HyDevelop) + * @author Hykilpikonna (https://github.com/hykilpikonna) + * @author Vanilla (https://github.com/VergeDX) + * @since 2020-03-01 12:26 + */ +public interface ClientPlayerInteractionI +{ + public float getCurrentBreakingProgress(); + + public void setBreakingBlock(boolean breakingBlock); + + public ItemStack windowClick_PICKUP(int slot); + + public ItemStack windowClick_QUICK_MOVE(int slot); + + public ItemStack windowClick_THROW(int slot); + + public void rightClickItem(); + + public void rightClickBlock(BlockPos pos, Direction side, Vec3d hitVec); + + public void sendPlayerActionC2SPacket(PlayerActionC2SPacket.Action action, BlockPos blockPos, Direction direction); +} diff --git a/src/main/java/org/hydev/fabric/fish/mixinterfaces/KeyBindingI.java b/src/main/java/org/hydev/fabric/fish/mixinterfaces/KeyBindingI.java new file mode 100644 index 0000000..b1a1809 --- /dev/null +++ b/src/main/java/org/hydev/fabric/fish/mixinterfaces/KeyBindingI.java @@ -0,0 +1,16 @@ +package org.hydev.fabric.fish.mixinterfaces; + +/** + * TODO: Write a description for this class! + *

+ * Class created by the HyDEV Team on 2020-03-01! + * + * @author HyDEV Team (https://github.com/HyDevelop) + * @author Hykilpikonna (https://github.com/hykilpikonna) + * @author Vanilla (https://github.com/VergeDX) + * @since 2020-03-01 14:17 + */ +public interface KeyBindingI +{ + void setPressed(boolean pressed); +} diff --git a/src/main/java/org/hydev/fabric/fish/mixinterfaces/MinecraftClientI.java b/src/main/java/org/hydev/fabric/fish/mixinterfaces/MinecraftClientI.java new file mode 100644 index 0000000..5fc23db --- /dev/null +++ b/src/main/java/org/hydev/fabric/fish/mixinterfaces/MinecraftClientI.java @@ -0,0 +1,18 @@ +package org.hydev.fabric.fish.mixinterfaces; + +/** + * TODO: Write a description for this class! + *

+ * Class created by the HyDEV Team on 2020-03-01! + * + * @author HyDEV Team (https://github.com/HyDevelop) + * @author Hykilpikonna (https://github.com/hykilpikonna) + * @author Vanilla (https://github.com/VergeDX) + * @since 2020-03-01 12:05 + */ +public interface MinecraftClientI +{ + void rightClick(); + + ClientPlayerInteractionI getInteractionManager(); +} diff --git a/src/main/resources/aaautofish.mixins.json b/src/main/resources/aaautofish.mixins.json index 21fe73a..ede4836 100644 --- a/src/main/resources/aaautofish.mixins.json +++ b/src/main/resources/aaautofish.mixins.json @@ -1,12 +1,16 @@ { "required": true, "minVersion": "0.8", - "package": "net.fabricmc.example.mixin", + "package": "org.hydev.fabric.fish.mixin", "compatibilityLevel": "JAVA_8", "mixins": [ ], "client": [ - "ExampleMixin" + "ClientConnectionMixin", + "ClientPlayerEntityMixin", + "ClientPlayerInteractionManagerMixin", + "KeyBindingMixin", + "MinecraftClientMixin" ], "injectors": { "defaultRequire": 1