Skip to content

Commit

Permalink
Merge pull request #290 from TechAle/v2.3.0
Browse files Browse the repository at this point in the history
EChestFarmer + FastBreak render done + OffHand improvements
  • Loading branch information
IUDevman authored May 9, 2021
2 parents be7b4c0 + b02f937 commit 8ed90aa
Show file tree
Hide file tree
Showing 13 changed files with 586 additions and 64 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.gamesense.api.util.player;

import com.gamesense.client.module.ModuleManager;
import com.gamesense.client.module.modules.combat.AutoCrystal;
import com.gamesense.client.module.modules.combat.OffHand;
import net.minecraft.block.Block;
import net.minecraft.block.BlockObsidian;
Expand All @@ -24,9 +26,9 @@ public static int findObsidianSlot(boolean offHandActived, boolean activeBefore)
int slot = -1;
List<ItemStack> mainInventory = mc.player.inventory.mainInventory;

if (offHandActived && OffHand.isActive()) {
if (offHandActived && ModuleManager.isModuleEnabled(OffHand.class)) {
if (!activeBefore) {
OffHand.requestObsidian();
OffHand.requestItems(0);
}
return 9;
}
Expand All @@ -53,7 +55,7 @@ public static int findSkullSlot(boolean offHandActived, boolean activeBefore) {

if (offHandActived) {
if (!activeBefore)
OffHand.requestSkull();
OffHand.requestItems(1);
return 9;
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/gamesense/api/util/player/NameUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static String resolveName(String uuid) {
}
}
}
} catch (IOException | ParseException e) {
} catch (Exception e) {
e.printStackTrace();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public void onDisable() {
AutoCrystal.stopAC = false;
// If offHand was enabled
if (slot_mat[0] == -2) {
OffHand.removeObsidian();
OffHand.removeItem(0);
}
}

Expand Down Expand Up @@ -307,7 +307,7 @@ private boolean placeBlock(BlockPos pos, int step) {
return false;

// If it's step of the obsidian and we have offHandMode
if (offHandObby.getValue() && OffHand.isActive() && slot_mat[utilSlot] == -2) {
if (offHandObby.getValue() && ModuleManager.isModuleEnabled(OffHand.class) && slot_mat[utilSlot] == -2) {
// Check if we have the obby in our offhand
if (mc.player.getHeldItemOffhand().getItem() instanceof ItemBlock && ((ItemBlock) mc.player.getHeldItemOffhand().getItem()).getBlock() instanceof BlockObsidian) {
// We can continue
Expand Down Expand Up @@ -462,9 +462,9 @@ private boolean getMaterialsSlot() {
}
}
// offHand obsidian
if (offHandObby.getValue() && OffHand.isActive()) {
if (offHandObby.getValue() && ModuleManager.isModuleEnabled(OffHand.class)) {
slot_mat[0] = -2;
OffHand.requestObsidian();
OffHand.requestItems(0);
}
// Count what we found
int count = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public void onEnable() {
disable();
return;
}
noObby = firstShift = alrPlaced = false;
noObby = firstShift = alrPlaced = activedBefore = false;
lastHitVec = null;
preRotationTick = afterRotationTick = 0;
}
Expand All @@ -106,7 +106,7 @@ public void onDisable() {
}

if (noObby) setDisabledMessage("Skull not found... Blocker turned OFF!");
if (offHandSkull.getValue()) OffHand.removeSkull();
if (offHandSkull.getValue()) OffHand.removeItem(1);
}

private boolean firstShift;
Expand Down Expand Up @@ -202,7 +202,6 @@ private void placeBlock() {
}

if (skullSlot == 9) {
activedBefore = true;
if (mc.player.getHeldItemOffhand().getItem() instanceof ItemSkull) {
// We can continue
handSwing = EnumHand.OFF_HAND;
Expand Down Expand Up @@ -234,9 +233,9 @@ private void placeBlock() {
oldSlot = -1;
}
firstShift = true;
activedBefore = alrPlaced = false;
activedBefore = alrPlaced = true;
if (offHandSkull.getValue())
OffHand.removeSkull();
OffHand.removeItem(1);

if (disableAfter.getValue()) {
disable();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.gamesense.api.util.player.PlayerUtil;
import com.gamesense.client.module.Category;
import com.gamesense.client.module.Module;
import com.gamesense.client.module.ModuleManager;
import net.minecraft.block.BlockObsidian;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
Expand Down Expand Up @@ -70,8 +71,8 @@ public void onDisable() {

AutoCrystal.stopAC = false;

if (offhandObby.getValue() && OffHand.isActive()) {
OffHand.removeObsidian();
if (offhandObby.getValue() && ModuleManager.isModuleEnabled(OffHand.class)) {
OffHand.removeItem(0);
activedOff = false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ private void blockAnvil() {
if (!found) {
if (activedBefore) {
activedBefore = false;
OffHand.removeObsidian();
OffHand.removeItem(0);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.gamesense.api.util.world.HoleUtil;
import com.gamesense.client.module.Category;
import com.gamesense.client.module.Module;
import com.gamesense.client.module.ModuleManager;
import net.minecraft.block.*;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
Expand Down Expand Up @@ -81,8 +82,8 @@ public void onDisable() {
}
recentPlacements.clear();

if (offHandObby.getValue() && OffHand.isActive()) {
OffHand.removeObsidian();
if (offHandObby.getValue() && ModuleManager.isModuleEnabled(OffHand.class)) {
OffHand.removeItem(0);
activedOff = false;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,7 @@ public class OffHand extends Module {
boolean returnBack,
stepChanging,
firstChange;
private static boolean activeT = false;
private static int forceObby;
private static int forceSkull;
private static String forceItem;
private final ArrayList<Long> switchDone = new ArrayList<>();
private final ArrayList<Item> ignoreNoSword = new ArrayList<Item>() {
{
Expand All @@ -82,24 +80,36 @@ public class OffHand extends Module {
}
};

public static boolean isActive() {
return activeT;
}

public static void requestObsidian() {
forceObby++;
}

public static void requestSkull() {
forceSkull = 1;
}

public static void removeSkull() {
forceSkull = 0;
public static void requestItems(int want) {
switch (want) {
case 0:
forceItem = "Obby";
break;
case 1:
forceItem = "Skull";
break;
case 2:
forceItem = "EChest";
break;
}
}

public static void removeObsidian() {
if (forceObby != 0) forceObby--;
public static void removeItem(int want) {
String check = "";
switch (want) {
case 0:
check = "Obby";
break;
case 1:
check = "Skull";
break;
case 2:
check = "EChest";
break;
}
if (forceItem.equals(check))
forceItem = "";
}

// Create maps of allowed items
Expand All @@ -117,23 +127,23 @@ public static void removeObsidian() {
put("Plates", Blocks.WOODEN_PRESSURE_PLATE);
put("Skull", Blocks.SKULL);
put("Obby", Blocks.OBSIDIAN);
put("Anvil", Blocks.ANVIL);
put("EChest", Blocks.ENDER_CHEST);
}
};

@Override
public void onEnable() {
// Enable it
activeT = firstChange = true;
firstChange = true;
// If they are gonna force us obby
forceObby = 0;

forceItem = "";
returnBack = false;
}

@Override
public void onDisable() {
activeT = false;
forceObby = forceSkull = 0;
forceItem = "";
}

@Override
Expand Down Expand Up @@ -237,15 +247,14 @@ private String getItem() {
normalOffHand = false;
itemCheck = "Totem";
}
// If forceSkull
if (forceSkull == 1) {
itemCheck = "Skull";
// If force items
if (!forceItem.equals("")) {
itemCheck = forceItem;
normalOffHand = false;
}
// If crystal obby
Item mainHandItem = mc.player.getHeldItemMainhand().getItem();
if (forceObby > 0
|| (normalOffHand && (
if ((normalOffHand && (
(crystObby.getValue() && mc.gameSettings.keyBindSneak.isKeyDown()
&& mainHandItem == Items.END_CRYSTAL)
|| (pickObby.getValue() && mainHandItem == Items.DIAMOND_PICKAXE && (!pickObbyShift.getValue() || mc.gameSettings.keyBindSneak.isKeyDown()))))) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.gamesense.api.util.world.BlockUtil;
import com.gamesense.client.module.Category;
import com.gamesense.client.module.Module;
import com.gamesense.client.module.ModuleManager;
import net.minecraft.block.BlockObsidian;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
Expand Down Expand Up @@ -77,8 +78,8 @@ public void onDisable() {

AutoCrystal.stopAC = false;

if (offhandObby.getValue() && OffHand.isActive()) {
OffHand.removeObsidian();
if (offhandObby.getValue() && ModuleManager.isModuleEnabled(OffHand.class)) {
OffHand.removeItem(0);
activedOff = false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.gamesense.api.util.world.BlockUtil;
import com.gamesense.client.module.Category;
import com.gamesense.client.module.Module;
import com.gamesense.client.module.ModuleManager;
import net.minecraft.block.BlockObsidian;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
Expand Down Expand Up @@ -78,8 +79,8 @@ public void onDisable() {

AutoCrystal.stopAC = false;

if (offhandObby.getValue() && OffHand.isActive()) {
OffHand.removeObsidian();
if (offhandObby.getValue() && ModuleManager.isModuleEnabled(OffHand.class)) {
OffHand.removeItem(0);
activedOff = false;
}

Expand Down
Loading

0 comments on commit 8ed90aa

Please sign in to comment.