本文整理汇总了Java中net.minecraft.entity.EntityList.newEntity方法的典型用法代码示例。如果您正苦于以下问题:Java EntityList.newEntity方法的具体用法?Java EntityList.newEntity怎么用?Java EntityList.newEntity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.entity.EntityList
的用法示例。
在下文中一共展示了EntityList.newEntity方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCollisionBox
import net.minecraft.entity.EntityList; //导入方法依赖的package包/类
@Override
public AxisAlignedBB getCollisionBox(Entity entityIn) {
if (!this.world.isRemote && !this.isExit() && this.getTPprogress() <= 0 && entityIn != null
&& entityIn instanceof EntityLivingBase && !(entityIn instanceof EntityBuilding)
&& ((this.getOwner() != null && ((WeaponsCapability.get(this.getOwner()).teleporterEntity && !(entityIn instanceof EntityPlayer)) ||
(WeaponsCapability.get(this.getOwner()).teleporterPlayer && entityIn instanceof EntityPlayer && entityIn.getTeam() == null)))
|| TF2Util.isOnSameTeam(EntityTeleporter.this, entityIn))
&& entityIn.getEntityBoundingBox()
.intersects(this.getEntityBoundingBox().grow(0, 0.5, 0).offset(0, 0.5D, 0)))
if (ticksToTeleport <= 0)
if (ticksToTeleport < 0)
ticksToTeleport = 10;
else {
TeleporterData exit = this.getTeleportExit();
if (exit != null) {
if (exit.dimension != this.dimension) {
if(entityIn instanceof EntityPlayerMP && net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, exit.dimension)) {
this.world.getMinecraftServer().getPlayerList().transferPlayerToDimension((EntityPlayerMP) entityIn,
exit.dimension, new TeleporterDim((WorldServer) this.world,exit));
}
else {
World destworld = this.world.getMinecraftServer().getWorld(exit.dimension);
Entity newent = EntityList.newEntity(entityIn.getClass(), destworld);
if(newent != null) {
NBTTagCompound data = entityIn.writeToNBT(new NBTTagCompound());
data.removeTag("Dimension");
newent.readFromNBT(data);
entityIn.setDead();
newent.forceSpawn = true;
entityIn.moveToBlockPosAndAngles(exit, entityIn.rotationYaw, entityIn.rotationPitch);
destworld.spawnEntity(newent);
entityIn = newent;
}
}
}
entityIn.setPositionAndUpdate(exit.getX() + 0.5, exit.getY() + 0.23, exit.getZ() + 0.5);
this.setTeleports(this.getTeleports() + 1);
this.setTPprogress(this.getLevel() == 1 ? 200 : (this.getLevel() == 2 ? 100 : 60));
this.playSound(TF2Sounds.MOB_TELEPORTER_SEND, 1.5f, 1f);
entityIn.playSound(TF2Sounds.MOB_TELEPORTER_RECEIVE, 0.75f, 1f);
if(this.getOwner() instanceof EntityPlayerMP){
((EntityPlayer) this.getOwner()).addStat(TF2Achievements.TELEPORTED);
/*if(((EntityPlayerMP) this.getOwner()).getStatFile().readStat(TF2Achievements.TELEPORTED)>=100)
((EntityPlayer) this.getOwner()).addStat(TF2Achievements.TELEPORTS);*/
}
}
}
return super.getCollisionBox(entityIn);
}
示例2: construct
import net.minecraft.entity.EntityList; //导入方法依赖的package包/类
/**
* Construct entity by class in the world
* @param world Target world
* @return Spawned entity
* */
public Entity construct(UWorld world) {
return EntityList.newEntity(entityClass, world.getWorld());
}