Some touchups on entities

This commit is contained in:
Vincent Lee committed 2015-11-25 01:36:21 -06:00
1 parent c0bcfb6448
commit 4426f8904f
9 files changed
+122 -129

No files matched your search

@@ -31,8 +31,8 @@ public class ColorSwitchingComponent extends MultiblockComponent {
}
@Override
public boolean matches(World world, int x, int y, int z) {
return world.getBlock(x, y, z) == getBlock();
public boolean matches(World world, BlockPos pos) {
return world.getBlockState(pos).getBlock() == getBlock();
}
@Override
@@ -39,7 +39,7 @@ public class MultiblockComponent {
}
public MultiblockComponent(BlockPos relPos, Block block, int meta, TileEntity tileEntity) {
this(relPos, block, meta, block.hasTileEntity() == (tileEntity != null), tileEntity);
this(relPos, block, meta, block.hasTileEntity(block.getStateFromMeta(meta)) == (tileEntity != null), tileEntity);
}
public MultiblockComponent(BlockPos relPos, Block block, int meta, boolean doFancyRender, TileEntity tileEntity) {
@@ -62,8 +62,8 @@ public class MultiblockComponent {
return meta;
}
public boolean matches(World world, int x, int y, int z) {
return world.getBlock(x, y, z) == getBlock() && (meta == -1 || world.getBlockMetadata(x, y, z) == meta);
public boolean matches(World world, BlockPos pos) {
return world.getBlockState(pos).getBlock() == getBlock() && (meta == -1 || world.getBlockState(pos).getBlock().getMetaFromState(world.getBlockState(pos)) == meta);
}
public ItemStack[] getMaterials() {
@@ -71,14 +71,14 @@ public class MultiblockComponent {
}
public void rotate(double angle) {
double x = relPos.posX;
double z = relPos.posZ;
double x = relPos.getX();
double z = relPos.getZ();
double sin = Math.sin(angle);
double cos = Math.cos(angle);
double xn = x * cos - z * sin;
double zn = x * sin + z * cos;
relPos = new BlockPos((int) Math.round(xn), relPos.posY, (int) Math.round(zn));
relPos = new BlockPos((int) Math.round(xn), relPos.getY(), (int) Math.round(zn));
}
public MultiblockComponent copy() {
@@ -48,7 +48,7 @@ public class BlockPump extends BlockModContainer implements ILexiconable {
@Override
public void onBlockPlacedBy(World p_149689_1_, BlockPos pos, IBlockState state, EntityLivingBase p_149689_5_, ItemStack p_149689_6_) {
p_149689_1_.setBlockState(pos, state.withProperty(p_149689_5_.getHorizontalFacing().getOpposite()), 2);
p_149689_1_.setBlockState(pos, state.withProperty(BotaniaStateProps.CARDINALS, p_149689_5_.getHorizontalFacing().getOpposite()), 2);
}
@Override
@@ -91,11 +91,11 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
private static final String TAG_HARD_MODE = "hardMode";
private static final String TAG_PLAYER_COUNT = "playerCount";
private static final int[][] PYLON_LOCATIONS = new int[][] {
{ 4, 1, 4 },
{ 4, 1, -4 },
{ -4, 1, 4 },
{ -4, 1, -4 }
private static final BlockPos[] PYLON_LOCATIONS = {
new BlockPos(4, 1, 4),
new BlockPos(4, 1, -4),
new BlockPos(-4, 1, 4),
new BlockPos(-4, 1, -4)
};
boolean spawnLandmines = false;
@@ -133,7 +133,7 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
}
public static boolean spawn(EntityPlayer player, ItemStack par1ItemStack, World par3World, BlockPos pos, boolean hard) {
Block block = par3World.getBlock(par4, par5, par6);
Block block = par3World.getBlockState(pos).getBlock();
if(block == Blocks.beacon && isTruePlayer(player)) {
if(par3World.getDifficulty() == EnumDifficulty.PEACEFUL) {
if(!par3World.isRemote)
@@ -141,10 +141,8 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
return false;
}
for(int[] coords : PYLON_LOCATIONS) {
int x = par4 + coords[0];
int y = par5 + coords[1];
int z = par6 + coords[2];
for(BlockPos coords : PYLON_LOCATIONS) {
BlockPos pos_ = pos.add(coords);
Block blockat = par3World.getBlock(x, y, z);
int meta = par3World.getBlockMetadata(x, y, z);
@@ -155,7 +153,7 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
}
}
if(!hasProperArena(par3World, par4, par5, par6)) {
if(!hasProperArena(par3World, pos)) {
for(int i = 0; i < 360; i += 8) {
float r = 1F;
float g = 0F;
@@ -164,9 +162,9 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
float mv = 0.35F;
float rad = i * (float) Math.PI / 180F;
double x = par4 + 0.5 - Math.cos(rad) * RANGE;
double y = par5 + 0.5;
double z = par6 + 0.5 - Math.sin(rad) * RANGE;
double x = pos.getX() + 0.5 - Math.cos(rad) * RANGE;
double y = pos.getY() + 0.5;
double z = pos.getZ() + 0.5 - Math.sin(rad) * RANGE;
Botania.proxy.sparkleFX(par3World, x, y, z, r, g, b, 5F, 120);
}
@@ -178,10 +176,10 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
par1ItemStack.stackSize--;
EntityDoppleganger e = new EntityDoppleganger(par3World);
e.setPosition(par4 + 0.5, par5 + 3, par6 + 0.5);
e.setPosition(pos.getX() + 0.5, pos.getY() + 3, pos.getZ() + 0.5);
e.setInvulTime(SPAWN_TICKS);
e.setHealth(1F);
e.setSource(par4, par5, par6);
e.setSource(pos);
e.setMobSpawnTicks(MOB_SPAWN_TICKS);
e.setHardMode(hard);
@@ -202,7 +200,7 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
return false;
}
private static boolean hasProperArena(World world, int sx, int sy, int sz) {
private static boolean hasProperArena(World world, BlockPos startPos) {
int heightCheck = 3;
int heightMin = 2;
int range = (int) Math.ceil(RANGE);
@@ -210,15 +208,13 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
for(int j = -range; j < range + 1; j++) {
if((Math.abs(i) == 4 && Math.abs(j) == 4) || vazkii.botania.common.core.helper.MathHelper.pointDistancePlane(i, j, 0, 0) > RANGE)
continue; // Ignore pylons and out of circle
int x = sx + i;
int z = sz + j;
int air = 0;
yCheck: {
for(int k = heightCheck + heightMin + 1; k >= -heightCheck; k--) {
int y = sy + k;
boolean isAir = world.getBlock(x, y, z).getCollisionBoundingBoxFromPool(world, x, y, z) == null;
BlockPos pos = startPos.add(i, k, j);
boolean isAir = world.getBlockState(pos).getBlock().getCollisionBoundingBox(world, pos, world.getBlockState(pos)) == null;
if(isAir)
air++;
else {
@@ -299,10 +295,10 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
dataWatcher.updateObject(22, delay);
}
public void setSource(int x, int y, int z) {
dataWatcher.updateObject(23, x);
dataWatcher.updateObject(24, y);
dataWatcher.updateObject(25, z);
public void setSource(BlockPos pos) {
dataWatcher.updateObject(23, pos.getX());
dataWatcher.updateObject(24, pos.getY());
dataWatcher.updateObject(25, pos.getZ());
}
public void setMobSpawnTicks(int ticks) {
@@ -325,9 +321,9 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
par1nbtTagCompound.setInteger(TAG_MOB_SPAWN_TICKS, getMobSpawnTicks());
BlockPos source = getSource();
par1nbtTagCompound.setInteger(TAG_SOURCE_X, source.posX);
par1nbtTagCompound.setInteger(TAG_SOURCE_Y, source.posY);
par1nbtTagCompound.setInteger(TAG_SOURCE_Z, source.posZ);
par1nbtTagCompound.setInteger(TAG_SOURCE_X, source.getX());
par1nbtTagCompound.setInteger(TAG_SOURCE_Y, source.getY());
par1nbtTagCompound.setInteger(TAG_SOURCE_Z, source.getZ());
par1nbtTagCompound.setBoolean(TAG_HARD_MODE, isHardMode());
par1nbtTagCompound.setInteger(TAG_PLAYER_COUNT, getPlayerCount());
@@ -343,7 +339,7 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
int x = par1nbtTagCompound.getInteger(TAG_SOURCE_X);
int y = par1nbtTagCompound.getInteger(TAG_SOURCE_Y);
int z = par1nbtTagCompound.getInteger(TAG_SOURCE_Z);
setSource(x, y, z);
setSource(new BlockPos(x, y, z));
setHardMode(par1nbtTagCompound.getBoolean(TAG_HARD_MODE));
if(par1nbtTagCompound.hasKey(TAG_PLAYER_COUNT))
@@ -494,7 +490,7 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
public List<EntityPlayer> getPlayersAround() {
BlockPos source = getSource();
float range = 15F;
List<EntityPlayer> players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, new AxisAlignedBB(source.posX + 0.5 - range, source.posY + 0.5 - range, source.posZ + 0.5 - range, source.posX + 0.5 + range, source.posY + 0.5 + range, source.posZ + 0.5 + range));
List<EntityPlayer> players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, new AxisAlignedBB(source.getX() + 0.5 - range, source.getY() + 0.5 - range, source.getZ() + 0.5 - range, source.getX() + 0.5 + range, source.getY() + 0.5 + range, source.getZ() + 0.5 + range));
return players;
}
@@ -513,18 +509,16 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
setDead();
if(!worldObj.isRemote) {
int posXInt = MathHelper.floor_double(posX);
int posYInt = MathHelper.floor_double(posY);
int posZInt = MathHelper.floor_double(posZ);
Block block = worldObj.getBlock(posXInt, posYInt, posZInt);
if(block.getBlockHardness(worldObj, posXInt, posYInt, posZInt) >= 0) {
List<ItemStack> items = block.getDrops(worldObj, posXInt, posYInt, posZInt, 0, 0);
BlockPos pos = new BlockPos(this);
Block block = worldObj.getBlockState(pos).getBlock();
if(block.getBlockHardness(worldObj, pos) >= 0) {
List<ItemStack> items = block.getDrops(worldObj, pos, worldObj.getBlockState(pos), 0);
for(ItemStack stack : items) {
if(ConfigHandler.blockBreakParticles)
worldObj.playAuxSFX(2001, posXInt, posYInt, posZInt, Block.getIdFromBlock(block) + (worldObj.getBlockMetadata(posXInt, posYInt, posZInt) << 12));
worldObj.spawnEntityInWorld(new EntityItem(worldObj, posXInt + 0.5, posYInt + 0.5, posZInt + 0.5, stack));
worldObj.playAuxSFX(2001, pos, Block.getStateId(worldObj.getBlockState(pos)));
worldObj.spawnEntityInWorld(new EntityItem(worldObj, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, stack));
}
worldObj.setBlockToAir(posXInt, posYInt, posZInt);
worldObj.setBlockToAir(pos);
}
}
@@ -535,7 +529,7 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
int playerCount = getPlayerCount();
if(worldObj.isRemote && !isPlayingMusic && !isDead && !players.isEmpty()) {
Botania.proxy.playRecordClientSided(worldObj, , source.posX, (ItemRecord) (hard ? ModItems.recordGaia2 : ModItems.recordGaia1));
Botania.proxy.playRecordClientSided(worldObj, source, (ItemRecord) (hard ? ModItems.recordGaia2 : ModItems.recordGaia1));
isPlayingMusic = true;
}
@@ -548,9 +542,9 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
float mv = 0.35F;
float rad = i * (float) Math.PI / 180F;
double x = source.posX + 0.5 - Math.cos(rad) * range;
double y = source.posY + 0.5;
double z = source.posZ + 0.5 - Math.sin(rad) * range;
double x = source.getX() + 0.5 - Math.cos(rad) * range;
double y = source.getY() + 0.5;
double z = source.getZ() + 0.5 - Math.sin(rad) * range;
Botania.proxy.wispFX(worldObj, x, y, z, r, g, b, 0.5F, (float) (Math.random() - 0.5F) * m, (float) (Math.random() - 0.5F) * mv, (float) (Math.random() - 0.5F) * m);
}
@@ -572,8 +566,8 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
player.capabilities.isFlying = player.capabilities.isFlying && player.capabilities.isCreativeMode;
if(vazkii.botania.common.core.helper.MathHelper.pointDistanceSpace(player.posX, player.posY, player.posZ, source.posX + 0.5, source.posY + 0.5, source.posZ + 0.5) >= range) {
Vector3 sourceVector = new Vector3(source.posX + 0.5, source.posY + 0.5, source.posZ + 0.5);
if(vazkii.botania.common.core.helper.MathHelper.pointDistanceSpace(player.posX, player.posY, player.posZ, source.getX() + 0.5, source.getY() + 0.5, source.getZ() + 0.5) >= range) {
Vector3 sourceVector = new Vector3(source.getX() + 0.5, source.getY() + 0.5, source.getZ() + 0.5);
Vector3 playerVector = Vector3.fromEntityCenter(player);
Vector3 motion = sourceVector.copy().sub(playerVector).copy().normalize();
@@ -673,13 +667,13 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
while(!teleportRandomly() && tries < 50)
tries++;
if(tries >= 50)
teleportTo(source.posX + 0.5, source.posY + 1.6, source.posZ + 0.5);
teleportTo(source.getX() + 0.5, source.getY() + 1.6, source.getZ() + 0.5);
if(spawnLandmines)
for(int i = 0; i < 6; i++) {
int x = source.posX - 10 + rand.nextInt(20);
int z = source.posZ - 10 + rand.nextInt(20);
int y = worldObj.getTopSolidOrLiquidBlock(x, z);
int x = source.getX() - 10 + rand.nextInt(20);
int z = source.getZ() - 10 + rand.nextInt(20);
int y = worldObj.getTopSolidOrLiquidBlock(new BlockPos(x, -1, z)).getY();
EntityMagicLandmine landmine = new EntityMagicLandmine(worldObj);
landmine.setPosition(x + 0.5, y, z + 0.5);
@@ -741,33 +735,31 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
posY = par3;
posZ = par5;
boolean flag = false;
int i = MathHelper.floor_double(posX);
int j = MathHelper.floor_double(posY);
int k = MathHelper.floor_double(posZ);
BlockPos pos = new BlockPos(this);
if(worldObj.blockExists(i, j, k)) {
if(worldObj.isBlockLoaded(pos)) {
boolean flag1 = false;
while(!flag1 && j > 0) {
Block block = worldObj.getBlock(i, j - 1, k);
while(!flag1 && pos.getY() > 0) {
Block block = worldObj.getBlockState(pos.down()).getBlock();
if(block.getMaterial().blocksMovement())
flag1 = true;
else {
--posY;
--j;
pos = pos.down();
}
}
if(flag1) {
setPosition(posX, posY, posZ);
if(worldObj.getCollidingBoundingBoxes(this, boundingBox).isEmpty() && !worldObj.isAnyLiquid(boundingBox))
if(worldObj.getCollidingBoundingBoxes(this, getEntityBoundingBox()).isEmpty() && !worldObj.isAnyLiquid(getEntityBoundingBox()))
flag = true;
// Prevent out of bounds teleporting
BlockPos source = getSource();
if(vazkii.botania.common.core.helper.MathHelper.pointDistanceSpace(posX, posY, posZ, source.posX, source.posY, source.posZ) > 12)
if(vazkii.botania.common.core.helper.MathHelper.pointDistanceSpace(posX, posY, posZ, source.getX(), source.getY(), source.getZ()) > 12)
flag = false;
}
}
@@ -786,7 +778,7 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
double d7 = d3 + (posX - d3) * d6 + (rand.nextDouble() - 0.5D) * width * 2.0D;
double d8 = d4 + (posY - d4) * d6 + rand.nextDouble() * height;
double d9 = d5 + (posZ - d5) * d6 + (rand.nextDouble() - 0.5D) * width * 2.0D;
worldObj.spawnParticle("portal", d7, d8, d9, f, f1, f2);
worldObj.spawnParticle(EnumParticleTypes.PORTAL, d7, d8, d9, f, f1, f2);
}
worldObj.playSoundEffect(d3, d4, d5, "mob.endermen.portal", 1.0F, 1.0F);
@@ -831,10 +823,10 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
Minecraft mc = Minecraft.getMinecraft();
ItemStack stack = new ItemStack(Items.skull, 1, 3);
mc.renderEngine.bindTexture(TextureMap.locationItemsTexture);
mc.renderEngine.bindTexture(TextureMap.locationBlocksTexture);
net.minecraft.client.renderer.RenderHelper.enableGUIStandardItemLighting();
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
RenderItem.getInstance().renderItemIntoGUI(mc.fontRenderer, mc.renderEngine, stack, px, py);
mc.getRenderItem().renderItemIntoGUI(stack, px, py);
net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
boolean unicode = mc.fontRendererObj.getUnicodeFlag();
@@ -883,8 +875,8 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
}
@Override
public boolean matches(World world, int x, int y, int z) {
return world.getBlock(x, y, z).isBeaconBase(world, x, y, z, x - relPos.posX, y - relPos.posY, z - relPos.posZ);
public boolean matches(World world, BlockPos pos) {
return world.getBlockState(pos).getBlock().isBeaconBase(world, pos, pos.add(relPos.multiply(-1)));
};
}
@@ -105,21 +105,21 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
this.fake = fake;
setBurstSourceCoords(tile.getPos());
setLocationAndAngles(tile.xCoord + 0.5, tile.yCoord + 0.5, tile.zCoord + 0.5, 0, 0);
setLocationAndAngles(tile.getPos().getX() + 0.5, tile.getPos().getY() + 0.5, tile.getPos().getZ() + 0.5, 0, 0);
rotationYaw = -(spreader.getRotationX() + 90F);
rotationPitch = spreader.getRotationY();
float f = 0.4F;
double mx = MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI) * f / 2D;
double mz = -(MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI) * f) / 2D;
double my = MathHelper.sin((rotationPitch + func_70183_g()) / 180.0F * (float) Math.PI) * f / 2D;
double my = MathHelper.sin((rotationPitch + getInaccuracy()) / 180.0F * (float) Math.PI) * f / 2D;
setMotion(mx, my, mz);
}
public EntityManaBurst(EntityPlayer player) {
this(player.worldObj);
setBurstSourceCoords(0);
setBurstSourceCoords(new BlockPos(0, -1, 0));
setLocationAndAngles(player.posX, player.posY + player.getEyeHeight(), player.posZ, player.rotationYaw + 180, -player.rotationPitch);
posX -= MathHelper.cos((rotationYaw + 180) / 180.0F * (float) Math.PI) * 0.16F;
@@ -130,7 +130,7 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
float f = 0.4F;
double mx = MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI) * f / 2D;
double mz = -(MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI) * f) / 2D;
double my = MathHelper.sin((rotationPitch + func_70183_g()) / 180.0F * (float) Math.PI) * f / 2D;
double my = MathHelper.sin((rotationPitch + getInaccuracy()) / 180.0F * (float) Math.PI) * f / 2D;
setMotion(mx, my, mz);
}
@@ -157,7 +157,7 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
if(!worldObj.isRemote) {
Entity entity = null;
List list = worldObj.getEntitiesWithinAABBExcludingEntity(this, boundingBox.addCoord(motionX, motionY, motionZ).expand(1.0D, 1.0D, 1.0D));
List list = worldObj.getEntitiesWithinAABBExcludingEntity(this, getEntityBoundingBox().addCoord(motionX, motionY, motionZ).expand(1.0D, 1.0D, 1.0D));
double d0 = 0.0D;
EntityLivingBase entitylivingbase = getThrower();
@@ -223,11 +223,12 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
int l = MathHelper.floor_double(par1Vec3.xCoord);
int i1 = MathHelper.floor_double(par1Vec3.yCoord);
int j1 = MathHelper.floor_double(par1Vec3.zCoord);
Block block = worldObj.getBlock(l, i1, j1);
int l1 = worldObj.getBlockMetadata(l, i1, j1);
BlockPos pos = new BlockPos(l, i1, j1);
IBlockState state = worldObj.getBlockState(pos);
Block block = state.getBlock();
if (block != null && (!par4 || block == null || block.getCollisionBoundingBoxFromPool(worldObj, l, i1, j1) != null) && block != Blocks.air && block.canCollideCheck(l1, par3)) {
MovingObjectPosition movingobjectposition = block.collisionRayTrace(worldObj, l, i1, j1, par1Vec3, par2Vec3);
if (block != null && (!par4 || block == null || block.getCollisionBoundingBox(worldObj, pos, state) != null) && block != Blocks.air && block.canCollideCheck(state, par3)) {
MovingObjectPosition movingobjectposition = block.collisionRayTrace(worldObj, pos, par1Vec3, par2Vec3);
if (movingobjectposition != null)
return movingobjectposition;
@@ -290,54 +291,52 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
b0 = 4;
else b0 = 5;
par1Vec3.xCoord = d0;
par1Vec3.yCoord += d7 * d3;
par1Vec3.zCoord += d8 * d3;
par1Vec3 = new Vec3(d0, par1Vec3.yCoord + (d7 * d3), par1Vec3.zCoord + (d8 * d3));
} else if (d4 < d5) {
if (j > i1)
b0 = 0;
else b0 = 1;
par1Vec3.xCoord += d6 * d4;
par1Vec3.yCoord = d1;
par1Vec3.zCoord += d8 * d4;
par1Vec3 = new Vec3(par1Vec3.xCoord + (d6 * d4), d1, par1Vec3.zCoord + (d8 * d4));
} else {
if (k > j1)
b0 = 2;
else b0 = 3;
par1Vec3.xCoord += d6 * d5;
par1Vec3.yCoord += d7 * d5;
par1Vec3.zCoord = d2;
par1Vec3 = new Vec3(par1Vec3.xCoord + (d6 * d5), par1Vec3.yCoord + (d7 * d5), d2);
}
Vec3 vec32 = new Vector3(par1Vec3.xCoord, par1Vec3.yCoord, par1Vec3.zCoord).toVec3D();
l = (int)(vec32.xCoord = MathHelper.floor_double(par1Vec3.xCoord));
vec32 = new Vec3(MathHelper.floor_double(par1Vec3.xCoord), vec32.yCoord, vec32.zCoord);
l = ((int) vec32.xCoord);
if (b0 == 5) {
--l;
++vec32.xCoord;
vec32 = vec32.addVector(1, 0, 0);
}
i1 = (int)(vec32.yCoord = MathHelper.floor_double(par1Vec3.yCoord));
vec32 = new Vec3(vec32.xCoord, MathHelper.floor_double(par1Vec3.yCoord), vec32.zCoord);
i1 = ((int) vec32.yCoord);
if (b0 == 1) {
--i1;
++vec32.yCoord;
vec32 = vec32.addVector(0, 1, 0);
}
j1 = (int)(vec32.zCoord = MathHelper.floor_double(par1Vec3.zCoord));
vec32 = new Vec3(par1Vec3.xCoord, vec32.yCoord, MathHelper.floor_double(vec32.zCoord));
j1 = ((int) vec32.zCoord);
if (b0 == 3) {
--j1;
++vec32.zCoord;
vec32 = vec32.addVector(0, 0, 1);
}
Block block1 = worldObj.getBlock(l, i1, j1);
int j2 = worldObj.getBlockMetadata(l, i1, j1);
BlockPos pos1 = new BlockPos(l, i1, j1);
IBlockState state1 = worldObj.getBlockState(pos1);
Block block1 = state1.getBlock();
if ((!par4 || block1 == null || block1.getCollisionBoundingBoxFromPool(worldObj, l, i1, j1) != null) && block1 != Blocks.air && block1.canCollideCheck(j2, par3)) {
MovingObjectPosition movingobjectposition1 = block1.collisionRayTrace(worldObj, l, i1, j1, par1Vec3, par2Vec3);
if ((!par4 || block1 == null || block1.getCollisionBoundingBox(worldObj, pos1, state) != null) && block1 != Blocks.air && block1.canCollideCheck(state, par3)) {
MovingObjectPosition movingobjectposition1 = block1.collisionRayTrace(worldObj, pos1, par1Vec3, par2Vec3);
if (movingobjectposition1 != null)
return movingobjectposition1;
@@ -467,7 +466,7 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
int y = par1nbtTagCompound.getInteger(TAG_SPREADER_Y);
int z = par1nbtTagCompound.getInteger(TAG_SPREADER_Z);
setBurstSourceCoords(x);
setBurstSourceCoords(new BlockPos(x, y, z));
double lastMotionX = par1nbtTagCompound.getDouble(TAG_LAST_MOTION_X);
double lastMotionY = par1nbtTagCompound.getDouble(TAG_LAST_MOTION_Y);
@@ -569,8 +568,8 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
boolean dead = false;
if(movingobjectposition.entityHit == null) {
TileEntity tile = worldObj.getTileEntity(movingobjectposition.blockX, movingobjectposition.blockY, movingobjectposition.blockZ);
Block block = worldObj.getBlock(movingobjectposition.blockX, movingobjectposition.blockY, movingobjectposition.blockZ);
TileEntity tile = worldObj.getTileEntity(movingobjectposition.getBlockPos());
Block block = worldObj.getBlockState(movingobjectposition.getBlockPos()).getBlock();
if(tile instanceof IManaCollisionGhost && ((IManaCollisionGhost) tile).isGhost() && !(block instanceof IManaTrigger) || block instanceof BlockBush || block instanceof BlockLeaves)
return;
@@ -579,15 +578,15 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
return;
BlockPos coords = getBurstSourceBlockPos();
if(tile != null && (tile.xCoord != coords.posX || tile.yCoord != coords.posY || tile.zCoord != coords.posZ))
if(tile != null && !tile.getPos().equals(coords))
collidedTile = tile;
if(tile == null || tile.xCoord != coords.posX || tile.yCoord != coords.posY || tile.zCoord != coords.posZ) {
if(tile == null || !tile.getPos().equals(coords)) {
if(!fake && !noParticles && (!worldObj.isRemote || tile instanceof IClientManaHandler) && tile != null && tile instanceof IManaReceiver && ((IManaReceiver) tile).canRecieveManaFromBursts())
onRecieverImpact((IManaReceiver) tile, tile.xCoord, tile.yCoord, tile.zCoord);
onRecieverImpact((IManaReceiver) tile, tile.getPos());
if(block instanceof IManaTrigger)
((IManaTrigger) block).onBurstCollision(this, worldObj, , movingobjectposition.blockX);
((IManaTrigger) block).onBurstCollision(this, worldObj, movingobjectposition.getBlockPos());
boolean ghost = tile instanceof IManaCollisionGhost;
dead = !ghost;
@@ -602,8 +601,8 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
if(lens != null)
dead = lens.collideBurst(this, movingobjectposition, collidedTile != null && collidedTile instanceof IManaReceiver && ((IManaReceiver) collidedTile).canRecieveManaFromBursts(), dead, getSourceLens());
if(collided && !hasAlreadyCollidedAt(movingobjectposition.blockX))
alreadyCollidedAt.add(getCollisionLocString(movingobjectposition.blockX, movingobjectposition.blockY, movingobjectposition.blockZ));
if(collided && !hasAlreadyCollidedAt(movingobjectposition.getBlockPos()))
alreadyCollidedAt.add(getCollisionLocString(movingobjectposition.getBlockPos()));
if(dead && !isDead) {
if(!fake) {
@@ -744,9 +743,9 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
@Override
public void setBurstSourceCoords(BlockPos pos) {
dataWatcher.updateObject(coordsStart, x);
dataWatcher.updateObject(coordsStart + 1, y);
dataWatcher.updateObject(coordsStart + 2, z);
dataWatcher.updateObject(coordsStart, pos.getX());
dataWatcher.updateObject(coordsStart + 1, pos.getY());
dataWatcher.updateObject(coordsStart + 2, pos.getZ());
}
@Override
@@ -787,7 +786,7 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
@Override
public boolean hasAlreadyCollidedAt(BlockPos pos) {
return alreadyCollidedAt.contains(getCollisionLocString(x, y, z));
return alreadyCollidedAt.contains(getCollisionLocString(pos));
}
@Override
@@ -796,8 +795,8 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
alreadyCollidedAt.add(getCollisionLocString(pos));
}
private String getCollisionLocString(int x, int y, int z) {
return x + ":" + y + ":" + z;
private String getCollisionLocString(BlockPos pos) {
return pos.getX() + ":" + pos.getY() + ":" + pos.getZ();
}
@Override
@@ -14,6 +14,7 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.boss.EntityWither;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
@@ -32,7 +33,7 @@ public class EntityPinkWither extends EntityWither {
double d10 = func_82214_u(j);
double d2 = func_82208_v(j);
double d4 = func_82213_w(j);
worldObj.spawnParticle("heart", d10 + rand.nextGaussian() * 0.30000001192092896D, d2 + rand.nextGaussian() * 0.30000001192092896D, d4 + rand.nextGaussian() * 0.30000001192092896D, 0.0D, 0.0D, 0.0D);
worldObj.spawnParticle(EnumParticleTypes.HEART, d10 + rand.nextGaussian() * 0.30000001192092896D, d2 + rand.nextGaussian() * 0.30000001192092896D, d4 + rand.nextGaussian() * 0.30000001192092896D, 0.0D, 0.0D, 0.0D);
}
}
@@ -21,9 +21,9 @@ import net.minecraft.util.BlockPos;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import vazkii.botania.api.internal.VanillaPacketDispatcher;
import vazkii.botania.api.mana.IManaPool;
import vazkii.botania.common.block.BotaniaStateProps;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.tile.mana.TilePool;
import vazkii.botania.common.block.tile.mana.TilePump;
@@ -90,7 +90,7 @@ public class EntityPoolMinecart extends EntityMinecart {
if(tile != null && tile instanceof IManaPool && !pump.hasRedstone) {
IManaPool pool = (IManaPool) tile;
EnumFacing pumpDir = ForgeDirection.getOrientation(meta);
EnumFacing pumpDir = ((EnumFacing) worldObj.getBlockState(posP).getValue(BotaniaStateProps.CARDINALS));
boolean did = false;
boolean can = false;
@@ -21,9 +21,10 @@ import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import vazkii.botania.common.core.helper.MathHelper;
import vazkii.botania.common.core.helper.Vector3;
import vazkii.botania.common.item.ModItems;
@@ -62,7 +63,7 @@ public class EntityThornChakram extends EntityThrowable {
double r = 0.1;
double m = 0.1;
for(int i = 0; i < 3; i++)
worldObj.spawnParticle("flame", posX + r * (Math.random() - 0.5), posY + r * (Math.random() - 0.5), posZ + r * (Math.random() - 0.5), m * (Math.random() - 0.5), m * (Math.random() - 0.5), m * (Math.random() - 0.5));
worldObj.spawnParticle(EnumParticleTypes.FLAME, posX + r * (Math.random() - 0.5), posY + r * (Math.random() - 0.5), posZ + r * (Math.random() - 0.5), m * (Math.random() - 0.5), m * (Math.random() - 0.5), m * (Math.random() - 0.5));
}
int bounces = getTimesBounced();
@@ -110,8 +111,8 @@ public class EntityThornChakram extends EntityThrowable {
if(noClip)
return;
Block block = worldObj.getBlock(pos.blockX, pos.blockY, pos.blockZ);
worldObj.getTileEntity(pos.blockX, pos.blockY, pos.blockZ);
Block block = worldObj.getBlockState(pos.getBlockPos()).getBlock();
worldObj.getTileEntity(pos.getBlockPos());
if(block instanceof BlockBush || block instanceof BlockLeaves)
return;
@@ -127,8 +128,8 @@ public class EntityThornChakram extends EntityThrowable {
int bounces = getTimesBounced();
if(bounces < MAX_BOUNCES) {
Vector3 currentMovementVec = new Vector3(motionX, motionY, motionZ);
ForgeDirection dir = ForgeDirection.getOrientation(pos.sideHit);
Vector3 normalVector = new Vector3(dir.offsetX, dir.offsetY, dir.offsetZ).normalize();
EnumFacing dir = pos.sideHit;
Vector3 normalVector = new Vector3(dir.getFrontOffsetX(), dir.getFrontOffsetY(), dir.getFrontOffsetZ()).normalize();
Vector3 movementVec = normalVector.multiply(-2 * currentMovementVec.dotProduct(normalVector)).add(currentMovementVec);
motionX = movementVec.x;
@@ -40,7 +40,7 @@ public class EntityThrownItem extends EntityItem {
}
@Override
public boolean isEntityInvulnerable() {
public boolean isEntityInvulnerable(DamageSource source) {
return true;
}
@@ -56,7 +56,7 @@ public class EntityThrownItem extends EntityItem {
if (!worldObj.isRemote)
{
Entity entity = null;
List list = worldObj.getEntitiesWithinAABBExcludingEntity(this, boundingBox.addCoord(motionX*2, motionY*2, motionZ*2).expand(2.0D, 2.0D, 2.0D));
List list = worldObj.getEntitiesWithinAABBExcludingEntity(this, getEntityBoundingBox().addCoord(motionX*2, motionY*2, motionZ*2).expand(2.0D, 2.0D, 2.0D));
double d0 = 0.0D;
for (int j = 0; j < list.size(); ++j)
@@ -66,7 +66,7 @@ public class EntityThrownItem extends EntityItem {
if (entity1.canBeCollidedWith() && (!(entity1 instanceof EntityPlayer) || delayBeforeCanPickup == 0))
{
float f = 1.0F;
AxisAlignedBB axisalignedbb = entity1.boundingBox.expand(f, f, f);
AxisAlignedBB axisalignedbb = entity1.getEntityBoundingBox().expand(f, f, f);
MovingObjectPosition movingobjectposition1 = axisalignedbb.calculateIntercept(vec3, vec31);
if (movingobjectposition1 != null)
@@ -90,7 +90,7 @@ public class EntityThrownItem extends EntityItem {
if (movingobjectposition != null)
{
if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK && worldObj.getBlock(movingobjectposition.blockX, movingobjectposition.blockY, movingobjectposition.blockZ) == Blocks.portal)
if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK && worldObj.getBlockState(movingobjectposition.getBlockPos()).getBlock() == Blocks.portal)
{
setInPortal();
}