setBlockBoundsBasedOnState方法
public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos)
{
IBlockState iblockstate = worldIn.getBlockState(pos);
if (iblockstate.getBlock() == this)
{
float f = 0.125F;
if (ViaLoadingBase.getInstance().getTargetVersion().newerThanOrEqualTo(ProtocolVersion.v1_12_2)) {
f = 0.1875f;
}
switch ((EnumFacing)iblockstate.getValue(FACING))
{
case NORTH:
this.setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F);
break;
case SOUTH:
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f);
break;
case WEST:
this.setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
break;
case EAST:
default:
this.setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F);
}
}
}
public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state)
{
double mod = 1f;
if (ViaLoadingBase.getInstance().getTargetVersion().newerThanOrEqualTo(ProtocolVersion.v1_12_2)) {
mod = 0.9375f;
}
return new AxisAlignedBB((double)pos.getX(), (double)pos.getY(), (double)pos.getZ(), (double)(pos.getX() + 1), (double)(pos.getY() + mod), (double)(pos.getZ() + 1));
}
public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state)
{
if (ViaLoadingBase.getInstance().getTargetVersion().newerThanOrEqualTo(ProtocolVersion.v1_12_2)) {
return new AxisAlignedBB((double)pos.getX() + 0.0625, (double)pos.getY(), (double)pos.getZ() + this.minZ + 0.0625, (double)pos.getX() + 0.9375, (double)pos.getY() + 0.09375, (double)pos.getZ() + 0.9375);
}
return new AxisAlignedBB((double)pos.getX() + this.minX, (double)pos.getY() + this.minY, (double)pos.getZ() + this.minZ, (double)pos.getX() + this.maxX, (double)pos.getY() + this.maxY, (double)pos.getZ() + this.maxZ);
}
if (this.pointedEntity != null && flag && vec3.distanceTo(vec33) > 3.0D)
{
this.pointedEntity = null;
this.mc.objectMouseOver = new MovingObjectPosition(MovingObjectPosition.MovingObjectType.MISS, vec33, (EnumFacing)null, new BlockPos(vec33));
}
double distance = 3.0D;
if (ViaLoadingBase.getInstance().getTargetVersion().newerThanOrEqualTo(ProtocolVersion.v1_12_2)) {
distance = 2.9D;
}
if (this.pointedEntity != null && flag && vec3.distanceTo(vec33) > distance)
{
this.pointedEntity = null;
this.mc.objectMouseOver = new MovingObjectPosition(MovingObjectPosition.MovingObjectType.MISS, vec33, (EnumFacing)null, new BlockPos(vec33));
}
public float getCollisionBorderSize()
{
if (ViaLoadingBase.getInstance().getTargetVersion().newerThanOrEqualTo(ProtocolVersion.v1_12_2)) {
return 0F;
}
return 0.1F;
}
if (Math.abs(this.motionX) < 0.005D)
{
this.motionX = 0.0D;
}
if (Math.abs(this.motionY) < 0.005D)
{
this.motionY = 0.0D;
}
if (Math.abs(this.motionZ) < 0.005D)
{
this.motionZ = 0.0D;
}
double movementThreshold = 0.005D;
if (ViaLoadingBase.getInstance().getTargetVersion().newerThanOrEqualTo(ProtocolVersion.v1_12_2)) {
movementThreshold = 0.003;
}
if (Math.abs(this.motionX) < movementThreshold)
{
this.motionX = 0.0D;
}
if (Math.abs(this.motionY) < movementThreshold)
{
this.motionY = 0.0D;
}
if (Math.abs(this.motionZ) < movementThreshold)
{
this.motionZ = 0.0D;
}
C08PacketPlayerBlockPlacement
public void writePacketData(PacketBuffer buf) throws IOException
{
buf.writeBlockPos(this.position);
buf.writeByte(this.placedBlockDirection);
buf.writeItemStackToBuffer(this.stack);
if (ViaLoadingBase.getInstance().getTargetVersion().getVersion() > 47) {
buf.writeByte((int)(this.facingX));
buf.writeByte((int)(this.facingY));
buf.writeByte((int)(this.facingZ));
} else {
buf.writeByte((int)(this.facingX * 16.0F));
buf.writeByte((int)(this.facingY * 16.0F));
buf.writeByte((int)(this.facingZ * 16.0F));
}
}
那么你的客户端已经可以在1.12.2正常游玩不被一些特殊的反作弊检测了