Skip to content

Commit

Permalink
Initial commit v11: 32k-related module bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Snoworange420 committed Mar 10, 2023
1 parent 8eb7f2a commit b03e01d
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 127 deletions.
10 changes: 1 addition & 9 deletions src/main/java/nl/snoworange/cranberry/Main.java
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
package nl.snoworange.cranberry;

import net.minecraft.advancements.*;
import net.minecraft.client.multiplayer.ClientAdvancementManager;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.client.tutorial.Tutorial;
import net.minecraft.client.tutorial.TutorialSteps;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.AdvancementEvent;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
import net.minecraftforge.fml.common.registry.GameRegistry;
import nl.snoworange.cranberry.features.command.CommandManager;
import nl.snoworange.cranberry.features.friend.Friend;
import nl.snoworange.cranberry.features.module.ModuleManager;
Expand All @@ -28,7 +20,7 @@ public class Main {
//Refrences
public static final String MOD_ID = "cranberry";
public static final String NAME = "Cranberry";
public static final String VERSION = "v0.7.6";
public static final String VERSION = "v0.7.8";
public static final String ACCEPTED_MINECRAFT_VERSIONS = "[1.12.2]";
public static final Logger LOGGER = LogManager.getLogger("Cranberry");

Expand Down

This file was deleted.

17 changes: 0 additions & 17 deletions src/main/java/nl/snoworange/cranberry/event/events/DeathEvent.java

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import nl.snoworange.cranberry.event.events.PacketEvent;
import nl.snoworange.cranberry.features.module.Category;
import nl.snoworange.cranberry.features.module.Module;
import nl.snoworange.cranberry.features.module.modules.stronkswordmeta.Auto32k;
import nl.snoworange.cranberry.features.setting.Setting;
import nl.snoworange.cranberry.util.minecraft.BlockUtils;
import nl.snoworange.cranberry.util.minecraft.InventoryUtils;
Expand Down Expand Up @@ -79,7 +80,8 @@ public void onTick() {

int oldSlot = mc.player.inventory.currentItem;

if (onlyOnGround.getValue() && !mc.player.onGround) return;
if ((onlyOnGround.getValue() && !mc.player.onGround)
|| (Auto32k.getInstance().isEnabled() && Auto32k.getInstance().getPhase() != 8)) return;

mc.player.inventory.currentItem = pickaxeIndex;
mc.playerController.updateController();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void onPacketSend(PacketEvent.Send event) {
if (onlyHopper.getValue()) {

if (((CPacketCloseWindow) event.getPacket()).windowId == Auto32k.lastHopperGuiID
&& Main.moduleManager.getModuleByName("Auto32k").isEnabled()) {
&& Auto32k.getInstance().isEnabled()) {
event.setCanceled(true);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,15 @@
import net.minecraft.init.MobEffects;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemSword;
import net.minecraft.item.ItemTool;
import net.minecraft.network.play.client.CPacketUseEntity;
import net.minecraft.network.play.server.SPacketEntityStatus;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumParticleTypes;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.relauncher.ReflectionHelper;
import nl.snoworange.cranberry.event.events.PacketEvent;
import nl.snoworange.cranberry.event.events.TotemPopEvent;
import nl.snoworange.cranberry.features.module.Category;
import nl.snoworange.cranberry.features.module.Module;
import nl.snoworange.cranberry.util.minecraft.ChatUtils;

import java.util.UUID;
import java.util.concurrent.ThreadLocalRandom;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package nl.snoworange.cranberry.features.module.modules.stronkswordmeta;

import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.ai.attributes.IAttribute;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.network.play.client.CPacketHeldItemChange;
import net.minecraft.network.play.client.CPacketUseEntity;
import net.minecraft.network.play.server.SPacketEntityStatus;
import net.minecraft.util.EnumHand;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import nl.snoworange.cranberry.Main;
import nl.snoworange.cranberry.event.events.BozoJustDiedEvent;
import nl.snoworange.cranberry.event.events.TotemPopEvent;
import nl.snoworange.cranberry.event.events.PacketEvent;
import nl.snoworange.cranberry.features.module.Category;
import nl.snoworange.cranberry.features.module.Module;
import nl.snoworange.cranberry.features.setting.Setting;
Expand Down Expand Up @@ -77,26 +77,38 @@ public void onFastTick() {
}

@SubscribeEvent(priority = EventPriority.HIGH)
public void onTotemPop(TotemPopEvent event) {
if (this.isEnabled()) {
public void onPacket(PacketEvent.Receive event) {
if (this.isEnabled() && !n()) {

int stronkswordslot = InventoryUtils.findHotbar32k();
if (event.getPacket() instanceof SPacketEntityStatus) {

if (currentTarget == null || stronkswordslot == -1) return;
SPacketEntityStatus packet = (SPacketEntityStatus) event.getPacket();

new Thread(() -> {
mc.player.connection.sendPacket(new CPacketHeldItemChange(stronkswordslot));
mc.player.connection.sendPacket(new CPacketUseEntity(currentTarget));
mc.player.connection.sendPacket(new CPacketHeldItemChange(mc.player.inventory.currentItem));
if (swing.getValue()) mc.player.swingArm(EnumHand.MAIN_HAND);
}).start();
if (packet.getOpCode() == 35) {

Entity entity = packet.getEntity(mc.world);

if (entity instanceof EntityPlayer && !entity.getName().equalsIgnoreCase(mc.player.getName())) {

int stronkswordslot = InventoryUtils.findHotbar32k();

if (currentTarget == null || stronkswordslot == -1) return;

new Thread(() -> {
mc.player.connection.sendPacket(new CPacketHeldItemChange(stronkswordslot));
mc.player.connection.sendPacket(new CPacketUseEntity(currentTarget));
mc.player.connection.sendPacket(new CPacketHeldItemChange(mc.player.inventory.currentItem));
if (swing.getValue()) mc.player.swingArm(EnumHand.MAIN_HAND);
}).start();
}
}
}
}
}

@SubscribeEvent(priority = EventPriority.LOWEST)
public void onKrypticAndKeiranSkillIssue(BozoJustDiedEvent event) {
event.tooEasy(true);

Bad.getSkill().getGood().info(event.getPlayer().getName() + " is bad ong imagine being that bad");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ public class Auto32k extends Module {
public static int lastHopperGuiID = 0;
public boolean firstShulker = false;

private static Auto32k instance;

Timer timer = new Timer();

public final Setting<Meta> meta = register(new Setting<>("Meta", Meta.DISPENSER));
Expand All @@ -61,6 +63,7 @@ public class Auto32k extends Module {
public final Setting<Double> maxHopperRange = register(new Setting<>("MaxHopperRange", 5.0, 1.0, 7.0));
public final Setting<Boolean> selectSwordSlot = register(new Setting<>("Select32kSlot", true));
public final Setting<Boolean> checkFor32kShulks = register(new Setting<>("Force32kShulker", true));
public final Setting<Boolean> updateToOriginalSlot = register(new Setting<>("UpdateToOrigin", false));
public final Setting<Boolean> debug = register(new Setting<>("Debug", false));

public enum SearchMode {
Expand All @@ -73,6 +76,14 @@ public enum Meta {
HOPPER;
}

public static Auto32k getInstance() {
return instance != null ? instance : new Auto32k();
}

public int getPhase() {
return phase;
}

public Auto32k() {
super("Auto32k",
"Automatically bypasses the anti-illegal with a setup to retrieve a 32k sword",
Expand Down Expand Up @@ -116,8 +127,7 @@ public void onDisable() {

if (!n()) {

if (originalSlot != -1 && !selectSwordSlot.getValue()) update(originalSlot, false);
update(mc.player.inventory.currentItem, false);
if (originalSlot != -1 && !selectSwordSlot.getValue() && updateToOriginalSlot.getValue()) update(originalSlot, false);

mc.player.connection.sendPacket(new CPacketEntityAction(mc.player, CPacketEntityAction.Action.STOP_SNEAKING));
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/mcmod.info
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"modid": "cranberry",
"name": "Cranberry",
"description": "An advanced utility mod for Minecraft 1.12.2",
"version": "0.7.6",
"version": "0.7.7",
"mcversion": "1.12.2",
"url": "",
"updateUrl": "",
Expand Down

0 comments on commit b03e01d

Please sign in to comment.