本文整理汇总了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();
}
}
}
}
示例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;
}
示例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;
}
}
示例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;
}
示例5: getEntity
import net.minecraft.world.World; //导入方法依赖的package包/类
@Nullable
@SideOnly(Side.CLIENT)
public Entity getEntity(World worldIn)
{
return worldIn.getEntityByID(this.entityId);
}
示例6: getEntity
import net.minecraft.world.World; //导入方法依赖的package包/类
public Entity getEntity(World worldIn)
{
return worldIn.getEntityByID(this.entityId);
}
示例7: getEntity
import net.minecraft.world.World; //导入方法依赖的package包/类
@SideOnly(Side.CLIENT)
public Entity getEntity(World worldIn)
{
return worldIn.getEntityByID(this.entityId);
}
示例8: getEntityFromWorld
import net.minecraft.world.World; //导入方法依赖的package包/类
public Entity getEntityFromWorld(World worldIn)
{
return worldIn.getEntityByID(this.entityId);
}
示例9: getEntityFromWorld
import net.minecraft.world.World; //导入方法依赖的package包/类
@Nullable
public Entity getEntityFromWorld(World worldIn)
{
return worldIn.getEntityByID(this.entityId);
}
示例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;
}
}