Merge branch 'zeroeightysix-master' into features-master

This commit is contained in:
Bella 2019-12-03 23:04:46 -05:00
commit 9895a7f1b7
5 changed files with 429 additions and 212 deletions

View File

@ -27,14 +27,17 @@ import net.minecraft.util.math.Vec3d;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.*;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static me.zeroeightsix.kami.module.modules.combat.CrystalAura.getPlayerPos;
import static me.zeroeightsix.kami.module.modules.player.Scaffold.faceVectorPacketInstant;
import static me.zeroeightsix.kami.util.BlockInteractionHelper.*;
/**
* Created by hub on 7 August 2019
* Updated by hub on 31 October 2019
* Updated by hub on 21 November 2019
*/
@Module.Info(name = "Auto32k", category = Module.Category.COMBAT, description = "Do not use with any AntiGhostBlock Mod!")
public class Auto32k extends Module {

View File

@ -0,0 +1,323 @@
package me.zeroeightsix.kami.module.modules.combat;
import com.mojang.realmsclient.gui.ChatFormatting;
import me.zeroeightsix.kami.command.Command;
import me.zeroeightsix.kami.module.Module;
import me.zeroeightsix.kami.module.ModuleManager;
import me.zeroeightsix.kami.setting.Setting;
import me.zeroeightsix.kami.setting.Settings;
import me.zeroeightsix.kami.util.BlockInteractionHelper;
import net.minecraft.block.Block;
import net.minecraft.block.BlockAir;
import net.minecraft.block.BlockLiquid;
import net.minecraft.block.BlockObsidian;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.item.EntityXPOrb;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.network.play.client.CPacketEntityAction;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import static me.zeroeightsix.kami.util.BlockInteractionHelper.canBeClicked;
import static me.zeroeightsix.kami.util.BlockInteractionHelper.faceVectorPacketInstant;
/**
* @author hub
* @since 2019-8-13
*/
@Module.Info(name = "AutoFeetPlace", category = Module.Category.COMBAT)
public class AutoFeetPlace extends Module {
private Setting<Mode> mode = register(Settings.e("Mode", Mode.FULL));
private Setting<Boolean> triggerable = register(Settings.b("Triggerable", true));
private Setting<Integer> timeoutTicks = register(Settings.integerBuilder("TimeoutTicks").withMinimum(1).withValue(40).withMaximum(100).withVisibility(b -> triggerable.getValue()).build());
private Setting<Integer> blocksPerTick = register(Settings.integerBuilder("BlocksPerTick").withMinimum(1).withValue(4).withMaximum(9).build());
private Setting<Integer> tickDelay = register(Settings.integerBuilder("TickDelay").withMinimum(0).withValue(0).withMaximum(10).build());
private Setting<Boolean> rotate = register(Settings.b("Rotate", true));
private Setting<Boolean> infoMessage = register(Settings.b("InfoMessage", false));
private int offsetStep = 0;
private int delayStep = 0;
private int playerHotbarSlot = -1;
private int lastHotbarSlot = -1;
private boolean isSneaking = false;
private int totalTicksRunning = 0;
private boolean firstRun;
private boolean missingObiDisable = false;
private 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()) {
return side;
}
}
return null;
}
@Override
protected void onEnable() {
if (mc.player == null) {
this.disable();
return;
}
firstRun = true;
// save initial player hand
playerHotbarSlot = mc.player.inventory.currentItem;
lastHotbarSlot = -1;
}
@Override
protected void onDisable() {
if (mc.player == null) {
return;
}
// load initial player hand
if (lastHotbarSlot != playerHotbarSlot && playerHotbarSlot != -1) {
mc.player.inventory.currentItem = playerHotbarSlot;
}
if (isSneaking) {
mc.player.connection.sendPacket(new CPacketEntityAction(mc.player, CPacketEntityAction.Action.STOP_SNEAKING));
isSneaking = false;
}
playerHotbarSlot = -1;
lastHotbarSlot = -1;
missingObiDisable = false;
}
@Override
public void onUpdate() {
if (mc.player == null || ModuleManager.isModuleEnabled("Freecam")) {
return;
}
if (triggerable.getValue() && totalTicksRunning >= timeoutTicks.getValue()) {
totalTicksRunning = 0;
this.disable();
return;
}
if (!firstRun) {
if (delayStep < tickDelay.getValue()) {
delayStep++;
return;
} else {
delayStep = 0;
}
}
if (firstRun) {
firstRun = false;
if (findObiInHotbar() == -1) {
missingObiDisable = true;
}
}
Vec3d[] offsetPattern = new Vec3d[0];
int maxSteps = 0;
if (mode.getValue().equals(Mode.FULL)) {
offsetPattern = Offsets.FULL;
maxSteps = Offsets.FULL.length;
}
if (mode.getValue().equals(Mode.SURROUND)) {
offsetPattern = Offsets.SURROUND;
maxSteps = Offsets.SURROUND.length;
}
int blocksPlaced = 0;
while (blocksPlaced < blocksPerTick.getValue()) {
if (offsetStep >= maxSteps) {
offsetStep = 0;
break;
}
BlockPos offsetPos = new BlockPos(offsetPattern[offsetStep]);
BlockPos targetPos = new BlockPos(mc.player.getPositionVector()).add(offsetPos.x, offsetPos.y, offsetPos.z);
if (placeBlock(targetPos)) {
blocksPlaced++;
}
offsetStep++;
}
if (blocksPlaced > 0) {
if (lastHotbarSlot != playerHotbarSlot && playerHotbarSlot != -1) {
mc.player.inventory.currentItem = playerHotbarSlot;
lastHotbarSlot = playerHotbarSlot;
}
if (isSneaking) {
mc.player.connection.sendPacket(new CPacketEntityAction(mc.player, CPacketEntityAction.Action.STOP_SNEAKING));
isSneaking = false;
}
}
totalTicksRunning++;
if (missingObiDisable) {
missingObiDisable = false;
if (infoMessage.getValue()) {
Command.sendChatMessage("[AutoFeetPlace] " + ChatFormatting.RED + "Disabled" + ChatFormatting.RESET + ", Obsidian missing!");
}
this.disable();
}
}
private boolean placeBlock(BlockPos pos) {
// check if block is already placed
Block block = mc.world.getBlockState(pos).getBlock();
if (!(block instanceof BlockAir) && !(block instanceof BlockLiquid)) {
return false;
}
// check if entity blocks placing
for (Entity entity : mc.world.getEntitiesWithinAABBExcludingEntity(null, new AxisAlignedBB(pos))) {
if (!(entity instanceof EntityItem) && !(entity instanceof EntityXPOrb)) {
return false;
}
}
EnumFacing side = getPlaceableSide(pos);
// check if we have a block adjacent to blockpos to click at
if (side == null) {
return false;
}
BlockPos neighbour = pos.offset(side);
EnumFacing opposite = side.getOpposite();
// check if neighbor can be right clicked
if (!canBeClicked(neighbour)) {
return false;
}
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();
int obiSlot = findObiInHotbar();
if (obiSlot == -1) {
missingObiDisable = true;
return false;
}
if (lastHotbarSlot != obiSlot) {
mc.player.inventory.currentItem = obiSlot;
lastHotbarSlot = obiSlot;
}
if (!isSneaking && BlockInteractionHelper.blackList.contains(neighbourBlock) || BlockInteractionHelper.shulkerList.contains(neighbourBlock)) {
mc.player.connection.sendPacket(new CPacketEntityAction(mc.player, CPacketEntityAction.Action.START_SNEAKING));
isSneaking = true;
}
if (rotate.getValue()) {
faceVectorPacketInstant(hitVec);
}
mc.playerController.processRightClickBlock(mc.player, mc.world, neighbour, opposite, hitVec, EnumHand.MAIN_HAND);
mc.player.swingArm(EnumHand.MAIN_HAND);
mc.rightClickDelayTimer = 4;
return true;
}
private int findObiInHotbar() {
// search blocks in hotbar
int slot = -1;
for (int i = 0; i < 9; i++) {
// filter out non-block items
ItemStack stack = mc.player.inventory.getStackInSlot(i);
if (stack == ItemStack.EMPTY || !(stack.getItem() instanceof ItemBlock)) {
continue;
}
Block block = ((ItemBlock) stack.getItem()).getBlock();
if (block instanceof BlockObsidian) {
slot = i;
break;
}
}
return slot;
}
private enum Mode {
SURROUND, FULL
}
private static class Offsets {
private static final Vec3d[] SURROUND = {
new Vec3d(1, 0, 0),
new Vec3d(0, 0, 1),
new Vec3d(-1, 0, 0),
new Vec3d(0, 0, -1),
new Vec3d(1, -1, 0),
new Vec3d(0, -1, 1),
new Vec3d(-1, -1, 0),
new Vec3d(0, -1, -1)
};
private static final Vec3d[] FULL = {
new Vec3d(1, 0, 0),
new Vec3d(0, 0, 1),
new Vec3d(-1, 0, 0),
new Vec3d(0, 0, -1),
new Vec3d(1, -1, 0),
new Vec3d(0, -1, 1),
new Vec3d(-1, -1, 0),
new Vec3d(0, -1, -1),
new Vec3d(0, -1, 0)
};
}
}

View File

@ -39,7 +39,7 @@ import static me.zeroeightsix.kami.util.EntityUtil.calculateLookAt;
/**
* Created by 086 on 28/12/2017.
* Last Updated 29 June 2019 by hub
* Updated 3 December 2019 by hub
*/
@Module.Info(name = "CrystalAura", category = Module.Category.COMBAT)
public class CrystalAura extends Module {
@ -232,14 +232,12 @@ public class CrystalAura extends Module {
private boolean canPlaceCrystal(BlockPos blockPos) {
BlockPos boost = blockPos.add(0, 1, 0);
BlockPos boost2 = blockPos.add(0, 2, 0);
if ((mc.world.getBlockState(blockPos).getBlock() != Blocks.BEDROCK
&& mc.world.getBlockState(blockPos).getBlock() != Blocks.OBSIDIAN)
|| mc.world.getBlockState(boost).getBlock() != Blocks.AIR
|| mc.world.getBlockState(boost2).getBlock() != Blocks.AIR
|| !mc.world.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(boost)).isEmpty()) {
return false;
}
return true;
return (mc.world.getBlockState(blockPos).getBlock() == Blocks.BEDROCK
|| mc.world.getBlockState(blockPos).getBlock() == Blocks.OBSIDIAN)
&& mc.world.getBlockState(boost).getBlock() == Blocks.AIR
&& mc.world.getBlockState(boost2).getBlock() == Blocks.AIR
&& mc.world.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(boost)).isEmpty()
&& mc.world.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(boost2)).isEmpty();
}
public static BlockPos getPlayerPos() {

View File

@ -1,59 +1,26 @@
package me.zeroeightsix.kami.module.modules.player;
import com.google.common.collect.Lists;
import me.zeroeightsix.kami.command.Command;
import me.zeroeightsix.kami.event.events.RenderEvent;
import me.zeroeightsix.kami.module.Module;
import me.zeroeightsix.kami.module.ModuleManager;
import me.zeroeightsix.kami.setting.Setting;
import me.zeroeightsix.kami.setting.Settings;
import me.zeroeightsix.kami.setting.builder.SettingBuilder;
import me.zeroeightsix.kami.util.EntityUtil;
import me.zeroeightsix.kami.util.GeometryMasks;
import me.zeroeightsix.kami.util.KamiTessellator;
import me.zeroeightsix.kami.util.Wrapper;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.BlockFalling;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.PlayerControllerMP;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.network.play.client.CPacketPlayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import org.lwjgl.opengl.GL11;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import static me.zeroeightsix.kami.util.BlockInteractionHelper.*;
@Module.Info(name = "Scaffold", category = Module.Category.PLAYER)
public class Scaffold extends Module {
private List<Block> blackList = Arrays.asList(new Block[] {
Blocks.ENDER_CHEST,
Blocks.CHEST,
Blocks.TRAPPED_CHEST,
});
private Setting<Integer> future = register(Settings.integerBuilder("Ticks").withMinimum(0).withMaximum(60).withValue(2));
private boolean hasNeighbour(BlockPos blockPos) {
for (EnumFacing side : EnumFacing.values()) {
BlockPos neighbour = blockPos.offset(side);
if(!Wrapper.getWorld().getBlockState(neighbour).getMaterial().isReplaceable())
return true;
}
return false;
}
@Override
public void onUpdate() {
if (isDisabled() || mc.player == null || ModuleManager.isModuleEnabled("Freecam")) return;
@ -104,15 +71,7 @@ public class Scaffold extends Module {
Wrapper.getPlayer().inventory.currentItem = newSlot;
// check if we don't have a block adjacent to blockpos
A: if (!hasNeighbour(blockPos)) {
// find air adjacent to blockpos that does have a block adjacent to it, let's fill this first as to form a bridge between the player and the original blockpos. necessary if the player is going diagonal.
for (EnumFacing side : EnumFacing.values()) {
BlockPos neighbour = blockPos.offset(side);
if (hasNeighbour(neighbour)) {
blockPos = neighbour;
break A;
}
}
if (!checkForNeighbours(blockPos)) {
return;
}
@ -123,107 +82,5 @@ public class Scaffold extends Module {
Wrapper.getPlayer().inventory.currentItem = oldSlot;
}
public static boolean placeBlockScaffold(BlockPos pos) {
Vec3d eyesPos = new Vec3d(Wrapper.getPlayer().posX,
Wrapper.getPlayer().posY + Wrapper.getPlayer().getEyeHeight(),
Wrapper.getPlayer().posZ);
for(EnumFacing side : EnumFacing.values())
{
BlockPos neighbor = pos.offset(side);
EnumFacing side2 = side.getOpposite();
// check if side is visible (facing away from player)
if(eyesPos.squareDistanceTo(
new Vec3d(pos).add(0.5, 0.5, 0.5)) >= eyesPos
.squareDistanceTo(
new Vec3d(neighbor).add(0.5, 0.5, 0.5)))
continue;
// check if neighbor can be right clicked
if(!canBeClicked(neighbor))
continue;
Vec3d hitVec = new Vec3d(neighbor).add(0.5, 0.5, 0.5)
.add(new Vec3d(side2.getDirectionVec()).scale(0.5));
// check if hitVec is within range (4.25 blocks)
if(eyesPos.squareDistanceTo(hitVec) > 18.0625)
continue;
// place block
faceVectorPacketInstant(hitVec);
processRightClickBlock(neighbor, side2, hitVec);
Wrapper.getPlayer().swingArm(EnumHand.MAIN_HAND);
mc.rightClickDelayTimer = 4;
return true;
}
return false;
}
private static PlayerControllerMP getPlayerController()
{
return Minecraft.getMinecraft().playerController;
}
public static void processRightClickBlock(BlockPos pos, EnumFacing side,
Vec3d hitVec)
{
getPlayerController().processRightClickBlock(Wrapper.getPlayer(),
mc.world, pos, side, hitVec, EnumHand.MAIN_HAND);
}
public static IBlockState getState(BlockPos pos)
{
return Wrapper.getWorld().getBlockState(pos);
}
public static Block getBlock(BlockPos pos)
{
return getState(pos).getBlock();
}
public static boolean canBeClicked(BlockPos pos)
{
return getBlock(pos).canCollideCheck(getState(pos), false);
}
public static void faceVectorPacketInstant(Vec3d vec)
{
float[] rotations = getNeededRotations2(vec);
Wrapper.getPlayer().connection.sendPacket(new CPacketPlayer.Rotation(rotations[0],
rotations[1], Wrapper.getPlayer().onGround));
}
private static float[] getNeededRotations2(Vec3d vec)
{
Vec3d eyesPos = getEyesPos();
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);
float yaw = (float)Math.toDegrees(Math.atan2(diffZ, diffX)) - 90F;
float pitch = (float)-Math.toDegrees(Math.atan2(diffY, diffXZ));
return new float[]{
Wrapper.getPlayer().rotationYaw
+ MathHelper.wrapDegrees(yaw - Wrapper.getPlayer().rotationYaw),
Wrapper.getPlayer().rotationPitch + MathHelper
.wrapDegrees(pitch - Wrapper.getPlayer().rotationPitch)};
}
public static Vec3d getEyesPos()
{
return new Vec3d(Wrapper.getPlayer().posX,
Wrapper.getPlayer().posY + Wrapper.getPlayer().getEyeHeight(),
Wrapper.getPlayer().posZ);
}
}

View File

@ -1,79 +1,129 @@
package me.zeroeightsix.kami.util;
import java.util.Arrays;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.PlayerControllerMP;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.network.play.client.CPacketPlayer.Rotation;
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.Arrays;
import java.util.List;
/**
* Created by hub on 15 June 2019
* Last Updated 16 June 2019 by hub
*/
public class BlockInteractionHelper {
public static final List blackList;
public static final List shulkerList;
private static final Minecraft mc;
public static boolean hotbarSlotCheckEmpty(ItemStack stack) {
return stack != ItemStack.EMPTY;
}
public static final List<Block> blackList = 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
);
public static boolean blockCheckNonBlock(ItemStack stack) {
return stack.getItem() instanceof ItemBlock;
}
public static final List<Block> shulkerList = 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
);
private static final Minecraft mc = Minecraft.getMinecraft();
public static void placeBlockScaffold(BlockPos pos) {
Vec3d eyesPos = new Vec3d(Wrapper.getPlayer().posX, Wrapper.getPlayer().posY + (double)Wrapper.getPlayer().getEyeHeight(), Wrapper.getPlayer().posZ);
EnumFacing[] var2 = EnumFacing.values();
int var3 = var2.length;
Vec3d eyesPos = new Vec3d(Wrapper.getPlayer().posX,
Wrapper.getPlayer().posY + Wrapper.getPlayer().getEyeHeight(),
Wrapper.getPlayer().posZ);
for(int var4 = 0; var4 < var3; ++var4) {
EnumFacing side = var2[var4];
for (EnumFacing side : EnumFacing.values()) {
BlockPos neighbor = pos.offset(side);
EnumFacing side2 = side.getOpposite();
if (canBeClicked(neighbor)) {
Vec3d hitVec = (new Vec3d(neighbor)).add(0.5D, 0.5D, 0.5D).add((new Vec3d(side2.getDirectionVec())).scale(0.5D));
if (eyesPos.squareDistanceTo(hitVec) <= 18.0625D) {
faceVectorPacketInstant(hitVec);
processRightClickBlock(neighbor, side2, hitVec);
Wrapper.getPlayer().swingArm(EnumHand.MAIN_HAND);
mc.rightClickDelayTimer = 4;
return;
}
// check if neighbor can be right clicked
if (!canBeClicked(neighbor)) {
continue;
}
Vec3d hitVec = new Vec3d(neighbor).add(0.5, 0.5, 0.5)
.add(new Vec3d(side2.getDirectionVec()).scale(0.5));
// check if hitVec is within range (4.25 blocks)
if (eyesPos.squareDistanceTo(hitVec) > 18.0625) {
continue;
}
// place block
faceVectorPacketInstant(hitVec);
processRightClickBlock(neighbor, side2, hitVec);
Wrapper.getPlayer().swingArm(EnumHand.MAIN_HAND);
mc.rightClickDelayTimer = 4;
return;
}
}
private static float[] getLegitRotations(Vec3d vec) {
Vec3d eyesPos = getEyesPos();
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);
float yaw = (float)Math.toDegrees(Math.atan2(diffZ, diffX)) - 90.0F;
float pitch = (float)(-Math.toDegrees(Math.atan2(diffY, diffXZ)));
return new float[]{Wrapper.getPlayer().rotationYaw + MathHelper.wrapDegrees(yaw - Wrapper.getPlayer().rotationYaw), Wrapper.getPlayer().rotationPitch + MathHelper.wrapDegrees(pitch - Wrapper.getPlayer().rotationPitch)};
float yaw = (float) Math.toDegrees(Math.atan2(diffZ, diffX)) - 90F;
float pitch = (float) -Math.toDegrees(Math.atan2(diffY, diffXZ));
return new float[]{
Wrapper.getPlayer().rotationYaw
+ MathHelper.wrapDegrees(yaw - Wrapper.getPlayer().rotationYaw),
Wrapper.getPlayer().rotationPitch + MathHelper
.wrapDegrees(pitch - Wrapper.getPlayer().rotationPitch)};
}
private static Vec3d getEyesPos() {
return new Vec3d(Wrapper.getPlayer().posX, Wrapper.getPlayer().posY + (double)Wrapper.getPlayer().getEyeHeight(), Wrapper.getPlayer().posZ);
return new Vec3d(Wrapper.getPlayer().posX,
Wrapper.getPlayer().posY + Wrapper.getPlayer().getEyeHeight(),
Wrapper.getPlayer().posZ);
}
public static void faceVectorPacketInstant(Vec3d vec) {
float[] rotations = getLegitRotations(vec);
Wrapper.getPlayer().connection.sendPacket(new Rotation(rotations[0], rotations[1], Wrapper.getPlayer().onGround));
Wrapper.getPlayer().connection.sendPacket(new CPacketPlayer.Rotation(rotations[0],
rotations[1], Wrapper.getPlayer().onGround));
}
private static void processRightClickBlock(BlockPos pos, EnumFacing side, Vec3d hitVec) {
getPlayerController().processRightClickBlock(Wrapper.getPlayer(), mc.world, pos, side, hitVec, EnumHand.MAIN_HAND);
private static void processRightClickBlock(BlockPos pos, EnumFacing side,
Vec3d hitVec) {
getPlayerController().processRightClickBlock(Wrapper.getPlayer(),
mc.world, pos, side, hitVec, EnumHand.MAIN_HAND);
}
public static boolean canBeClicked(BlockPos pos) {
@ -93,42 +143,28 @@ public class BlockInteractionHelper {
}
public static boolean checkForNeighbours(BlockPos blockPos) {
// check if we don't have a block adjacent to blockpos
if (!hasNeighbour(blockPos)) {
EnumFacing[] var1 = EnumFacing.values();
int var2 = var1.length;
for(int var3 = 0; var3 < var2; ++var3) {
EnumFacing side = var1[var3];
// find air adjacent to blockpos that does have a block adjacent to it, let's fill this first as to form a bridge between the player and the original blockpos. necessary if the player is going diagonal.
for (EnumFacing side : EnumFacing.values()) {
BlockPos neighbour = blockPos.offset(side);
if (hasNeighbour(neighbour)) {
return true;
}
}
return false;
} else {
return true;
}
return true;
}
private static boolean hasNeighbour(BlockPos blockPos) {
EnumFacing[] var1 = EnumFacing.values();
int var2 = var1.length;
for(int var3 = 0; var3 < var2; ++var3) {
EnumFacing side = var1[var3];
public static boolean hasNeighbour(BlockPos blockPos) {
for (EnumFacing side : EnumFacing.values()) {
BlockPos neighbour = blockPos.offset(side);
if (!Wrapper.getWorld().getBlockState(neighbour).getMaterial().isReplaceable()) {
return true;
}
}
return false;
}
static {
blackList = 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);
shulkerList = 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);
mc = Minecraft.getMinecraft();
}
}