first scaffold commit
This commit is contained in:
parent
85f8adb577
commit
797dc2706d
1 changed files with 46 additions and 0 deletions
46
src/main/java/ftbsc/bscv/modules/self/Scaffold.java
Normal file
46
src/main/java/ftbsc/bscv/modules/self/Scaffold.java
Normal 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);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue