本文整理汇总了Java中net.minecraft.entity.monster.EntityPigZombie类的典型用法代码示例。如果您正苦于以下问题:Java EntityPigZombie类的具体用法?Java EntityPigZombie怎么用?Java EntityPigZombie使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EntityPigZombie类属于net.minecraft.entity.monster包,在下文中一共展示了EntityPigZombie类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isMobAggressive
import net.minecraft.entity.monster.EntityPigZombie; //导入依赖的package包/类
/**
* Checks if the mob could be possibly hostile towards us (we can't detect their attack target easily)
* Current entities:
* PigZombie: Aggressive if arms are raised, when arms are put down a internal timer is slowly ticked down from 400
* Wolf: Aggressive if the owner isn't the local player and the wolf is angry
* Enderman: Aggressive if making screaming sounds
*/
public static boolean isMobAggressive(Entity entity) {
if(entity instanceof EntityPigZombie) {
// arms raised = aggressive, angry = either game or we have set the anger cooldown
if(((EntityPigZombie) entity).isArmsRaised() || ((EntityPigZombie) entity).isAngry()) {
if(!((EntityPigZombie) entity).isAngry()) {
// set pigmens anger to 400 if it hasn't been angered already
FastReflection.Fields.EntityPigZombie_angerLevel.set((EntityPigZombie)entity, 400);
}
return true;
}
} else if(entity instanceof EntityWolf) {
return ((EntityWolf) entity).isAngry() &&
!MC.player.equals(((EntityWolf) entity).getOwner());
} else if(entity instanceof EntityEnderman) {
return ((EntityEnderman) entity).isScreaming();
}
return false;
}
示例2: onStruckByLightning
import net.minecraft.entity.monster.EntityPigZombie; //导入依赖的package包/类
/**
* Called when a lightning bolt hits the entity.
*/
public void onStruckByLightning(EntityLightningBolt lightningBolt)
{
if (!this.worldObj.isRemote && !this.isDead)
{
EntityPigZombie entitypigzombie = new EntityPigZombie(this.worldObj);
entitypigzombie.setCurrentItemOrArmor(0, new ItemStack(Items.golden_sword));
entitypigzombie.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
entitypigzombie.setNoAI(this.isAIDisabled());
if (this.hasCustomName())
{
entitypigzombie.setCustomNameTag(this.getCustomNameTag());
entitypigzombie.setAlwaysRenderNameTag(this.getAlwaysRenderNameTag());
}
this.worldObj.spawnEntityInWorld(entitypigzombie);
this.setDead();
}
}
示例3: onStruckByLightning
import net.minecraft.entity.monster.EntityPigZombie; //导入依赖的package包/类
/**
* Called when a lightning bolt hits the entity.
*/
public void onStruckByLightning(EntityLightningBolt lightningBolt)
{
if (!this.world.isRemote && !this.isDead)
{
EntityPigZombie entitypigzombie = new EntityPigZombie(this.world);
entitypigzombie.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, new ItemStack(Items.GOLDEN_SWORD));
entitypigzombie.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
entitypigzombie.setNoAI(this.isAIDisabled());
if (this.hasCustomName())
{
entitypigzombie.setCustomNameTag(this.getCustomNameTag());
entitypigzombie.setAlwaysRenderNameTag(this.getAlwaysRenderNameTag());
}
this.world.spawnEntityInWorld(entitypigzombie);
this.setDead();
}
}
示例4: updateTick
import net.minecraft.entity.monster.EntityPigZombie; //导入依赖的package包/类
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
super.updateTick(worldIn, pos, state, rand);
if (worldIn.provider.isSurfaceWorld() && worldIn.getGameRules().getBoolean("doMobSpawning") && rand.nextInt(2000) < worldIn.getDifficulty().getDifficultyId())
{
int i = pos.getY();
BlockPos blockpos;
for (blockpos = pos; !worldIn.getBlockState(blockpos).isFullyOpaque() && blockpos.getY() > 0; blockpos = blockpos.down())
{
;
}
if (i > 0 && !worldIn.getBlockState(blockpos.up()).isNormalCube())
{
Entity entity = ItemMonsterPlacer.spawnCreature(worldIn, EntityList.func_191306_a(EntityPigZombie.class), (double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 1.1D, (double)blockpos.getZ() + 0.5D);
if (entity != null)
{
entity.timeUntilPortal = entity.getPortalCooldown();
}
}
}
}
示例5: onStruckByLightning
import net.minecraft.entity.monster.EntityPigZombie; //导入依赖的package包/类
/**
* Called when a lightning bolt hits the entity.
*/
public void onStruckByLightning(EntityLightningBolt lightningBolt)
{
if (!this.worldObj.isRemote && !this.isDead)
{
EntityPigZombie entitypigzombie = new EntityPigZombie(this.worldObj);
entitypigzombie.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, new ItemStack(Items.GOLDEN_SWORD));
entitypigzombie.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
entitypigzombie.setNoAI(this.isAIDisabled());
if (this.hasCustomName())
{
entitypigzombie.setCustomNameTag(this.getCustomNameTag());
entitypigzombie.setAlwaysRenderNameTag(this.getAlwaysRenderNameTag());
}
this.worldObj.spawnEntityInWorld(entitypigzombie);
this.setDead();
}
}
示例6: updateTick
import net.minecraft.entity.monster.EntityPigZombie; //导入依赖的package包/类
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
super.updateTick(worldIn, pos, state, rand);
if (worldIn.provider.isSurfaceWorld() && worldIn.getGameRules().getBoolean("doMobSpawning") && rand.nextInt(2000) < worldIn.getDifficulty().getDifficultyId())
{
int i = pos.getY();
BlockPos blockpos;
for (blockpos = pos; !worldIn.getBlockState(blockpos).isFullyOpaque() && blockpos.getY() > 0; blockpos = blockpos.down())
{
;
}
if (i > 0 && !worldIn.getBlockState(blockpos.up()).isNormalCube())
{
Entity entity = ItemMonsterPlacer.spawnCreature(worldIn, EntityList.getEntityStringFromClass(EntityPigZombie.class), (double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 1.1D, (double)blockpos.getZ() + 0.5D);
if (entity != null)
{
entity.timeUntilPortal = entity.getPortalCooldown();
}
}
}
}
示例7: postInit
import net.minecraft.entity.monster.EntityPigZombie; //导入依赖的package包/类
public static void postInit(){
addToBiomes(EntityCrystalPigZombie.class, 50, 1, 4, EnumCreatureType.MONSTER, getBiomesThatCanSpawn(EntityPigZombie.class, EnumCreatureType.MONSTER));
addToBiomes(EntityCrystalCow.class, 6, 1, 4, EnumCreatureType.CREATURE, getBiomesThatCanSpawn(EntityCow.class, EnumCreatureType.CREATURE));
addToBiomes(EntityCrystalEnderman.class, 8, 1, 4, EnumCreatureType.MONSTER, getBiomesThatCanSpawn(EntityEnderman.class, EnumCreatureType.MONSTER));
List<Biome> angelBiomeList = getBiomesThatCanSpawn(EntityEnderman.class, EnumCreatureType.MONSTER);
Biome hell = Biome.REGISTRY.getObject(new ResourceLocation("hell"));
Biome sky = Biome.REGISTRY.getObject(new ResourceLocation("sky"));
if(sky !=null){
angelBiomeList.remove(sky);
}
if(hell !=null){
angelBiomeList.remove(hell);
List<Biome> listHell = Lists.newArrayList(hell);
addToBiomes(EntityAngel.class, 50, 4, 4, EnumCreatureType.MONSTER, listHell);
addToBiomes(EntityDevil.class, 50, 4, 4, EnumCreatureType.MONSTER, listHell);
}
addToBiomes(EntityAngel.class, 8, 1, 4, EnumCreatureType.MONSTER, angelBiomeList);
addToBiomes(EntityDevil.class, 8, 1, 4, EnumCreatureType.MONSTER, angelBiomeList);
}
示例8: saveCurrentRenderers
import net.minecraft.entity.monster.EntityPigZombie; //导入依赖的package包/类
private void saveCurrentRenderers(RenderManager rm) {
// villagers
saveRenderer(rm, EntityVillager.class);
saveRenderer(rm, EntityZombieVillager.class);
// zombies
saveRenderer(rm, EntityZombie.class);
saveRenderer(rm, EntityHusk.class);
// pig zombie
saveRenderer(rm, EntityPigZombie.class);
// skeletons
saveRenderer(rm, EntitySkeleton.class);
saveRenderer(rm, EntityStray.class);
saveRenderer(rm, EntityWitherSkeleton.class);
// illagers
saveRenderer(rm, EntityVex.class);
saveRenderer(rm, EntityEvoker.class);
saveRenderer(rm, EntityVindicator.class);
saveRenderer(rm, EntityIllusionIllager.class);
}
示例9: inputEnergy
import net.minecraft.entity.monster.EntityPigZombie; //导入依赖的package包/类
@Override
public long inputEnergy(long amount, boolean simulate) {
if (!simulate && !charged) {
if (creature instanceof EntityPig) {
final EntityPigZombie pigman = new EntityPigZombie(creature.world);
pigman.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, new ItemStack(Items.GOLDEN_AXE));
pigman.setLocationAndAngles(creature.posX, creature.posY, creature.posZ, creature.rotationYaw, creature.rotationPitch);
pigman.setNoAI(creature.isAIDisabled());
if (creature.hasCustomName()) {
pigman.setCustomNameTag(creature.getCustomNameTag());
pigman.setAlwaysRenderNameTag(creature.getAlwaysRenderNameTag());
}
creature.world.spawnEntity(pigman);
creature.setDead();
} else if (creature instanceof EntityCreeper)
creature.onStruckByLightning(null);
charged = true;
return 1;
}
return charged ? 0 : 1;
}
示例10: applyEntityAI
import net.minecraft.entity.monster.EntityPigZombie; //导入依赖的package包/类
@Override
protected void applyEntityAI()
{
// this.tasks.addTask(4, new EntityAIAttackOnCollide(this, EntityMob.class, 1.0D, true));
this.tasks.addTask(9, new SummonAIMoveToArea(this, 1.0));
this.tasks.addTask(4, new SummonAIManipulateTargetBlock(this));
this.tasks.addTask(6, new SummonAIMoveToNextTargetBlock(this, 1.0));
this.tasks.addTask(3, new SummonAIMoveToChest(this, 1.0));
this.tasks.addTask(4, new SummonAIDumpToChest(this));
// this.tasks.addTask(6, new EntityAIMoveThroughVillage(this, 1.0D, false));
this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true, new Class[] {EntityPigZombie.class}));
this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityMob.class, true));
}
示例11: BiomeGenDarkLand
import net.minecraft.entity.monster.EntityPigZombie; //导入依赖的package包/类
public BiomeGenDarkLand(int id) {
super(id);
this.waterColorMultiplier = 0x666600;
this.theBiomeDecorator.treesPerChunk = 1;
this.theBiomeDecorator.grassPerChunk = 1;
this.theBiomeDecorator.flowersPerChunk = -999;
this.theBiomeDecorator.generateLakes = true;
this.spawnableMonsterList.clear();
this.spawnableCreatureList.clear();
this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityDarkZertum.class, 100, 4, 4));
this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityBat.class, 60, 1, 5));
this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityMagmaCube.class, 1, 4, 4));
this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityPigZombie.class, 20, 2, 3));
this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityGhast.class, 20, 1, 2));
this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityKurr.class, 10, 2, 2));
this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntitySpider.class, 100, 4, 4));
this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityZombie.class, 100, 4, 4));
}
示例12: BiomeGenDarkLand
import net.minecraft.entity.monster.EntityPigZombie; //导入依赖的package包/类
public BiomeGenDarkLand(int id) {
super(id);
this.waterColorMultiplier = 0x666600;
this.theBiomeDecorator.treesPerChunk = 1;
this.theBiomeDecorator.grassPerChunk = 1;
this.theBiomeDecorator.flowersPerChunk = -999;
this.addFlower(ModBlocks.nileBlackFlower.getDefaultState(), 100);
this.theBiomeDecorator.generateLakes = true;
this.spawnableMonsterList.clear();
this.spawnableCreatureList.clear();
this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityBat.class, 60, 1, 5));
this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityMagmaCube.class, 1, 4, 4));
this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityPigZombie.class, 20, 2, 3));
this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityGhast.class, 20, 1, 2));
this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntitySpider.class, 100, 4, 4));
this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityZombie.class, 100, 4, 4));
}
示例13: attackEntity
import net.minecraft.entity.monster.EntityPigZombie; //导入依赖的package包/类
@Override
public boolean attackEntity(Entity entity){
if (entity instanceof EntityLivingBase) {
if ((entity instanceof EntityPlayer && (getOwner().isOwner((EntityPlayer) entity) || (hasModule(EnumCustomModules.WHITELIST) && ModuleUtils.getPlayersFromModule(worldObj, pos, EnumCustomModules.WHITELIST).contains(((EntityLivingBase) entity).getName().toLowerCase())))) ||
entity instanceof EntityPigZombie ||
(entity instanceof EntityCreeper && ((EntityCreeper) entity).getPowered()))
return false;
EntityLightningBolt lightning = new EntityLightningBolt(worldObj, entity.posX, entity.posY, entity.posZ, true);
worldObj.addWeatherEffect(lightning);
BlockUtils.setBlockProperty(worldObj, pos, BlockProtecto.ACTIVATED, false);
return true;
}
return false;
}
示例14: attackEntity
import net.minecraft.entity.monster.EntityPigZombie; //导入依赖的package包/类
@Override
public boolean attackEntity(Entity entity){
if (entity instanceof EntityLivingBase) {
if ((entity instanceof EntityPlayer && (getOwner().isOwner((EntityPlayer) entity) || (hasModule(EnumCustomModules.WHITELIST) && ModuleUtils.getPlayersFromModule(world, pos, EnumCustomModules.WHITELIST).contains(((EntityLivingBase) entity).getName().toLowerCase())))) ||
entity instanceof EntityPigZombie ||
(entity instanceof EntityCreeper && ((EntityCreeper) entity).getPowered()))
return false;
EntityLightningBolt lightning = new EntityLightningBolt(world, entity.posX, entity.posY, entity.posZ, true);
world.addWeatherEffect(lightning);
BlockUtils.setBlockProperty(world, pos, BlockProtecto.ACTIVATED, false);
return true;
}
return false;
}
示例15: attackEntity
import net.minecraft.entity.monster.EntityPigZombie; //导入依赖的package包/类
@Override
public boolean attackEntity(Entity entity){
if (entity instanceof EntityLivingBase) {
if ((entity instanceof EntityPlayer && (getOwner().isOwner((EntityPlayer) entity) || (hasModule(EnumCustomModules.WHITELIST) && ModuleUtils.getPlayersFromModule(worldObj, pos, EnumCustomModules.WHITELIST).contains(((EntityLivingBase) entity).getCommandSenderName().toLowerCase())))) ||
entity instanceof EntityPigZombie ||
(entity instanceof EntityCreeper && ((EntityCreeper) entity).getPowered()))
return false;
EntityLightningBolt lightning = new EntityLightningBolt(worldObj, entity.posX, entity.posY, entity.posZ);
worldObj.addWeatherEffect(lightning);
BlockUtils.setBlockProperty(worldObj, pos, BlockProtecto.ACTIVATED, false);
return true;
}
return false;
}