本文整理汇总了Java中net.minecraft.entity.Entity.getPushReaction方法的典型用法代码示例。如果您正苦于以下问题:Java Entity.getPushReaction方法的具体用法?Java Entity.getPushReaction怎么用?Java Entity.getPushReaction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.entity.Entity
的用法示例。
在下文中一共展示了Entity.getPushReaction方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: func_190589_G
import net.minecraft.entity.Entity; //导入方法依赖的package包/类
private void func_190589_G()
{
IBlockState iblockstate = this.world.getBlockState(this.getPos());
if (iblockstate.getBlock() instanceof BlockShulkerBox)
{
EnumFacing enumfacing = (EnumFacing)iblockstate.getValue(BlockShulkerBox.field_190957_a);
AxisAlignedBB axisalignedbb = this.func_190588_c(enumfacing).offset(this.pos);
List<Entity> list = this.world.getEntitiesWithinAABBExcludingEntity((Entity)null, axisalignedbb);
if (!list.isEmpty())
{
for (int i = 0; i < list.size(); ++i)
{
Entity entity = (Entity)list.get(i);
if (entity.getPushReaction() != EnumPushReaction.IGNORE)
{
double d0 = 0.0D;
double d1 = 0.0D;
double d2 = 0.0D;
AxisAlignedBB axisalignedbb1 = entity.getEntityBoundingBox();
switch (enumfacing.getAxis())
{
case X:
if (enumfacing.getAxisDirection() == EnumFacing.AxisDirection.POSITIVE)
{
d0 = axisalignedbb.maxX - axisalignedbb1.minX;
}
else
{
d0 = axisalignedbb1.maxX - axisalignedbb.minX;
}
d0 = d0 + 0.01D;
break;
case Y:
if (enumfacing.getAxisDirection() == EnumFacing.AxisDirection.POSITIVE)
{
d1 = axisalignedbb.maxY - axisalignedbb1.minY;
}
else
{
d1 = axisalignedbb1.maxY - axisalignedbb.minY;
}
d1 = d1 + 0.01D;
break;
case Z:
if (enumfacing.getAxisDirection() == EnumFacing.AxisDirection.POSITIVE)
{
d2 = axisalignedbb.maxZ - axisalignedbb1.minZ;
}
else
{
d2 = axisalignedbb1.maxZ - axisalignedbb.minZ;
}
d2 = d2 + 0.01D;
}
entity.moveEntity(MoverType.SHULKER_BOX, d0 * (double)enumfacing.getFrontOffsetX(), d1 * (double)enumfacing.getFrontOffsetY(), d2 * (double)enumfacing.getFrontOffsetZ());
}
}
}
}
}
示例2: moveCollidedEntities
import net.minecraft.entity.Entity; //导入方法依赖的package包/类
private void moveCollidedEntities(float p_184322_1_)
{
EnumFacing enumfacing = this.extending ? this.pistonFacing : this.pistonFacing.getOpposite();
double d0 = (double)(p_184322_1_ - this.progress);
List<AxisAlignedBB> list = Lists.<AxisAlignedBB>newArrayList();
this.func_190606_j().addCollisionBoxToList(this.world, BlockPos.ORIGIN, new AxisAlignedBB(BlockPos.ORIGIN), list, (Entity)null, true);
if (!((List)list).isEmpty())
{
AxisAlignedBB axisalignedbb = this.func_190607_a(this.func_191515_a(list));
List<Entity> list1 = this.world.getEntitiesWithinAABBExcludingEntity((Entity)null, this.func_190610_a(axisalignedbb, enumfacing, d0).union(axisalignedbb));
if (!list1.isEmpty())
{
boolean flag = this.pistonState.getBlock() == Blocks.SLIME_BLOCK;
for (int i = 0; i < list1.size(); ++i)
{
Entity entity = (Entity)list1.get(i);
if (entity.getPushReaction() != EnumPushReaction.IGNORE)
{
if (flag)
{
switch (enumfacing.getAxis())
{
case X:
entity.motionX = (double)enumfacing.getFrontOffsetX();
break;
case Y:
entity.motionY = (double)enumfacing.getFrontOffsetY();
break;
case Z:
entity.motionZ = (double)enumfacing.getFrontOffsetZ();
}
}
double d1 = 0.0D;
for (int j = 0; j < ((List)list).size(); ++j)
{
AxisAlignedBB axisalignedbb1 = this.func_190610_a(this.func_190607_a((AxisAlignedBB)list.get(j)), enumfacing, d0);
AxisAlignedBB axisalignedbb2 = entity.getEntityBoundingBox();
if (axisalignedbb1.intersectsWith(axisalignedbb2))
{
d1 = Math.max(d1, this.func_190612_a(axisalignedbb1, enumfacing, axisalignedbb2));
if (d1 >= d0)
{
break;
}
}
}
if (d1 > 0.0D)
{
d1 = Math.min(d1, d0) + 0.01D;
field_190613_i.set(enumfacing);
entity.moveEntity(MoverType.PISTON, d1 * (double)enumfacing.getFrontOffsetX(), d1 * (double)enumfacing.getFrontOffsetY(), d1 * (double)enumfacing.getFrontOffsetZ());
field_190613_i.set((EnumFacing)null);
if (!this.extending && this.shouldHeadBeRendered)
{
this.func_190605_a(entity, enumfacing, d0);
}
}
}
}
}
}
}