Skip to content

Commit

Permalink
Fixed general bug with negative hotbar values
Browse files Browse the repository at this point in the history
  • Loading branch information
IUDevman committed Dec 7, 2020
1 parent 82d951e commit 59ec692
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ public void onUpdate(){
firstRun = false;
if (findObsidianSlot() == -1){
noObby = true;
disable();
}
}
else {
Expand Down Expand Up @@ -251,7 +252,7 @@ private boolean placeBlock(BlockPos pos, int range){

int obsidianSlot = findObsidianSlot();

if (mc.player.inventory.currentItem != obsidianSlot){
if (mc.player.inventory.currentItem != obsidianSlot && obsidianSlot != -1){
mc.player.inventory.currentItem = obsidianSlot;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ private boolean placeBlock(BlockPos pos, int range){

int webbSlot = findWebSlot();

if (mc.player.inventory.currentItem != webbSlot){
if (mc.player.inventory.currentItem != webbSlot && webbSlot != -1){
mc.player.inventory.currentItem = webbSlot;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,14 @@ public void onUpdate(){

if (autoSwitch.getValue()) {
int oldHand = mc.player.inventory.currentItem;
mc.player.inventory.currentItem = findRightBlock(oldHand);
int newHand = findRightBlock(oldHand);

if (newHand != -1) {
mc.player.inventory.currentItem = findRightBlock(oldHand);
}
else {
return;
}
}

BlockPos placePos = holePos.stream().sorted(Comparator.comparing(blockPos -> blockPos.getDistance((int) mc.player.posX, (int) mc.player.posY, (int) mc.player.posZ))).findFirst().orElse(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ public void onUpdate(){
firstRun = false;
if (findObsidianSlot() == -1){
noObby = true;
disable();
}
}
else {
Expand Down Expand Up @@ -297,7 +298,7 @@ private boolean placeBlock(BlockPos pos){

int obsidianSlot = findObsidianSlot();

if (mc.player.inventory.currentItem != obsidianSlot){
if (mc.player.inventory.currentItem != obsidianSlot && obsidianSlot != -1){
mc.player.inventory.currentItem = obsidianSlot;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ public void onUpdate(){
firstRun = false;
if (findWebSlot() == -1){
noWeb = true;
disable();
}
}
else {
Expand Down Expand Up @@ -236,7 +237,7 @@ private boolean placeBlock(BlockPos pos){

int webSlot = findWebSlot();

if (mc.player.inventory.currentItem != webSlot){
if (mc.player.inventory.currentItem != webSlot && webSlot != -1){
mc.player.inventory.currentItem = webSlot;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ public void onUpdate(){
firstRun = false;
if (findObsidianSlot() == -1){
noObby = true;
disable();
}
}
else {
Expand Down Expand Up @@ -293,7 +294,7 @@ private boolean placeBlock(BlockPos pos){

int obsidianSlot = findObsidianSlot();

if (mc.player.inventory.currentItem != obsidianSlot){
if (mc.player.inventory.currentItem != obsidianSlot && obsidianSlot != -1){

mc.player.inventory.currentItem = obsidianSlot;
}
Expand Down

0 comments on commit 59ec692

Please sign in to comment.