本文整理汇总了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)));
}
}
示例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;
}
示例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);
}
}
}
示例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);
}
}
}
}
}
示例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);
}
}
}
示例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);
}
}
示例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));
}
}
}
}
示例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);
}
}
}
示例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();
}
}
}
}
示例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());
}
}
示例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);
}
}
}
示例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)));
}
}
}
示例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);
}
}
}
示例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));
}
示例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));
}