Skip to content
This repository has been archived by the owner on Nov 7, 2023. It is now read-only.

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Coderx-Gamer authored Dec 9, 2021
1 parent e1b8445 commit c5e02e9
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 10 deletions.
Binary file modified build/classes/java/main/net/shulker/dupe/MainClient.class
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v1 named intermediary
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v1 named intermediary
Binary file modified build/tmp/compileJava/previous-compilation-data.bin
Binary file not shown.
18 changes: 17 additions & 1 deletion src/main/java/net/shulker/dupe/MainClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,23 @@ public class MainClient implements ClientModInitializer {
public void onInitializeClient() {
}

public static boolean fra = true;
public static int thex = 0;
public static int they = 0;

public static void setFra(boolean fra) {
MainClient.fra = fra;
}

public static void tick() {

boolean b1 = (CLIENT.player.currentScreenHandler instanceof ShulkerBoxScreenHandler);

if (shouldDupe || shouldDupeAll) {
HitResult hit = CLIENT.crosshairTarget;
if (hit instanceof BlockHitResult) {
BlockHitResult blockHit = (BlockHitResult) hit;
if (CLIENT.world.getBlockState(blockHit.getBlockPos()).getBlock() instanceof ShulkerBoxBlock && CLIENT.player.currentScreenHandler instanceof ShulkerBoxScreenHandler) {
if (CLIENT.world.getBlockState(blockHit.getBlockPos()).getBlock() instanceof ShulkerBoxBlock && b1) {
CLIENT.interactionManager.updateBlockBreakingProgress(blockHit.getBlockPos(), Direction.DOWN);
} else {
log("You need to have a shulker box screen open and look at a shulker box.");
Expand All @@ -38,5 +49,10 @@ public static void tick() {
}
}
}
if (b1) {

} else {
setFra(true);
}
}
}
36 changes: 27 additions & 9 deletions src/main/java/net/shulker/dupe/mixin/ShulkerBoxScreenMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import net.shulker.dupe.MainClient;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
Expand All @@ -22,14 +23,31 @@ public ShulkerBoxScreenMixin(Text title) {

@Inject(at = @At("TAIL"), method = "render(Lnet/minecraft/client/util/math/MatrixStack;IIF)V")
public void renderScreen(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci) {
this.addDrawableChild(new ButtonWidget(232, 60, 50, 20, Text.of("Dupe"), (button) -> {
if (shouldDupeAll) shouldDupeAll = false;
shouldDupe = true;
}));

this.addDrawableChild(new ButtonWidget(285, 60, 50, 20, Text.of("Dupe All"), (button) -> {
if (shouldDupe) shouldDupe = false;
shouldDupeAll = true;
}));
if (isFra()) {
setFra(false);
MainClient.thex = this.width;
MainClient.they = this.height;
this.addDrawableChild(new ButtonWidget(this.width/2-90, this.height/2+35-145, 50, 20, Text.of("Dupe"), (button) -> {
if (shouldDupeAll) shouldDupeAll = false;
shouldDupe = true;
}));
this.addDrawableChild(new ButtonWidget(this.width/2+40, this.height/2+35-145, 50, 20, Text.of("Dupe All"), (button) -> {
if (shouldDupe) shouldDupe = false;
shouldDupeAll = true;
}));
}

if (this.width != MainClient.thex || this.height != MainClient.they) {
setFra(true);
}

}

public boolean isFra() {
return MainClient.fra;
}

public void setFra(boolean fra) {
MainClient.fra = fra;
}
}

0 comments on commit c5e02e9

Please sign in to comment.