754 lines
22 KiB
Java
754 lines
22 KiB
Java
package openonyx.movement;
|
|
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import net.minecraft.block.Block;
|
|
import net.minecraft.block.material.Material;
|
|
import net.minecraft.block.state.IBlockState;
|
|
import net.minecraft.client.entity.EntityPlayerSP;
|
|
import net.minecraft.enchantment.EnchantmentHelper;
|
|
import net.minecraft.entity.Entity;
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
import net.minecraft.init.Blocks;
|
|
import net.minecraft.potion.Potion;
|
|
import net.minecraft.potion.PotionEffect;
|
|
import net.minecraft.util.AxisAlignedBB;
|
|
import net.minecraft.util.BlockPos;
|
|
import net.minecraft.util.MathHelper;
|
|
import net.minecraft.util.Vec3;
|
|
import net.minecraft.world.World;
|
|
import openonyx.configuration.internal.SimulatedMoveEvent;
|
|
import openonyx.core.MinecraftAccess;
|
|
import openonyx.core.OnyxClient;
|
|
import openonyx.utilities.PlayerUtils;
|
|
import openonyx.utilities.VecUtils;
|
|
|
|
public class SimulatedPlayer implements SimulatedEntity, MinecraftAccess {
|
|
private Vec3 vec3;
|
|
private boolean c;
|
|
private double a;
|
|
private static final double k = 1.0;
|
|
private float g;
|
|
private Vec3 vec32;
|
|
private int L;
|
|
private boolean j;
|
|
private boolean m;
|
|
private int h;
|
|
private final EntityPlayer entityPlayer;
|
|
private float I;
|
|
private boolean d;
|
|
private boolean i;
|
|
private SimulatedPlayerInput simulatedPlayerInput;
|
|
private boolean H;
|
|
private AxisAlignedBB axisAlignedBB;
|
|
|
|
private boolean H() {
|
|
return this.L().isMaterialInBB(this.axisAlignedBB.expand(-0.1F, -0.4F, -0.1F), Material.lava);
|
|
}
|
|
|
|
private void i() {
|
|
this.a = 0.0;
|
|
}
|
|
|
|
public boolean e() {
|
|
return this.c;
|
|
}
|
|
|
|
public static SimulatedPlayer L(SimulatedPlayerInput simulatedPlayerInput) {
|
|
return L(mc.thePlayer, simulatedPlayerInputx, PlayerUtils.L((Entity)mc.thePlayer));
|
|
}
|
|
|
|
public boolean k() {
|
|
return this.m;
|
|
}
|
|
|
|
public void L(SimulatedPlayerInput simulatedPlayerInput) {
|
|
this.simulatedPlayerInput = simulatedPlayerInputx;
|
|
}
|
|
|
|
private boolean F() {
|
|
SimulatedPlayer simulatedPlayer1 = this;
|
|
Block block;
|
|
return (
|
|
block = simulatedPlayer1.L(
|
|
new BlockPos(
|
|
MathHelper.floor_double(simulatedPlayer1.vec3.xCoord),
|
|
MathHelper.floor_double(simulatedPlayer1.axisAlignedBB.minY),
|
|
MathHelper.floor_double(simulatedPlayer1.vec3.zCoord)
|
|
)
|
|
)
|
|
.getBlock()
|
|
)
|
|
== Blocks.ladder
|
|
|| block == Blocks.vine;
|
|
}
|
|
|
|
public void i(Vec3 vec3) {
|
|
this.vec3 = vec3x;
|
|
this.axisAlignedBB = PlayerUtils.L(vec3x);
|
|
}
|
|
|
|
public float i() {
|
|
return this.g;
|
|
}
|
|
|
|
public SimulatedPlayerInput getSimulatedPlayerInput() {
|
|
return this.simulatedPlayerInput;
|
|
}
|
|
|
|
public void I(boolean bl) {
|
|
this.j = bl;
|
|
}
|
|
|
|
public int d() {
|
|
return this.L;
|
|
}
|
|
|
|
private IBlockState L(BlockPos blockPos) {
|
|
return this.L().getBlockState(blockPos);
|
|
}
|
|
|
|
private boolean L(AxisAlignedBB axisAlignedBB) {
|
|
return this.L().getCollidingBoundingBoxes(this.entityPlayer, axisAlignedBBx).isEmpty();
|
|
}
|
|
|
|
public boolean l() {
|
|
return this.i;
|
|
}
|
|
|
|
public SimulatedPlayer L() {
|
|
return new SimulatedPlayer(
|
|
this.entityPlayer,
|
|
this.simulatedPlayerInput,
|
|
this.vec3,
|
|
this.vec32,
|
|
this.axisAlignedBB,
|
|
this.I,
|
|
this.g,
|
|
this.d,
|
|
this.a,
|
|
this.L,
|
|
this.j,
|
|
this.m,
|
|
this.i,
|
|
this.c
|
|
);
|
|
}
|
|
|
|
private float D() {
|
|
SimulatedPlayer simulatedPlayer1 = this;
|
|
float f = 0.02F;
|
|
return simulatedPlayer1.simulatedPlayerInput.L() ? (float)(f + f * 0.3) : f;
|
|
}
|
|
|
|
public void D(Vec3 vec3) {
|
|
this.vec32 = vec3x;
|
|
}
|
|
|
|
private Vec3 D(Vec3 vec3) {
|
|
if (!this.F()) {
|
|
return vec3x;
|
|
}
|
|
|
|
this.i();
|
|
double dx = MathHelper.clamp_double(vec3x.xCoord, -0.15F, 0.15F);
|
|
double e = MathHelper.clamp_double(vec3x.zCoord, -0.15F, 0.15F);
|
|
double f;
|
|
if ((f = Math.max(vec3x.yCoord, -0.15F)) < 0.0 && this.simulatedPlayerInput.inputFlags.shift()) {
|
|
f = 0.0;
|
|
}
|
|
|
|
return new Vec3(dx, f, e);
|
|
}
|
|
|
|
public void d(int i) {
|
|
this.h = ix;
|
|
}
|
|
|
|
public void i(boolean bl) {
|
|
this.m = bl;
|
|
}
|
|
|
|
public Vec3 getVec32() {
|
|
return this.vec32;
|
|
}
|
|
|
|
private float d() {
|
|
return this.entityPlayer.getAIMoveSpeed();
|
|
}
|
|
|
|
private static SimulatedPlayer L(EntityPlayer entityPlayer, SimulatedPlayerInput simulatedPlayerInput, Vec3 vec3) {
|
|
SimulatedPlayer simulatedPlayer = new SimulatedPlayer;
|
|
Vec3 vec31 = PlayerUtils.D(entityPlayerx);
|
|
AxisAlignedBB axisAlignedBBx = entityPlayerx.getEntityBoundingBox();
|
|
float f = entityPlayerx.rotationYaw;
|
|
float gx = entityPlayerx.rotationPitch;
|
|
boolean bl = entityPlayerx.isSprinting();
|
|
double dx = entityPlayerx.fallDistance;
|
|
EntityPlayerSP entityPlayerSP;
|
|
boolean bl1;
|
|
EntityPlayer entityPlayer1;
|
|
if (entityPlayerx instanceof EntityPlayerSP
|
|
&& (entityPlayerSP = (EntityPlayerSP)entityPlayerx).movementInput != null
|
|
&& entityPlayerSP.movementInput.jump) {
|
|
bl1 = true;
|
|
entityPlayer1 = entityPlayerx;
|
|
} else {
|
|
bl1 = false;
|
|
entityPlayer1 = entityPlayerx;
|
|
}
|
|
|
|
simulatedPlayer./* $VF: Unable to resugar constructor */<init>(
|
|
entityPlayerx,
|
|
simulatedPlayerInputx,
|
|
vec31,
|
|
vec3x,
|
|
axisAlignedBBx,
|
|
f,
|
|
gx,
|
|
bl,
|
|
dx,
|
|
0,
|
|
bl1,
|
|
entityPlayer1.onGround,
|
|
entityPlayerx.isCollidedHorizontally,
|
|
entityPlayerx.isCollidedVertically
|
|
);
|
|
return simulatedPlayer;
|
|
}
|
|
|
|
private boolean h() {
|
|
return this.L().isMaterialInBB(this.axisAlignedBB.expand(0.0, -0.4F, 0.0).contract(0.001, 0.001, 0.001), Material.water);
|
|
}
|
|
|
|
public void L(double d) {
|
|
this.a = dx;
|
|
}
|
|
|
|
public boolean I() {
|
|
return this.j;
|
|
}
|
|
|
|
public float L() {
|
|
return this.I;
|
|
}
|
|
|
|
public int L() {
|
|
return this.h;
|
|
}
|
|
|
|
private void L(float f, Vec3 vec3) {
|
|
this.vec32 = this.vec32.add(PlayerUtils.L(vec3x, f, this.I));
|
|
}
|
|
|
|
private IBlockState L() {
|
|
return this.L(
|
|
new BlockPos(
|
|
MathHelper.floor_double(this.vec3.xCoord), MathHelper.floor_double(this.axisAlignedBB.minY) - 1, MathHelper.floor_double(this.vec3.zCoord)
|
|
)
|
|
);
|
|
}
|
|
|
|
public void D() {
|
|
SimulatedPlayer simulatedPlayer1 = this;
|
|
simulatedPlayer1.vec32 = VecUtils.i(simulatedPlayer1.vec32, 0.42F);
|
|
PotionEffect potionEffect;
|
|
if ((potionEffect = simulatedPlayer1.entityPlayer.getActivePotionEffect(Potion.jump)) != null) {
|
|
simulatedPlayer1.vec32 = simulatedPlayer1.vec32.add(0.0, (potionEffect.getAmplifier() + 1) * 0.1F, 0.0);
|
|
}
|
|
|
|
if (simulatedPlayer1.d) {
|
|
float f = simulatedPlayer1.I * (float) (Math.PI / 180.0);
|
|
simulatedPlayer1.vec32 = simulatedPlayer1.vec32.add(-MathHelper.sin(f) * 0.2F, 0.0, MathHelper.cos(f) * 0.2F);
|
|
}
|
|
}
|
|
|
|
private void d(Vec3 vec3) {
|
|
SimulatedMoveEvent simulatedMoveEvent = new SimulatedMoveEvent(vec3x);
|
|
OnyxClient.EVENT_BUS.post(simulatedMoveEvent);
|
|
vec3x = simulatedMoveEvent.getVec3();
|
|
if (this.D()) {
|
|
vec3x = vec3x.multiply(0.25, 0.05F, 0.25);
|
|
this.vec32 = Vec3.ZERO;
|
|
}
|
|
|
|
Vec3 vec31;
|
|
if ((vec31 = this.d(vec3x = this.L(vec3x))).lengthSqr() > 1.0E-7) {
|
|
this.vec3 = this.vec3.add(vec31);
|
|
this.axisAlignedBB = PlayerUtils.L(this.vec3);
|
|
}
|
|
|
|
boolean bl1 = vec3x.xCoord != vec31.xCoord;
|
|
boolean bl = vec3x.zCoord != vec31.zCoord;
|
|
this.i = bl1 || bl;
|
|
this.c = vec3x.yCoord != vec31.yCoord;
|
|
this.m = this.c && vec3x.yCoord < 0.0;
|
|
SimulatedPlayer simulatedPlayer1;
|
|
if (this.m) {
|
|
simulatedPlayer1 = this;
|
|
this.i();
|
|
} else {
|
|
if (vec31.yCoord < 0.0) {
|
|
this.a = this.a - vec31.yCoord;
|
|
}
|
|
|
|
simulatedPlayer1 = this;
|
|
}
|
|
|
|
vec3x = simulatedPlayer1.vec32;
|
|
if (this.i || this.c) {
|
|
Vec3 vec32x = new Vec3;
|
|
double e;
|
|
SimulatedPlayer simulatedPlayer2;
|
|
if (bl1) {
|
|
e = 0.0;
|
|
simulatedPlayer2 = this;
|
|
} else {
|
|
e = vec3x.xCoord;
|
|
simulatedPlayer2 = this;
|
|
}
|
|
|
|
double dx;
|
|
boolean bl2;
|
|
if (simulatedPlayer2.m) {
|
|
dx = 0.0;
|
|
bl2 = bl;
|
|
} else {
|
|
dx = vec3x.yCoord;
|
|
bl2 = bl;
|
|
}
|
|
|
|
vec32x./* $VF: Unable to resugar constructor */<init>(e, dx, bl2 ? 0.0 : vec3x.zCoord);
|
|
this.vec32 = vec32x;
|
|
}
|
|
}
|
|
|
|
public void d() {
|
|
this.D();
|
|
}
|
|
|
|
public void L(AxisAlignedBB axisAlignedBB) {
|
|
this.axisAlignedBB = axisAlignedBBx;
|
|
}
|
|
|
|
private Vec3 d(Vec3 vec3) {
|
|
SimulatedPlayer simulatedPlayer1 = this;
|
|
double dx = vec3x.xCoord;
|
|
double e = vec3x.yCoord;
|
|
double f = vec3x.zCoord;
|
|
double gx = dx;
|
|
double hx = f;
|
|
AxisAlignedBB axisAlignedBBx = simulatedPlayer1.axisAlignedBB;
|
|
AxisAlignedBB axisAlignedBB1 = simulatedPlayer1.axisAlignedBB;
|
|
List list;
|
|
Iterator iterator3;
|
|
Iterator iterator13 = iterator3 = (list = simulatedPlayer1.L()
|
|
.getCollidingBoundingBoxes(simulatedPlayer1.entityPlayer, axisAlignedBB1.addCoord(dx, e, f)))
|
|
.iterator();
|
|
|
|
while (iterator13.hasNext()) {
|
|
AxisAlignedBB axisAlignedBB2 = (AxisAlignedBB)iterator3.next();
|
|
iterator13 = iterator3;
|
|
e = axisAlignedBB2.calculateYOffset(axisAlignedBB1, e);
|
|
}
|
|
|
|
axisAlignedBB1 = axisAlignedBB1.offset(0.0, e, 0.0);
|
|
boolean bl = simulatedPlayer1.m || vec3x.yCoord != e && vec3x.yCoord < 0.0;
|
|
Iterator iterator8;
|
|
iterator13 = iterator8 = list.iterator();
|
|
|
|
while (iterator13.hasNext()) {
|
|
AxisAlignedBB axisAlignedBB3 = (AxisAlignedBB)iterator8.next();
|
|
iterator13 = iterator8;
|
|
dx = axisAlignedBB3.calculateXOffset(axisAlignedBB1, dx);
|
|
}
|
|
|
|
axisAlignedBB1 = axisAlignedBB1.offset(dx, 0.0, 0.0);
|
|
iterator13 = iterator8 = list.iterator();
|
|
|
|
while (iterator13.hasNext()) {
|
|
AxisAlignedBB axisAlignedBB16 = (AxisAlignedBB)iterator8.next();
|
|
iterator13 = iterator8;
|
|
f = axisAlignedBB16.calculateZOffset(axisAlignedBB1, f);
|
|
}
|
|
|
|
axisAlignedBB1 = axisAlignedBB1.offset(0.0, 0.0, f);
|
|
float l = simulatedPlayer1.entityPlayer.stepHeight;
|
|
if (simulatedPlayer1.entityPlayer.stepHeight > 0.0F && bl && (gx != dx || hx != f)) {
|
|
double mx = dx;
|
|
double ix = e;
|
|
double jx = f;
|
|
e = l;
|
|
List list1 = simulatedPlayer1.L().getCollidingBoundingBoxes(simulatedPlayer1.entityPlayer, axisAlignedBBx.addCoord(gx, e, hx));
|
|
AxisAlignedBB axisAlignedBB10 = axisAlignedBBx;
|
|
AxisAlignedBB axisAlignedBB5 = axisAlignedBBx.addCoord(gx, 0.0, hx);
|
|
double kx = e;
|
|
|
|
Iterator iterator;
|
|
for (Iterator iterator9 = iterator = list1.iterator(); iterator9.hasNext(); iterator9 = iterator) {
|
|
kx = ((AxisAlignedBB)iterator.next()).calculateYOffset(axisAlignedBB5, kx);
|
|
}
|
|
|
|
AxisAlignedBB axisAlignedBB11 = axisAlignedBB10.offset(0.0, kx, 0.0);
|
|
double n = gx;
|
|
|
|
Iterator iterator1;
|
|
for (Iterator iterator10 = iterator1 = list1.iterator(); iterator10.hasNext(); iterator10 = iterator1) {
|
|
n = ((AxisAlignedBB)iterator1.next()).calculateXOffset(axisAlignedBB11, n);
|
|
}
|
|
|
|
AxisAlignedBB axisAlignedBB12 = axisAlignedBB11.offset(n, 0.0, 0.0);
|
|
double o = hx;
|
|
Iterator iterator4;
|
|
iterator13 = iterator4 = list1.iterator();
|
|
|
|
while (iterator13.hasNext()) {
|
|
AxisAlignedBB axisAlignedBB4 = (AxisAlignedBB)iterator4.next();
|
|
iterator13 = iterator4;
|
|
o = axisAlignedBB4.calculateZOffset(axisAlignedBB12, o);
|
|
}
|
|
|
|
AxisAlignedBB axisAlignedBB13 = axisAlignedBB12.offset(0.0, 0.0, o);
|
|
AxisAlignedBB axisAlignedBB6 = axisAlignedBBx;
|
|
double p = e;
|
|
|
|
Iterator iterator2;
|
|
for (Iterator iterator11 = iterator2 = list1.iterator(); iterator11.hasNext(); iterator11 = iterator2) {
|
|
p = ((AxisAlignedBB)iterator2.next()).calculateYOffset(axisAlignedBB6, p);
|
|
}
|
|
|
|
AxisAlignedBB axisAlignedBB7 = axisAlignedBB6.offset(0.0, p, 0.0);
|
|
double q = gx;
|
|
|
|
for (Iterator iterator12 = iterator5 = list1.iterator(); iterator12.hasNext(); iterator12 = iterator5) {
|
|
q = ((AxisAlignedBB)iterator5.next()).calculateXOffset(axisAlignedBB7, q);
|
|
}
|
|
|
|
AxisAlignedBB axisAlignedBB8 = axisAlignedBB7.offset(q, 0.0, 0.0);
|
|
gx = hx;
|
|
Iterator iterator6;
|
|
iterator13 = iterator6 = list1.iterator();
|
|
|
|
while (iterator13.hasNext()) {
|
|
AxisAlignedBB axisAlignedBB14 = (AxisAlignedBB)iterator6.next();
|
|
iterator13 = iterator6;
|
|
gx = axisAlignedBB14.calculateZOffset(axisAlignedBB8, gx);
|
|
}
|
|
|
|
AxisAlignedBB axisAlignedBB9 = axisAlignedBB8.offset(0.0, 0.0, gx);
|
|
List list2;
|
|
if (n * n + o * o > q * q + gx * gx) {
|
|
dx = n;
|
|
f = o;
|
|
e = -kx;
|
|
axisAlignedBB1 = axisAlignedBB13;
|
|
list2 = list1;
|
|
} else {
|
|
dx = q;
|
|
f = gx;
|
|
e = -p;
|
|
axisAlignedBB1 = axisAlignedBB9;
|
|
list2 = list1;
|
|
}
|
|
|
|
Iterator iterator7;
|
|
iterator13 = iterator7 = list2.iterator();
|
|
|
|
while (iterator13.hasNext()) {
|
|
AxisAlignedBB axisAlignedBB15 = (AxisAlignedBB)iterator7.next();
|
|
iterator13 = iterator7;
|
|
e = axisAlignedBB15.calculateYOffset(axisAlignedBB1, e);
|
|
}
|
|
|
|
if (mx * mx + jx * jx >= dx * dx + f * f) {
|
|
dx = mx;
|
|
e = ix;
|
|
f = jx;
|
|
}
|
|
}
|
|
|
|
return new Vec3(dx, e, f);
|
|
}
|
|
|
|
public void D(boolean bl) {
|
|
this.i = bl;
|
|
}
|
|
|
|
public static SimulatedPlayer L(EntityPlayer entityPlayer, SimulatedPlayerInput simulatedPlayerInput) {
|
|
return L(entityPlayerx, simulatedPlayerInputx, PlayerUtils.D(entityPlayerx).subtract(PlayerUtils.d(entityPlayerx)));
|
|
}
|
|
|
|
@Override
|
|
public Vec3 pos() {
|
|
return this.vec3;
|
|
}
|
|
|
|
private void L(Vec3 vec3) {
|
|
SimulatedPlayer simulatedPlayer1 = this;
|
|
boolean bl = simulatedPlayer1.entityPlayer.capabilities.isFlying;
|
|
double dx = simulatedPlayer1.vec32.yCoord;
|
|
if (simulatedPlayer1.h() && !bl) {
|
|
double l = simulatedPlayer1.vec3.yCoord;
|
|
float jx = 0.8F;
|
|
float mx = 0.02F;
|
|
float hx;
|
|
if ((hx = EnchantmentHelper.getDepthStriderModifier(simulatedPlayer1.entityPlayer)) > 3.0F) {
|
|
hx = 3.0F;
|
|
}
|
|
|
|
if (!simulatedPlayer1.m) {
|
|
hx *= 0.5F;
|
|
}
|
|
|
|
if (hx > 0.0F) {
|
|
jx += (0.54600006F - jx) * hx / 3.0F;
|
|
mx += (simulatedPlayer1.d() * 1.0F - mx) * hx / 3.0F;
|
|
}
|
|
|
|
simulatedPlayer1.L(mx, vec3x);
|
|
simulatedPlayer1.d(simulatedPlayer1.vec32);
|
|
simulatedPlayer1.vec32 = simulatedPlayer1.vec32.multiply(jx, 0.8F, jx).add(0.0, -0.02, 0.0);
|
|
if (simulatedPlayer1.i
|
|
&& simulatedPlayer1.L(
|
|
simulatedPlayer1.vec32.xCoord, simulatedPlayer1.vec32.yCoord + 0.6F - simulatedPlayer1.vec3.yCoord + l, simulatedPlayer1.vec32.zCoord
|
|
)) {
|
|
simulatedPlayer1.vec32 = VecUtils.i(simulatedPlayer1.vec32, 0.3F);
|
|
return;
|
|
}
|
|
} else if (simulatedPlayer1.H() && !bl) {
|
|
double kx = simulatedPlayer1.vec3.yCoord;
|
|
simulatedPlayer1.L(0.02F, vec3x);
|
|
simulatedPlayer1.d(simulatedPlayer1.vec32);
|
|
simulatedPlayer1.vec32 = simulatedPlayer1.vec32.scale(0.5).add(0.0, -0.02, 0.0);
|
|
if (simulatedPlayer1.i
|
|
&& simulatedPlayer1.L(
|
|
simulatedPlayer1.vec32.xCoord, simulatedPlayer1.vec32.yCoord + 0.6F - simulatedPlayer1.vec3.yCoord + kx, simulatedPlayer1.vec32.zCoord
|
|
)) {
|
|
simulatedPlayer1.vec32 = VecUtils.i(simulatedPlayer1.vec32, 0.3F);
|
|
return;
|
|
}
|
|
} else {
|
|
float f = 0.91F;
|
|
if (simulatedPlayer1.m) {
|
|
f = simulatedPlayer1.L().getBlock().slipperiness * 0.91F;
|
|
}
|
|
|
|
float gx = 0.16277136F / (f * f * f);
|
|
float ix = simulatedPlayer1.m ? simulatedPlayer1.d() * gx : simulatedPlayer1.D();
|
|
simulatedPlayer1.L(ix, vec3x);
|
|
simulatedPlayer1.vec32 = simulatedPlayer1.D(simulatedPlayer1.vec32);
|
|
simulatedPlayer1.d(simulatedPlayer1.vec32);
|
|
if (simulatedPlayer1.i && simulatedPlayer1.F()) {
|
|
simulatedPlayer1.vec32 = VecUtils.i(simulatedPlayer1.vec32, 0.2);
|
|
}
|
|
|
|
double e = bl ? dx * 0.6 : (simulatedPlayer1.vec32.yCoord - 0.08) * 0.98F;
|
|
simulatedPlayer1.vec32 = new Vec3(simulatedPlayer1.vec32.xCoord * f, e, simulatedPlayer1.vec32.zCoord * f);
|
|
if (bl) {
|
|
simulatedPlayer1.i();
|
|
}
|
|
}
|
|
}
|
|
|
|
public AxisAlignedBB getAxisAlignedBB() {
|
|
return this.axisAlignedBB;
|
|
}
|
|
|
|
public Vec3 getVec3() {
|
|
return this.vec3;
|
|
}
|
|
|
|
public EntityPlayer getEntityPlayer() {
|
|
return this.entityPlayer;
|
|
}
|
|
|
|
private boolean L(double d, double e, double f) {
|
|
AxisAlignedBB axisAlignedBBx;
|
|
return this.L(axisAlignedBBx = this.axisAlignedBB.offset(dx, e, f)) && !this.L().isAnyLiquid(axisAlignedBBx);
|
|
}
|
|
|
|
public void d(boolean bl) {
|
|
this.d = bl;
|
|
}
|
|
|
|
public boolean i() {
|
|
return this.d;
|
|
}
|
|
|
|
private Vec3 L(Vec3 vec3) {
|
|
if (this.m && !(vec3x.yCoord > 0.0)) {
|
|
double dx = vec3x.xCoord;
|
|
double e = vec3x.zCoord;
|
|
double f = 0.05;
|
|
double gx = dx;
|
|
|
|
while (gx != 0.0 && this.L(this.axisAlignedBB.offset(dx, -1.0, 0.0))) {
|
|
gx = dx < f && dx >= -f ? (dx = 0.0) : (dx > 0.0 ? (dx -= f) : (dx += f));
|
|
}
|
|
|
|
gx = e;
|
|
|
|
while (gx != 0.0 && this.L(this.axisAlignedBB.offset(0.0, -1.0, e))) {
|
|
gx = e < f && e >= -f ? (e = 0.0) : (e > 0.0 ? (e -= f) : (e += f));
|
|
}
|
|
|
|
gx = dx;
|
|
|
|
while (gx != 0.0 && e != 0.0 && this.L(this.axisAlignedBB.offset(dx, -1.0, e))) {
|
|
if (dx < f && dx >= -f) {
|
|
dx = 0.0;
|
|
gx = e;
|
|
} else if (dx > 0.0) {
|
|
dx -= f;
|
|
gx = e;
|
|
} else {
|
|
dx += f;
|
|
gx = e;
|
|
}
|
|
|
|
if (gx < f && e >= -f) {
|
|
e = 0.0;
|
|
gx = dx;
|
|
} else if (e > 0.0) {
|
|
e -= f;
|
|
gx = dx;
|
|
} else {
|
|
e += f;
|
|
gx = dx;
|
|
}
|
|
}
|
|
|
|
if (vec3x.xCoord != dx || vec3x.zCoord != e) {
|
|
this.H = true;
|
|
}
|
|
|
|
return !this.L() ? vec3x : new Vec3(dx, vec3x.yCoord, e);
|
|
} else {
|
|
return vec3x;
|
|
}
|
|
}
|
|
|
|
public void L(boolean bl) {
|
|
this.c = bl;
|
|
}
|
|
|
|
public SimulatedPlayer(
|
|
EntityPlayer entityPlayer,
|
|
SimulatedPlayerInput simulatedPlayerInput,
|
|
Vec3 vec3,
|
|
Vec3 vec31,
|
|
AxisAlignedBB axisAlignedBB,
|
|
float f,
|
|
float g,
|
|
boolean bl,
|
|
double d,
|
|
int i,
|
|
boolean bl1,
|
|
boolean bl2,
|
|
boolean bl3,
|
|
boolean bl4
|
|
) {
|
|
this.entityPlayer = entityPlayerx;
|
|
this.simulatedPlayerInput = simulatedPlayerInputx;
|
|
this.vec3 = vec3x;
|
|
this.vec32 = vec31;
|
|
this.axisAlignedBB = axisAlignedBBx;
|
|
this.I = f;
|
|
this.g = gx;
|
|
this.d = bl;
|
|
this.a = dx;
|
|
this.L = ix;
|
|
this.j = bl1;
|
|
this.m = bl2;
|
|
this.i = bl3;
|
|
this.c = bl4;
|
|
}
|
|
|
|
@Override
|
|
public void L() {
|
|
this.H = false;
|
|
if (!(this.vec3.yCoord <= -70.0)) {
|
|
this.simulatedPlayerInput.L();
|
|
if (this.L > 0) {
|
|
this.L--;
|
|
}
|
|
|
|
this.j = this.simulatedPlayerInput.inputFlags.jump();
|
|
double dx = this.vec32.xCoord;
|
|
double e = this.vec32.yCoord;
|
|
double f = this.vec32.zCoord;
|
|
if (Math.abs(dx) < 0.005) {
|
|
dx = 0.0;
|
|
}
|
|
|
|
if (Math.abs(e) < 0.005) {
|
|
e = 0.0;
|
|
}
|
|
|
|
if (Math.abs(f) < 0.005) {
|
|
f = 0.0;
|
|
}
|
|
|
|
SimulatedPlayer simulatedPlayer1;
|
|
label36: {
|
|
this.vec32 = new Vec3(dx, e, f);
|
|
if (this.j) {
|
|
if (this.h() || this.H()) {
|
|
simulatedPlayer1 = this;
|
|
this.vec32 = this.vec32.add(0.0, 0.04F, 0.0);
|
|
break label36;
|
|
}
|
|
|
|
if (this.m && this.L == 0) {
|
|
simulatedPlayer1 = this;
|
|
this.D();
|
|
this.L = 10;
|
|
break label36;
|
|
}
|
|
} else {
|
|
this.L = 0;
|
|
}
|
|
|
|
simulatedPlayer1 = this;
|
|
}
|
|
|
|
dx = simulatedPlayer1.simulatedPlayerInput.D() * 0.98;
|
|
e = this.simulatedPlayerInput.d() * 0.98;
|
|
this.L(new Vec3(dx, 0.0, e));
|
|
this.h++;
|
|
}
|
|
}
|
|
|
|
public double L() {
|
|
return this.a;
|
|
}
|
|
|
|
public void L(int i) {
|
|
this.L = ix;
|
|
}
|
|
|
|
private boolean D() {
|
|
return this.L(VecUtils.L(this.vec3)).getBlock() == Blocks.web;
|
|
}
|
|
|
|
public void d(float f) {
|
|
this.I = f;
|
|
}
|
|
|
|
public boolean d() {
|
|
return this.H;
|
|
}
|
|
|
|
private boolean L() {
|
|
return !this.simulatedPlayerInput.D() && (this.simulatedPlayerInput.inputFlags.shift() || this.simulatedPlayerInput.d());
|
|
}
|
|
|
|
private World L() {
|
|
return this.entityPlayer.worldObj;
|
|
}
|
|
|
|
public void L(float f) {
|
|
this.g = f;
|
|
}
|
|
}
|