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


Java MovingObjectType类代码示例

本文整理汇总了Java中net.minecraft.util.MovingObjectPosition.MovingObjectType的典型用法代码示例。如果您正苦于以下问题:Java MovingObjectType类的具体用法?Java MovingObjectType怎么用?Java MovingObjectType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: onItemRightClick

import net.minecraft.util.MovingObjectPosition.MovingObjectType; //导入依赖的package包/类
@Override
public ItemStack onItemRightClick(ItemStack is, World world, EntityPlayer player)
{
    MovingObjectPosition mop = this.getMovingObjectPositionFromPlayer(world, player, false);

    if (mop == null)
        return is;

    if (mop.typeOfHit == MovingObjectType.BLOCK)
    {
        int x = mop.blockX;
        int y = mop.blockY;
        int z = mop.blockZ;

        if (!world.canMineBlock(player, x, y, z))
            return is;

        return new ItemStack(TFCItems.woodenBucketEmpty);
    }

    return is;
}
 
开发者ID:Wahazar,项目名称:TFCPrimitiveTech,代码行数:23,代码来源:WoodenBucket_BasePotashLiquor.java

示例2: impactWasting

import net.minecraft.util.MovingObjectPosition.MovingObjectType; //导入依赖的package包/类
private void impactWasting(MovingObjectPosition mop, boolean enhanced) {
   Entity livingEntity = mop.entityHit;
   double x;
   double y;
   double z;
   if(mop.typeOfHit == MovingObjectType.ENTITY) {
      x = livingEntity.posX;
      y = livingEntity.posY;
      z = livingEntity.posZ;
   } else {
      x = (double)mop.blockX;
      y = (double)mop.blockY;
      z = (double)mop.blockZ;
   }

   explodeWasting(super.worldObj, x, y, z, livingEntity, super.boundingBox, enhanced);
}
 
开发者ID:lerion13,项目名称:witchery,代码行数:18,代码来源:EntityWitchProjectile.java

示例3: rayTraceCuboids

import net.minecraft.util.MovingObjectPosition.MovingObjectType; //导入依赖的package包/类
public void rayTraceCuboids(Vector3 start, Vector3 end, List<IndexedCuboid6> cuboids, BlockCoord pos, Block block, List<ExtendedMOP> hitList)
{
    for(IndexedCuboid6 cuboid : cuboids)
    {
        MovingObjectPosition mop = rayTraceCuboid(start, end, cuboid);
        if(mop != null)
        {
            ExtendedMOP emop = new ExtendedMOP(mop, cuboid.data, s_dist);
            emop.typeOfHit = MovingObjectType.BLOCK;
            emop.blockX = pos.x;
            emop.blockY = pos.y;
            emop.blockZ = pos.z;
            hitList.add(emop);
        }
    }
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:17,代码来源:RayTracer.java

示例4: renderOverlay

import net.minecraft.util.MovingObjectPosition.MovingObjectType; //导入依赖的package包/类
public static void renderOverlay() {
    Minecraft mc = Minecraft.getMinecraft();
    if (mc.currentScreen == null &&
            mc.theWorld != null &&
            !mc.gameSettings.keyBindPlayerList.getIsKeyPressed() &&
            NEIClientConfig.getBooleanSetting("world.highlight_tips") &&
            mc.objectMouseOver != null &&
            mc.objectMouseOver.typeOfHit == MovingObjectType.BLOCK) {
        World world = mc.theWorld;
        ArrayList<ItemStack> items = ItemInfo.getIdentifierItems(world, mc.thePlayer, mc.objectMouseOver);
        if (items.isEmpty())
            return;

        int minDamage = Integer.MAX_VALUE;
        ItemStack stack = null;
        for(ItemStack astack : items) {
            if(astack.getItem() != null && astack.getItemDamage() < minDamage) {
                stack = astack;
                minDamage = stack.getItemDamage();
            }
        }

        renderOverlay(stack, ItemInfo.getText(stack, world, mc.thePlayer, mc.objectMouseOver), getPositioning());
    }
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:26,代码来源:HUDRenderer.java

示例5: renderOverlay

import net.minecraft.util.MovingObjectPosition.MovingObjectType; //导入依赖的package包/类
public static void renderOverlay() {
    Minecraft mc = Minecraft.getMinecraft();
    if (mc.currentScreen == null &&
            mc.theWorld != null &&
            !mc.gameSettings.keyBindPlayerList.isKeyDown() &&
            NEIClientConfig.getBooleanSetting("world.highlight_tips") &&
            mc.objectMouseOver != null &&
            mc.objectMouseOver.typeOfHit == MovingObjectType.BLOCK) {
        World world = mc.theWorld;
        ArrayList<ItemStack> items = ItemInfo.getIdentifierItems(world, mc.thePlayer, mc.objectMouseOver);
        if (items.isEmpty())
            return;

        int minDamage = Integer.MAX_VALUE;
        ItemStack stack = null;
        for(ItemStack astack : items) {
            if(astack.getItem() != null && astack.getItemDamage() < minDamage) {
                stack = astack;
                minDamage = stack.getItemDamage();
            }
        }

        renderOverlay(stack, ItemInfo.getText(stack, world, mc.thePlayer, mc.objectMouseOver), getPositioning());
    }
}
 
开发者ID:SneakyTactician,项目名称:BIGB,代码行数:26,代码来源:HUDRenderer.java

示例6: clickItem

import net.minecraft.util.MovingObjectPosition.MovingObjectType; //导入依赖的package包/类
boolean clickItem(EntityPlayer player, ItemStack is, MovingObjectPosition mop) {
    try {
        if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
            return mcClick(player, mop, is);
        } else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY) {
            if (player.interactWith(mop.entityHit)) {
                return true;
            }
        }
    } catch (Throwable t) {
        CrashReport err = new CrashReport("clicking item", t);
        CrashReportCategory cat = err.makeCategory("clicked item");
        cat.addCrashSection("Item", is);
        cat.addCrashSection("Mop", mop);
        throw new ReportedException(err);
    }
    return false;
}
 
开发者ID:purpleposeidon,项目名称:Factorization,代码行数:19,代码来源:SocketRobotHand.java

示例7: degooArea

import net.minecraft.util.MovingObjectPosition.MovingObjectType; //导入依赖的package包/类
private boolean degooArea(EntityPlayer player, GooData data, ItemStack gooItem, MovingObjectPosition mop, int radius) {
    if (player.worldObj.isRemote) return false;
    if (data == null) return false;
    if (mop == null || mop.typeOfHit != MovingObjectPosition.MovingObjectType.BLOCK) return false;
    int d = radius;
    boolean any = false;
    BlockPos pos = mop.getBlockPos();
    for (int dx = -d; dx <= d; dx++) {
        for (int dy = -d; dy <= d; dy++) {
            for (int dz = -d; dz <= d; dz++) {
                any |= deselectCoord(gooItem, data, player.worldObj, pos.add(dx, dy, dz), false);
            }
        }
    }
    if (any) {
        data.markDirty();
    }
    return false;
}
 
开发者ID:purpleposeidon,项目名称:Factorization,代码行数:20,代码来源:ItemGoo.java

示例8: processCommand

import net.minecraft.util.MovingObjectPosition.MovingObjectType; //导入依赖的package包/类
@Override
public void processCommand(ICommandSender sender, String[] args) {
    String msg = Joiner.on(" ").join(args);
    Minecraft mc = Minecraft.getMinecraft();
    EntityPlayer player = mc.thePlayer;
    MovingObjectPosition mop = getMouseOver(player, 64);
    if (mop == null || mop.typeOfHit == MovingObjectType.MISS) {
        sender.addChatMessage(new ChatComponentTranslation("notify.point.toofar"));
        return;
    }
    try {
        switch (mop.typeOfHit) {
        default: return;
        case BLOCK:
            PointNetworkHandler.INSTANCE.pointAtCoord(Coord.fromMop(player.worldObj, mop), msg);
            break;
        case ENTITY:
            PointNetworkHandler.INSTANCE.pointAtEntity(mop.entityHit, msg);
            break;
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
}
 
开发者ID:purpleposeidon,项目名称:Factorization,代码行数:25,代码来源:PointCommand.java

示例9: onItemRightClick

import net.minecraft.util.MovingObjectPosition.MovingObjectType; //导入依赖的package包/类
@Override
public ItemStack onItemRightClick(ItemStack is, World world, EntityPlayer player) {
    MovingObjectPosition mop = this.getMovingObjectPositionFromPlayer(world, player, false);

    if (mop == null)
        return is;

    if (mop.typeOfHit == MovingObjectType.BLOCK) {
        int x = mop.blockX;
        int y = mop.blockY;
        int z = mop.blockZ;

        if (!world.canMineBlock(player, x, y, z))
            return is;

        return new ItemStack(this);
    }
    return is;

}
 
开发者ID:AnodeCathode,项目名称:TechNodefirmacraftMod,代码行数:21,代码来源:ModItemBottle.java

示例10: onItemRightClick

import net.minecraft.util.MovingObjectPosition.MovingObjectType; //导入依赖的package包/类
/**
 * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
 */
@Override
public ItemStack onItemRightClick(ItemStack is, World world, EntityPlayer player)
{
    MovingObjectPosition mop = this.getMovingObjectPositionFromPlayer(world, player, false);

    if (mop == null)
        return is;

    if (mop.typeOfHit == MovingObjectType.BLOCK)
    {
        int x = mop.blockX;
        int y = mop.blockY;
        int z = mop.blockZ;

        if (!world.canMineBlock(player, x, y, z))
            return is;

        return new ItemStack(TFCItems.woodenBucketEmpty);
    }

    return is;
}
 
开发者ID:Aleksey-Terzi,项目名称:DecorationsTFC,代码行数:26,代码来源:ItemPlaster.java

示例11: onImpact

import net.minecraft.util.MovingObjectPosition.MovingObjectType; //导入依赖的package包/类
@Override
protected void onImpact(MovingObjectPosition mop)
{

	if(mop.typeOfHit == MovingObjectType.BLOCK)
	{
		this.worldObj.newExplosion(this, mop.blockX, mop.blockY, mop.blockZ, 2.0F, true, true);
	}
	if (mop.entityHit != null)
       {
           this.worldObj.newExplosion(this, mop.blockX, mop.blockY, mop.blockZ, 2.0F, true, true);         
       }
	if (!this.worldObj.isRemote)
	{
		this.setDead();
	}
}
 
开发者ID:RamiLego4Game,项目名称:GalacticraftPixelGalaxy,代码行数:18,代码来源:EntitySeedFrezz.java

示例12: onUse

import net.minecraft.util.MovingObjectPosition.MovingObjectType; //导入依赖的package包/类
@Override
public void onUse(World world, EntityPlayer player, IPlayerSession session, ItemStack stack, int boost, int cost) {
    if (session.hasEnoughMana(cost())) {
        MovingObjectPosition mop = SimpleUtil.rayTrace(player, world, 43);
        if (mop != null) {
            if (mop.typeOfHit == MovingObjectType.BLOCK) {
                int blockX = mop.blockX;
                int blockY = mop.blockY;
                int blockZ = mop.blockZ;
                Block block = world.getBlock(blockX, blockY, blockZ);
                if (block != null && !world.isAirBlock(blockX, blockY, blockZ)) {
                    EntityLightningBolt light = new EntityLightningBolt(world, blockX, blockY, blockZ);
                    world.spawnEntityInWorld(light);
                    session.adjustMana(-cost(), false);
                }
            }
        }
    }
}
 
开发者ID:Lomeli12,项目名称:MagicalRings,代码行数:20,代码来源:HeavenStrike.java

示例13: onImpact

import net.minecraft.util.MovingObjectPosition.MovingObjectType; //导入依赖的package包/类
@Override
protected void onImpact(MovingObjectPosition pos) {
	if (pos.entityHit instanceof EntityEnderman) return;
	if (pos.typeOfHit == MovingObjectType.BLOCK) {
		if (worldObj.getBlock(pos.blockX, pos.blockY, pos.blockZ).getMaterial().isReplaceable()) return;
	}
	setDead();
	if (!worldObj.isRemote) {
		if (pos.entityHit != null && pos.entityHit instanceof EntityLivingBase) {
			float min = (float)FarragoMod.config.getDouble("blunderbuss.damage.min");
			float max = (float)FarragoMod.config.getDouble("blunderbuss.damage.max");
			((EntityLivingBase)pos.entityHit).attackEntityFrom(new EntityDamageSourceIndirect("blunderbuss", this, getThrower()), (rand.nextFloat()*(max-min))+min);
			((EntityLivingBase)pos.entityHit).hurtResistantTime = 1;
		}
		if (worldObj instanceof WorldServer) {
			((WorldServer)worldObj).func_147487_a("smoke", pos.hitVec.xCoord, pos.hitVec.yCoord, pos.hitVec.zCoord, 1, 0.2f, 0.2f, 0.2f, 0f);
			((WorldServer)worldObj).playSoundAtEntity(this, "step.stone", 0.5f, 0.3f);
		}
	}
}
 
开发者ID:unascribed,项目名称:Farrago,代码行数:21,代码来源:EntityBlunderbussProjectile.java

示例14: onImpact

import net.minecraft.util.MovingObjectPosition.MovingObjectType; //导入依赖的package包/类
@Override
protected void onImpact(MovingObjectPosition par1MovingObjectPosition)
{
	if(!worldObj.isRemote)
		if(par1MovingObjectPosition.typeOfHit == MovingObjectType.ENTITY)
		{
			if(par1MovingObjectPosition.entityHit instanceof EntityPlayer)
				if(((EntityPlayer)par1MovingObjectPosition.entityHit).capabilities.isCreativeMode || (EntityLivingBase)par1MovingObjectPosition.entityHit == getThrower())
					return;

			if(par1MovingObjectPosition.entityHit instanceof EntityLivingBase)
			{
				((EntityLivingBase) par1MovingObjectPosition.entityHit).attackEntityFrom(DamageSource.generic, 1F);
				((EntityLivingBase) par1MovingObjectPosition.entityHit).addPotionEffect(new PotionEffect(Potion.weakness.id, 500, 2));
				((EntityLivingBase) par1MovingObjectPosition.entityHit).addPotionEffect(new PotionEffect(Potion.confusion.id, 500, 2));
				((EntityLivingBase) par1MovingObjectPosition.entityHit).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 500, 2));
				setDead();
			}
		}
}
 
开发者ID:Geforce132,项目名称:SecurityCraft,代码行数:21,代码来源:EntityTaserBullet.java

示例15: getBlockInFront

import net.minecraft.util.MovingObjectPosition.MovingObjectType; //导入依赖的package包/类
private int[] getBlockInFront(World par1World, EntityPlayer par2EntityPlayer, double reach){
	int[] blockInfo = {0, 0, 0, 0, -1, 0};
	
	MovingObjectPosition movingobjectposition = getMovingObjectPositionFromPlayer(par1World, par2EntityPlayer, true, reach);
	
	if(movingobjectposition != null){
		if(movingobjectposition.typeOfHit == MovingObjectType.BLOCK){
			blockInfo[1] = movingobjectposition.blockX;
			blockInfo[2] = movingobjectposition.blockY;
			blockInfo[3] = movingobjectposition.blockZ;
			blockInfo[4] = movingobjectposition.sideHit;
			blockInfo[5] = par1World.getBlockMetadata(blockInfo[1], blockInfo[2], blockInfo[3]);
			blockInfo[0] = Block.getIdFromBlock(par1World.getBlock(blockInfo[1], blockInfo[2], blockInfo[3]));

		}
	}
	
	return blockInfo;
}
 
开发者ID:Geforce132,项目名称:SecurityCraft,代码行数:20,代码来源:PacketCheckRetinalScanner.java


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