本文整理汇总了Java中net.minecraft.util.EnumFacing.Axis.Z属性的典型用法代码示例。如果您正苦于以下问题:Java Axis.Z属性的具体用法?Java Axis.Z怎么用?Java Axis.Z使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类net.minecraft.util.EnumFacing.Axis
的用法示例。
在下文中一共展示了Axis.Z属性的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: travel
public void travel(Entity entity){
if(entity.getEntityWorld().isRemote)return;
if(otherPortalPos !=null){
World world = FMLCommonHandler.instance().getMinecraftServerInstance().worldServerForDimension(otherPortalDim);
if(world !=null){
TileEntity tile = world.getTileEntity(otherPortalPos);
if(tile !=null && tile instanceof TileTelePortal){
TileTelePortal otherPortal = (TileTelePortal)tile;
Vector3d motion = new Vector3d(entity.motionX, entity.motionY, entity.motionZ);
double ejectPower = 0.0;
if(facing.getAxis() == Axis.X){
ejectPower = Math.abs(motion.x);
}
if(facing.getAxis() == Axis.Y){
ejectPower = Math.abs(motion.y);
}
if(facing.getAxis() == Axis.Z){
ejectPower = Math.abs(motion.z);
}
teleportTo(entity, otherPortal, ejectPower);
}
}
}
}
示例2: getRenderBoundingBox
@Override
@SideOnly(Side.CLIENT)
public AxisAlignedBB getRenderBoundingBox()
{
if (this.blueprint != null && this.cachedBB == null)
{
if (BlockMultiblockBase.getFacing(this.meta).getAxis() == Axis.Z)
{
this.cachedBB = new AxisAlignedBB(
this.pos.add(-this.multiblock.getOffsetX(), -this.multiblock.getOffsetY(),
-this.multiblock.getOffsetZ()),
this.pos.add(this.multiblock.getWidth(), this.multiblock.getHeight(),
this.multiblock.getLength()));
}
else
this.cachedBB = new AxisAlignedBB(
this.pos.add(-this.multiblock.getOffsetZ(), -this.multiblock.getOffsetY(),
-this.multiblock.getOffsetX()),
this.pos.add(this.multiblock.getLength(), this.multiblock.getHeight(),
this.multiblock.getWidth()));
}
if (this.cachedBB != null)
return this.cachedBB;
return super.getRenderBoundingBox();
}
示例3: internalGetCoreOffset
private BlockPos internalGetCoreOffset(EnumFacing facing)
{
BlockPos rtn = BlockPos.ORIGIN;
if (this.getLength() % 2 == 0 || this.getWidth() % 2 == 0)
{
if (this.getWidth() % 2 == 0 && facing.getAxis() == Axis.Z
&& facing.getAxisDirection() == AxisDirection.NEGATIVE)
rtn = rtn.add(-1, 0, 0);
if (this.getWidth() % 2 == 0 && facing.getAxis() == Axis.X
&& facing.getAxisDirection() == AxisDirection.POSITIVE)
rtn = rtn.add(0, 0, -1);
if (this.getLength() % 2 == 0 && facing.getAxis() == Axis.Z
&& facing.getAxisDirection() == AxisDirection.NEGATIVE)
rtn = rtn.add(0, 0, -1);
if (this.getLength() % 2 == 0 && facing.getAxis() == Axis.X
&& facing.getAxisDirection() == AxisDirection.NEGATIVE)
rtn = rtn.add(-1, 0, 0);
}
return rtn;
}
示例4: getAllInBox
public Iterable<BlockPos> getAllInBox(BlockPos pos, final EnumFacing facing)
{
Iterable<BlockPos> searchables = null;
pos = pos.add(this.getCoreOffset(facing));
if (facing.getAxis() == Axis.Z)
searchables = BlockPos.getAllInBox(
pos.subtract(new Vec3i(this.getOffsetX(), this.getOffsetY(), this.getOffsetZ())),
pos.add(this.getWidth() - 1 - this.getOffsetX(), this.getHeight() - 1 - this.getOffsetY(),
this.getLength() - 1 - this.getOffsetZ()));
else
searchables = BlockPos.getAllInBox(
pos.subtract(new Vec3i(this.getOffsetZ(), this.getOffsetY(), this.getOffsetX())),
pos.add(this.getLength() - 1 - this.getOffsetZ(), this.getHeight() - 1 - this.getOffsetY(),
this.getWidth() - 1 - this.getOffsetX()));
return searchables;
}
示例5: findControllerBlock
public static ControlBlockLocation findControllerBlock(World world, BlockPos pos, SizerFactory sizerFactory) {
Size size = sizerFactory.get(world, pos, Axis.X);
ControlBlockLocation loc = new ControlBlockLocation();
if (size.isValid()) {
loc.pos = size.getBottomLeft();
loc.axis = Axis.X;
return loc;
}
size = sizerFactory.get(world, pos, Axis.Z);
if (size.isValid()) {
loc.pos = size.getBottomLeft();
loc.axis = Axis.Z;
return loc;
}
return null;
}
示例6: getRedirectorSide
public static RedirectorSide getRedirectorSide(EnumFacing dir, EnumFacing hitSide, float hitX, float hitY,
float hitZ, boolean topOnly) {
EnumFacing sideToConsider = hitSide;
if (hitSide == EnumFacing.UP) {
if (dir.getAxis() == Axis.Z) {
// We look in Z direction, need to check X
sideToConsider = hitX > 0.5 ? EnumFacing.EAST : EnumFacing.WEST;
} else {
// We look in X direction, need to check Z
sideToConsider = hitZ > 0.5 ? EnumFacing.SOUTH : EnumFacing.NORTH;
}
} else if (topOnly) {
return RedirectorSide.None;
}
if (sideToConsider == dir.rotateY()) {
return topOnly ? RedirectorSide.None : RedirectorSide.Right;
} else if (sideToConsider == dir.rotateYCCW()) {
return topOnly ? RedirectorSide.None : RedirectorSide.Left;
} else {
return RedirectorSide.None;
}
}
示例7: addBlockHitEffects
@SideOnly(Side.CLIENT)
private void addBlockHitEffects(@Nonnull World world, @Nonnull ParticleManager effectRenderer, double xCoord, double yCoord, double zCoord,
@Nonnull EnumFacing sideEnum, @Nonnull TextureAtlasSprite tex) {
double d0 = xCoord;
double d1 = yCoord;
double d2 = zCoord;
if (sideEnum.getAxis() != Axis.X) {
d0 += rand.nextDouble() * 0.4 - rand.nextDouble() * 0.4;
}
if (sideEnum.getAxis() != Axis.Y) {
d1 += rand.nextDouble() * 0.4 - rand.nextDouble() * 0.4;
}
if (sideEnum.getAxis() != Axis.Z) {
d2 += rand.nextDouble() * 0.4 - rand.nextDouble() * 0.4;
}
ParticleDigging digFX = (ParticleDigging) Minecraft.getMinecraft().effectRenderer.spawnEffectParticle(EnumParticleTypes.BLOCK_CRACK.getParticleID(), d0, d1,
d2, 0, 0, 0, 0);
if (digFX != null) {
digFX.init().multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F);
digFX.setParticleTexture(tex);
}
}
示例8: execute
@Override
public void execute(EntityLivingBase target, @Nullable AbstractMorph morph)
{
World world = target.worldObj;
if (world.isRemote)
{
return;
}
if (target instanceof EntityPlayer && ((EntityPlayer) target).getCooledAttackStrength(0.0F) < 1)
{
return;
}
Entity toShoot = EntityUtils.getTargetEntity(target, 32);
if (toShoot != null)
{
target.playSound(SoundEvents.ENTITY_SHULKER_SHOOT, 2.0F, (target.getRNG().nextFloat() - target.getRNG().nextFloat()) * 0.2F + 1.0F);
EntityShulkerBullet fireball = new EntityShulkerBullet(world, target, toShoot, Axis.Z);
fireball.posX = target.posX;
fireball.posZ = target.posZ;
world.spawnEntityInWorld(fireball);
}
if (target instanceof EntityPlayer)
{
((EntityPlayer) target).resetCooldown();
}
}
示例9: MultiblockComponent
public MultiblockComponent(int width, int height, int length, int offsetX, int offsetY, int offsetZ)
{
this.width = width;
this.height = height;
this.length = length;
this.offsetX = offsetX;
this.offsetY = offsetY;
this.offsetZ = offsetZ;
this.CORE_OFFSET = new EnumMap<>(EnumFacing.class);
this.CACHED_AABB = new EnumMap<>(EnumFacing.class);
for (EnumFacing facing : EnumFacing.VALUES)
{
this.CORE_OFFSET.put(facing, this.internalGetCoreOffset(facing));
if (facing.getAxis() == Axis.Z)
this.CACHED_AABB.put(facing,
new AxisAlignedBB(-this.getOffsetX(), -this.getOffsetY(), -this.getOffsetZ(),
this.getWidth() - this.getOffsetX(), this.getHeight() - this.getOffsetY(),
this.getLength() - this.getOffsetZ()).offset(this.CORE_OFFSET.get(facing)));
else
this.CACHED_AABB.put(facing,
new AxisAlignedBB(-this.getOffsetZ(), -this.getOffsetY(), -this.getOffsetX(),
this.getLength() - this.getOffsetZ(), this.getHeight() - this.getOffsetY(),
this.getWidth() - this.getOffsetX()).offset(this.CORE_OFFSET.get(facing)));
}
}
示例10: getBoneFacing
private static Axis getBoneFacing(StructureConfiguration configuration, Block foundBlock, BuildBlock block, EnumFacing assumedNorth)
{
Axis boneFacing = Axis.X;
if (foundBlock instanceof BlockBone)
{
if (block.getProperty("axis").getValue().equals("x"))
{
boneFacing = Axis.X;
}
else if (block.getProperty("axis").getValue().equals("y"))
{
boneFacing = Axis.Y;
}
else
{
boneFacing = Axis.Z;
}
if (boneFacing != Axis.Y)
{
boneFacing =
configuration.houseFacing == assumedNorth || configuration.houseFacing == assumedNorth.getOpposite()
? boneFacing :
boneFacing == Axis.X
? Axis.Z : Axis.X;
}
}
return boneFacing;
}
示例11: axis2GLFloats
float[] axis2GLFloats(EnumFacing facing) {
float[] floats = new float[]{
(facing.getAxis() == Axis.X ? 1f : 0f),
(facing.getAxis() == Axis.Y ? 1f : 0f),
(facing.getAxis() == Axis.Z ? 1f : 0f)
};
return floats;
}
示例12: getPositions
private Set<BlockPos> getPositions(BlockPos pos, EnumFacing facing){
Set<BlockPos> stuff = Sets.newHashSet();
stuff.add(pos);
Axis a = facing.getAxis();
if(a.isHorizontal()){
stuff.add(pos.up());
stuff.add(pos.down());
if(a == Axis.Z){
stuff.add(pos.east());
stuff.add(pos.east().up());
stuff.add(pos.east().down());
stuff.add(pos.west());
stuff.add(pos.west().up());
stuff.add(pos.west().down());
} else {
stuff.add(pos.north());
stuff.add(pos.north().up());
stuff.add(pos.north().down());
stuff.add(pos.south());
stuff.add(pos.south().up());
stuff.add(pos.south().down());
}
} else {
for(EnumFacing face : Plane.HORIZONTAL.facings())
stuff.add(pos.offset(face));
stuff.add(pos.north().east());
stuff.add(pos.north().west());
stuff.add(pos.south().east());
stuff.add(pos.south().west());
}
return stuff;
}
示例13: initBlockBounds
private void initBlockBounds() {
float w = getBoundsWidth();
float h = getBoundsHeight();
float d = getBoundsDepth();
for (int i = 0; i < _boundsFromFacing.length; i++) {
EnumFacing facing = EnumFacing.getFront(i + 2);
_boundsFromFacing[i] = ((facing.getAxis() == Axis.Z)
? new AxisAlignedBB(0.5F - w / 2, 0.0F, 0.5F - d / 2, 0.5F + w / 2, h, 0.5F + d / 2)
: new AxisAlignedBB(0.5F - d / 2, 0.0F, 0.5F - w / 2, 0.5F + d / 2, h, 0.5F + w / 2));
}
}