Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
ItziSpyder authored Apr 2, 2023
1 parent 1fb6528 commit 6e79dbb
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 18 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ org.gradle.jvmargs=-Xmx1G
loader_version=0.14.14

# Mod Properties
mod_version = 1.19.3-0.6.2
mod_version = 1.19.3-0.6.3
maven_group = io.github.itzispyder
archives_base_name = ClickCrystals

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
import io.github.itzispyder.clickcrystals.events.Listener;
import io.github.itzispyder.clickcrystals.events.events.PacketSendEvent;
import io.github.itzispyder.clickcrystals.modules.Module;
import io.github.itzispyder.clickcrystals.scheduler.ScheduledTask;
import io.github.itzispyder.clickcrystals.util.BlockUtils;
import io.github.itzispyder.clickcrystals.util.HotbarUtils;
import io.github.itzispyder.clickcrystals.util.Randomizer;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.RespawnAnchorBlock;
import net.minecraft.item.Items;
import net.minecraft.network.packet.c2s.play.PlayerInteractBlockC2SPacket;
import net.minecraft.util.math.BlockPos;

/**
* GlowStoneSearch module
Expand Down Expand Up @@ -42,25 +42,29 @@ protected void onDisable() {
@EventHandler
private void onPacketSend(PacketSendEvent e) {
if (e.getPacket() instanceof PlayerInteractBlockC2SPacket packet) {
BlockState state = mc.player.getWorld().getBlockState(packet.getBlockHitResult().getBlockPos());
BlockPos pos = packet.getBlockHitResult().getBlockPos();
BlockState state = mc.player.getWorld().getBlockState(pos);
if (state == null) return;
if (!mc.options.useKey.isPressed()) return;

try {
if (state.isOf(Blocks.RESPAWN_ANCHOR)) {
int charges = state.get(RespawnAnchorBlock.CHARGES); // charges of the clicked block
if (HotbarUtils.isHolding(Items.GLOWSTONE) && charges > 0) { // after charging the anchor
new ScheduledTask(() -> {
HotbarUtils.search(Items.RESPAWN_ANCHOR);
}).runDelayedTask(Randomizer.rand(50));
return;
if (HotbarUtils.isHolding(Items.RESPAWN_ANCHOR)) {
if (!state.isOf(Blocks.RESPAWN_ANCHOR)) HotbarUtils.search(Items.GLOWSTONE);
else {
int charges = state.get(RespawnAnchorBlock.CHARGES);
if (charges >= 1) return;
e.setCancelled(true);
HotbarUtils.search(Items.GLOWSTONE);
BlockUtils.interact(pos,packet.getBlockHitResult().getSide());
}
}

if (HotbarUtils.isHolding(Items.RESPAWN_ANCHOR) && !state.isOf(Blocks.RESPAWN_ANCHOR)) {
new ScheduledTask(() -> {
else if (HotbarUtils.isHolding(Items.GLOWSTONE)) {
if (!state.isOf(Blocks.RESPAWN_ANCHOR)) {
e.setCancelled(true);
HotbarUtils.search(Items.RESPAWN_ANCHOR);
BlockUtils.interact(pos,packet.getBlockHitResult().getSide());
HotbarUtils.search(Items.GLOWSTONE);
}).runDelayedTask(Randomizer.rand(50));
}
else HotbarUtils.search(Items.RESPAWN_ANCHOR);
}
} catch (Exception ignore) {}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import net.minecraft.item.Items;
import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;

/**
* ObsidianSearch module
Expand All @@ -36,7 +35,7 @@ protected void onDisable() {
@EventHandler
private void onPacketSend(PacketSendEvent e) {
if (e.getPacket() instanceof PlayerActionC2SPacket packet) {
if (!HotbarUtils.isHolding(Items.END_CRYSTAL)) return;
if (!(HotbarUtils.nameContains("crystal") || HotbarUtils.nameContains("totem") || HotbarUtils.nameContains("sword"))) return;
if (cooldown > System.currentTimeMillis()) return;
cooldown = System.currentTimeMillis() + (50 * 4);
if (packet.getAction() != PlayerActionC2SPacket.Action.START_DESTROY_BLOCK) return;
Expand Down

0 comments on commit 6e79dbb

Please sign in to comment.