-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
414 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
//By Zgoly | ||
package zgoly.meteorist.commands; | ||
|
||
import com.mojang.brigadier.builder.LiteralArgumentBuilder; | ||
import meteordevelopment.meteorclient.systems.commands.Command; | ||
import net.minecraft.block.entity.BlockEntity; | ||
import net.minecraft.command.CommandSource; | ||
import net.minecraft.nbt.NbtCompound; | ||
import net.minecraft.text.Text; | ||
import net.minecraft.util.hit.BlockHitResult; | ||
import net.minecraft.util.hit.EntityHitResult; | ||
import net.minecraft.util.math.BlockPos; | ||
|
||
import static com.mojang.brigadier.Command.SINGLE_SUCCESS; | ||
|
||
public class TargetNbt extends Command { | ||
public TargetNbt() { | ||
super("target-nbt", "Gets NBT of target you're looking at.", "nbt-target", "target"); | ||
} | ||
|
||
@Override | ||
public void build(LiteralArgumentBuilder<CommandSource> builder) { | ||
builder.executes(context -> getNbt()); | ||
builder.then(literal("get").executes(context -> getNbt())); | ||
|
||
builder.then(literal("copy").executes(context -> { | ||
if (getTargetNbt() == null) return SINGLE_SUCCESS; | ||
mc.keyboard.setClipboard(getTargetNbt().toString()); | ||
info("NBT successfully copied to your clipboard"); | ||
return SINGLE_SUCCESS; | ||
})); | ||
} | ||
|
||
private NbtCompound getTargetNbt() { | ||
switch (mc.crosshairTarget.getType()) { | ||
case MISS -> info("There is no target for your cursor"); | ||
case BLOCK -> { | ||
BlockPos pos = ((BlockHitResult) mc.crosshairTarget).getBlockPos(); | ||
BlockEntity blockEntity = mc.world.getBlockEntity(pos); | ||
|
||
if (blockEntity != null) { | ||
return blockEntity.createNbt(); | ||
} else { | ||
info("Block you're targeting doesn't have NBT"); | ||
} | ||
} | ||
case ENTITY -> { | ||
return ((EntityHitResult) mc.crosshairTarget).getEntity().writeNbt(new NbtCompound()); | ||
} | ||
|
||
} | ||
return null; | ||
} | ||
|
||
private int getNbt() { | ||
if (getTargetNbt() == null) return SINGLE_SUCCESS; | ||
mc.player.sendMessage(Text.of(getTargetNbt().toString())); | ||
return SINGLE_SUCCESS; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
//By Zgoly | ||
package zgoly.meteorist.modules; | ||
|
||
import meteordevelopment.meteorclient.events.world.TickEvent; | ||
import meteordevelopment.meteorclient.settings.*; | ||
import meteordevelopment.meteorclient.systems.modules.Module; | ||
import meteordevelopment.orbit.EventHandler; | ||
import net.minecraft.item.ItemStack; | ||
import zgoly.meteorist.Meteorist; | ||
|
||
public class AutoFix extends Module { | ||
public enum Mode { | ||
Default, | ||
Percentage | ||
} | ||
private final SettingGroup sgGeneral = settings.getDefaultGroup(); | ||
|
||
private final Setting<String> fixCommand = sgGeneral.add(new StringSetting.Builder() | ||
.name("fix-command") | ||
.description("Command to fix item.") | ||
.defaultValue("/fix all") | ||
.build() | ||
); | ||
|
||
private final Setting<AutoFix.Mode> mode = sgGeneral.add(new EnumSetting.Builder<AutoFix.Mode>() | ||
.name("mode") | ||
.description("Percentage - calculate item durability in percentage, Default - calculate item durability in numbers.") | ||
.defaultValue(Mode.Default) | ||
.build() | ||
); | ||
|
||
private final Setting<Integer> minDurability = sgGeneral.add(new IntSetting.Builder() | ||
.name("min-durability") | ||
.description("The durability number to send the command.") | ||
.defaultValue(10) | ||
.range(1, 1000) | ||
.sliderRange(1, 1000) | ||
.visible(() -> mode.get() == Mode.Default) | ||
.build() | ||
); | ||
|
||
private final Setting<Integer> minDurabilityPercentage = sgGeneral.add(new IntSetting.Builder() | ||
.name("min-durability") | ||
.description("The durability percentage to send the command.") | ||
.defaultValue(10) | ||
.range(1, 100) | ||
.sliderRange(1, 100) | ||
.visible(() -> mode.get() == Mode.Percentage) | ||
.build() | ||
); | ||
|
||
private final Setting<Integer> delay = sgGeneral.add(new IntSetting.Builder() | ||
.name("delay") | ||
.description("Delay after sending a command in ticks (20 ticks = 1 sec).") | ||
.defaultValue(20) | ||
.range(1, 1200) | ||
.sliderRange(1, 40) | ||
.build() | ||
); | ||
|
||
private int timer; | ||
|
||
public AutoFix() { | ||
super(Meteorist.CATEGORY, "auto-fix", "Writes command in chat when item close to break."); | ||
} | ||
|
||
@Override | ||
public void onActivate() { | ||
timer = 0; | ||
} | ||
|
||
@EventHandler | ||
private void onTick(TickEvent.Post event) { | ||
boolean work = false; | ||
if (timer >= delay.get()) { | ||
for (ItemStack item : mc.player.getItemsEquipped()) { | ||
if (item.getDamage() > 0 && item.getMaxDamage() > 0) { | ||
if ((mode.get() == Mode.Default && item.getMaxDamage() - item.getDamage() >= minDurability.get()) || (mode.get() == Mode.Percentage | ||
&& (((item.getMaxDamage() - item.getDamage()) * 100) / item.getMaxDamage()) >= minDurabilityPercentage.get())) work = true; | ||
} | ||
} | ||
if (work) { | ||
mc.player.sendCommand(fixCommand.get().replace("/", "")); | ||
timer = 0; | ||
} | ||
} else timer ++; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.