Skip to content
This repository was archived by the owner on Mar 10, 2025. It is now read-only.

Commit c502e16

Browse files
committed
Various fixes
1 parent c3e359b commit c502e16

6 files changed

Lines changed: 27 additions & 27 deletions

File tree

src/main/java/fartenware/systems/modules/main/BedrockBreaker.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
public class BedrockBreaker extends Module {
1919
public BedrockBreaker() {
20-
super(FartenWare.MAIN,"bedrock-breaker","Breaks bedrock automatically (requires haste 2).");
20+
super(FartenWare.MAIN, "bedrock-breaker", "Breaks bedrock automatically (requires haste 2).");
2121
}
2222

2323
private static ArrayList<TargetBlock> cachedTargetBlockList = new ArrayList<>();
@@ -32,18 +32,19 @@ public static void addBlockPosToList(BlockPos pos) {
3232
return;
3333
}
3434

35-
if (shouldAddNewTargetBlock(pos)){
35+
if (shouldAddNewTargetBlock(pos)) {
3636
TargetBlock targetBlock = new TargetBlock(pos, world);
3737
cachedTargetBlockList.add(targetBlock);
3838
}
3939
}
4040
}
41-
@EventHandler
42-
public void onTick(TickEvent.Post event){
4341

44-
if (InventoryManager.warningMessage() != null) {
42+
@EventHandler
43+
public void onTick(TickEvent.Post event) {
44+
if (InventoryManager.warningMessage() != null) {
4545
return;
4646
}
47+
4748
MinecraftClient minecraftClient = MinecraftClient.getInstance();
4849
PlayerEntity player = minecraftClient.player;
4950

@@ -54,7 +55,7 @@ public void onTick(TickEvent.Post event){
5455
for (int i = 0; i < cachedTargetBlockList.size(); i++) {
5556
TargetBlock selectedBlock = cachedTargetBlockList.get(i);
5657

57-
if (selectedBlock.getWorld() != MinecraftClient.getInstance().world ) {
58+
if (selectedBlock.getWorld() != MinecraftClient.getInstance().world) {
5859
cachedTargetBlockList = new ArrayList<>();
5960
break;
6061
}
@@ -68,7 +69,6 @@ public void onTick(TickEvent.Post event){
6869
} else {
6970
break;
7071
}
71-
7272
}
7373
}
7474
}

src/main/java/fartenware/utils/bedrock/BlockBreaker.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
public class BlockBreaker {
99
public static void breakBlock(BlockPos pos) {
10-
InventoryManager.switchToItem(Items.DIAMOND_PICKAXE);
10+
InventoryManager.switchToItem(Items.NETHERITE_PICKAXE);
1111
MinecraftClient.getInstance().interactionManager.attackBlock(pos, Direction.UP);
1212
}
1313
}

src/main/java/fartenware/utils/bedrock/BlockPlacer.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,16 @@
77
import net.minecraft.item.ItemConvertible;
88
import net.minecraft.item.ItemStack;
99
import net.minecraft.item.ItemUsageContext;
10+
import net.minecraft.network.packet.c2s.play.PlayerInteractBlockC2SPacket;
1011
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket;
1112
import net.minecraft.util.Hand;
1213
import net.minecraft.util.hit.BlockHitResult;
1314
import net.minecraft.util.math.BlockPos;
1415
import net.minecraft.util.math.Direction;
1516
import net.minecraft.util.math.Vec3d;
1617

18+
import static meteordevelopment.meteorclient.MeteorClient.mc;
19+
1720
public class BlockPlacer {
1821
public static void simpleBlockPlacement(BlockPos pos, ItemConvertible item) {
1922
MinecraftClient minecraftClient = MinecraftClient.getInstance();
@@ -32,14 +35,15 @@ public static void pistonPlacement(BlockPos pos, Direction direction) {
3235
case UP:
3336
pitch = 90f;
3437
break;
35-
case DOWN:
38+
case DOWN: {
3639
pitch = -90f;
3740
break;
38-
default:
41+
}
42+
default: {
3943
pitch = 90f;
4044
break;
45+
}
4146
}
42-
4347
minecraftClient.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.LookAndOnGround(player.getYaw(1.0f), pitch, player.isOnGround()));
4448

4549
Vec3d vec3d = new Vec3d(x, pos.getY(), pos.getZ());
@@ -53,12 +57,11 @@ private static void placeBlockWithoutInteractingBlock(MinecraftClient minecraftC
5357
ClientPlayerEntity player = minecraftClient.player;
5458
ItemStack itemStack = player.getStackInHand(Hand.MAIN_HAND);
5559

56-
minecraftClient.interactionManager.interactBlock(player,Hand.MAIN_HAND,hitResult);
60+
mc.player.networkHandler.sendPacket(new PlayerInteractBlockC2SPacket(Hand.MAIN_HAND, hitResult, 0));
5761

5862
if (!itemStack.isEmpty() && !player.getItemCooldownManager().isCoolingDown(itemStack.getItem())) {
5963
ItemUsageContext itemUsageContext = new ItemUsageContext(player, Hand.MAIN_HAND, hitResult);
6064
itemStack.useOnBlock(itemUsageContext);
61-
6265
}
6366
}
6467
}

src/main/java/fartenware/utils/bedrock/InventoryManager.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
import net.minecraft.registry.tag.FluidTags;
1616

1717
public class InventoryManager {
18-
public static void switchToItem(ItemConvertible item) {
18+
public static boolean switchToItem(ItemConvertible item) {
1919
MinecraftClient minecraftClient = MinecraftClient.getInstance();
2020
PlayerInventory playerInventory = minecraftClient.player.getInventory();
2121

2222
int i = playerInventory.getSlotWithStack(new ItemStack(item));
2323

24-
if ("diamond_pickaxe".equals(item.toString())) {
24+
if ("netherite_pickaxe".equals(item.toString())) {
2525
i = getEfficientTool(playerInventory);
2626
}
2727

@@ -32,7 +32,9 @@ public static void switchToItem(ItemConvertible item) {
3232
minecraftClient.interactionManager.pickFromInventory(i);
3333
}
3434
minecraftClient.getNetworkHandler().sendPacket(new UpdateSelectedSlotC2SPacket(playerInventory.selectedSlot));
35+
return true;
3536
}
37+
return false;
3638
}
3739

3840
private static int getEfficientTool(PlayerInventory playerInventory) {
@@ -113,21 +115,20 @@ public static int getInventoryItemCount(ItemConvertible item) {
113115

114116
public static String warningMessage() {
115117
if (InventoryManager.getInventoryItemCount(Blocks.PISTON) < 2) {
116-
return "missing piston";
118+
return "Missing piston";
117119
}
118120

119121
if (InventoryManager.getInventoryItemCount(Blocks.REDSTONE_TORCH) < 1) {
120-
return "missing redstone torch";
122+
return "Missing redstone torch";
121123
}
122124

123125
if (InventoryManager.getInventoryItemCount(Blocks.SLIME_BLOCK)<1){
124-
return "missing slime";
126+
return "Missing slime";
125127
}
126128

127129
if (!InventoryManager.canInstantlyMinePiston()) {
128-
return "missing instant mine";
130+
return "Missing instant mine";
129131
}
130132
return null;
131133
}
132-
133134
}
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package fartenware.utils.bedrock;
22

3-
43
import net.minecraft.client.MinecraftClient;
54
import net.minecraft.text.Text;
65

@@ -10,4 +9,3 @@ public static void actionBar(String message){
109
minecraftClient.inGameHud.setOverlayMessage(Text.translatable(message),false);
1110
}
1211
}
13-

src/main/java/fartenware/utils/bedrock/TargetBlock.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
package fartenware.utils.bedrock;
2+
23
import net.minecraft.block.Blocks;
34
import net.minecraft.block.PistonBlock;
45
import net.minecraft.client.world.ClientWorld;
@@ -7,8 +8,6 @@
78

89
import java.util.ArrayList;
910

10-
11-
1211
public class TargetBlock {
1312
private BlockPos blockPos;
1413
private BlockPos redstoneTorchBlockPos;
@@ -120,7 +119,7 @@ private void updateStatus() {
120119
redstoneTorchBlockPos = slimeBlockPos.up();
121120
} else {
122121
this.status = Status.FAILED;
123-
Messager.actionBar("failed to place redstone torch");
122+
Messager.actionBar("Failed to place redstone torch");
124123
}
125124
} else if (!this.world.getBlockState(this.blockPos).isOf(Blocks.BEDROCK) && this.world.getBlockState(this.pistonBlockPos).isOf(Blocks.PISTON)) {
126125
this.status = Status.RETRACTED;
@@ -143,10 +142,9 @@ private void updateStatus() {
143142
this.status = Status.UNINITIALIZED;
144143
} else if (!CheckingEnvironment.has2BlocksOfPlaceToPlacePiston(world, this.blockPos)) {
145144
this.status = Status.FAILED;
146-
Messager.actionBar("failed to place piston");
145+
Messager.actionBar("Failed to place piston");
147146
} else {
148147
this.status = Status.FAILED;
149148
}
150149
}
151-
152150
}

0 commit comments

Comments
 (0)