[+] Finish project
This commit is contained in:
@@ -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!
|
||||
* <p>
|
||||
* 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();
|
||||
}
|
||||
}
|
||||
@@ -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.
|
||||
* <p>
|
||||
* 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; }
|
||||
}
|
||||
@@ -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.
|
||||
* <p>
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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!
|
||||
* <p>
|
||||
* 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);
|
||||
}
|
||||
}
|
||||
@@ -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!
|
||||
* <p>
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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!
|
||||
* <p>
|
||||
* 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);
|
||||
}
|
||||
@@ -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!
|
||||
* <p>
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
@@ -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!
|
||||
* <p>
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
@@ -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!
|
||||
* <p>
|
||||
* 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);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.hydev.fabric.fish.mixinterfaces;
|
||||
|
||||
/**
|
||||
* TODO: Write a description for this class!
|
||||
* <p>
|
||||
* 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);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package org.hydev.fabric.fish.mixinterfaces;
|
||||
|
||||
/**
|
||||
* TODO: Write a description for this class!
|
||||
* <p>
|
||||
* 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();
|
||||
}
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user