当前位置: 首页>>代码示例>>Java>>正文


Java Direction.getMovementDirection方法代码示例

本文整理汇总了Java中net.minecraft.util.Direction.getMovementDirection方法的典型用法代码示例。如果您正苦于以下问题:Java Direction.getMovementDirection方法的具体用法?Java Direction.getMovementDirection怎么用?Java Direction.getMovementDirection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.util.Direction的用法示例。


在下文中一共展示了Direction.getMovementDirection方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setInPortal

import net.minecraft.util.Direction; //导入方法依赖的package包/类
/**
 * Called by portal blocks when an entity is within it.
 */
public void setInPortal()
{
    if (this.timeUntilPortal > 0)
    {
        this.timeUntilPortal = this.getPortalCooldown();
    }
    else
    {
        double d0 = this.prevPosX - this.posX;
        double d1 = this.prevPosZ - this.posZ;

        if (!this.worldObj.isRemote && !this.inPortal)
        {
            this.teleportDirection = Direction.getMovementDirection(d0, d1);
        }

        this.inPortal = true;
    }
}
 
开发者ID:wildex999,项目名称:TickDynamic,代码行数:23,代码来源:Entity.java

示例2: setInPortal

import net.minecraft.util.Direction; //导入方法依赖的package包/类
/**
 * Called by portal blocks when an entity is within it.
 */
public void setInPortal()
{
    if (this.timeUntilPortal > 0)
    {
        this.timeUntilPortal = this.getPortalCooldown();
    }
    else
    {
        double var1 = this.prevPosX - this.posX;
        double var3 = this.prevPosZ - this.posZ;

        if (!this.worldObj.isClient && !this.inPortal)
        {
            this.teleportDirection = Direction.getMovementDirection(var1, var3);
        }

        this.inPortal = true;
    }
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:23,代码来源:Entity.java

示例3: setInPortal

import net.minecraft.util.Direction; //导入方法依赖的package包/类
public void setInPortal()
{
    if (this.timeUntilPortal > 0)
    {
        this.timeUntilPortal = this.getPortalCooldown();
    }
    else
    {
        double d0 = this.prevPosX - this.posX;
        double d1 = this.prevPosZ - this.posZ;

        if (!this.worldObj.isRemote && !this.inPortal)
        {
            this.teleportDirection = Direction.getMovementDirection(d0, d1);
        }

        this.inPortal = true;
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:20,代码来源:Entity.java

示例4: canConnectRedstone

import net.minecraft.util.Direction; //导入方法依赖的package包/类
@Override
public boolean canConnectRedstone(World world, Vec3i location, ForgeDirection side, ForgeDirection face) {

    if (!isMultipart(world, location))
        return false;

    int s = Direction.getMovementDirection(side.offsetX, side.offsetZ);

    TileMultipart tmp = TileMultipart.getOrConvertTile(world, new BlockCoord(location.getX(), location.getY(), location.getZ()));

    if (face == ForgeDirection.UNKNOWN)
        return tmp.canConnectRedstone(s);

    TMultiPart slotPart = tmp.partMap(side.ordinal());
    if (slotPart != null) {
        if (slotPart instanceof IRedstonePart)
            return ((IRedstonePart) slotPart).canConnectRedstone(side.ordinal());
        return false;
    }

    for (TMultiPart p : tmp.jPartList())
        if (p instanceof IRedstonePart && ((IRedstonePart) p).canConnectRedstone(s))
            return true;

    return false;
}
 
开发者ID:Qmunity,项目名称:QmunityLib,代码行数:27,代码来源:FMPCompat.java

示例5: canConnectVanilla

import net.minecraft.util.Direction; //导入方法依赖的package包/类
public static boolean canConnectVanilla(World world, BlockPos pos, ForgeDirection side, ForgeDirection face) {

        if (side == ForgeDirection.UNKNOWN)
            return false;

        Block block = world.getBlock(pos.getX(), pos.getY(), pos.getZ());
        int meta = world.getBlockMetadata(pos.getX(), pos.getY(), pos.getZ());
        int d = Direction.getMovementDirection(side.offsetX, side.offsetZ);

        if ((block == Blocks.unpowered_repeater || block == Blocks.powered_repeater)
                && (face == ForgeDirection.DOWN || face == ForgeDirection.UNKNOWN))
            if (d % 2 == meta % 2)
                return true;

        if (block instanceof BlockLever) {
            meta = meta % 8;
            ForgeDirection leverFace = ((meta == 0 || meta == 7) ? ForgeDirection.UP : ((meta == 5 || meta == 6) ? ForgeDirection.DOWN
                    : (meta == 1 ? ForgeDirection.WEST : (meta == 2 ? ForgeDirection.EAST : (meta == 3 ? ForgeDirection.NORTH
                            : (meta == 4 ? ForgeDirection.SOUTH : ForgeDirection.UNKNOWN))))));
            if (face != ForgeDirection.UNKNOWN && face != leverFace)
                return false;
            return side != leverFace.getOpposite();
        }

        if (block instanceof BlockRedstoneComparator && (face == ForgeDirection.DOWN || face == ForgeDirection.UNKNOWN))
            return side != ForgeDirection.UP;

        if (block instanceof BlockRedstoneWire)
            return face == ForgeDirection.UNKNOWN || face == ForgeDirection.DOWN;

        return block instanceof BlockDoor || block instanceof BlockRedstoneLight || block instanceof BlockTNT
                || block instanceof BlockDispenser || block instanceof BlockNote
                || block instanceof BlockPistonBase;// true;
    }
 
开发者ID:Qmunity,项目名称:QmunityLib,代码行数:35,代码来源:RedstoneHelper.java

示例6: onBlockBreak

import net.minecraft.util.Direction; //导入方法依赖的package包/类
@ForgeSubscribe
public void onBlockBreak(BreakEvent ev) {
	EntityPlayer p = ev.getPlayer();
	if (p == null ) return;
	if (!(p instanceof EntityPlayer)) return;
	Block breakBlock= ev.block;
	if (ev.block==null) return;
	int direction = Direction.rotateLeft[Direction.getMovementDirection(ev.x - p.posX, ev.z - p.posZ)];

	Material breakBlockType = breakBlock.blockMaterial;
	if (breakBlockType == Material.wood) {
		this.blockBreak(ev.world, new ChunkCoordinates(ev.x, ev.y, ev.z), direction);
	}
	//ev.setCanceled(true);
}
 
开发者ID:Vovics,项目名称:RealChop2,代码行数:16,代码来源:RealchopListener.java


注:本文中的net.minecraft.util.Direction.getMovementDirection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。