Compare commits

..

1 commit

Author SHA1 Message Date
797dc2706d first scaffold commit 2024-01-11 00:17:42 +01:00
7 changed files with 58 additions and 57 deletions

View file

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

View file

@ -9,8 +9,6 @@ import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.command.CommandSource;
import net.minecraft.command.Commands;
import net.minecraft.command.arguments.BlockStateArgument;
import net.minecraft.command.arguments.BlockStateInput;
import static ftbsc.bscv.Boscovicino.log;
@ -50,19 +48,6 @@ 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 -> {
log("no block specified");
return 0;

View file

@ -8,8 +8,6 @@ import ftbsc.bscv.api.ILoadable;
import ftbsc.bscv.tools.Inventory;
import net.minecraft.command.CommandSource;
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.item.Item;
@ -50,18 +48,6 @@ 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 -> {
Slot slot = Inventory.hotbar(MC.player).get(MC.player.inventory.selected);
if (!slot.hasItem()) return 0;

View file

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

View file

@ -9,7 +9,6 @@ import net.minecraft.client.Minecraft;
import net.minecraft.network.play.server.SPlaySoundEffectPacket;
import net.minecraft.util.Hand;
import net.minecraft.util.SoundEvents;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraftforge.common.ForgeConfigSpec;
import net.minecraftforge.eventbus.api.SubscribeEvent;
@ -18,7 +17,6 @@ public class AutoFish extends AbstractModule {
public final ForgeConfigSpec.ConfigValue<Boolean> recast;
public final ForgeConfigSpec.ConfigValue<Integer> delay;
public final ForgeConfigSpec.ConfigValue<Double> distance;
// public final ForgeConfigSpec.ConfigValue<Long> reaction;
public AutoFish() {
@ -35,23 +33,13 @@ public class AutoFish extends AbstractModule {
.name("delay")
.comment("how long in ms to wait before recasting hook")
.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
public void onPacket(PacketEvent.Incoming event) {
if (event.packet instanceof SPlaySoundEffectPacket) {
SPlaySoundEffectPacket packet = (SPlaySoundEffectPacket) event.packet;
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())
) {
if (packet.getSound().equals(SoundEvents.FISHING_BOBBER_SPLASH)) {
MC.gameMode.useItem(MC.player, MC.level, Hand.MAIN_HAND);
if (this.recast.get()) {
new RecastThread(MC, this.delay.get()).start();
@ -60,7 +48,6 @@ 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 long delay;
private Minecraft mc;

View file

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