當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。