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


Java World.getEntityByID方法代码示例

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


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

示例1: songEnded

import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
public void songEnded(EntityPlayer player, ItemStack instrument, int interval) {
	World world = player.world;
	player.dismountRidingEntity();
	if (!world.isRemote) {
		NBTTagCompound tag = ItemUtil.getOrCreateTag(instrument);
		if (tag.hasKey("id")) {
			int id = tag.getInteger("id");
			EntityHorse horse = (EntityHorse) world.getEntityByID(id);
			if (horse != null) {
				horse.setDead();

			}
		}
	}

}
 
开发者ID:TeamMelodium,项目名称:Melodium,代码行数:18,代码来源:SongHorse.java

示例2: getServerGuiElement

import net.minecraft.world.World; //导入方法依赖的package包/类
/**
 * Returns a Server side Container to be displayed to the user.
 */
@Override
public Object getServerGuiElement(int id, EntityPlayer player, World world, int entityId, int professionId, int careerId)
{
	if (id == GUI_VILLAGER_INVENTORY)
	{
		EntityVillager villager = (EntityVillager)world.getEntityByID(entityId);
		if (villager != null)
		{
			return new ContainerVillagerInventory(player.inventory, villager.getVillagerInventory(), villager, player);
		}
	}
	return null;
}
 
开发者ID:crazysnailboy,项目名称:VillagerInventory,代码行数:17,代码来源:ModGuiHandler.java

示例3: unloadNemesis

import net.minecraft.world.World; //导入方法依赖的package包/类
private void unloadNemesis(World world, INemesisRegistry registry, NemesisEntry nemesis) {
	Entity entity = world.getEntityByID(nemesis.getSpawned());

	if (nemesis.isLoaded() && entity == null) {
		nemesis.setUnloaded(world.getTotalWorldTime());
		registry.update(nemesis);
		return;
	}

	if (entity == null) {
		return;
	}

	boolean playersNear = NemesisUtil.findPlayersAround(world, entity.getPosition(), 100).size() > 0;

	if (nemesis.isLoaded() && !playersNear) {
		nemesis.setUnloaded(world.getTotalWorldTime());
		registry.update(nemesis);
		return;
	}

	if (!nemesis.isLoaded() && playersNear) {
		nemesis.setUnloaded(null);
		registry.update(nemesis);
		return;
	}
}
 
开发者ID:ToroCraft,项目名称:NemesisSystem,代码行数:28,代码来源:Reaper.java

示例4: use

import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
public boolean use(ItemStack stack, EntityLivingBase living, World world, EnumHand hand,
		PredictionMessage message) {
	// if(!world.isRemote||living !=
	// Minecraft.getMinecraft().player!(TF2weapons.medigunLock&&living.getCapability(TF2weapons.WEAPONS_CAP,
	// null).healTarget>0)) return false;
	// System.out.println("View: "+var4+" "+startX+" "+startY+" "+startZ+"
	// "+startX+endX+" "+endY+" "+endZ);
	if (world.isRemote && living == Minecraft.getMinecraft().player) {
		RayTraceResult trace = this.trace(stack, living, world);
		if (world.getEntityByID(living.getCapability(TF2weapons.WEAPONS_CAP, null).getHealTarget()) == null
				&& trace != null && trace.entityHit != null && trace.entityHit instanceof EntityLivingBase
				&& !(trace.entityHit instanceof EntityBuilding)) {
			List<RayTraceResult> list = new ArrayList<RayTraceResult>();
			trace.hitInfo = new float[] { 0, 0 };
			list.add(trace);
			message.target = list;
			// System.out.println("healing:
			// "+trace.entityHit.getEntityId());
			// living.getCapability(TF2weapons.aaWEAPONS_CAP,
			// null).healTarget=trace.entityHit.getEntityId();
			// TF2weapons.network.sendToServer(new
			// TF2Message.CapabilityMessage(living));

			// ClientProxy.playWeaponSound(living,
			// ItemFromData.getSound(stack,PropertyType.HEAL_START_SOUND),
			// false, 0, stack);
		}
	} else if (!world.isRemote && message != null && message.readData != null) {
		living.getCapability(TF2weapons.WEAPONS_CAP, null).setHealTarget((int) message.readData.get(0)[0]);
	}
	return true;
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:34,代码来源:ItemMedigun.java

示例5: getEntity

import net.minecraft.world.World; //导入方法依赖的package包/类
@Nullable
@SideOnly(Side.CLIENT)
public Entity getEntity(World worldIn)
{
    return worldIn.getEntityByID(this.entityId);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:7,代码来源:SPacketCamera.java

示例6: getEntity

import net.minecraft.world.World; //导入方法依赖的package包/类
public Entity getEntity(World worldIn)
{
    return worldIn.getEntityByID(this.entityId);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:5,代码来源:S19PacketEntityStatus.java

示例7: getEntity

import net.minecraft.world.World; //导入方法依赖的package包/类
@SideOnly(Side.CLIENT)
public Entity getEntity(World worldIn)
{
    return worldIn.getEntityByID(this.entityId);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:6,代码来源:SPacketEntityStatus.java

示例8: getEntityFromWorld

import net.minecraft.world.World; //导入方法依赖的package包/类
public Entity getEntityFromWorld(World worldIn)
{
    return worldIn.getEntityByID(this.entityId);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:5,代码来源:CPacketUseEntity.java

示例9: getEntityFromWorld

import net.minecraft.world.World; //导入方法依赖的package包/类
@Nullable
public Entity getEntityFromWorld(World worldIn)
{
    return worldIn.getEntityByID(this.entityId);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:6,代码来源:CPacketUseEntity.java

示例10: displayParticles

import net.minecraft.world.World; //导入方法依赖的package包/类
public static void displayParticles(int entityID, byte particle, byte strength)
{
	//String SFX;
	
	if (PARTICLES == null) { registerParticles(); } // First time init
	
	if (particle >= PARTICLES.length) { return; } // Not a possible particle
	
	if (PARTICLES[particle] == null) { return; } // Not a valid particle
	
	World world = Minecraft.getMinecraft().theWorld;
	
	if (world == null) { return; }	// World doesn't exist? oO
	
	Entity entity = world.getEntityByID(entityID);
	
	if (entity == null) { return; }	// Entity doesn't exist
	
	int count = 0;
	
	while (count < strength)
	{
		world.spawnParticle(PARTICLES[particle], 
				entity.posX + entity.motionX * (double) count / 4.0D, 
				entity.posY + entity.motionY * (double) count / 4.0D, 
				entity.posZ + entity.motionZ * (double) count / 4.0D, 
           		0, 0.2D, 0);
		
		count += 1;
	}
}
 
开发者ID:Domochevsky,项目名称:minecraft-quiverbow,代码行数:32,代码来源:Helper_Client.java


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