diff options
author | frelodev <frelodev@gmail.com> | 2024-01-11 00:17:42 +0100 |
---|---|---|
committer | frelodev <frelodev@gmail.com> | 2024-01-11 00:17:42 +0100 |
commit | 797dc2706d08d0df8f212c3989cee511668462aa (patch) | |
tree | 5a8147a94cd9b683a4144898c2c6c7f39c59aa53 /src/main/java/ftbsc | |
parent | 85f8adb57772cf7d8d05c4b7f92ac15a80cbe5a1 (diff) |
first scaffold commitfeat/scaffold
Diffstat (limited to 'src/main/java/ftbsc')
-rw-r--r-- | src/main/java/ftbsc/bscv/modules/self/Scaffold.java | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/main/java/ftbsc/bscv/modules/self/Scaffold.java b/src/main/java/ftbsc/bscv/modules/self/Scaffold.java new file mode 100644 index 0000000..655e933 --- /dev/null +++ b/src/main/java/ftbsc/bscv/modules/self/Scaffold.java @@ -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); + + } + } + + } + } + +} |