当前位置: 首页>>代码示例>>Java>>正文


Java EntityWither类代码示例

本文整理汇总了Java中net.minecraft.entity.boss.EntityWither的典型用法代码示例。如果您正苦于以下问题:Java EntityWither类的具体用法?Java EntityWither怎么用?Java EntityWither使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


EntityWither类属于net.minecraft.entity.boss包,在下文中一共展示了EntityWither类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: dropClay

import net.minecraft.entity.boss.EntityWither; //导入依赖的package包/类
@SubscribeEvent
public void dropClay(LivingDropsEvent event) {
    EntityLivingBase deadEntity = event.getEntityLiving();
    World world = deadEntity.getEntityWorld();
    BlockPos position = deadEntity.getPosition();
    double x = position.getX();
    double y = position.getY();
    double z = position.getZ();
    if (deadEntity instanceof EntityWitherSkeleton) {
        if (world.rand.nextInt(10) == 5) {
            event.getDrops().add(new EntityItem(world, x, y, z, new ItemStack(Items.CLAY_BALL)));
        }
    } else if (deadEntity instanceof EntityDragon || deadEntity instanceof EntityWither) {
        event.getDrops().add(new EntityItem(world, x, y, z, new ItemStack(Items.CLAY_BALL)));
    }
}
 
开发者ID:elifoster,项目名称:MakeClayValuableAgain,代码行数:17,代码来源:ClayProgressionImprovements.java

示例2: breakBlocks

import net.minecraft.entity.boss.EntityWither; //导入依赖的package包/类
public boolean breakBlocks(){
	boolean flag = false;
	AxisAlignedBB box=this.getBreakingBB();
	for (int x = MathHelper.floor(box.minX); x <= MathHelper.floor(box.maxX); ++x)
		for (int y = MathHelper.floor(box.minY); y <= MathHelper.floor(box.maxY); ++y)
			for (int z = MathHelper.floor(box.minZ); z <= MathHelper.floor(box.maxZ); ++z) {
				BlockPos blockpos = new BlockPos(x, y, z);
				IBlockState iblockstate = this.world.getBlockState(blockpos);
				Block block = iblockstate.getBlock();

				if (!block.isAir(iblockstate, this.world, blockpos) && !iblockstate.getMaterial().isLiquid()
						&& EntityWither.canDestroyBlock(block)
						&& block.canEntityDestroy(iblockstate, world, blockpos, this))
					flag = this.world.destroyBlock(blockpos, true) || flag;
			}

	if (flag)
		this.world.playEvent((EntityPlayer) null, 1022, new BlockPos(this), 0);
	return flag;
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:21,代码来源:EntityTF2Boss.java

示例3: netherDrop

import net.minecraft.entity.boss.EntityWither; //导入依赖的package包/类
@SubscribeEvent
public void netherDrop(final LivingDropsEvent event) {
    if (ExtraUtils.divisionSigil != null && event.entityLiving instanceof EntityWither && event.source.getSourceOfDamage() instanceof EntityPlayer && event.entity.worldObj != null && event.entity.worldObj.getGameRules().getGameRuleBooleanValue("doMobLoot")) {
        final EntityPlayer player = (EntityPlayer)event.source.getSourceOfDamage();
        NBTTagCompound t = new NBTTagCompound();
        if (player.getEntityData().hasKey("PlayerPersisted")) {
            t = player.getEntityData().getCompoundTag("PlayerPersisted");
        }
        else {
            player.getEntityData().setTag("PlayerPersisted", (NBTBase)t);
        }
        int kills = 0;
        if (t.hasKey("witherKills")) {
            kills = t.getInteger("witherKills");
        }
        ++kills;
        t.setInteger("witherKills", kills);
        if (kills == 1 || !t.hasKey("hasSigil") || event.entity.worldObj.rand.nextInt(10) == 0) {
            final ItemStack item = new ItemStack(ExtraUtils.divisionSigil);
            final EntityItem entityitem = new EntityItem(event.entity.worldObj, event.entity.posX, event.entity.posY, event.entity.posZ, item);
            entityitem.delayBeforeCanPickup = 10;
            event.drops.add(entityitem);
        }
    }
}
 
开发者ID:sameer,项目名称:ExtraUtilities,代码行数:26,代码来源:EventHandlerServer.java

示例4: onEntityDropLoot

import net.minecraft.entity.boss.EntityWither; //导入依赖的package包/类
@SubscribeEvent
public void onEntityDropLoot(LivingDropsEvent event)
{
	if (event.getSource() instanceof EntityDamageSource)
	{
		EntityLivingBase entity = event.getEntityLiving();
		EntityDamageSource source = (EntityDamageSource) event.getSource();

		if (source.getEntity() instanceof EntityPlayer)
		{
			EntityPlayer player = (EntityPlayer) source.getEntity();
			ItemStack currentItem = player.inventory.getCurrentItem();

			if (currentItem != null && currentItem.getItem() instanceof ItemSkyrootSword && !(entity instanceof EntityPlayer) && !(entity instanceof EntityWither))
			{
				for (EntityItem items : event.getDrops())
				{
					EntityItem item = new EntityItem(entity.worldObj, entity.posX, entity.posY, entity.posZ, items.getEntityItem());
					entity.worldObj.spawnEntityInWorld(item);
				}
			}
		}
	}
}
 
开发者ID:Modding-Legacy,项目名称:Aether-Legacy,代码行数:25,代码来源:AetherEventHandler.java

示例5: onWitherDeath

import net.minecraft.entity.boss.EntityWither; //导入依赖的package包/类
@SubscribeEvent
@SuppressWarnings("unused")
public void onWitherDeath(LivingDropsEvent event) {
    if(ItemRegistry.getInstance().itemRecord == null) {
        return;
    }
    if(!(event.getEntity() instanceof EntityWither)) {
        return;
    }
    Entity killer = event.getSource().getSourceOfDamage();
    if(event.isRecentlyHit() && killer != null && killer instanceof EntityPlayer) {
        EntityPlayer player = (EntityPlayer) killer;
        ItemStack left = player.getHeldItem(EnumHand.MAIN_HAND);
        ItemStack right = player.getHeldItem(EnumHand.OFF_HAND);
        if(isValidStack(left) && isValidStack(right)) {
            EntityItem drop = new EntityItem(event.getEntity().getEntityWorld(), event.getEntity().posX, event.getEntity().posY+0.5D, event.getEntity().posZ,
                    new ItemStack(ItemRegistry.getInstance().itemRecord));
            event.getDrops().add(drop);
        }
    }
}
 
开发者ID:InfinityRaider,项目名称:3DManeuverGear,代码行数:22,代码来源:EntityLivingHandler.java

示例6: makeMobRebornTransition

import net.minecraft.entity.boss.EntityWither; //导入依赖的package包/类
private void makeMobRebornTransition(LivingDropsEvent event) {
	if (ConfigValues.ALLOWBOSSES) {
		if (event.getEntityLiving() instanceof EntityWither || event.getEntityLiving() instanceof EntityDragon) {
			makeMobReborn(event);
			return;
		}
	} else if (event.getEntityLiving() instanceof EntityWither || event.getEntityLiving() instanceof EntityDragon)
		return;
	if (ConfigValues.ALLOWSLIMES) {
		if (event.getEntityLiving() instanceof EntitySlime) {
			makeMobReborn(event);
			return;
		}
	} else if (event.getEntityLiving() instanceof EntitySlime)
		return;
	if (ConfigValues.VANILLAONLY) {
		if (isVanilla(event.getEntityLiving())) {
			makeMobReborn(event);
		}
	} else {
		makeMobReborn(event);
	}
}
 
开发者ID:The-Fireplace-Minecraft-Mods,项目名称:Mob-Rebirth,代码行数:24,代码来源:CommonEvents.java

示例7: onSpawnMob

import net.minecraft.entity.boss.EntityWither; //导入依赖的package包/类
@SubscribeEvent
public void onSpawnMob(EntityJoinWorldEvent event)
{
   if(!event.world.isRemote)
   {
      if (event.entity != null && event.entity.getClass() == EntityWither.class)
      {
         EntityWither theWither = (EntityWither)event.entity;
         if( !powerUpManager.isWitherPoweredUp(theWither) )
         {
            List nearbyPlayers = theWither.worldObj.getEntitiesWithinAABB(EntityPlayer.class, theWither.boundingBox.expand(64.0D, 64.0D, 64.0D));
            double powerUpSize = 0.0;
            for (int index = 0; index < nearbyPlayers.size(); ++index)
            {
               EntityPlayer player = (EntityPlayer)nearbyPlayers.get(index);
               powerUpSize += playerHandler.wasAtWitherSpawn(player);
            }
            powerUpManager.powerUpWither( theWither, (int)Math.round(powerUpSize));
         }
      }
   }
}
 
开发者ID:thor12022,项目名称:HardcoreWither,代码行数:23,代码来源:EventHandler.java

示例8: onEntityDieing

import net.minecraft.entity.boss.EntityWither; //导入依赖的package包/类
@SubscribeEvent
public void onEntityDieing(LivingDeathEvent event)
{
   if(!event.entity.worldObj.isRemote)
   {
      if (event.entityLiving != null && event.entityLiving.getClass() == EntityWither.class)
      {
         List nearbyPlayers = event.entity.worldObj.getEntitiesWithinAABB(EntityPlayer.class, event.entity.boundingBox.expand(64.0D, 64.0D, 64.0D));
         double powerUpSize = 0.0;
         for (int index = 0; index < nearbyPlayers.size(); ++index)
         {
            EntityPlayer player = (EntityPlayer)nearbyPlayers.get(index);
            powerUpSize += playerHandler.wasAtWitherSpawn(player);
            player.addChatMessage(new ChatComponentText(TextHelper.localize("info." + ModInformation.ID + ".chat.wither-experience")));
         }
         powerUpManager.witherDied((EntityWither) event.entityLiving);
      }
   }
}
 
开发者ID:thor12022,项目名称:HardcoreWither,代码行数:20,代码来源:EventHandler.java

示例9: update

import net.minecraft.entity.boss.EntityWither; //导入依赖的package包/类
public void update(EntityWither wither)
{
   if(!usedPowerUps.containsKey(wither.getUniqueID()))
   {}
   else
   {
      // Iterate through the powerups for this Wither
      Iterator iter = usedPowerUps.get(wither.getUniqueID()).values().iterator();
      while(iter.hasNext())
      {
         IPowerUp powerUp = (IPowerUp)iter.next();
         {
            powerUp.updateWither();
         }
      }
   }
}
 
开发者ID:thor12022,项目名称:HardcoreWither,代码行数:18,代码来源:PowerUpManager.java

示例10: witherDied

import net.minecraft.entity.boss.EntityWither; //导入依赖的package包/类
public void witherDied(EntityWither wither)
{
   if(!usedPowerUps.containsKey(wither.getUniqueID()))
   {}
   else
   {
      // Iterate through the powerups for this Wither
      Iterator iter = usedPowerUps.get(wither.getUniqueID()).values().iterator();
      while(iter.hasNext())
      {
         IPowerUp powerUp = (IPowerUp)iter.next();
         {
            powerUp.witherDied();
         }
      }
      usedPowerUps.remove(wither.getUniqueID());
   }
}
 
开发者ID:thor12022,项目名称:HardcoreWither,代码行数:19,代码来源:PowerUpManager.java

示例11: loadWitherFromNBT

import net.minecraft.entity.boss.EntityWither; //导入依赖的package包/类
/**
 * Loads the Power Up data for a Wither from NBT
 * @param wither
 * @param nbt
 * @pre   the wither is not already in usedPowerUps
 * @post  the Power Up map for this Wither in usedPowerUps contains the IPowerUps from NBT
 */
private void loadWitherFromNBT(EntityWither wither, NBTTagCompound nbt)
{
   usedPowerUps.put(wither.getUniqueID(), new HashMap<String, IPowerUp>());
   Set powerUpTags = nbt.func_150296_c();
   Iterator powerUpIter = powerUpTags.iterator();
   while (powerUpIter.hasNext()) 
   {
      String powerUpName = (String)powerUpIter.next();
      try 
      {
         if(powerUpPrototypes.containsKey(powerUpName))
         {
            NBTTagCompound powerUpNbt = (NBTTagCompound) nbt.getTag(powerUpName);
            IPowerUp powerUp = powerUpPrototypes.get(powerUpName).createPowerUp(wither);
            powerUp.readFromNBT(powerUpNbt);
            usedPowerUps.get(wither.getUniqueID()).put(powerUpName, powerUp);
         }
      }
      catch (Exception ex)
      {
         HardcoreWither.logger.warn("Attempting to powerup from save with unknown powerup: " + powerUpName + "\n\t" + ex);
      }
   
   }
}
 
开发者ID:thor12022,项目名称:HardcoreWither,代码行数:33,代码来源:PowerUpManager.java

示例12: onEntityKill

import net.minecraft.entity.boss.EntityWither; //导入依赖的package包/类
@SubscribeEvent
public void onEntityKill(LivingDropsEvent event){
    if(event.entityLiving instanceof EntitySkeleton){
        if(((EntitySkeleton) event.entityLiving).getSkeletonType() == 1){
            if(Math.round(Marble.rand.nextFloat() * 100) < ConfigHandler.witherOneDropChance){
                MiscHelper.drop(event, Items.enchanted_book.getEnchantedItemStack(new EnchantmentData(ConfigHandler.witheringID, 1)));
            }
        }
    }

    if(event.entityLiving instanceof EntityWither){
        if(Math.round(Marble.rand.nextInt()) < ConfigHandler.witherTwoDropChance){
            MiscHelper.drop(event, Items.enchanted_book.getEnchantedItemStack(new EnchantmentData(ConfigHandler.witheringID, 2)));
        }
    }
}
 
开发者ID:goldenapple3,项目名称:Marble,代码行数:17,代码来源:WitheringHandler.java

示例13: livingKilled

import net.minecraft.entity.boss.EntityWither; //导入依赖的package包/类
@SubscribeEvent
public void livingKilled(LivingDeathEvent event) {
    Entity killer = event.source.getEntity();
    EntityLivingBase target = event.entityLiving;
    if (isServer() && killer != null && killer instanceof EntityPlayer) {
        EntityPlayer player = (EntityPlayer) killer;

        if (target instanceof EntityWither) {
            DiscoveryManager.unlockItem(QADiscoveries.Item.STAR.get().getKey(), player, false);
        } else if (target instanceof EntityZombie) {
            ItemStack equip = ((EntityZombie) target).getEquipmentInSlot(0);
            if (equip != null && equip.getItem() instanceof ItemSword)
                DiscoveryManager.unlockItem(QADiscoveries.Item.SWORD.get().getKey(), player, false);
        } else if (target instanceof EntityBlaze) {
            DiscoveryManager.unlockItem(QADiscoveries.Item.TOOLS.get().getKey(), player, false);
        }
    }
}
 
开发者ID:MSourceCoded,项目名称:Quantum-Anomalies,代码行数:19,代码来源:DiscoveryListener.java

示例14: EntityArcher

import net.minecraft.entity.boss.EntityWither; //导入依赖的package包/类
public EntityArcher(World p_i1683_1_) {
    super(p_i1683_1_);
    this.goldNeededToTame += this.rand.nextInt(15);

    int taskPriority = 0;
    this.tasks.addTask(++taskPriority, new EntityAISwimming(this));
    this.tasks.addTask(++taskPriority, new EntityAIDefensiveArrowAttack(this, 20, 40, 15.0F, 10.0F));
    this.tasks.addTask(++taskPriority, new EntityAIFollowOwner(this, 1.0D, 10.0F, 4.0F));
    this.tasks.addTask(++taskPriority, new EntityAIWander(this, 1.0D));
    this.tasks.addTask(++taskPriority, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
    this.tasks.addTask(++taskPriority, new EntityAILookIdle(this));

    int targetPriority = 0;
    this.targetTasks.addTask(++targetPriority, new EntityAIOwnerHurtByTarget(this));
    this.targetTasks.addTask(++targetPriority, new EntityAIHurtByTarget(this, true));
    this.targetTasks.addTask(++targetPriority, new EntityAIOwnerHurtTarget(this));
    this.targetTasks.addTask(++targetPriority, new EntityAITamedNearestAttackableTarget(this, EntityCreeper.class, 0, true));
    this.targetTasks.addTask(++targetPriority, new EntityAITamedNearestAttackableTarget(this, EntityZombie.class, 0, true));
    this.targetTasks.addTask(++targetPriority, new EntityAITamedNearestAttackableTarget(this, EntitySkeleton.class, 0, true));
    this.targetTasks.addTask(++targetPriority, new EntityAITamedNearestAttackableTarget(this, EntitySpider.class, 0, true));
    this.targetTasks.addTask(++targetPriority, new EntityAITamedNearestAttackableTarget(this, EntityCaveSpider.class, 0, true));
    this.targetTasks.addTask(++targetPriority, new EntityAITamedNearestAttackableTarget(this, EntityBlaze.class, 0, true));
    this.targetTasks.addTask(++targetPriority, new EntityAITamedNearestAttackableTarget(this, EntityGhast.class, 0, true));
    this.targetTasks.addTask(++targetPriority, new EntityAITamedNearestAttackableTarget(this, EntityWither.class, 0, true));
    this.targetTasks.addTask(++targetPriority, new EntityAITamedNearestAttackableTarget(this, EntityDragon.class, 0, true));
}
 
开发者ID:civilframe,项目名称:TameHumans,代码行数:27,代码来源:EntityArcher.java

示例15: EntityWarrior

import net.minecraft.entity.boss.EntityWither; //导入依赖的package包/类
public EntityWarrior(World p_i1683_1_) {
    super(p_i1683_1_);
    this.goldNeededToTame += this.rand.nextInt(10);

    int taskPriority = 0;
    this.tasks.addTask(++taskPriority, new EntityAISwimming(this));
    this.tasks.addTask(++taskPriority, new EntityAIAvoidEntity(this, EntityCreeper.class, 4.0F, 1.0D, 1.2D));
    this.tasks.addTask(++taskPriority, new EntityAIAttackOnCollide(this, 1.0D, false));
    this.tasks.addTask(++taskPriority, new EntityAIFollowOwner(this, 1.0D, 10.0F, 3.0F));
    this.tasks.addTask(++taskPriority, new EntityAIWander(this, 1.0D));
    this.tasks.addTask(++taskPriority, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
    this.tasks.addTask(++taskPriority, new EntityAILookIdle(this));

    int targetPriority = 0;
    this.targetTasks.addTask(++targetPriority, new EntityAIOwnerHurtByTarget(this));
    this.targetTasks.addTask(++targetPriority, new EntityAIHurtByTarget(this, true));
    this.targetTasks.addTask(++targetPriority, new EntityAIOwnerHurtTarget(this));
    this.targetTasks.addTask(++targetPriority, new EntityAITamedNearestAttackableTarget(this, EntityZombie.class, 0, true));
    this.targetTasks.addTask(++targetPriority, new EntityAITamedNearestAttackableTarget(this, EntitySkeleton.class, 0, true));
    this.targetTasks.addTask(++targetPriority, new EntityAITamedNearestAttackableTarget(this, EntitySpider.class, 0, true));
    this.targetTasks.addTask(++targetPriority, new EntityAITamedNearestAttackableTarget(this, EntityCaveSpider.class, 0, true));
    this.targetTasks.addTask(++targetPriority, new EntityAITamedNearestAttackableTarget(this, EntityBlaze.class, 0, true));
    this.targetTasks.addTask(++targetPriority, new EntityAITamedNearestAttackableTarget(this, EntityWither.class, 0, true));
}
 
开发者ID:civilframe,项目名称:TameHumans,代码行数:25,代码来源:EntityWarrior.java


注:本文中的net.minecraft.entity.boss.EntityWither类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。