Compare commits

..

6 commits

Author SHA1 Message Date
115c4f0470
fix: use gitversion properly 2024-05-08 23:26:10 +02:00
7640b4f6b8
Merge branch 'dev' of fantabos.co:ftbsc/bscv into dev 2024-02-14 20:31:52 +01:00
5adc5da6cd
feat: block and item id search 2024-02-14 20:30:53 +01:00
f1b2842357
fix: multiblock updates show correctly
the callback blockpos is always the same, clone it to store it and it
now works as intended
2024-01-17 01:46:47 +01:00
57dd48049d
fix: only hide effects when no gui is shown 2024-01-17 00:36:57 +01:00
2893438f64
feat: add distance option to autofish 2024-01-17 00:18:13 +01:00
7 changed files with 57 additions and 58 deletions

View file

@ -6,12 +6,10 @@ plugins {
alias libs.plugins.checkerFramework alias libs.plugins.checkerFramework
} }
version = gitVersion() version = versionDetails().lastTag
group = 'ftbsc' group = 'ftbsc'
archivesBaseName = 'bscv' archivesBaseName = 'bscv'
def shortVersion = version.split('-')[0].replaceAll(".dirty", "") // necessary when there are no extra commits on tags, and thus no dash
project.ext { project.ext {
deployJarDo = getProjectProperty("deployJar.do", "false") deployJarDo = getProjectProperty("deployJar.do", "false")
deployJarTargetDir = getProjectProperty("deployJar.targetDir", ".") deployJarTargetDir = getProjectProperty("deployJar.targetDir", ".")
@ -70,7 +68,7 @@ compileJava { //mappings for lillero-processor
} }
jar { jar {
archiveFileName = "${jar.archiveBaseName.get()}-${shortVersion}.${jar.archiveExtension.get()}" archiveFileName = "${jar.archiveBaseName.get()}-${archiveVersion.get()}.${jar.archiveExtension.get()}"
manifest { manifest {
attributes([ attributes([
"Specification-Title": "bscv", "Specification-Title": "bscv",

View file

@ -9,6 +9,8 @@ import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.command.CommandSource; import net.minecraft.command.CommandSource;
import net.minecraft.command.Commands; import net.minecraft.command.Commands;
import net.minecraft.command.arguments.BlockStateArgument;
import net.minecraft.command.arguments.BlockStateInput;
import static ftbsc.bscv.Boscovicino.log; import static ftbsc.bscv.Boscovicino.log;
@ -48,6 +50,19 @@ public class BlockSearch extends AbstractCommand {
) )
) )
) )
.then(
Commands.literal("id")
.then(
Commands.argument("name", BlockStateArgument.block())
.executes( ctx -> {
BlockStateInput arg = ctx.getArgument("name", BlockStateInput.class);
BlockState state = arg.getState();
int block_id = Block.getId(state);
log("block #[%d:%d] >> %s", block_id >> 4, block_id & 0xF, state.toString());
return 1;
})
)
)
.executes(ctx -> { .executes(ctx -> {
log("no block specified"); log("no block specified");
return 0; return 0;

View file

@ -8,6 +8,8 @@ import ftbsc.bscv.api.ILoadable;
import ftbsc.bscv.tools.Inventory; import ftbsc.bscv.tools.Inventory;
import net.minecraft.command.CommandSource; import net.minecraft.command.CommandSource;
import net.minecraft.command.Commands; import net.minecraft.command.Commands;
import net.minecraft.command.arguments.ItemArgument;
import net.minecraft.command.arguments.ItemInput;
import net.minecraft.inventory.container.Slot; import net.minecraft.inventory.container.Slot;
import net.minecraft.item.Item; import net.minecraft.item.Item;
@ -48,6 +50,18 @@ public class ItemCommand extends AbstractCommand {
}) })
) )
) )
.then(
Commands.literal("id")
.then(
Commands.argument("name", ItemArgument.item())
.executes( ctx -> {
ItemInput arg = ctx.getArgument("name", ItemInput.class);
Item item = arg.getItem();
log("item #[%d] >> %s", Item.getId(item), item.toString());
return 1;
})
)
)
.executes(ctx -> { .executes(ctx -> {
Slot slot = Inventory.hotbar(MC.player).get(MC.player.inventory.selected); Slot slot = Inventory.hotbar(MC.player).get(MC.player.inventory.selected);
if (!slot.hasItem()) return 0; if (!slot.hasItem()) return 0;

View file

@ -175,11 +175,14 @@ public class InfoDisplay extends HudModule {
@SubscribeEvent @SubscribeEvent
public void onRenderOverlay(RenderGameOverlayEvent event) { public void onRenderOverlay(RenderGameOverlayEvent event) {
if (event.getType() == ElementType.POTION_ICONS) { if (
if (this.hide_effects.get() && event.isCancelable()) { event.getType() == ElementType.POTION_ICONS
&& MC.screen == null
&& this.hide_effects.get()
&& event.isCancelable()
) {
event.setCanceled(true); event.setCanceled(true);
} }
}
if (event.getType() != ElementType.TEXT) return; if (event.getType() != ElementType.TEXT) return;
if (this.shouldHide()) return; if (this.shouldHide()) return;

View file

@ -9,6 +9,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.network.play.server.SPlaySoundEffectPacket; import net.minecraft.network.play.server.SPlaySoundEffectPacket;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.SoundEvents; import net.minecraft.util.SoundEvents;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraftforge.common.ForgeConfigSpec; import net.minecraftforge.common.ForgeConfigSpec;
import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
@ -17,6 +18,7 @@ public class AutoFish extends AbstractModule {
public final ForgeConfigSpec.ConfigValue<Boolean> recast; public final ForgeConfigSpec.ConfigValue<Boolean> recast;
public final ForgeConfigSpec.ConfigValue<Integer> delay; public final ForgeConfigSpec.ConfigValue<Integer> delay;
public final ForgeConfigSpec.ConfigValue<Double> distance;
// public final ForgeConfigSpec.ConfigValue<Long> reaction; // public final ForgeConfigSpec.ConfigValue<Long> reaction;
public AutoFish() { public AutoFish() {
@ -33,13 +35,23 @@ public class AutoFish extends AbstractModule {
.name("delay") .name("delay")
.comment("how long in ms to wait before recasting hook") .comment("how long in ms to wait before recasting hook")
.build(this); .build(this);
this.distance = Setting.Decimal.builder()
.fallback(0.)
.name("distance")
.comment("ignore splashes further than X blocks, set to 0 to disable")
.build(this);
} }
@SubscribeEvent @SubscribeEvent
public void onPacket(PacketEvent.Incoming event) { public void onPacket(PacketEvent.Incoming event) {
if (event.packet instanceof SPlaySoundEffectPacket) { if (event.packet instanceof SPlaySoundEffectPacket) {
SPlaySoundEffectPacket packet = (SPlaySoundEffectPacket) event.packet; SPlaySoundEffectPacket packet = (SPlaySoundEffectPacket) event.packet;
if (packet.getSound().equals(SoundEvents.FISHING_BOBBER_SPLASH)) { Vector3d location = new Vector3d(packet.getX(), packet.getY(), packet.getZ());
if (
packet.getSound().equals(SoundEvents.FISHING_BOBBER_SPLASH)
&& (this.distance.get() == 0 || MC.player.position().distanceTo(location) < this.distance.get())
) {
MC.gameMode.useItem(MC.player, MC.level, Hand.MAIN_HAND); MC.gameMode.useItem(MC.player, MC.level, Hand.MAIN_HAND);
if (this.recast.get()) { if (this.recast.get()) {
new RecastThread(MC, this.delay.get()).start(); new RecastThread(MC, this.delay.get()).start();
@ -48,6 +60,7 @@ public class AutoFish extends AbstractModule {
} }
} }
// TODO don't spawn a thread, minecraft has a way to schedule actions for later
private class RecastThread extends Thread { private class RecastThread extends Thread {
private long delay; private long delay;
private Minecraft mc; private Minecraft mc;

View file

@ -1,46 +0,0 @@
package ftbsc.bscv.modules.self;
import java.util.ArrayList;
import java.util.List;
import com.google.auto.service.AutoService;
import ftbsc.bscv.api.ILoadable;
import ftbsc.bscv.modules.AbstractModule;
import ftbsc.bscv.tools.Inventory;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.inventory.container.Slot;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraftforge.event.TickEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
@AutoService(ILoadable.class)
public class Scaffold extends AbstractModule {
@SubscribeEvent
public void onTick(TickEvent.ClientTickEvent event) {
if (MC.level == null || MC.player == null) return;
BlockPos block_pos_below = MC.player.blockPosition().below();
BlockState block_below = MC.level.getBlockState(block_pos_below);
if (block_below.getBlock() == Blocks.AIR) {
List<Slot> hotbar = Inventory.hotbar(MC.player);
for(Slot slot : hotbar) {
boolean canPlace = slot.getItem().getItem().canAttackBlock(block_below, MC.level,block_pos_below,MC.player); // this doesn't work for sure
if(canPlace) {
Vector3d vector = new Vector3d(block_pos_below.getX(), block_pos_below.getY(),block_pos_below.getZ()); //we need utilsssss :(
MC.player.interactAt(MC.player, vector, Hand.MAIN_HAND);
}
}
}
}
}

View file

@ -9,7 +9,7 @@ import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import ftbsc.bscv.api.ILoadable; import ftbsc.bscv.api.ILoadable;
import ftbsc.bscv.modules.QuickModule; import ftbsc.bscv.modules.AbstractModule;
import ftbsc.bscv.patches.PacketPatch.PacketEvent; import ftbsc.bscv.patches.PacketPatch.PacketEvent;
import ftbsc.bscv.tools.Setting; import ftbsc.bscv.tools.Setting;
import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.BufferBuilder;
@ -18,8 +18,10 @@ import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.renderer.WorldVertexBufferUploader; import net.minecraft.client.renderer.WorldVertexBufferUploader;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.network.play.server.SChangeBlockPacket; import net.minecraft.network.play.server.SChangeBlockPacket;
import net.minecraft.network.play.server.SChunkDataPacket;
import net.minecraft.network.play.server.SMultiBlockChangePacket; import net.minecraft.network.play.server.SMultiBlockChangePacket;
import net.minecraft.util.Tuple; import net.minecraft.util.Tuple;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.vector.Vector3d; import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.util.math.vector.Vector3i; import net.minecraft.util.math.vector.Vector3i;
import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.client.event.RenderWorldLastEvent;
@ -29,7 +31,7 @@ import net.minecraftforge.event.TickEvent.Phase;
import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
@AutoService(ILoadable.class) @AutoService(ILoadable.class)
public class UpdateESP extends QuickModule { public class UpdateESP extends AbstractModule {
public final ForgeConfigSpec.ConfigValue<Integer> duration; public final ForgeConfigSpec.ConfigValue<Integer> duration;
public final ForgeConfigSpec.ConfigValue<Double> alpha; public final ForgeConfigSpec.ConfigValue<Double> alpha;
@ -142,7 +144,7 @@ public class UpdateESP extends QuickModule {
if (event.packet instanceof SMultiBlockChangePacket) { if (event.packet instanceof SMultiBlockChangePacket) {
SMultiBlockChangePacket packet = (SMultiBlockChangePacket) event.packet; SMultiBlockChangePacket packet = (SMultiBlockChangePacket) event.packet;
packet.runUpdates( (pos, state) -> this.updates.add(new Tuple<>(pos, System.currentTimeMillis())) ); packet.runUpdates( (pos, state) -> this.updates.add(new Tuple<>(new BlockPos(pos), System.currentTimeMillis())) );
} }
} }
} }