Compare commits

...

1 commit

Author SHA1 Message Date
797dc2706d first scaffold commit 2024-01-11 00:17:42 +01:00

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);
}
}
}
}
}