i felt bad (it's gone)

This commit is contained in:
Jess H 2024-05-29 02:06:04 +01:00
parent a07fef533f
commit b5ae1ff2d3
3 changed files with 0 additions and 284 deletions

View file

@ -52,7 +52,6 @@ public class Setup {
new NoSlowDown(),
new Ping(),
new Say(),
new Scaffold(),
new SeedOverlay(),
new Set(),
new Selection(),

View file

@ -1,145 +0,0 @@
package com.baseband.client.module.world;
import com.baseband.client.event.events.MotionUpdateEvent;
import com.baseband.client.module.Feature;
import com.baseband.client.module.category.World;
import com.baseband.client.util.interact.BlockUtils;
import com.baseband.client.util.misc.Timer;
import net.minecraft.block.Block;
import net.minecraft.block.BlockLiquid;
import net.minecraft.block.material.Material;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemAir;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.network.play.client.CPacketHeldItemChange;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
@World
public class Scaffold extends Feature {
//rusherhack b8, must fix soon.
@Override
public String toString() {
return "Scaffold";
}
Timer timer = new Timer();
public void preMotion(MotionUpdateEvent.Post event) {
timer.reset();
BlockPos playerBlock = new BlockPos(
mc.player.getRidingEntity() != null ? mc.player.getRidingEntity().posX
: mc.player.posX,
mc.player.getRidingEntity() != null ? mc.player.getRidingEntity().posY
: mc.player.posY,
mc.player.getRidingEntity() != null ? mc.player.getRidingEntity().posZ
: mc.player.posZ);
if (mc.world.isAirBlock(playerBlock.add(0, -1, 0))
|| mc.world.getBlockState(playerBlock.add(0, -1, 0)).getBlock() == Blocks.SNOW_LAYER
|| mc.world.getBlockState(playerBlock.add(0, -1, 0)).getBlock() == Blocks.TALLGRASS
|| mc.world.getBlockState(playerBlock.add(0, -1, 0)).getBlock() instanceof BlockLiquid) {
if (isValidBlock(playerBlock.add(0, -2, 0))) {
place(playerBlock.add(0, -1, 0), EnumFacing.UP);
} else if (isValidBlock(playerBlock.add(-1, -1, 0))) {
place(playerBlock.add(0, -1, 0), EnumFacing.EAST);
} else if (isValidBlock(playerBlock.add(1, -1, 0))) {
place(playerBlock.add(0, -1, 0), EnumFacing.WEST);
} else if (isValidBlock(playerBlock.add(0, -1, -1))) {
place(playerBlock.add(0, -1, 0), EnumFacing.SOUTH);
} else if (isValidBlock(playerBlock.add(0, -1, 1))) {
place(playerBlock.add(0, -1, 0), EnumFacing.NORTH);
} else if (isValidBlock(playerBlock.add(1, -1, 1))) {
if (isValidBlock(playerBlock.add(0, -1, 1))) {
place(playerBlock.add(0, -1, 1), EnumFacing.NORTH);
}
place(playerBlock.add(1, -1, 1), EnumFacing.EAST);
} else if (isValidBlock(playerBlock.add(-1, -1, 1))) {
if (isValidBlock(playerBlock.add(-1, -1, 0))) {
place(playerBlock.add(0, -1, 1), EnumFacing.WEST);
}
place(playerBlock.add(-1, -1, 1), EnumFacing.SOUTH);
} else if (isValidBlock(playerBlock.add(1, -1, 1))) {
if (isValidBlock(playerBlock.add(0, -1, 1))) {
place(playerBlock.add(0, -1, 1), EnumFacing.SOUTH);
}
place(playerBlock.add(1, -1, 1), EnumFacing.WEST);
} else if (isValidBlock(playerBlock.add(1, -1, 1))) {
if (isValidBlock(playerBlock.add(0, -1, 1))) {
place(playerBlock.add(0, -1, 1), EnumFacing.EAST);
}
place(playerBlock.add(1, -1, 1), EnumFacing.NORTH);
}
}
}
@SuppressWarnings("deprecation")
private boolean isValidBlock(BlockPos pos) {
Block b = mc.world.getBlockState(pos).getBlock();
return !(b instanceof BlockLiquid) && b.getMaterial(null) != Material.AIR;
}
public void place(BlockPos pos, EnumFacing face) {
if (face == EnumFacing.UP) {
pos = pos.add(0, -1, 0);
} else if (face == EnumFacing.NORTH) {
pos = pos.add(0, 0, 1);
} else if (face == EnumFacing.SOUTH) {
pos = pos.add(0, 0, -1);
} else if (face == EnumFacing.EAST) {
pos = pos.add(-1, 0, 0);
} else if (face == EnumFacing.WEST) {
pos = pos.add(1, 0, 0);
}
final int oldSlot = mc.player.inventory.currentItem;
int newSlot = -1;
for (int i = 0; i < 9; ++i) {
final ItemStack stack = mc.player.inventory.getStackInSlot(i);
if (!isNull(stack) && stack.getItem() instanceof ItemBlock
&& Block.getBlockFromItem(stack.getItem()).getDefaultState().isFullBlock()) {
newSlot = i;
break;
}
}
if (newSlot == -1) {
return;
}
if (!(mc.player.getHeldItemMainhand().getItem() instanceof ItemBlock)) {
mc.player.connection.sendPacket(new CPacketHeldItemChange(newSlot));
mc.player.inventory.currentItem = newSlot;
mc.playerController.updateController();
}
if (mc.gameSettings.keyBindJump.isKeyDown()) {
mc.player.motionX *= 0.3;
mc.player.motionZ *= 0.3;
mc.player.jump();
if (timer.passed(1500) && mc.gameSettings.keyBindJump.isKeyDown()) {
mc.player.motionY = -0.28;
timer.reset();
}
if (!mc.gameSettings.keyBindJump.isKeyDown()) {
timer.reset();
}
}
//TODO: waiter waiter, more rotations please
BlockUtils.faceBlockPosPacketInstant(pos);
mc.playerController.processRightClickBlock(mc.player, mc.world, pos, face, new Vec3d(0.5, 0.5, 0.5), EnumHand.MAIN_HAND);
mc.player.swingArm(EnumHand.MAIN_HAND);
mc.player.connection.sendPacket(new CPacketHeldItemChange(oldSlot));
mc.player.inventory.currentItem = oldSlot;
mc.playerController.updateController();
}
public static boolean isNull(ItemStack stack) {
return stack == null || stack.getItem() instanceof ItemAir;
}
}

View file

@ -1,138 +0,0 @@
package com.baseband.client.util.interact;
import net.minecraft.block.Block;
import net.minecraft.block.BlockDeadBush;
import net.minecraft.block.BlockTallGrass;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.init.Blocks;
import net.minecraft.network.play.client.CPacketEntityAction;
import net.minecraft.network.play.client.CPacketPlayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import java.util.ArrayList;
import java.util.Arrays;
public class BlockUtils {
private static final Minecraft mc = Minecraft.getMinecraft();
// Sneak!
public static ArrayList<Block> blackList = new ArrayList<Block>(Arrays.asList(
Blocks.ENDER_CHEST,
Blocks.CHEST,
Blocks.TRAPPED_CHEST,
Blocks.CRAFTING_TABLE,
Blocks.ANVIL,
Blocks.BREWING_STAND,
Blocks.HOPPER,
Blocks.DROPPER,
Blocks.DISPENSER,
Blocks.TRAPDOOR,
Blocks.ENCHANTING_TABLE
));
public static ArrayList<Block> shulkerList = new ArrayList<Block>(Arrays.asList(
Blocks.WHITE_SHULKER_BOX,
Blocks.ORANGE_SHULKER_BOX,
Blocks.MAGENTA_SHULKER_BOX,
Blocks.LIGHT_BLUE_SHULKER_BOX,
Blocks.YELLOW_SHULKER_BOX,
Blocks.LIME_SHULKER_BOX,
Blocks.PINK_SHULKER_BOX,
Blocks.GRAY_SHULKER_BOX,
Blocks.SILVER_SHULKER_BOX,
Blocks.CYAN_SHULKER_BOX,
Blocks.PURPLE_SHULKER_BOX,
Blocks.BLUE_SHULKER_BOX,
Blocks.BROWN_SHULKER_BOX,
Blocks.GREEN_SHULKER_BOX,
Blocks.RED_SHULKER_BOX,
Blocks.BLACK_SHULKER_BOX
));
// Magic i don't want to explain, gets a placeable size of a neighbor block and places
// the block on it, uses getPlaceableSide
public static void placeBlock(BlockPos pos, boolean rotate) {
EnumFacing side = getPlaceableSide(pos);
if (side == null) {
//ChatUtils.print("Couldn't place a block");
return;
}
BlockPos neighbour = pos.offset(side);
EnumFacing opposite = side.getOpposite();
Vec3d hitVec = new Vec3d(neighbour).add(0.5, 0.5, 0.5).add(new Vec3d(opposite.getDirectionVec()).scale(0.5));
Block neighbourBlock = mc.world.getBlockState(neighbour).getBlock();
if ((BlockUtils.blackList.contains(neighbourBlock) || BlockUtils.shulkerList.contains(neighbourBlock))) {
mc.player.connection.sendPacket(new CPacketEntityAction(mc.player, CPacketEntityAction.Action.START_SNEAKING));
}
if (rotate) BlockUtils.faceVectorPacketInstant(hitVec);
mc.playerController.processRightClickBlock(mc.player, mc.world, neighbour, opposite, hitVec, EnumHand.MAIN_HAND);
mc.player.swingArm(EnumHand.MAIN_HAND);
if ((BlockUtils.blackList.contains(neighbourBlock) || BlockUtils.shulkerList.contains(neighbourBlock))) {
mc.player.connection.sendPacket(new CPacketEntityAction(mc.player, CPacketEntityAction.Action.STOP_SNEAKING));
}
}
public static void lookAt(Vec3d pos) {
faceVectorPacketInstant(pos);
}
// Gets a block next to a block position
public static EnumFacing getPlaceableSide(BlockPos pos) {
for (EnumFacing side : EnumFacing.values()) {
BlockPos neighbour = pos.offset(side);
if (!mc.world.getBlockState(neighbour).getBlock().canCollideCheck(mc.world.getBlockState(neighbour), false)) {
continue;
}
IBlockState blockState = mc.world.getBlockState(neighbour);
if (!blockState.getMaterial().isReplaceable() && !(blockState.getBlock() instanceof BlockTallGrass) && !(blockState.getBlock() instanceof BlockDeadBush)) {
return side;
}
}
return null; // :(
}
public static Vec3d eyesPos() {
return new Vec3d(mc.player.posX, mc.player.posY + mc.player.getEyeHeight(), mc.player.posZ);
}
// Skidded magic.
public static float[] getLegitRotations(Vec3d vec) {
Vec3d eyesPos = eyesPos();
double diffX = vec.x - eyesPos.x;
double diffY = vec.y - eyesPos.y;
double diffZ = vec.z - eyesPos.z;
double diffXZ = Math.sqrt(diffX * diffX + diffZ * diffZ);
double yaw = Math.toDegrees(Math.atan2(diffZ, diffX)) - 90f;
double pitch = (-Math.toDegrees(Math.atan2(diffY, diffXZ)));
return new float[]{(float) (MathHelper.wrapDegrees(yaw)), (float) (MathHelper.wrapDegrees(pitch))};
}
public static void faceBlockPosPacketInstant(BlockPos pos) {
EnumFacing side = BlockUtils.getPlaceableSide(pos);
if (side == null) {
return;
}
BlockPos neighbour = pos.offset(side);
EnumFacing opposite = side.getOpposite();
Vec3d hitVec = new Vec3d(neighbour).add(0.5, 0.5, 0.5).add(new Vec3d(opposite.getDirectionVec()).scale(0.5));
BlockUtils.faceVectorPacketInstant(hitVec);
}
// Makes it more legit-looking
public static void faceVectorPacketInstant(Vec3d vec) {
float[] rotations = getLegitRotations(vec);
mc.player.connection.sendPacket(
new CPacketPlayer.Rotation(
//mc.player.posX, mc.player.posY, mc.player.posZ,
rotations[0], rotations[1], mc.player.onGround
)
);
}
}