mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-19 11:49:37 +00:00
1.8.8 tess fixes, potential double plant fix, bunch of reflectoin in spawner claw
This commit is contained in:
1 parent
5d666cd891
commit
a9b060257f
67 files changed
+480
-240
No files matched your search
@@ -11,6 +11,7 @@
|
||||
package vazkii.botania.common.entity;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -21,6 +22,7 @@ import net.minecraft.init.Blocks;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -40,7 +42,6 @@ public abstract class EntityThrowableCopy extends Entity implements IProjectile
|
||||
private String throwerName;
|
||||
private int ticksInGround;
|
||||
private int ticksInAir;
|
||||
private static final String __OBFID = "CL_00001723";
|
||||
|
||||
public EntityThrowableCopy(World worldIn)
|
||||
{
|
||||
@@ -48,7 +49,9 @@ public abstract class EntityThrowableCopy extends Entity implements IProjectile
|
||||
this.setSize(0.25F, 0.25F);
|
||||
}
|
||||
|
||||
protected void entityInit() {}
|
||||
protected void entityInit()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the entity is in range to render by using the past in distance and comparing it to its average edge
|
||||
@@ -57,9 +60,15 @@ public abstract class EntityThrowableCopy extends Entity implements IProjectile
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean isInRangeToRenderDist(double distance)
|
||||
{
|
||||
double d1 = this.getEntityBoundingBox().getAverageEdgeLength() * 4.0D;
|
||||
d1 *= 64.0D;
|
||||
return distance < d1 * d1;
|
||||
double d0 = this.getEntityBoundingBox().getAverageEdgeLength() * 4.0D;
|
||||
|
||||
if (Double.isNaN(d0))
|
||||
{
|
||||
d0 = 4.0D;
|
||||
}
|
||||
|
||||
d0 = d0 * 64.0D;
|
||||
return distance < d0 * d0;
|
||||
}
|
||||
|
||||
public EntityThrowableCopy(World worldIn, EntityLivingBase throwerIn)
|
||||
@@ -79,12 +88,12 @@ public abstract class EntityThrowableCopy extends Entity implements IProjectile
|
||||
this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, this.getVelocity(), 1.0F);
|
||||
}
|
||||
|
||||
public EntityThrowableCopy(World worldIn, double x, double y, double p_i1778_6_)
|
||||
public EntityThrowableCopy(World worldIn, double x, double y, double z)
|
||||
{
|
||||
super(worldIn);
|
||||
this.ticksInGround = 0;
|
||||
this.setSize(0.25F, 0.25F);
|
||||
this.setPosition(x, y, p_i1778_6_);
|
||||
this.setPosition(x, y, z);
|
||||
}
|
||||
|
||||
protected float getVelocity()
|
||||
@@ -99,27 +108,25 @@ public abstract class EntityThrowableCopy extends Entity implements IProjectile
|
||||
|
||||
/**
|
||||
* Similar to setArrowHeading, it's point the throwable entity to a x, y, z direction.
|
||||
*
|
||||
* @param inaccuracy Higher means more error.
|
||||
*/
|
||||
public void setThrowableHeading(double x, double y, double z, float velocity, float inaccuracy)
|
||||
{
|
||||
float f2 = MathHelper.sqrt_double(x * x + y * y + z * z);
|
||||
x /= (double)f2;
|
||||
y /= (double)f2;
|
||||
z /= (double)f2;
|
||||
x += this.rand.nextGaussian() * 0.007499999832361937D * (double)inaccuracy;
|
||||
y += this.rand.nextGaussian() * 0.007499999832361937D * (double)inaccuracy;
|
||||
z += this.rand.nextGaussian() * 0.007499999832361937D * (double)inaccuracy;
|
||||
x *= (double)velocity;
|
||||
y *= (double)velocity;
|
||||
z *= (double)velocity;
|
||||
float f = MathHelper.sqrt_double(x * x + y * y + z * z);
|
||||
x = x / (double)f;
|
||||
y = y / (double)f;
|
||||
z = z / (double)f;
|
||||
x = x + this.rand.nextGaussian() * 0.007499999832361937D * (double)inaccuracy;
|
||||
y = y + this.rand.nextGaussian() * 0.007499999832361937D * (double)inaccuracy;
|
||||
z = z + this.rand.nextGaussian() * 0.007499999832361937D * (double)inaccuracy;
|
||||
x = x * (double)velocity;
|
||||
y = y * (double)velocity;
|
||||
z = z * (double)velocity;
|
||||
this.motionX = x;
|
||||
this.motionY = y;
|
||||
this.motionZ = z;
|
||||
float f3 = MathHelper.sqrt_double(x * x + z * z);
|
||||
this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(x, z) * 180.0D / Math.PI);
|
||||
this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(y, (double)f3) * 180.0D / Math.PI);
|
||||
float f1 = MathHelper.sqrt_double(x * x + z * z);
|
||||
this.prevRotationYaw = this.rotationYaw = (float)(MathHelper.func_181159_b(x, z) * 180.0D / Math.PI);
|
||||
this.prevRotationPitch = this.rotationPitch = (float)(MathHelper.func_181159_b(y, (double)f1) * 180.0D / Math.PI);
|
||||
this.ticksInGround = 0;
|
||||
}
|
||||
|
||||
@@ -136,8 +143,8 @@ public abstract class EntityThrowableCopy extends Entity implements IProjectile
|
||||
if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F)
|
||||
{
|
||||
float f = MathHelper.sqrt_double(x * x + z * z);
|
||||
this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(x, z) * 180.0D / Math.PI);
|
||||
this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(y, (double)f) * 180.0D / Math.PI);
|
||||
this.prevRotationYaw = this.rotationYaw = (float)(MathHelper.func_181159_b(x, z) * 180.0D / Math.PI);
|
||||
this.prevRotationPitch = this.rotationPitch = (float)(MathHelper.func_181159_b(y, (double)f) * 180.0D / Math.PI);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,7 +203,7 @@ public abstract class EntityThrowableCopy extends Entity implements IProjectile
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
Entity entity = null;
|
||||
List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox().addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D));
|
||||
List<Entity> list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox().addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D));
|
||||
double d0 = 0.0D;
|
||||
EntityLivingBase entitylivingbase = this.getThrower();
|
||||
|
||||
@@ -212,7 +219,7 @@ public abstract class EntityThrowableCopy extends Entity implements IProjectile
|
||||
|
||||
if (movingobjectposition1 != null)
|
||||
{
|
||||
double d1 = vec3.distanceTo(movingobjectposition1.hitVec);
|
||||
double d1 = vec3.squareDistanceTo(movingobjectposition1.hitVec);
|
||||
|
||||
if (d1 < d0 || d0 == 0.0D)
|
||||
{
|
||||
@@ -233,7 +240,7 @@ public abstract class EntityThrowableCopy extends Entity implements IProjectile
|
||||
{
|
||||
if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK && this.worldObj.getBlockState(movingobjectposition.getBlockPos()).getBlock() == Blocks.portal)
|
||||
{
|
||||
this.setInPortal();
|
||||
this.func_181015_d(movingobjectposition.getBlockPos());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -245,9 +252,9 @@ public abstract class EntityThrowableCopy extends Entity implements IProjectile
|
||||
this.posY += this.motionY;
|
||||
this.posZ += this.motionZ;
|
||||
float f1 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
|
||||
this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);
|
||||
this.rotationYaw = (float)(MathHelper.func_181159_b(this.motionX, this.motionZ) * 180.0D / Math.PI);
|
||||
|
||||
for (this.rotationPitch = (float)(Math.atan2(this.motionY, (double)f1) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F)
|
||||
for (this.rotationPitch = (float)(MathHelper.func_181159_b(this.motionY, (double)f1) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F)
|
||||
{
|
||||
;
|
||||
}
|
||||
@@ -311,7 +318,7 @@ public abstract class EntityThrowableCopy extends Entity implements IProjectile
|
||||
tagCompound.setShort("xTile", (short)this.xTile);
|
||||
tagCompound.setShort("yTile", (short)this.yTile);
|
||||
tagCompound.setShort("zTile", (short)this.zTile);
|
||||
ResourceLocation resourcelocation = Block.blockRegistry.getNameForObject(this.inTile);
|
||||
ResourceLocation resourcelocation = (ResourceLocation)Block.blockRegistry.getNameForObject(this.inTile);
|
||||
tagCompound.setString("inTile", resourcelocation == null ? "" : resourcelocation.toString());
|
||||
tagCompound.setByte("shake", (byte)this.throwableShake);
|
||||
tagCompound.setByte("inGround", (byte)(this.inGround ? 1 : 0));
|
||||
@@ -344,12 +351,15 @@ public abstract class EntityThrowableCopy extends Entity implements IProjectile
|
||||
|
||||
this.throwableShake = tagCompund.getByte("shake") & 255;
|
||||
this.inGround = tagCompund.getByte("inGround") == 1;
|
||||
this.thrower = null;
|
||||
this.throwerName = tagCompund.getString("ownerName");
|
||||
|
||||
if (this.throwerName != null && this.throwerName.length() == 0)
|
||||
{
|
||||
this.throwerName = null;
|
||||
}
|
||||
|
||||
this.thrower = this.getThrower();
|
||||
}
|
||||
|
||||
public EntityLivingBase getThrower()
|
||||
@@ -357,6 +367,23 @@ public abstract class EntityThrowableCopy extends Entity implements IProjectile
|
||||
if (this.thrower == null && this.throwerName != null && this.throwerName.length() > 0)
|
||||
{
|
||||
this.thrower = this.worldObj.getPlayerEntityByName(this.throwerName);
|
||||
|
||||
if (this.thrower == null && this.worldObj instanceof WorldServer)
|
||||
{
|
||||
try
|
||||
{
|
||||
Entity entity = ((WorldServer)this.worldObj).getEntityFromUuid(UUID.fromString(this.throwerName));
|
||||
|
||||
if (entity instanceof EntityLivingBase)
|
||||
{
|
||||
this.thrower = (EntityLivingBase)entity;
|
||||
}
|
||||
}
|
||||
catch (Throwable var2)
|
||||
{
|
||||
this.thrower = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return this.thrower;
|
||||
|
||||
Reference in new issue
Block a user