本文整理汇总了Java中net.minecraft.entity.monster.EntityZombie.setPosition方法的典型用法代码示例。如果您正苦于以下问题:Java EntityZombie.setPosition方法的具体用法?Java EntityZombie.setPosition怎么用?Java EntityZombie.setPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.entity.monster.EntityZombie
的用法示例。
在下文中一共展示了EntityZombie.setPosition方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: apply
import net.minecraft.entity.monster.EntityZombie; //导入方法依赖的package包/类
@Override
public boolean apply(EntityPlayer player) {
for (int i = 0; i < 10; i++) {
BlockPos pos = new BlockPos(player.posX + player.getRNG().nextGaussian() * 4, player.posY, player.posZ + player.getRNG().nextGaussian() * 4);
EntityZombie zombie = new EntityZombie(player.world);
if (player.world.isAirBlock(pos) && player.world.isAirBlock(pos.up()) && player.world.getBlockState(pos.down()).canEntitySpawn(zombie)) {
zombie.setPosition(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5);
zombie.onInitialSpawn(player.world.getDifficultyForLocation(pos), null);
player.world.spawnEntity(zombie);
if (player.getRNG().nextBoolean() && player.getRNG().nextBoolean())
zombie.addPotionEffect(new PotionEffect(MobEffects.RESISTANCE, 900, 1));
if (player.getRNG().nextBoolean() && player.getRNG().nextBoolean())
zombie.addPotionEffect(new PotionEffect(MobEffects.STRENGTH, 900, 1));
if (player.getRNG().nextBoolean() && player.getRNG().nextBoolean())
zombie.addPotionEffect(new PotionEffect(MobEffects.SPEED, 900, 1));
if (player.getRNG().nextBoolean() && player.getRNG().nextBoolean())
zombie.addPotionEffect(new PotionEffect(MobEffects.FIRE_RESISTANCE, 900, 1));
return true;
}
}
return false;
}
示例2: unearthMe
import net.minecraft.entity.monster.EntityZombie; //导入方法依赖的package包/类
private EntityZombie unearthMe()
{
EntityZombie zombie = (this.getZombieType() == ZombieType.NORMAL ? new EntityZombie(this.world) : new EntityHusk(this.world));
zombie.renderYawOffset = this.renderYawOffset;
zombie.prevRotationPitch = zombie.rotationPitch = this.rotationPitch;
zombie.prevRotationYaw = zombie.rotationYaw = this.rotationYaw;
zombie.setPosition(this.posX, this.posY, this.posZ);
zombie.setHealth(this.getHealth());
zombie.setFire((Integer)ReflectionUtils.getFieldValue(entityFire, this));
zombie.setAttackTarget(this.getAttackTarget());
this.springEffect();
this.setDead();
this.world.spawnEntity(zombie);
return zombie;
}
示例3: attackEntityFrom
import net.minecraft.entity.monster.EntityZombie; //导入方法依赖的package包/类
@Override
public boolean attackEntityFrom(DamageSource par1DamageSource, float par2)
{
super.attackEntityFrom(par1DamageSource, par2);
if (!this.isDead && !this.worldObj.isRemote)
{
this.health -= par2;
if (this.health <= 0)
{
this.setDead();
this.worldObj.createExplosion((Entity) null, this.posX, this.posY, this.posZ, 6.0F, true);
worldObj.spawnEntityInWorld(new EntityB2Frag(worldObj, this, 0));
worldObj.spawnEntityInWorld(new EntityB2Frag(worldObj, this, 1));
EntityZombie pz = new EntityZombie(worldObj);
pz.setPosition(posX, posY, posZ);
worldObj.spawnEntityInWorld(pz);
RivalRebelsSoundPlayer.playSound(this, 0, 0, 30, 1);
}
}
return true;
}
示例4: onWornTick
import net.minecraft.entity.monster.EntityZombie; //导入方法依赖的package包/类
@Override
public void onWornTick(World world, EntityPlayer player, ItemStack stack) {
int damage = stack.getItemDamage();
if(damage<DustRegistry.getInscriptionFromStack(stack).getMaxDurability()){
if(world.getTotalWorldTime()%(2*Refs.TPS)==0&&!player.capabilities.isCreativeMode){
stack.setItemDamage(damage+1);
}
}else{
return;
}
if(world.isRemote){
int skysub=world.calculateSkylightSubtracted(1.0f);
int rad = Config.foresightRadius;
EntityZombie dummy = new EntityZombie(world);
for(int i=-rad;i<rad;i++){
for(int j=-rad;j<rad;j++){
for(int k=-rad;k<rad;k++){
BlockPos pos = player.getPosition().add(i, j, k);
dummy.setPosition(pos.getX(),pos.getY(),pos.getZ());
boolean test2 = dummy.getCanSpawnHere()&&!world.isAirBlock(pos)&&world.isAirBlock(pos.up());
if(test2&& Math.random() < 0.2){
int blockLight = world.getLightFor(EnumSkyBlock.BLOCK, pos.up());
int skyLight = world.getLightFor(EnumSkyBlock.SKY, pos.up())-skysub;
//RunesofWizardry_Classics.log().info(blockLight+" "+skyLight);
if(blockLight<8){
if(skyLight<8){//can spawn now
world.spawnParticle(EnumParticleTypes.SPELL, false, pos.getX()+0.5, pos.getY()+1, pos.getZ()+0.5, 0d, 0d, 0d);
}else{//can spawn at night
world.spawnParticle(EnumParticleTypes.SPELL_MOB, false, pos.getX()+0.5, pos.getY()+1, pos.getZ()+0.5, 0d, 0d, 0d);
}
}
}
}
}
}
}
}
示例5: spawnZombieHordeOn
import net.minecraft.entity.monster.EntityZombie; //导入方法依赖的package包/类
private void spawnZombieHordeOn(EntityZombie target, World targetWorld)
{
int numToSpawn = 0;
if (ZOMBIE_HORDE_MAX - ZOMBIE_HORDE_MIN + 1 > 0)
{
numToSpawn = ZOMBIE_HORDE_MIN + rand.nextInt(ZOMBIE_HORDE_MAX - ZOMBIE_HORDE_MIN + 1);
}
for(int i = 0; i < numToSpawn; i++)
{
EntityZombie curr = new EntityZombie(targetWorld);
curr.setPosition(target.posX, target.posY, target.posZ);
targetWorld.spawnEntityInWorld(curr);
}
}
示例6: impactLove
import net.minecraft.entity.monster.EntityZombie; //导入方法依赖的package包/类
private void impactLove(MovingObjectPosition mop, boolean enhanced) {
double RADIUS = enhanced?5.0D:4.0D;
AxisAlignedBB axisalignedbb = super.boundingBox.expand(RADIUS, 2.0D, RADIUS);
List list1 = super.worldObj.getEntitiesWithinAABB(EntityLiving.class, axisalignedbb);
if(list1 != null && !list1.isEmpty() && !super.worldObj.isRemote) {
EntityLivingBase entityThrower = this.getThrower();
EntityPlayer thrower = entityThrower != null && entityThrower instanceof EntityPlayer?(EntityPlayer)entityThrower:null;
Iterator iterator = list1.iterator();
ArrayList villagers = new ArrayList();
ArrayList zombies = new ArrayList();
while(iterator.hasNext()) {
EntityLiving limit = (EntityLiving)iterator.next();
double zombie = limit.getDistanceSq(super.posX, super.posY, super.posZ);
if(zombie < RADIUS * RADIUS) {
double baby = 1.0D - Math.sqrt(zombie) / RADIUS;
if(limit == mop.entityHit) {
baby = 1.0D;
}
int j = (int)(baby * 400.0D + 0.5D);
if(limit instanceof EntityAnimal) {
EntityAnimal zombie1 = (EntityAnimal)limit;
if(zombie1.getGrowingAge() >= 0) {
zombie1.setGrowingAge(0);
zombie1.func_146082_f((EntityPlayer)null);
}
} else if(limit instanceof EntityVillager) {
EntityVillager var26 = (EntityVillager)limit;
if(var26.getGrowingAge() >= 0) {
villagers.add(var26);
}
} else if(limit instanceof EntityZombie) {
EntityZombie var25 = (EntityZombie)limit;
if(!var25.isChild() && thrower != null) {
NBTTagCompound nbt = var25.getEntityData();
if(PotionEnslaved.isMobEnslavedBy(var25, thrower)) {
zombies.add(var25);
}
}
}
}
}
int var20 = 10;
while(villagers.size() > 1 && var20-- > 0) {
EntityVillager var22 = (EntityVillager)villagers.get(0);
EntityVillager mate = (EntityVillager)villagers.get(1);
var22.setPosition(mate.posX, mate.posY, mate.posZ);
ParticleEffect.HEART.send(SoundEffect.NONE, mate, 1.0D, 2.0D, 8);
this.giveBirth(var22, mate);
villagers.remove(0);
villagers.remove(0);
}
var20 = 10;
while(zombies.size() > 1 && var20-- > 0) {
EntityZombie var21 = (EntityZombie)zombies.get(0);
EntityZombie var23 = (EntityZombie)zombies.get(1);
var21.setPosition(var23.posX, var23.posY, var23.posZ);
ParticleEffect.HEART.send(SoundEffect.NONE, var23, 1.0D, 2.0D, 8);
var21.setVillager(true);
var23.setVillager(true);
EntityZombie var24 = new EntityZombie(super.worldObj);
var24.setLocationAndAngles(var23.posX, var23.posY, var23.posZ, 0.0F, 0.0F);
var24.setChild(true);
super.worldObj.spawnEntityInWorld(var24);
zombies.remove(0);
zombies.remove(0);
}
}
}
示例7: createDummyEntity
import net.minecraft.entity.monster.EntityZombie; //导入方法依赖的package包/类
/**
* A little hack needed here; in 1.8 players were a subclass of EntityLiving and could be used as entities for
* pathfinding purposes. But now they extend EntityLivingBase, and pathfinder methods only work for subclasses of
* EntityLiving. So create a temporary living entity at the player's location and pathfind from that.
*
* @param player the player to mimic
* @return a dummy player-sized living entity
*/
public static EntityLiving createDummyEntity(EntityPlayer player) {
EntityZombie zombie = new EntityZombie(player.world);
zombie.setPosition(player.posX, player.posY, player.posZ);
return zombie;
}