本文整理匯總了Java中net.minecraft.entity.IEntityLivingData類的典型用法代碼示例。如果您正苦於以下問題:Java IEntityLivingData類的具體用法?Java IEntityLivingData怎麽用?Java IEntityLivingData使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
IEntityLivingData類屬於net.minecraft.entity包,在下文中一共展示了IEntityLivingData類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onInitialSpawn
import net.minecraft.entity.IEntityLivingData; //導入依賴的package包/類
@Nullable
public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, @Nullable IEntityLivingData livingdata) {
livingdata = super.onInitialSpawn(difficulty, livingdata);
float f = difficulty.getClampedAdditionalDifficulty();
this.setCanPickUpLoot(false);
this.setEquipmentBasedOnDifficulty(difficulty);
this.setEnchantmentBasedOnDifficulty(difficulty);
this.setCombatTask();
this.getEntityAttribute(SharedMonsterAttributes.KNOCKBACK_RESISTANCE).applyModifier(
new AttributeModifier("Random spawn bonus", this.rand.nextDouble() * 0.05000000074505806D, 0));
double d0 = this.rand.nextDouble() * 1.5D * (double) f;
if (d0 > 1.0D) {
this.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE)
.applyModifier(new AttributeModifier("Random zombie-spawn bonus", d0, 2));
}
return livingdata;
}
示例2: onStruckByLightning
import net.minecraft.entity.IEntityLivingData; //導入依賴的package包/類
@Override
public void onStruckByLightning(EntityLightningBolt lightningBolt) {
if (!this.world.isRemote && !this.isDead) {
EntityPigZombieMage entitymage = new EntityPigZombieMage(this.world);
entitymage.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
entitymage.onInitialSpawn(this.world.getDifficultyForLocation(new BlockPos(entitymage)),
(IEntityLivingData) null);
entitymage.setNoAI(this.isAIDisabled());
if (this.hasCustomName()) {
entitymage.setCustomNameTag(this.getCustomNameTag());
entitymage.setAlwaysRenderNameTag(this.getAlwaysRenderNameTag());
}
this.world.spawnEntity(entitymage);
this.setDead();
}
}
示例3: func_175817_a
import net.minecraft.entity.IEntityLivingData; //導入依賴的package包/類
protected boolean func_175817_a(World worldIn, StructureBoundingBox p_175817_2_, int p_175817_3_, int p_175817_4_, int p_175817_5_)
{
int i = this.getXWithOffset(p_175817_3_, p_175817_5_);
int j = this.getYWithOffset(p_175817_4_);
int k = this.getZWithOffset(p_175817_3_, p_175817_5_);
if (p_175817_2_.isVecInside(new BlockPos(i, j, k)))
{
EntityGuardian entityguardian = new EntityGuardian(worldIn);
entityguardian.setElder(true);
entityguardian.heal(entityguardian.getMaxHealth());
entityguardian.setLocationAndAngles((double)i + 0.5D, (double)j, (double)k + 0.5D, 0.0F, 0.0F);
entityguardian.onInitialSpawn(worldIn.getDifficultyForLocation(new BlockPos(entityguardian)), (IEntityLivingData)null);
worldIn.spawnEntityInWorld(entityguardian);
return true;
}
else
{
return false;
}
}
示例4: spawnVillagers
import net.minecraft.entity.IEntityLivingData; //導入依賴的package包/類
protected void spawnVillagers(World worldIn, StructureBoundingBox p_74893_2_, int p_74893_3_, int p_74893_4_, int p_74893_5_, int p_74893_6_)
{
if (this.villagersSpawned < p_74893_6_)
{
for (int i = this.villagersSpawned; i < p_74893_6_; ++i)
{
int j = this.getXWithOffset(p_74893_3_ + i, p_74893_5_);
int k = this.getYWithOffset(p_74893_4_);
int l = this.getZWithOffset(p_74893_3_ + i, p_74893_5_);
if (!p_74893_2_.isVecInside(new BlockPos(j, k, l)))
{
break;
}
++this.villagersSpawned;
EntityVillager entityvillager = new EntityVillager(worldIn);
entityvillager.setLocationAndAngles((double)j + 0.5D, (double)k, (double)l + 0.5D, 0.0F, 0.0F);
entityvillager.onInitialSpawn(worldIn.getDifficultyForLocation(new BlockPos(entityvillager)), (IEntityLivingData)null);
entityvillager.setProfession(this.func_180779_c(i, entityvillager.getProfession()));
worldIn.spawnEntityInWorld(entityvillager);
}
}
}
示例5: onInitialSpawn
import net.minecraft.entity.IEntityLivingData; //導入依賴的package包/類
/**
* Called only once on an entity when first time spawned, via egg, mob spawner, natural spawning etc, but not called
* when entity is reloaded from nbt. Mainly used for initializing attributes and inventory
*/
public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata)
{
livingdata = super.onInitialSpawn(difficulty, livingdata);
int i = this.rand.nextInt(6);
boolean flag = false;
if (livingdata instanceof EntityRabbit.RabbitTypeData)
{
i = ((EntityRabbit.RabbitTypeData)livingdata).typeData;
flag = true;
}
else
{
livingdata = new EntityRabbit.RabbitTypeData(i);
}
this.setRabbitType(i);
if (flag)
{
this.setGrowingAge(-24000);
}
return livingdata;
}
示例6: onStruckByLightning
import net.minecraft.entity.IEntityLivingData; //導入依賴的package包/類
/**
* Called when a lightning bolt hits the entity.
*/
public void onStruckByLightning(EntityLightningBolt lightningBolt)
{
if (!this.worldObj.isRemote && !this.isDead)
{
EntityWitch entitywitch = new EntityWitch(this.worldObj);
entitywitch.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
entitywitch.onInitialSpawn(this.worldObj.getDifficultyForLocation(new BlockPos(entitywitch)), (IEntityLivingData)null);
entitywitch.setNoAI(this.isAIDisabled());
if (this.hasCustomName())
{
entitywitch.setCustomNameTag(this.getCustomNameTag());
entitywitch.setAlwaysRenderNameTag(this.getAlwaysRenderNameTag());
}
this.worldObj.spawnEntityInWorld(entitywitch);
this.setDead();
}
}
示例7: onInitialSpawn
import net.minecraft.entity.IEntityLivingData; //導入依賴的package包/類
/**
* Called only once on an entity when first time spawned, via egg, mob spawner, natural spawning etc, but not called
* when entity is reloaded from nbt. Mainly used for initializing attributes and inventory
*/
public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata)
{
livingdata = super.onInitialSpawn(difficulty, livingdata);
if (this.worldObj.rand.nextInt(7) == 0)
{
for (int i = 0; i < 2; ++i)
{
EntityOcelot entityocelot = new EntityOcelot(this.worldObj);
entityocelot.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, 0.0F);
entityocelot.setGrowingAge(-24000);
this.worldObj.spawnEntityInWorld(entityocelot);
}
}
return livingdata;
}
示例8: spawnElder
import net.minecraft.entity.IEntityLivingData; //導入依賴的package包/類
protected boolean spawnElder(World worldIn, StructureBoundingBox p_175817_2_, int p_175817_3_, int p_175817_4_, int p_175817_5_)
{
int i = this.getXWithOffset(p_175817_3_, p_175817_5_);
int j = this.getYWithOffset(p_175817_4_);
int k = this.getZWithOffset(p_175817_3_, p_175817_5_);
if (p_175817_2_.isVecInside(new BlockPos(i, j, k)))
{
EntityGuardian entityguardian = new EntityGuardian(worldIn);
entityguardian.setElder(true);
entityguardian.heal(entityguardian.getMaxHealth());
entityguardian.setLocationAndAngles((double)i + 0.5D, (double)j, (double)k + 0.5D, 0.0F, 0.0F);
entityguardian.onInitialSpawn(worldIn.getDifficultyForLocation(new BlockPos(entityguardian)), (IEntityLivingData)null);
worldIn.spawnEntityInWorld(entityguardian);
return true;
}
else
{
return false;
}
}
示例9: convertToVillager
import net.minecraft.entity.IEntityLivingData; //導入依賴的package包/類
/**
* Convert this zombie into a villager.
*/
protected void convertToVillager()
{
EntityVillager entityvillager = new EntityVillager(this.worldObj);
entityvillager.copyLocationAndAnglesFrom(this);
entityvillager.onInitialSpawn(this.worldObj.getDifficultyForLocation(new BlockPos(entityvillager)), (IEntityLivingData)null);
entityvillager.setLookingForHome();
if (this.isChild())
{
entityvillager.setGrowingAge(-24000);
}
this.worldObj.removeEntity(this);
entityvillager.setNoAI(this.isAIDisabled());
if (this.hasCustomName())
{
entityvillager.setCustomNameTag(this.getCustomNameTag());
entityvillager.setAlwaysRenderNameTag(this.getAlwaysRenderNameTag());
}
this.worldObj.spawnEntityInWorld(entityvillager);
entityvillager.addPotionEffect(new PotionEffect(Potion.confusion.id, 200, 0));
this.worldObj.playAuxSFXAtEntity((EntityPlayer)null, 1017, new BlockPos((int)this.posX, (int)this.posY, (int)this.posZ), 0);
}
示例10: onStruckByLightning
import net.minecraft.entity.IEntityLivingData; //導入依賴的package包/類
/**
* Called when a lightning bolt hits the entity.
*/
public void onStruckByLightning(EntityLightningBolt lightningBolt)
{
if (!this.world.isRemote && !this.isDead)
{
EntityWitch entitywitch = new EntityWitch(this.world);
entitywitch.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
entitywitch.onInitialSpawn(this.world.getDifficultyForLocation(new BlockPos(entitywitch)), (IEntityLivingData)null);
entitywitch.setNoAI(this.isAIDisabled());
if (this.hasCustomName())
{
entitywitch.setCustomNameTag(this.getCustomNameTag());
entitywitch.setAlwaysRenderNameTag(this.getAlwaysRenderNameTag());
}
this.world.spawnEntityInWorld(entitywitch);
this.setDead();
}
}
示例11: createSkeleton
import net.minecraft.entity.IEntityLivingData; //導入依賴的package包/類
private EntitySkeleton createSkeleton(DifficultyInstance p_188514_1_, EntityHorse p_188514_2_)
{
EntitySkeleton entityskeleton = new EntitySkeleton(p_188514_2_.worldObj);
entityskeleton.onInitialSpawn(p_188514_1_, (IEntityLivingData)null);
entityskeleton.setPosition(p_188514_2_.posX, p_188514_2_.posY, p_188514_2_.posZ);
entityskeleton.hurtResistantTime = 60;
entityskeleton.enablePersistence();
if (entityskeleton.getItemStackFromSlot(EntityEquipmentSlot.HEAD) == null)
{
entityskeleton.setItemStackToSlot(EntityEquipmentSlot.HEAD, new ItemStack(Items.IRON_HELMET));
}
EnchantmentHelper.addRandomEnchantment(entityskeleton.getRNG(), entityskeleton.getHeldItemMainhand(), (int)(5.0F + p_188514_1_.getClampedAdditionalDifficulty() * (float)entityskeleton.getRNG().nextInt(18)), false);
EnchantmentHelper.addRandomEnchantment(entityskeleton.getRNG(), entityskeleton.getItemStackFromSlot(EntityEquipmentSlot.HEAD), (int)(5.0F + p_188514_1_.getClampedAdditionalDifficulty() * (float)entityskeleton.getRNG().nextInt(18)), false);
entityskeleton.worldObj.spawnEntityInWorld(entityskeleton);
return entityskeleton;
}
示例12: onInitialSpawn
import net.minecraft.entity.IEntityLivingData; //導入依賴的package包/類
/**
* Called only once on an entity when first time spawned, via egg, mob spawner, natural spawning etc, but not called
* when entity is reloaded from nbt. Mainly used for initializing attributes and inventory
*/
public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata)
{
if (livingdata instanceof EntityPolarBear.GroupData)
{
if (((EntityPolarBear.GroupData)livingdata).madeParent)
{
this.setGrowingAge(-24000);
}
}
else
{
EntityPolarBear.GroupData entitypolarbear$groupdata = new EntityPolarBear.GroupData();
entitypolarbear$groupdata.madeParent = true;
livingdata = entitypolarbear$groupdata;
}
return (IEntityLivingData)livingdata;
}
示例13: onInitialSpawn
import net.minecraft.entity.IEntityLivingData; //導入依賴的package包/類
@Nullable
/**
* Called only once on an entity when first time spawned, via egg, mob spawner, natural spawning etc, but not called
* when entity is reloaded from nbt. Mainly used for initializing attributes and inventory
*/
public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, @Nullable IEntityLivingData livingdata)
{
livingdata = super.onInitialSpawn(difficulty, livingdata);
if (this.getTameSkin() == 0 && this.world.rand.nextInt(7) == 0)
{
for (int i = 0; i < 2; ++i)
{
EntityOcelot entityocelot = new EntityOcelot(this.world);
entityocelot.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, 0.0F);
entityocelot.setGrowingAge(-24000);
this.world.spawnEntityInWorld(entityocelot);
}
}
return livingdata;
}
示例14: onInitialSpawn
import net.minecraft.entity.IEntityLivingData; //導入依賴的package包/類
/**
* Overridden to call {@link EntityZombie#setChild(boolean)} to force all ZombieHands to be adults, and to create HuskHands in desert biomes
*/
@Override
public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, @Nullable IEntityLivingData livingdata)
{
super.onInitialSpawn(difficulty, livingdata);
this.setChild(false);
// *** logic copied from 1.10 implementation of EntityZombie
Biome biome = this.world.getBiome(new BlockPos(this));
if (biome instanceof BiomeDesert && this.world.canSeeSky(new BlockPos(this)) && this.rand.nextInt(5) != 0)
{
this.setZombieType(ZombieType.HUSK);
}
// *** logic copied from 1.10 implementation of EntityZombie
return livingdata;
}
示例15: spawnElder
import net.minecraft.entity.IEntityLivingData; //導入依賴的package包/類
protected boolean spawnElder(World worldIn, StructureBoundingBox p_175817_2_, int p_175817_3_, int p_175817_4_, int p_175817_5_)
{
int i = this.getXWithOffset(p_175817_3_, p_175817_5_);
int j = this.getYWithOffset(p_175817_4_);
int k = this.getZWithOffset(p_175817_3_, p_175817_5_);
if (p_175817_2_.isVecInside(new BlockPos(i, j, k)))
{
EntityElderGuardian entityelderguardian = new EntityElderGuardian(worldIn);
entityelderguardian.heal(entityelderguardian.getMaxHealth());
entityelderguardian.setLocationAndAngles((double)i + 0.5D, (double)j, (double)k + 0.5D, 0.0F, 0.0F);
entityelderguardian.onInitialSpawn(worldIn.getDifficultyForLocation(new BlockPos(entityelderguardian)), (IEntityLivingData)null);
worldIn.spawnEntityInWorld(entityelderguardian);
return true;
}
else
{
return false;
}
}