aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoseGoldIsntGay <yoavkau@gmail.com>2022-01-21 19:06:33 +0200
committerRoseGoldIsntGay <yoavkau@gmail.com>2022-01-21 19:06:33 +0200
commitfdc569f2ab7674d850d25b41519b4e3da244dd00 (patch)
tree941cc71de47f731920ba19816d8103606cbbdbfc /src
parent5db7e7cb4918c64f25f57797345b9bc6c0527942 (diff)
downloadRGA-fdc569f2ab7674d850d25b41519b4e3da244dd00.tar.gz
RGA-fdc569f2ab7674d850d25b41519b4e3da244dd00.tar.bz2
RGA-fdc569f2ab7674d850d25b41519b4e3da244dd00.zip
2.7.0-pre2
Diffstat (limited to 'src')
-rw-r--r--src/main/java/rosegoldaddons/Config.java8
-rw-r--r--src/main/java/rosegoldaddons/Main.java4
-rw-r--r--src/main/java/rosegoldaddons/features/CropNuker.java15
-rw-r--r--src/main/java/rosegoldaddons/features/MithrilNuker.java8
-rw-r--r--src/main/java/rosegoldaddons/features/PinglessMining.java132
-rw-r--r--src/main/java/rosegoldaddons/mixins/MixinRenderString.java27
6 files changed, 168 insertions, 26 deletions
diff --git a/src/main/java/rosegoldaddons/Config.java b/src/main/java/rosegoldaddons/Config.java
index 658b1df..c0a0908 100644
--- a/src/main/java/rosegoldaddons/Config.java
+++ b/src/main/java/rosegoldaddons/Config.java
@@ -129,6 +129,14 @@ public class Config extends Vigilant {
category = "Mining", subcategory = "General")
public boolean includeOres = false;
+ @Property(type = PropertyType.SWITCH, name = "Pingless Mining", description = "Mines the next block before the previous block breaks, instabreak only",
+ category = "Mining", subcategory = "General")
+ public boolean pinglessMining = false;
+
+ @Property(type = PropertyType.SELECTOR, name = "Pingless Mining Speed", description = "Determine how long to wait before mining the next block",
+ category = "Mining", subcategory = "General", options = {"20 BPS (Legit)", "40 BPS", "80 BPS"})
+ public int pinglessSpeed = 0;
+
@Property(type = PropertyType.SWITCH, name = "Auto Slayer", description = "Automatically use batphone",
category = "RoseGoldAddons", subcategory = "General")
public boolean autoSlayer = false;
diff --git a/src/main/java/rosegoldaddons/Main.java b/src/main/java/rosegoldaddons/Main.java
index 495114b..bd91b90 100644
--- a/src/main/java/rosegoldaddons/Main.java
+++ b/src/main/java/rosegoldaddons/Main.java
@@ -107,6 +107,7 @@ public class Main {
MinecraftForge.EVENT_BUS.register(new CanePlanter());
MinecraftForge.EVENT_BUS.register(new ArmorStandESPs());
MinecraftForge.EVENT_BUS.register(new DamagePerSecond());
+ MinecraftForge.EVENT_BUS.register(new PinglessMining());
configFile.initialize();
ClientCommandHandler.instance.registerCommand(new OpenSettings());
ClientCommandHandler.instance.registerCommand(new Rosedrobe());
@@ -119,7 +120,8 @@ public class Main {
String[] temp = getUrlContents("https://gist.github.com/RoseGoldIsntGay/6fa79111ae8efe3f5d269a095d748aa5/raw").split("\n");
for(String str : temp) {
- resp.put(str.substring(0, str.indexOf(":")), str.substring(str.indexOf(": ") + 2));
+ resp.put(str.substring(0, str.indexOf(":")), str.substring(str.indexOf(": ") + 2).replace("&", "§"));
+ System.out.println(str.substring(0, str.indexOf(":"))+" "+str.substring(str.indexOf(": ") + 2).replace("&", "§"));
}
init = true;
diff --git a/src/main/java/rosegoldaddons/features/CropNuker.java b/src/main/java/rosegoldaddons/features/CropNuker.java
index 46744df..fc00737 100644
--- a/src/main/java/rosegoldaddons/features/CropNuker.java
+++ b/src/main/java/rosegoldaddons/features/CropNuker.java
@@ -5,15 +5,19 @@ import net.minecraft.client.Minecraft;
import net.minecraft.init.Blocks;
import net.minecraft.network.play.client.C07PacketPlayerDigging;
import net.minecraft.util.*;
+import net.minecraftforge.client.event.RenderWorldLastEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import rosegoldaddons.Main;
import rosegoldaddons.utils.ChatUtils;
import rosegoldaddons.utils.PlayerUtils;
+import rosegoldaddons.utils.RenderUtils;
+import java.awt.*;
import java.util.ArrayList;
public class CropNuker {
+ private static BlockPos crop = null;
private static final ArrayList<BlockPos> broken = new ArrayList<>();
private static int ticks = 0;
@@ -24,7 +28,7 @@ public class CropNuker {
broken.clear();
return;
}
- BlockPos crop = closestCrop();
+ crop = closestCrop();
if (crop != null) {
Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, crop, EnumFacing.DOWN));
PlayerUtils.swingItem();
@@ -33,7 +37,16 @@ public class CropNuker {
}
+ @SubscribeEvent
+ public void onRender(RenderWorldLastEvent event) {
+ if (!Main.nukeCrops) return;
+ if(crop != null) {
+ RenderUtils.drawBlockBox(crop, new Color(255, 0, 0), true, event.partialTicks);
+ }
+ }
+
private BlockPos closestCrop() {
+ if(Minecraft.getMinecraft().theWorld == null) return null;
double r = 6;
BlockPos playerPos = Minecraft.getMinecraft().thePlayer.getPosition();
playerPos = playerPos.add(0, 1, 0);
diff --git a/src/main/java/rosegoldaddons/features/MithrilNuker.java b/src/main/java/rosegoldaddons/features/MithrilNuker.java
index a6c2be4..c84b378 100644
--- a/src/main/java/rosegoldaddons/features/MithrilNuker.java
+++ b/src/main/java/rosegoldaddons/features/MithrilNuker.java
@@ -4,14 +4,12 @@ import net.minecraft.block.*;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.init.Blocks;
-import net.minecraft.item.EnumDyeColor;
import net.minecraft.network.play.client.C07PacketPlayerDigging;
import net.minecraft.util.*;
import net.minecraftforge.client.event.RenderWorldLastEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import rosegoldaddons.Main;
-import rosegoldaddons.utils.ChatUtils;
import rosegoldaddons.utils.PlayerUtils;
import rosegoldaddons.utils.RenderUtils;
import rosegoldaddons.utils.RotationUtils;
@@ -26,7 +24,7 @@ public class MithrilNuker {
@SubscribeEvent
public void onTick(TickEvent.ClientTickEvent event) {
- if (!Main.mithrilNuker) {
+ if (!Main.mithrilNuker || Minecraft.getMinecraft().thePlayer == null || Minecraft.getMinecraft().theWorld == null) {
currentDamage = 0;
return;
}
@@ -66,7 +64,7 @@ public class MithrilNuker {
@SubscribeEvent
public void renderWorld(RenderWorldLastEvent event) {
- if (!Main.mithrilNuker) return;
+ if (!Main.mithrilNuker || Minecraft.getMinecraft().theWorld == null) return;
if (blockPos != null) {
IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos);
if(blockState.getBlock() == Blocks.stone) {
@@ -79,7 +77,7 @@ public class MithrilNuker {
private BlockPos closestMithril() {
int r = 6;
- if (Minecraft.getMinecraft().thePlayer == null) return null;
+ if (Minecraft.getMinecraft().thePlayer == null || Minecraft.getMinecraft().theWorld == null) return null;
BlockPos playerPos = Minecraft.getMinecraft().thePlayer.getPosition();
playerPos = playerPos.add(0, 1, 0);
Vec3 playerVec = Minecraft.getMinecraft().thePlayer.getPositionVector();
diff --git a/src/main/java/rosegoldaddons/features/PinglessMining.java b/src/main/java/rosegoldaddons/features/PinglessMining.java
new file mode 100644
index 0000000..9b21e91
--- /dev/null
+++ b/src/main/java/rosegoldaddons/features/PinglessMining.java
@@ -0,0 +1,132 @@
+package rosegoldaddons.features;
+
+import net.minecraft.block.Block;
+import net.minecraft.block.state.IBlockState;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.settings.KeyBinding;
+import net.minecraft.init.Blocks;
+import net.minecraft.network.play.client.C07PacketPlayerDigging;
+import net.minecraft.util.*;
+import net.minecraftforge.client.event.RenderWorldLastEvent;
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
+import net.minecraftforge.fml.common.gameevent.TickEvent;
+import rosegoldaddons.Main;
+import rosegoldaddons.utils.PlayerUtils;
+import rosegoldaddons.utils.RenderUtils;
+
+import java.awt.*;
+import java.util.ArrayList;
+
+public class PinglessMining {
+ private static BlockPos block = null;
+ private static final ArrayList<BlockPos> broken = new ArrayList<>();
+ private final KeyBinding lc = Minecraft.getMinecraft().gameSettings.keyBindAttack;
+ private static int ticks = 0;
+
+ @SubscribeEvent
+ public void onTick80(TickEvent.PlayerTickEvent event) {
+ if (!Main.configFile.pinglessMining) return;
+ if (Main.configFile.pinglessSpeed == 0 || Main.configFile.pinglessSpeed == 1) return;
+ ticks++;
+ if(ticks % 80 == 0) {
+ broken.clear();
+ }
+ if (lc != null && lc.isKeyDown()) {
+ if (block != null) {
+ MovingObjectPosition movingObjectPosition = Minecraft.getMinecraft().objectMouseOver;
+ if (movingObjectPosition != null && movingObjectPosition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
+ Block b = Minecraft.getMinecraft().theWorld.getBlockState(movingObjectPosition.getBlockPos()).getBlock();
+ if (b == Blocks.stone || b == Blocks.emerald_ore || b == Blocks.lapis_ore || b == Blocks.redstone_ore ||
+ b == Blocks.iron_ore || b == Blocks.gold_ore || b == Blocks.coal_ore || b == Blocks.diamond_ore) {
+ broken.add(block);
+ Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, block, EnumFacing.DOWN));
+ PlayerUtils.swingItem();
+ }
+ }
+ }
+ }
+ }
+
+ @SubscribeEvent
+ public void onTick40(TickEvent.PlayerTickEvent event) {
+ if (!Main.configFile.pinglessMining) return;
+ if (Main.configFile.pinglessSpeed == 2) return;
+ if (Main.configFile.pinglessSpeed == 0 && event.phase == TickEvent.Phase.END) return;
+ ticks++;
+ if(ticks % 80 == 0) {
+ broken.clear();
+ }
+ if (lc != null && lc.isKeyDown()) {
+ if (block != null) {
+ MovingObjectPosition movingObjectPosition = Minecraft.getMinecraft().objectMouseOver;
+ if (movingObjectPosition != null && movingObjectPosition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
+ Block b = Minecraft.getMinecraft().theWorld.getBlockState(movingObjectPosition.getBlockPos()).getBlock();
+ if (b == Blocks.stone || b == Blocks.emerald_ore || b == Blocks.lapis_ore || b == Blocks.redstone_ore ||
+ b == Blocks.iron_ore || b == Blocks.gold_ore || b == Blocks.coal_ore || b == Blocks.diamond_ore) {
+ broken.add(block);
+ Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, block, EnumFacing.DOWN));
+ PlayerUtils.swingItem();
+ }
+ }
+ }
+ }
+ }
+
+ @SubscribeEvent
+ public void onRender(RenderWorldLastEvent event) {
+ if (!Main.configFile.pinglessMining || Minecraft.getMinecraft().thePlayer == null || Minecraft.getMinecraft().theWorld == null) {
+ broken.clear();
+ return;
+ }
+ block = closestBlock(event);
+ if (block != null) {
+ RenderUtils.drawBlockBox(block, new Color(255, 0, 0), true, event.partialTicks);
+ }
+ }
+
+ private BlockPos closestBlock(RenderWorldLastEvent event) {
+ int r = 5;
+ BlockPos playerPos = Minecraft.getMinecraft().thePlayer.getPosition().add(0, 1, 0);
+ Vec3 playerVec = Minecraft.getMinecraft().thePlayer.getPositionVector();
+ Vec3i vec3i = new Vec3i(r, r, r);
+ ArrayList<Vec3> blocks = new ArrayList<>();
+ for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) {
+ IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos);
+ if (isLookingAtBlock(blockPos, event) && !broken.contains(blockPos) && blockState.getBlock() != Blocks.air) {
+ blocks.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5));
+ }
+ }
+ double smallest = 9999;
+ Vec3 closest = null;
+ for (Vec3 block : blocks) {
+ double dist = block.distanceTo(playerVec);
+ if (dist < smallest) {
+ smallest = dist;
+ closest = block;
+ }
+ }
+ if (closest != null) {
+ return new BlockPos(closest.xCoord, closest.yCoord, closest.zCoord);
+ }
+ return null;
+ }
+
+ private boolean isLookingAtBlock(BlockPos blockPos, RenderWorldLastEvent event) {
+ AxisAlignedBB aabb = AxisAlignedBB.fromBounds(blockPos.getX(), blockPos.getY(), blockPos.getZ(), blockPos.getX() + 1, blockPos.getY() + 1, blockPos.getZ() + 1);
+ Vec3 position = new Vec3(Minecraft.getMinecraft().thePlayer.posX, (Minecraft.getMinecraft().thePlayer.posY + Minecraft.getMinecraft().thePlayer.getEyeHeight()), Minecraft.getMinecraft().thePlayer.posZ);
+ Vec3 look = Minecraft.getMinecraft().thePlayer.getLook(event.partialTicks);
+ look = scaleVec(look, 0.2F);
+ for (int i = 0; i < 40; i++) {
+ if (aabb.minX <= position.xCoord && aabb.maxX >= position.xCoord && aabb.minY <= position.yCoord && aabb.maxY >= position.yCoord && aabb.minZ <= position.zCoord && aabb.maxZ >= position.zCoord) {
+ return true;
+ }
+ position = position.add(look);
+ }
+
+ return false;
+ }
+
+ private static Vec3 scaleVec(Vec3 vec, float f) {
+ return new Vec3(vec.xCoord * (double) f, vec.yCoord * (double) f, vec.zCoord * (double) f);
+ }
+}
diff --git a/src/main/java/rosegoldaddons/mixins/MixinRenderString.java b/src/main/java/rosegoldaddons/mixins/MixinRenderString.java
index 6e95444..4db798b 100644
--- a/src/main/java/rosegoldaddons/mixins/MixinRenderString.java
+++ b/src/main/java/rosegoldaddons/mixins/MixinRenderString.java
@@ -1,42 +1,31 @@
package rosegoldaddons.mixins;
-import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.Shadow;
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.ModifyVariable;
import rosegoldaddons.Main;
-import rosegoldaddons.utils.ChatUtils;
import java.util.Map;
-@Mixin(value = FontRenderer.class, priority = 999)
+@Mixin(FontRenderer.class)
public abstract class MixinRenderString {
- @Shadow
- protected abstract void renderStringAtPos(String text, boolean shadow);
- @Inject(method = "renderStringAtPos", at = @At("HEAD"), cancellable = true)
- private void renderString(String text, boolean shadow, CallbackInfo ci) {
+ @ModifyVariable(method = "renderString", at = @At(value = "FIELD"))
+ private String replaceName(String text) {
if(Main.configFile.wydsi && text.contains("727")) {
- ci.cancel();
- renderStringAtPos(text.replace("727", "726"), shadow);
+ text = text.replace("727", "726");
}
if (Main.init) {
for (Map.Entry<String, String> entry : Main.resp.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
- if (text.contains(key)) {
- ci.cancel();
- try {
- renderStringAtPos(text.replaceAll(key, value).replace("&", "§"), shadow);
- } catch (Exception e) {
- ChatUtils.sendMessage(e.toString());
- }
+ if (text.contains(key) && !text.contains(value)) {
+ text = text.replace(key, value)+"§r";
}
}
}
+ return text;
}
}