Skip to content

Commit

Permalink
更新东西太多写不下了
Browse files Browse the repository at this point in the history
  • Loading branch information
ItzGreenCat committed Jan 28, 2023
1 parent 45558fb commit f2c6ce6
Show file tree
Hide file tree
Showing 74 changed files with 4,054 additions and 381 deletions.
6 changes: 5 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ buildscript {
url = "https://repo.spongepowered.org/maven"
}
maven { url 'https://plugins.gradle.org/m2' }
maven {
url = "https://mvnrepository.com/artifact/com.alibaba/fastjson"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT'
Expand All @@ -32,7 +35,7 @@ plugins {
id "net.minecraftforge.gradle.forge" version "2.0.2"
}
*/
version = "3.9.3"
version = "4.0"
group= "com.greencat" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "Antimony-Client"

Expand Down Expand Up @@ -64,6 +67,7 @@ tasks.withType(JavaCompile) {
dependencies {
//implementation 'org.jetbrains:annotations:20.1.0'
implementation 'org.jetbrains:annotations:23.0.0'
implementation group: 'com.alibaba', name: 'fastjson', version: '1.2.83'
//implementation 'com.google.code.gson:gson:2.10'
implementation fileTree(dir: 'libs', include: ['*.jar'])

Expand Down
138 changes: 124 additions & 14 deletions src/main/java/com/greencat/Antimony.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
import com.greencat.antimony.core.FunctionManager.FunctionManager;
import com.greencat.antimony.common.function.CustomItemName;
import com.greencat.antimony.core.Pathfinder;
import com.greencat.antimony.core.gui.ClickGUI;
import com.greencat.antimony.core.gui.KeyBindsGUI;
import com.greencat.antimony.core.PathfinderProxy;
import com.greencat.antimony.utils.Utils;
import net.minecraft.client.Minecraft;
import net.minecraft.command.CommandBase;
Expand Down Expand Up @@ -137,18 +136,17 @@ public void processCommand(ICommandSender sender, String[] args) throws CommandE
FakeBan.active(str);
}
}
if (args.length == 4) {
if (args.length == 5) {
if(args[0].equalsIgnoreCase("goto")){
try {
Minecraft mc = Minecraft.getMinecraft();
Pathfinder.setup(new BlockPos(Utils.floorVec(mc.thePlayer.getPositionVector())), new BlockPos(Integer.parseInt(args[1]), Integer.parseInt(args[2]), Integer.parseInt(args[3])), 0.0D);
if(Pathfinder.hasPath()){
FunctionManager.switchStatus("Pathfinding");
} else {
utils.print("无法找到去此方块的路径");
PathfinderProxy.calcPathDistance(new BlockPos(Integer.parseInt(args[1]), Integer.parseInt(args[2]), Integer.parseInt(args[3])), Integer.parseInt(args[4]));
if (!PathfinderProxy.running && Pathfinder.hasPath()) {
if (!FunctionManager.getStatus("Pathfinding")) {
FunctionManager.setStatus("Pathfinding", true);
}
}
} catch (Exception e) {
utils.print("寻找路径时出错");
Utils.print("寻找路径时出错");
e.printStackTrace();
}

Expand Down
28 changes: 3 additions & 25 deletions src/main/java/com/greencat/antimony/common/decorate/Events.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,38 +9,16 @@
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

import java.util.Map;

public class Events {
public Events() {
MinecraftForge.EVENT_BUS.register(this);
}
@SubscribeEvent
public void Render(RenderLivingEvent.Pre<EntityLivingBase> event){
if(event.entity instanceof EntityPlayer) {
try {
for(Map.Entry<String,String> entry : Antimony.GroundDecorateList.entrySet()) {
if(entry.getKey().equalsIgnoreCase(EnumChatFormatting.getTextWithoutFormattingCodes(event.entity.getName()))){
GroundDecorate.draw(event.entity.posX, event.entity.posY, event.entity.posZ,new ResourceLocation(Antimony.MODID,"ground/" + entry.getValue() + ".png"));
}
}
} catch(Exception e){
e.printStackTrace();
if(Antimony.GroundDecorateList.containsKey(EnumChatFormatting.getTextWithoutFormattingCodes(event.entity.getName()))){
GroundDecorate.draw(event.entity.posX, event.entity.posY, event.entity.posZ,new ResourceLocation(Antimony.MODID,"ground/" + Antimony.GroundDecorateList.get(EnumChatFormatting.getTextWithoutFormattingCodes(event.entity.getName())) + ".png"));
}
}
}
/*@SubscribeEvent
public void RenderSelfDecorate(RenderWorldLastEvent event){
if(Minecraft.getMinecraft().gameSettings.thirdPersonView == 0){
try {
for (Map.Entry<String, String> entry : Antimony.GroundDecorateList.entrySet()) {
if (entry.getKey().equalsIgnoreCase(EnumChatFormatting.getTextWithoutFormattingCodes(Minecraft.getMinecraft().thePlayer.getName()))) {
GroundDecorate.draw(Minecraft.getMinecraft().thePlayer.posX, Minecraft.getMinecraft().thePlayer.posY, Minecraft.getMinecraft().thePlayer.posZ,new ResourceLocation(Antimony.MODID,"ground/" + entry.getValue() + ".png"));
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}*/
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public void ClientTickEvent(TickEvent.ClientTickEvent event){
}
if (tick == maxTick) {
KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindRight.getKeyCode(), false);
tick = 0;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package com.greencat.antimony.common.function;

import com.greencat.antimony.core.FunctionManager.FunctionManager;
import com.greencat.antimony.core.auctionTracker.AuctionItem;
import com.greencat.antimony.core.config.getConfigByFunctionName;
import com.greencat.antimony.core.event.CustomEventHandler;
import net.minecraft.client.Minecraft;
import net.minecraft.event.ClickEvent;
import net.minecraft.util.*;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;

import java.util.UUID;

public class AuctionTracker {
public AuctionTracker() {
MinecraftForge.EVENT_BUS.register(this);
CustomEventHandler.EVENT_BUS.register(this);
}
@SubscribeEvent
public void onTick(TickEvent.ClientTickEvent event){
if(FunctionManager.getStatus("AuctionTracker")){
if(com.greencat.antimony.core.auctionTracker.AuctionTracker.finish && System.currentTimeMillis() - com.greencat.antimony.core.auctionTracker.AuctionTracker.lastGet > ((Integer) getConfigByFunctionName.get("AuctionTracker","cooldown") * 1000)){
com.greencat.antimony.core.auctionTracker.AuctionTracker.getAuctions();
}
if (com.greencat.antimony.core.auctionTracker.AuctionTracker.finish && !com.greencat.antimony.core.auctionTracker.AuctionTracker.auctions.isEmpty()) {
new Thread(() -> {
for(AuctionItem item : com.greencat.antimony.core.auctionTracker.AuctionTracker.auctions){
if(Minecraft.getMinecraft().thePlayer != null){
ChatComponentText text = new ChatComponentText(EnumChatFormatting.GOLD + "Item: " + item.item_name + EnumChatFormatting.GOLD + " | Coins: " + item.item_name);
ChatStyle style = text.getChatStyle();
String uuid = item.uuid.substring(0,8) + "-" + item.uuid.substring(8,12) + "-" + item.uuid.substring(12,16) + "-" + item.uuid.substring(16,20) + "-" + item.uuid.substring(20,32);
style.setChatClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND,"/viewauction " + uuid));
Minecraft.getMinecraft().thePlayer.addChatMessage(text);
}
}
com.greencat.antimony.core.auctionTracker.AuctionTracker.auctions.clear();
});
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class AutoFish {
public static boolean emberStatus = false;
static int Tick = 40;
static int hookTick = -1;
static int maxHookTick = 1400;
static int maxHookTick = 920;
static boolean MoveStatus = false;
static Boolean AutoFishStatus = false;
static Boolean slugFish = false;
Expand Down Expand Up @@ -58,7 +58,7 @@ public void init() {
@SubscribeEvent
public void WorldChangeTrigger(WorldEvent.Load event) {
if (FunctionManager.getStatus("AutoFish")) {
new Utils().print("检测到世界服务器改变,自动关闭AutoFish");
Utils.print("检测到世界服务器改变,自动关闭AutoFish");
FunctionManager.setStatus("AutoFish", false);
}
}
Expand Down Expand Up @@ -174,7 +174,7 @@ public void ClientTick(TickEvent.ClientTickEvent event) {
if ((Boolean) getConfigByFunctionName.get("AutoFish", "throwHook")) {
if (!isHookThrown() && Minecraft.getMinecraft().thePlayer.getHeldItem() != null && Minecraft.getMinecraft().thePlayer.getHeldItem().getItem() == Items.fishing_rod) {
if (hookThrownCooldown + 1 > (Integer) getConfigByFunctionName.get("AutoFish", "throwHookCooldown") * 40) {
utils.print("到达设定时间,自动抛竿");
Utils.print("到达设定时间,自动抛竿");
Minecraft.getMinecraft().playerController.sendUseItem(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().theWorld, Minecraft.getMinecraft().thePlayer.getHeldItem());
hookThrownCooldown = 0;
} else {
Expand All @@ -193,7 +193,7 @@ public void ClientTick(TickEvent.ClientTickEvent event) {
init();
AutoFishStatus = false;
if ((Boolean) getConfigByFunctionName.get("AutoFish", "message")) {
utils.print("钓鱼检测状态:关闭");
Utils.print("钓鱼检测状态:关闭");
}
hookTick = -1;
}
Expand All @@ -204,7 +204,7 @@ public void ClientTick(TickEvent.ClientTickEvent event) {
AutoFishStatus = true;
hookTick = 0;
if ((Boolean) getConfigByFunctionName.get("AutoFish", "message")) {
utils.print("钓鱼检测状态:开启");
Utils.print("钓鱼检测状态:开启");
}
nextTickThrow = false;
}
Expand All @@ -229,15 +229,15 @@ public void onPacketReceived(PlaySoundEvent event) throws AWTException {
init();
AutoFishStatus = false;
if ((Boolean) getConfigByFunctionName.get("AutoFish", "message")) {
utils.print("钓鱼检测状态:关闭");
Utils.print("钓鱼检测状态:关闭");
}
hookTick = -1;
}
} else {
init();
AutoFishStatus = false;
if ((Boolean) getConfigByFunctionName.get("AutoFish", "message")) {
utils.print("钓鱼检测状态:关闭");
Utils.print("钓鱼检测状态:关闭");
}
hookTick = -1;
}
Expand All @@ -247,7 +247,7 @@ public void onPacketReceived(PlaySoundEvent event) throws AWTException {
AutoFishStatus = true;
hookTick = 0;
if ((Boolean) getConfigByFunctionName.get("AutoFish", "message")) {
utils.print("钓鱼检测状态:开启");
Utils.print("钓鱼检测状态:开启");
}
}
}
Expand All @@ -263,7 +263,7 @@ public void PLayerInteract(PlayerInteractEvent event) {
if (AutoFishStatus) {
AutoFishStatus = false;
if ((Boolean) getConfigByFunctionName.get("AutoFish", "message")) {
utils.print("钓鱼检测状态:关闭");
Utils.print("钓鱼检测状态:关闭");
}
}
}
Expand Down
20 changes: 8 additions & 12 deletions src/main/java/com/greencat/antimony/common/function/AutoLeave.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.world.WorldEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import static com.greencat.antimony.core.PlayerNameFilter.isValid;

import java.util.ArrayList;
import java.util.List;
Expand All @@ -35,7 +37,7 @@ public void onTick(TickEvent.ClientTickEvent event){
List<EntityPlayer> entityList = Minecraft.getMinecraft().theWorld.getEntitiesWithinAABB(EntityPlayer.class, new AxisAlignedBB(x - (bound / 2d), y - (bound / 2d), z - (bound / 2d), x + (bound / 2d), y + (bound / 2d), z + (bound / 2d)), null);
validList.clear();
for (EntityPlayer entityplayer : entityList) {
if (isValid(entityplayer)) {
if (isValid(entityplayer,true)) {
validList.add(entityplayer);
}
}
Expand Down Expand Up @@ -80,17 +82,11 @@ public void onRender(RenderGameOverlayEvent event) {
}
}
}
public Boolean isValid(EntityPlayer player){
if(!Utils.isNPC(player) && player != Minecraft.getMinecraft().thePlayer){
if(!player.getName().contains("Goblin") && !player.getName().contains("Ice Walker") && !player.getName().contains("Weakling") && !player.getName().contains("Frozen Steve")){
if(!player.isInvisible()) {
return true;
} else {
return player.getEquipmentInSlot(0) != null || player.getEquipmentInSlot(1) != null || player.getEquipmentInSlot(2) != null || player.getEquipmentInSlot(3) != null || player.getEquipmentInSlot(4) != null;
}
}
return false;
@SubscribeEvent
public void WorldChangeTrigger(WorldEvent.Load event) {
if (FunctionManager.getStatus("AutoLeave")) {
Utils.print("检测到世界服务器改变,自动关闭AutoLeave");
FunctionManager.setStatus("AutoLeave", false);
}
return false;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package com.greencat.antimony.common.function;

import com.greencat.antimony.core.FunctionManager.FunctionManager;
import com.greencat.antimony.core.config.getConfigByFunctionName;
import com.greencat.antimony.core.event.CustomEventHandler;
import net.minecraft.client.Minecraft;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraft.network.play.client.C02PacketUseEntity;
import net.minecraft.network.play.client.C09PacketHeldItemChange;
import net.minecraft.util.BlockPos;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;

public class AutoWeapon {
public static boolean isEnable = false;
public static long latest;
public AutoWeapon(){
MinecraftForge.EVENT_BUS.register(this);
CustomEventHandler.EVENT_BUS.register(this);
}
@SubscribeEvent
public void onTick(TickEvent.ClientTickEvent event){
if(FunctionManager.getStatus("AutoWeapon")){
isEnable = true;
} else {
isEnable = false;
}
}
@SubscribeEvent
public void onPacketSent(CustomEventHandler.PacketSentEvent event){
if (isEnable && event.packet instanceof C02PacketUseEntity && ((C02PacketUseEntity) event.packet).getAction() == C02PacketUseEntity.Action.ATTACK){
Switch();
}
}
public static void Switch(){
try {
if (System.currentTimeMillis() - latest >= 0) {
latest = System.currentTimeMillis();
ItemStack hand = Minecraft.getMinecraft().thePlayer.getHeldItem();
if (hand == null || !(hand.getItem() instanceof ItemSword)) {
for (int i = 0; i < 8; ++i) {
ItemStack stack = Minecraft.getMinecraft().thePlayer.inventory.mainInventory[i];
if (stack != null && stack.getItem() instanceof ItemSword) {
Minecraft.getMinecraft().getNetHandler().getNetworkManager().sendPacket(new C09PacketHeldItemChange(i));
Minecraft.getMinecraft().thePlayer.inventory.currentItem = i;
break;
}
}
}
}
} catch(Exception e){
e.printStackTrace();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.greencat.antimony.common.function;

import com.greencat.antimony.core.FunctionManager.FunctionManager;
import com.greencat.antimony.core.Pathfinding;
import com.greencat.antimony.core.config.getConfigByFunctionName;
import com.greencat.antimony.core.event.CustomEventHandler;
import com.greencat.antimony.core.Pathfinder;
Expand Down
44 changes: 44 additions & 0 deletions src/main/java/com/greencat/antimony/common/function/BHop.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package com.greencat.antimony.common.function;

import com.greencat.antimony.core.FunctionManager.FunctionManager;
import com.greencat.antimony.core.config.getConfigByFunctionName;
import com.greencat.antimony.core.event.CustomEventHandler;
import com.greencat.antimony.utils.Utils;
import net.minecraft.client.Minecraft;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;

public class BHop {
public static boolean isEnable = false;
public static boolean useStrafe = false;
public BHop() {
MinecraftForge.EVENT_BUS.register(this);
CustomEventHandler.EVENT_BUS.register(this);
}
@SubscribeEvent
public void onTick(TickEvent.ClientTickEvent event){
if(FunctionManager.getStatus("BHop")){
isEnable = true;
useStrafe = (Boolean) getConfigByFunctionName.get("BHop","strafe");
} else {
isEnable = false;
}
}
@SubscribeEvent
public void onMotionPre(CustomEventHandler.MotionChangeEvent.Pre event){
if(isEnable && !Minecraft.getMinecraft().thePlayer.isInWater() && !Minecraft.getMinecraft().thePlayer.isInLava()){
if(Utils.isMoving()){
if(Minecraft.getMinecraft().thePlayer.onGround){
Minecraft.getMinecraft().thePlayer.jump();
if (useStrafe) {
Utils.strafe();
}
}
} else if(useStrafe){
Minecraft.getMinecraft().thePlayer.motionX = 0.0F;
Minecraft.getMinecraft().thePlayer.motionZ = 0.0F;
}
}
}
}
Loading

0 comments on commit f2c6ce6

Please sign in to comment.