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


Java MovingObjectType.ENTITY属性代码示例

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


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

示例1: impactWasting

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,代码行数:17,代码来源:EntityWitchProjectile.java

示例2: onImpact

@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,代码行数:20,代码来源:EntityTaserBullet.java

示例3: runAutoTool

public void runAutoTool(boolean proactive) {
	// proactive means we're doing this before the keybinding is even logged yet.
	// currently mining? and not using swap command?
	if (swappedInventoryState == 0 && (proactive || mc.gameSettings.keyBindAttack.isKeyDown()) && mc.objectMouseOver != null) {
		// get the block being targetted
		if (!mc.playerController.isInCreativeMode() && ControlPackOptions.booleanOptions.get(ControlPackEnumOptions.AUTOTOOL) && mc.objectMouseOver.typeOfHit == MovingObjectType.BLOCK) {
			Block block = mc.world.getBlockState(mc.objectMouseOver.getBlockPos()).getBlock();
			if (block != null) {
				ensureCorrectToolSelected(block);
			}
		}
		else if (ControlPackOptions.booleanOptions.get(ControlPackEnumOptions.AUTOSWORD) && (mc.objectMouseOver.typeOfHit == MovingObjectType.ENTITY && mc.objectMouseOver.entityHit instanceof EntityLivingBase)) {
			ensureSwordSelected();
		}
		// fyi change item: player.inventory.changeCurrentItem(k);, or player.inventory.currentItem = i;
		// mc.objectMouseOver
		// objectMouseOver.typeOfHit == EnumMovingObjectType.TILE
		// objectMouseOver.typeOfHit == EnumMovingObjectType.ENTITY
		// objectMouseOver.blockX,Y,Z
		// world.getBlockId(i,j,k)
		// Block.blocksList[id]
	}
}
 
开发者ID:uyjulian,项目名称:ControlPack,代码行数:23,代码来源:ControlPackMain.java

示例4: onImpact

@Override
protected void onImpact(MovingObjectPosition mop) {
	if (!worldObj.isRemote) {
		if (mop.typeOfHit == MovingObjectType.ENTITY) {
			Entity entity = mop.entityHit;
			if (entity instanceof EntityLivingBase && !affectedEntities.contains(entity.getEntityId()) && entity != getThrower()) {
				affectedEntities.add(entity.getEntityId());
				if (entity.attackEntityFrom(DamageUtils.causeIndirectSwordDamage(this, getThrower()), damage)) {
					WorldUtils.playSoundAtEntity(entity, Sounds.HURT_FLESH, 0.4F, 0.5F);
					if (entity instanceof EntityLivingBase) {
						((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.weakness.id, 60));
					}
				}
			}
		} else {
			Block block = worldObj.getBlockState(mop.getBlockPos()).getBlock();
			if (block.getMaterial().blocksMovement()) {
				setDead();
			}
		}
	}
}
 
开发者ID:coolAlias,项目名称:ZeldaSwordSkills,代码行数:22,代码来源:EntityLeapingBlow.java

示例5: impactHitchcock

private void impactHitchcock(MovingObjectPosition mop) {
   if(mop.typeOfHit == MovingObjectType.ENTITY && mop.entityHit instanceof EntityLivingBase) {
      EntityLivingBase var7 = (EntityLivingBase)mop.entityHit;
      int var6 = super.worldObj.rand.nextInt(2) + 3;

      for(int i = 0; i < var6; ++i) {
         EntityOwl owl = new EntityOwl(super.worldObj);
         owl.setLocationAndAngles(var7.posX - 2.0D + (double)super.worldObj.rand.nextInt(5), var7.posY + (double)var7.height + 1.0D + (double)super.worldObj.rand.nextInt(2), var7.posZ - 2.0D + (double)super.worldObj.rand.nextInt(5), 0.0F, 0.0F);
         owl.setAttackTarget(var7);
         owl.setTimeToLive(400);
         super.worldObj.spawnEntityInWorld(owl);
         ParticleEffect.PORTAL.send(SoundEffect.MOB_ENDERMEN_PORTAL, owl, 1.0D, 1.0D, 16);
      }
   } else {
      EntityItem itemEntity = null;
      if(mop != null) {
         ItemStack newBrewStack = Witchery.Items.GENERIC.itemBrewOfHitchcock.createStack();
         switch(EntityWitchProjectile.NamelessClass2036201851.$SwitchMap$net$minecraft$util$MovingObjectPosition$MovingObjectType[mop.typeOfHit.ordinal()]) {
         case 1:
            itemEntity = new EntityItem(super.worldObj, (double)mop.blockX + 0.5D, (double)(mop.blockY + (mop.sideHit == 0?-1:1)) + 0.5D, (double)mop.blockZ + 0.5D, newBrewStack);
            break;
         case 2:
            itemEntity = new EntityItem(super.worldObj, mop.entityHit.posX, mop.entityHit.posY, mop.entityHit.posZ, newBrewStack);
         }
      }

      this.skipFX = true;
      if(itemEntity != null) {
         super.worldObj.spawnEntityInWorld(itemEntity);
      }
   }

}
 
开发者ID:lerion13,项目名称:witchery,代码行数:33,代码来源:EntityWitchProjectile.java

示例6: impactQuicklime

private void impactQuicklime(MovingObjectPosition mop) {
   if(mop.typeOfHit == MovingObjectType.ENTITY) {
      if(mop.entityHit instanceof EntityLivingBase) {
         EntityLivingBase itemEntity1 = (EntityLivingBase)mop.entityHit;
         if(!itemEntity1.isPotionActive(Potion.blindness)) {
            itemEntity1.addPotionEffect(new PotionEffect(Potion.blindness.id, 60, 0));
         }

         float newBrewStack1 = mop.entityHit instanceof EntitySlime?4.0F:(itemEntity1.getHealth() == itemEntity1.getMaxHealth()?0.5F:0.1F);
         itemEntity1.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), newBrewStack1);
      }

      this.skipFX = true;
   } else {
      EntityItem itemEntity = null;
      if(mop != null) {
         ItemStack newBrewStack = Witchery.Items.GENERIC.itemQuicklime.createStack();
         switch(EntityWitchProjectile.NamelessClass2036201851.$SwitchMap$net$minecraft$util$MovingObjectPosition$MovingObjectType[mop.typeOfHit.ordinal()]) {
         case 1:
            itemEntity = new EntityItem(super.worldObj, (double)mop.blockX + 0.5D, (double)(mop.blockY + (mop.sideHit == 0?-1:1)) + 0.5D, (double)mop.blockZ + 0.5D, newBrewStack);
            break;
         case 2:
            itemEntity = new EntityItem(super.worldObj, mop.entityHit.posX, mop.entityHit.posY, mop.entityHit.posZ, newBrewStack);
         }
      }

      this.skipFX = true;
      if(itemEntity != null) {
         super.worldObj.spawnEntityInWorld(itemEntity);
      }

   }
}
 
开发者ID:lerion13,项目名称:witchery,代码行数:33,代码来源:EntityWitchProjectile.java

示例7: rayTraceCuboid

public MovingObjectPosition rayTraceCuboid(Vector3 start, Vector3 end, Cuboid6 cuboid, Entity e)
{
    MovingObjectPosition mop = rayTraceCuboid(start, end, cuboid);
    if(mop != null)
    {
        mop.typeOfHit = MovingObjectType.ENTITY;
        mop.entityHit = e;
    }
    return mop;
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:10,代码来源:RayTracer.java

示例8: getPlayerLookingAtEntity

public Entity getPlayerLookingAtEntity(EntityPlayerMP player, float reach)
{
    Vec3 vec3d = Vec3.createVectorHelper(player.posX, (player.posY + 1.6200000000000001D) - player.yOffset, player.posZ);
    Vec3 vec3d1 = player.getLook(1.0F);
    Vec3 vec3d2 = vec3d.addVector(vec3d1.xCoord * reach, vec3d1.yCoord * reach, vec3d1.zCoord * reach);
    MovingObjectPosition hit = player.worldObj.rayTraceBlocks(vec3d, vec3d2);
    if(hit == null || hit.typeOfHit != MovingObjectType.ENTITY)
    {
        return null;
    }
    
    return hit.entityHit;
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:13,代码来源:PlayerCommand.java

示例9: onUpdate

@Override
public void onUpdate() {
    if (Minecraft.getMinecraft().objectMouseOver != null &&
            Minecraft.getMinecraft().objectMouseOver.typeOfHit == MovingObjectType.ENTITY &&
            Minecraft.getMinecraft().objectMouseOver.entityHit instanceof EntityLivingBase) {
        updateMS();
        boolean yesCheatMode = WurstClient.INSTANCE.mods.getModByClass(YesCheatMod.class).isActive();
        if (yesCheatMode &&
                hasTimePassedS(WurstClient.INSTANCE.mods.getModByClass(KillauraMod.class).yesCheatSpeed) ||
                !yesCheatMode &&
                        hasTimePassedS(WurstClient.INSTANCE.mods.getModByClass(KillauraMod.class).normalSpeed)) {
            EntityLivingBase en = (EntityLivingBase) Minecraft.getMinecraft().objectMouseOver.entityHit;
            if ((yesCheatMode && Minecraft.getMinecraft().thePlayer.getDistanceToEntity(en) <=
                    WurstClient.INSTANCE.mods.getModByClass(KillauraMod.class).yesCheatRange || !yesCheatMode &&
                    Minecraft.getMinecraft().thePlayer.getDistanceToEntity(en) <=
                            WurstClient.INSTANCE.mods.getModByClass(KillauraMod.class).normalRange) &&
                    EntityUtils.isCorrectEntity(en, true)) {
                if (WurstClient.INSTANCE.mods.getModByClass(AutoSwordMod.class).isActive()) AutoSwordMod.setSlot();
                CriticalsMod.doCritical();
                WurstClient.INSTANCE.mods.getModByClass(BlockHitMod.class).doBlock();
                Minecraft.getMinecraft().thePlayer.swingItem();
                Minecraft.getMinecraft().playerController.attackEntity(Minecraft.getMinecraft().thePlayer, en);
                updateLastMS();
            }
        }
    }
}
 
开发者ID:null-dev,项目名称:EvenWurse,代码行数:27,代码来源:TriggerBotMod.java

示例10: renderOverLay

@SubscribeEvent
public void renderOverLay(RenderGameOverlayEvent.Pre event)
{
	MovingObjectPosition movingObjectPosition = Minecraft.getMinecraft().objectMouseOver;
	if(movingObjectPosition != null && movingObjectPosition.typeOfHit == MovingObjectType.ENTITY)
	{
		if(movingObjectPosition.entityHit instanceof EntityMinecartTEBase)
		{
			EntityMinecartTEBase minecartTEBase = (EntityMinecartTEBase)movingObjectPosition.entityHit;
			minecartTEBase.setClientNeedy(true);
			minecartTEBase.markDirty();
		}
	}
}
 
开发者ID:BrassGoggledCoders,项目名称:MoarCarts,代码行数:14,代码来源:CartUpdateEvents.java

示例11: set

public void set(World _world, EntityPlayer _player, MovingObjectPosition _mop, EntityLivingBase viewEntity, double partialTicks) {
	this.world      = _world;
	this.player     = _player;
	this.mop        = _mop;
	
	if (this.mop.typeOfHit == MovingObjectType.BLOCK){
		this.block      = world.getBlock(_mop.blockX, _mop.blockY, _mop.blockZ);
		this.metadata   = world.getBlockMetadata(_mop.blockX, _mop.blockY, _mop.blockZ);
		this.tileEntity = world.getTileEntity(_mop.blockX, _mop.blockY, _mop.blockZ);
		this.entity     = null;
		this.blockID       = Block.getIdFromBlock(this.block);
		this.blockResource = GameData.getBlockRegistry().getNameForObject(this.block);
		try{ this.stack = new ItemStack(this.block, 1, this.metadata); } catch (Exception e) {}
		
	} else if (this.mop.typeOfHit == MovingObjectType.ENTITY){
		this.block      = null;
		this.metadata   = -1;
		this.tileEntity = null;
		this.stack      = null;
		this.entity     = _mop.entityHit;
	}
	
	if (viewEntity != null){
		double px = viewEntity.lastTickPosX + (viewEntity.posX - viewEntity.lastTickPosX) * partialTicks;
		double py = viewEntity.lastTickPosY + (viewEntity.posY - viewEntity.lastTickPosY) * partialTicks;
		double pz = viewEntity.lastTickPosZ + (viewEntity.posZ - viewEntity.lastTickPosZ) * partialTicks;		
		this.renderingvec = Vec3.createVectorHelper(_mop.blockX - px, _mop.blockY - py, _mop.blockZ - pz);
		this.partialFrame = partialTicks;
	}
}
 
开发者ID:Lomeli12,项目名称:WIIEMC,代码行数:30,代码来源:DataAccessorCommon.java

示例12: onClick

@Override
public void onClick(EventOnClick event){
	if(event.getButton() == 0 && invoker.isOnGround() && !invoker.isInWater() && ((invoker.getObjectMouseOver() != null && invoker.getObjectMouseOver().typeOfHit == MovingObjectType.ENTITY) || (event.isAutoClick() && Resilience.getInstance().getValues().killAuraEnabled))){
		invoker.setMotionY(0.290000000);
		invoker.setFallDistance(0.289F);
		invoker.setOnGround(false);
	}
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:8,代码来源:ModuleCriticals.java

示例13: onImpact

@Override
public void onImpact(MovingObjectPosition position)
{
	if (this.ticksInAir >= 3 && !worldObj.isRemote)
	{
		float speed = calcSpeed();
		BlockPos pos = position.getBlockPos();
		
		if (position.typeOfHit == MovingObjectType.BLOCK)
		{
			// Hit a block
			if (speed >= VELOCITY_COST) {
				// Destroys the block and explodes
				worldObj.destroyBlock(pos, false);
				this.setSpeed(speed - VELOCITY_COST);
			}
			else {
				this.setDead();
			}
		}
		else if (position.typeOfHit == MovingObjectType.ENTITY)
		{
			// Hit an entity
			Entity entityHit = position.entityHit;
			entityHit.motionX += this.motionX;
			entityHit.motionY += this.motionY;
			entityHit.motionZ += this.motionZ;
		}
		
		// Blows up
		worldObj.createExplosion(this, pos.getX(), pos.getY(), pos.getZ(), speed / 2, true);
	}
}
 
开发者ID:JasonYe4273,项目名称:Minecraft-Modding,代码行数:33,代码来源:Particle.java

示例14: onKeyInput

@SubscribeEvent
public void onKeyInput(KeyInputEvent event) {
	if(WikiLink.keyBinding.isPressed()) {
		Minecraft mc = Minecraft.getMinecraft();
		Object topic = null;
		if(mc.inGameHasFocus) {
			if(mc.pointedEntity != null) {
				if(mc.pointedEntity instanceof EntityItem) {
					topic = ((EntityItem) mc.pointedEntity).getEntityItem().copy();
					((ItemStack) topic).stackSize = 1;
				} else {
					topic = mc.pointedEntity;
				}
			} else if(mc.objectMouseOver != null) {
				MovingObjectPosition mop = mc.objectMouseOver;
				if(mop.typeOfHit == MovingObjectType.BLOCK) {
					Block block = mc.theWorld.getBlock(mop.blockX, mop.blockY, mop.blockZ);
					topic = block.getPickBlock(mop, mc.theWorld, mop.blockX, mop.blockY, mop.blockZ);
					((ItemStack) topic).stackSize = 1;
				} else if(mop.typeOfHit == MovingObjectType.ENTITY) {
					if(mop.entityHit instanceof EntityItem) {
						topic = ((EntityItem) mop.entityHit).getEntityItem().copy();
						((ItemStack) topic).stackSize = 1;
					} else {
						topic = mop.entityHit;
					}
				}
			}
		}
		if(topic != null) {
			mc.displayGuiScreen(new GuiWikiLinkMenu(topic));
		}
	}
}
 
开发者ID:ElConquistador,项目名称:WikiLink,代码行数:34,代码来源:WLEventHandlerClient.java

示例15: onUse

@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, 70 + (boost * 2));
        if (mop != null) {
            int oldX = MathHelper.floor_double(player.posX), oldY = MathHelper.floor_double(player.posY), oldZ = MathHelper.floor_double(player.posZ);
            int newX = MathHelper.floor_double(player.posX), newY = MathHelper.floor_double(player.posY), newZ = MathHelper.floor_double(player.posZ);
            boolean teleport = false;
            if (mop.typeOfHit == MovingObjectType.BLOCK) {
                newX = mop.blockX;
                newY = mop.blockY;
                newZ = mop.blockZ;
                Block blk = world.getBlock(newX, newY, newZ);
                if (blk != null && !world.isAirBlock(newX, newY, newZ))
                    teleport = true;
            } else if (mop.typeOfHit == MovingObjectType.ENTITY) {
                newX = MathHelper.floor_double(mop.entityHit.posX);
                newY = MathHelper.floor_double(mop.entityHit.posY);
                newZ = MathHelper.floor_double(mop.entityHit.posZ);
                teleport = true;
            }
            if (teleport) {
                teleportTo(player, newX, newY, newZ);
                if (MathHelper.floor_double(player.posX) != oldX || MathHelper.floor_double(player.posY) != oldY || MathHelper.floor_double(player.posZ) != oldZ)
                    session.adjustMana(-cost(), false);
            }
        }
    }
}
 
开发者ID:Lomeli12,项目名称:MagicalRings,代码行数:29,代码来源:EnderPort.java


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