本文整理匯總了Java中net.minecraft.entity.Entity.isPushedByWater方法的典型用法代碼示例。如果您正苦於以下問題:Java Entity.isPushedByWater方法的具體用法?Java Entity.isPushedByWater怎麽用?Java Entity.isPushedByWater使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.entity.Entity
的用法示例。
在下文中一共展示了Entity.isPushedByWater方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: handleMaterialAcceleration
import net.minecraft.entity.Entity; //導入方法依賴的package包/類
/**
* handles the acceleration of an object whilst in water. Not sure if it is used elsewhere.
*/
public boolean handleMaterialAcceleration(AxisAlignedBB bb, Material materialIn, Entity entityIn)
{
int i = MathHelper.floor_double(bb.minX);
int j = MathHelper.floor_double(bb.maxX + 1.0D);
int k = MathHelper.floor_double(bb.minY);
int l = MathHelper.floor_double(bb.maxY + 1.0D);
int i1 = MathHelper.floor_double(bb.minZ);
int j1 = MathHelper.floor_double(bb.maxZ + 1.0D);
if (!this.isAreaLoaded(i, k, i1, j, l, j1, true))
{
return false;
}
else
{
boolean flag = false;
Vec3 vec3 = new Vec3(0.0D, 0.0D, 0.0D);
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
for (int k1 = i; k1 < j; ++k1)
{
for (int l1 = k; l1 < l; ++l1)
{
for (int i2 = i1; i2 < j1; ++i2)
{
blockpos$mutableblockpos.func_181079_c(k1, l1, i2);
IBlockState iblockstate = this.getBlockState(blockpos$mutableblockpos);
Block block = iblockstate.getBlock();
if (block.getMaterial() == materialIn)
{
double d0 = (double)((float)(l1 + 1) - BlockLiquid.getLiquidHeightPercent(((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue()));
if ((double)l >= d0)
{
flag = true;
vec3 = block.modifyAcceleration(this, blockpos$mutableblockpos, entityIn, vec3);
}
}
}
}
}
if (vec3.lengthVector() > 0.0D && entityIn.isPushedByWater())
{
vec3 = vec3.normalize();
double d1 = 0.014D;
entityIn.motionX += vec3.xCoord * d1;
entityIn.motionY += vec3.yCoord * d1;
entityIn.motionZ += vec3.zCoord * d1;
}
return flag;
}
}
示例2: handleMaterialAcceleration
import net.minecraft.entity.Entity; //導入方法依賴的package包/類
/**
* handles the acceleration of an object whilst in water. Not sure if it is used elsewhere.
*/
public boolean handleMaterialAcceleration(AxisAlignedBB bb, Material materialIn, Entity entityIn)
{
int i = MathHelper.floor(bb.minX);
int j = MathHelper.ceil(bb.maxX);
int k = MathHelper.floor(bb.minY);
int l = MathHelper.ceil(bb.maxY);
int i1 = MathHelper.floor(bb.minZ);
int j1 = MathHelper.ceil(bb.maxZ);
if (!this.isAreaLoaded(i, k, i1, j, l, j1, true))
{
return false;
}
else
{
boolean flag = false;
Vec3d vec3d = Vec3d.ZERO;
BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.retain();
for (int k1 = i; k1 < j; ++k1)
{
for (int l1 = k; l1 < l; ++l1)
{
for (int i2 = i1; i2 < j1; ++i2)
{
blockpos$pooledmutableblockpos.setPos(k1, l1, i2);
IBlockState iblockstate = this.getBlockState(blockpos$pooledmutableblockpos);
Block block = iblockstate.getBlock();
if (iblockstate.getMaterial() == materialIn)
{
double d0 = (double)((float)(l1 + 1) - BlockLiquid.getLiquidHeightPercent(((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue()));
if ((double)l >= d0)
{
flag = true;
vec3d = block.modifyAcceleration(this, blockpos$pooledmutableblockpos, entityIn, vec3d);
}
}
}
}
}
blockpos$pooledmutableblockpos.release();
if (vec3d.lengthVector() > 0.0D && entityIn.isPushedByWater())
{
vec3d = vec3d.normalize();
double d1 = 0.014D;
entityIn.motionX += vec3d.xCoord * 0.014D;
entityIn.motionY += vec3d.yCoord * 0.014D;
entityIn.motionZ += vec3d.zCoord * 0.014D;
}
return flag;
}
}
示例3: handleMaterialAcceleration
import net.minecraft.entity.Entity; //導入方法依賴的package包/類
/**
* handles the acceleration of an object whilst in water. Not sure if it is used elsewhere.
*/
public boolean handleMaterialAcceleration(AxisAlignedBB bb, Material materialIn, Entity entityIn)
{
int i = MathHelper.floor_double(bb.minX);
int j = MathHelper.ceiling_double_int(bb.maxX);
int k = MathHelper.floor_double(bb.minY);
int l = MathHelper.ceiling_double_int(bb.maxY);
int i1 = MathHelper.floor_double(bb.minZ);
int j1 = MathHelper.ceiling_double_int(bb.maxZ);
if (!this.isAreaLoaded(i, k, i1, j, l, j1, true))
{
return false;
}
else
{
boolean flag = false;
Vec3d vec3d = Vec3d.ZERO;
BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.retain();
for (int k1 = i; k1 < j; ++k1)
{
for (int l1 = k; l1 < l; ++l1)
{
for (int i2 = i1; i2 < j1; ++i2)
{
blockpos$pooledmutableblockpos.setPos(k1, l1, i2);
IBlockState iblockstate = this.getBlockState(blockpos$pooledmutableblockpos);
Block block = iblockstate.getBlock();
Boolean result = block.isEntityInsideMaterial(this, blockpos$pooledmutableblockpos, iblockstate, entityIn, (double)l, materialIn, false);
if (result != null && result == true)
{
// Forge: When requested call blocks modifyAcceleration method, and more importantly cause this method to return true, which results in an entity being "inWater"
flag = true;
vec3d = block.modifyAcceleration(this, blockpos$pooledmutableblockpos, entityIn, vec3d);
continue;
}
else if (result != null && result == false) continue;
if (iblockstate.getMaterial() == materialIn)
{
double d0 = (double)((float)(l1 + 1) - BlockLiquid.getLiquidHeightPercent(((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue()));
if ((double)l >= d0)
{
flag = true;
vec3d = block.modifyAcceleration(this, blockpos$pooledmutableblockpos, entityIn, vec3d);
}
}
}
}
}
blockpos$pooledmutableblockpos.release();
if (vec3d.lengthVector() > 0.0D && entityIn.isPushedByWater())
{
vec3d = vec3d.normalize();
double d1 = 0.014D;
entityIn.motionX += vec3d.xCoord * 0.014D;
entityIn.motionY += vec3d.yCoord * 0.014D;
entityIn.motionZ += vec3d.zCoord * 0.014D;
}
return flag;
}
}