本文整理匯總了Java中net.minecraft.entity.EntityLiving.playLivingSound方法的典型用法代碼示例。如果您正苦於以下問題:Java EntityLiving.playLivingSound方法的具體用法?Java EntityLiving.playLivingSound怎麽用?Java EntityLiving.playLivingSound使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.entity.EntityLiving
的用法示例。
在下文中一共展示了EntityLiving.playLivingSound方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: spawnCreature
import net.minecraft.entity.EntityLiving; //導入方法依賴的package包/類
/**
* Spawns the creature specified by the egg's type in the location specified by the last three parameters.
* Parameters: world, entityID, x, y, z.
*/
public static Entity spawnCreature(World worldIn, int entityID, double x, double y, double z)
{
if (!EntityList.entityEggs.containsKey(Integer.valueOf(entityID)))
{
return null;
}
else
{
Entity entity = null;
for (int i = 0; i < 1; ++i)
{
entity = EntityList.createEntityByID(entityID, worldIn);
if (entity instanceof EntityLivingBase)
{
EntityLiving entityliving = (EntityLiving)entity;
entity.setLocationAndAngles(x, y, z, MathHelper.wrapAngleTo180_float(worldIn.rand.nextFloat() * 360.0F), 0.0F);
entityliving.rotationYawHead = entityliving.rotationYaw;
entityliving.renderYawOffset = entityliving.rotationYaw;
entityliving.onInitialSpawn(worldIn.getDifficultyForLocation(new BlockPos(entityliving)), (IEntityLivingData)null);
worldIn.spawnEntityInWorld(entity);
entityliving.playLivingSound();
}
}
return entity;
}
}
示例2: spawnEntity
import net.minecraft.entity.EntityLiving; //導入方法依賴的package包/類
public static Entity spawnEntity(World world, int id, double x, double y, double z) {
Entity entity = ModEntityList.createEntityByID(id, world);
if (entity != null && entity instanceof EntityLivingBase) {
EntityLiving entityliving = (EntityLiving) entity;
entity.setLocationAndAngles(x, y, z, MathHelper.wrapAngleTo180_float(world.rand.nextFloat() * 360.0F), 0.0F);
entityliving.rotationYawHead = entityliving.rotationYaw;
entityliving.renderYawOffset = entityliving.rotationYaw;
entityliving.onSpawnWithEgg((IEntityLivingData) null);
world.spawnEntityInWorld(entity);
entityliving.playLivingSound();
}
return entity;
}
示例3: spawnCreature
import net.minecraft.entity.EntityLiving; //導入方法依賴的package包/類
@Nullable
/**
* Spawns the creature specified by the egg's type in the location specified by the last three parameters.
* Parameters: world, entityID, x, y, z.
*/
public static Entity spawnCreature(World worldIn, @Nullable ResourceLocation entityID, double x, double y, double z)
{
if (entityID != null && EntityList.ENTITY_EGGS.containsKey(entityID))
{
Entity entity = null;
for (int i = 0; i < 1; ++i)
{
entity = EntityList.createEntityByIDFromName(entityID, worldIn);
if (entity instanceof EntityLiving)
{
EntityLiving entityliving = (EntityLiving)entity;
entity.setLocationAndAngles(x, y, z, MathHelper.wrapDegrees(worldIn.rand.nextFloat() * 360.0F), 0.0F);
entityliving.rotationYawHead = entityliving.rotationYaw;
entityliving.renderYawOffset = entityliving.rotationYaw;
entityliving.onInitialSpawn(worldIn.getDifficultyForLocation(new BlockPos(entityliving)), (IEntityLivingData)null);
worldIn.spawnEntityInWorld(entity);
entityliving.playLivingSound();
}
}
return entity;
}
else
{
return null;
}
}
示例4: spawnCreature
import net.minecraft.entity.EntityLiving; //導入方法依賴的package包/類
/**
* Spawns the creature specified by the egg's type in the location specified by the last three parameters.
* Parameters: world, entityID, x, y, z.
*/
@Nullable
public static Entity spawnCreature(World worldIn, @Nullable String entityID, double x, double y, double z)
{
if (entityID != null && EntityList.ENTITY_EGGS.containsKey(entityID))
{
Entity entity = null;
for (int i = 0; i < 1; ++i)
{
entity = EntityList.createEntityByIDFromName(entityID, worldIn);
if (entity instanceof EntityLivingBase)
{
EntityLiving entityliving = (EntityLiving)entity;
entity.setLocationAndAngles(x, y, z, MathHelper.wrapDegrees(worldIn.rand.nextFloat() * 360.0F), 0.0F);
entityliving.rotationYawHead = entityliving.rotationYaw;
entityliving.renderYawOffset = entityliving.rotationYaw;
entityliving.onInitialSpawn(worldIn.getDifficultyForLocation(new BlockPos(entityliving)), (IEntityLivingData)null);
worldIn.spawnEntityInWorld(entity);
entityliving.playLivingSound();
}
}
return entity;
}
else
{
return null;
}
}
示例5: spawnCreature
import net.minecraft.entity.EntityLiving; //導入方法依賴的package包/類
/**
* Spawns the creature specified by the egg's type in the location specified
* by the last three parameters. Parameters: world, entityID, x, y, z.
*/
public static EntityLiving spawnCreature(World par0World, int par1, double par2, double par4, double par6,
NBTTagCompound nbtdata) {
EntityLiving entity = null;
for (int j = 0; j < 1; ++j) {
if (par1 / 2 == 0)
entity = new EntityHeavy(par0World);
else if (par1 / 2 == 1)
entity = new EntityScout(par0World);
else if (par1 / 2 == 2)
entity = new EntitySniper(par0World);
else if (par1 / 2 == 3)
entity = new EntitySoldier(par0World);
else if (par1 / 2 == 4)
entity = new EntityPyro(par0World);
else if (par1 / 2 == 5)
entity = new EntityDemoman(par0World);
else if (par1 / 2 == 6)
entity = new EntityMedic(par0World);
else if (par1 / 2 == 7)
entity = new EntitySpy(par0World);
else if (par1 / 2 == 8)
entity = new EntityEngineer(par0World);
else if (par1 / 2 == 9)
entity = new EntitySentry(par0World);
else if (par1 / 2 == 10)
entity = new EntityDispenser(par0World);
else if (par1 / 2 == 11)
entity = new EntityTeleporter(par0World);
else if (par1 / 2 == 12)
entity = new EntityTeleporter(par0World);
else if (par1 / 2 == 13)
entity = new EntitySaxtonHale(par0World);
else if (par1 == 28)
entity = new EntityMonoculus(par0World);
else if (par1 == 29)
entity = new EntityHHH(par0World);
else if (par1 == 30)
entity = new EntityMerasmus(par0World);
if (entity != null) {
EntityLiving entityliving = entity;
if (nbtdata != null)
entityliving.readFromNBT(nbtdata);
// System.out.println("read");
entity.setLocationAndAngles(par2, par4, par6,
MathHelper.wrapDegrees(par0World.rand.nextFloat() * 360.0F), 0.0F);
entityliving.rotationYawHead = entityliving.rotationYaw;
entityliving.renderYawOffset = entityliving.rotationYaw;
TF2CharacterAdditionalData data = new TF2CharacterAdditionalData();
data.team = par1 % 2;
entityliving.onInitialSpawn(par0World.getDifficultyForLocation(new BlockPos(entityliving)), data);
entityliving.playLivingSound();
if (entity instanceof EntityBuilding)
((EntityBuilding) entity).setEntTeam(par1 % 2);
if (entity instanceof EntitySaxtonHale && par1 % 2 == 1)
((EntitySaxtonHale) entity).setHostile();
if (!par0World.getCollisionBoxes(entity, entity.getEntityBoundingBox()).isEmpty())
return null;
par0World.spawnEntity(entity);
}
}
return entity;
}