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


Java EntityGolem类代码示例

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


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

示例1: matches

import net.minecraft.entity.monster.EntityGolem; //导入依赖的package包/类
@Override
protected boolean matches(EntityLivingBase entity) {
    if (type == BOSS) return !entity.isNonBoss();
    else if (!entity.isNonBoss()) return false;

    switch (type) {
        case ANIMAL:    return entity instanceof EntityAnimal;
        case MONSTER:   return entity instanceof IMob;
        case TAMEABLE:  return entity instanceof IEntityOwnable;
        case PLAYER:    return entity instanceof EntityPlayer;
        case WATER:     return entity instanceof EntityWaterMob || entity instanceof EntityGuardian;
        case NPC:       return entity instanceof INpc;
        case GOLEM:     return entity instanceof EntityGolem;
        default:        return false;
    }
}
 
开发者ID:joshiejack,项目名称:Progression,代码行数:17,代码来源:FilterEntityType.java

示例2: hitEntity

import net.minecraft.entity.monster.EntityGolem; //导入依赖的package包/类
@Override
public boolean hitEntity(ItemStack stack, EntityLivingBase victim, EntityLivingBase player) {
    stack.damageItem(1, player);
    if (victim instanceof EntityHorse || victim instanceof EntityPig)
        victim.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 200, 5));
    else if (victim instanceof EntityPlayer || victim instanceof EntityGolem) {
        victim.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 200, 1));
        victim.addPotionEffect(new PotionEffect(Potion.digSpeed.id, 200, 1));
        victim.addPotionEffect(new PotionEffect(Potion.damageBoost.id, 200, 1));
    }
    if (!player.worldObj.isRemote && !Config.noLust && player.worldObj.provider.dimensionId == -1 && player.worldObj.rand.nextInt(15) == 1) {
        EntityItem ent = victim.entityDropItem(new ItemStack(ForbiddenItems.deadlyShards, 1, 4), 1.0F);
        ent.motionY += player.worldObj.rand.nextFloat() * 0.05F;
        ent.motionX += (player.worldObj.rand.nextFloat() - player.worldObj.rand.nextFloat()) * 0.1F;
        ent.motionZ += (player.worldObj.rand.nextFloat() - player.worldObj.rand.nextFloat()) * 0.1F;
    }
    return true;
}
 
开发者ID:SpitefulFox,项目名称:ForbiddenMagic,代码行数:19,代码来源:ItemRidingCrop.java

示例3: applyMagicEffectsOnNewlySpawnedGolem

import net.minecraft.entity.monster.EntityGolem; //导入依赖的package包/类
/**
 * Applies all related effects on a golem that was just created
 * with a enchanted pumpkin.
 * 
 */
public static void applyMagicEffectsOnNewlySpawnedGolem(EntityGolem golem, ItemStack enchantedPumpkin)
{
    if (ConfigurationHandler.onDebug) {
        LogHelper.info("-- Enchanted Golem found at [" + golem.getPosition() + "], applying extra info");
    }
    
    MagicHelper.applyPumpkinExtraInfo(golem, enchantedPumpkin);
    MagicHelper.applyPassiveEffects(golem);
    MagicHelper.applyRefreshEffects(golem);
    
    // Heals the golem, if needed (so enchantments that raise health actually work)
    if (golem.getHealth() < golem.getMaxHealth()) {
        golem.heal(golem.getMaxHealth());
    }        
}
 
开发者ID:sidben,项目名称:VillagerTweaks,代码行数:21,代码来源:MagicHelper.java

示例4: warnPlayerIfNecessary

import net.minecraft.entity.monster.EntityGolem; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
private void warnPlayerIfNecessary(LivingSetAttackTargetEvent event) {
    EntityPlayer player = FMLClientHandler.instance().getClient().player;
    if (event.getTarget() == player && (event.getEntityLiving() instanceof EntityGolem || event.getEntityLiving() instanceof EntityMob)) {
        ItemStack helmetStack = player.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
        if (helmetStack.getItem() == Itemss.PNEUMATIC_HELMET && ((IPressurizable) helmetStack.getItem()).getPressure(helmetStack) > 0 && ItemPneumaticArmor.getUpgrades(EnumUpgrade.ENTITY_TRACKER, helmetStack) > 0 && GuiKeybindCheckBox.trackedCheckboxes.get("pneumaticHelmet.upgrade.coreComponents").checked && GuiKeybindCheckBox.trackedCheckboxes.get("pneumaticHelmet.upgrade." + EntityTrackUpgradeHandler.UPGRADE_NAME).checked) {
            HUDHandler.instance().getSpecificRenderer(EntityTrackUpgradeHandler.class).warnIfNecessary(event.getEntity());
        }
    } else {
        HUDHandler.instance().getSpecificRenderer(EntityTrackUpgradeHandler.class).removeTargetingEntity(event.getEntityLiving());
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:13,代码来源:EventHandlerPneumaticCraft.java

示例5: isMobType

import net.minecraft.entity.monster.EntityGolem; //导入依赖的package包/类
@Override
public boolean isMobType(Entity entity) {
    return entity.isCreatureType(EnumCreatureType.CREATURE, false)
            || entity.isCreatureType(EnumCreatureType.AMBIENT, false)
            || entity.isCreatureType(EnumCreatureType.WATER_CREATURE, false)
            || entity instanceof EntityVillager
            || entity instanceof EntityGolem;
}
 
开发者ID:fr1kin,项目名称:ForgeHax,代码行数:9,代码来源:FriendlyMob.java

示例6: instanceOf

import net.minecraft.entity.monster.EntityGolem; //导入依赖的package包/类
public boolean instanceOf(EntityType e) {
	// Generic types and players
	if (e.equals(EntityType.ENTITY_PLAYER_SP)) {
		return entity instanceof EntityPlayerSP;
	} else if (e.equals(EntityType.ENTITY_PLAYER)) {
		return entity instanceof EntityPlayer;
	} else if (e.equals(EntityType.ENTITY_LIVING_BASE)) {
		return entity instanceof EntityLivingBase;
	} else if (e.equals(EntityType.ENTITY_LIVING)) {
		return entity instanceof EntityLiving;
	}
	// Mobs
	if (e.equals(EntityType.ENTITY_WOLF)) {
		return entity instanceof EntityWolf;
	} else if (e.equals(EntityType.Entity_Ageable)) {
		return entity instanceof EntityAgeable;
	} else if (e.equals(EntityType.EntityAmbientCreature)) {
		return entity instanceof EntityAmbientCreature;
	} else if (e.equals(EntityType.EntityWaterMob)) {
		return entity instanceof EntityWaterMob;
	} else if (e.equals(EntityType.EntityMob)) {
		return entity instanceof EntityMob;
	} else if (e.equals(EntityType.EntitySlime)) {
		return entity instanceof EntitySlime;
	} else if (e.equals(EntityType.EntityFlying)) {
		return entity instanceof EntityFlying;
	} else if (e.equals(EntityType.EntityGolem)) {
		return entity instanceof EntityGolem;
	} else if (e.equals(EntityType.ENTITY_SPIDER)) {
		return entity instanceof EntitySpider;
	} else if (e.equals(EntityType.ENTITY_SPIDER)) {
		return entity instanceof EntitySpider;
	} else if (e.equals(EntityType.ENTITY_ZOMBIE_PIGMAN)) {
		return entity instanceof EntityZombie;
	} else if (e.equals(EntityType.ENTITY_ENDERMAN)) {
		return entity instanceof EntityEnderman;
	}
	return false;
}
 
开发者ID:Moudoux,项目名称:EMC,代码行数:40,代码来源:IEntity.java

示例7: isApplicableType

import net.minecraft.entity.monster.EntityGolem; //导入依赖的package包/类
private boolean isApplicableType(final Entity e) {
	if (e instanceof EntityLiving) {
		if (e instanceof IMob)
			return true;
		if (e instanceof EntityPlayer)
			return true;
		if (e instanceof EntityGolem)
			return true;
		if (e instanceof EntityPolarBear)
			return true;
	}
	return false;
}
 
开发者ID:OreCruncher,项目名称:DynamicSurroundings,代码行数:14,代码来源:BattleScanner.java

示例8: Config

import net.minecraft.entity.monster.EntityGolem; //导入依赖的package包/类
public Config() {
	mobs = new ArrayList<Entity>(Arrays.asList(new Entity[]{
			new Entity(EntityBat.class), 
			new Entity(EntityChicken.class),
			new Entity(EntityCow.class),
			new Entity(EntityHorse.class),
			new Entity(EntityMooshroom.class),
			new Entity(EntityOcelot.class),
			new Entity(EntityPig.class),
			new Entity(EntityRabbit.class),
			new Entity(EntitySheep.class),
			new Entity(EntitySquid.class),
			new Entity(EntityVillager.class),
			new Entity(EntityWolf.class),
			new Entity(EntityBlaze.class),
			new Entity(EntityCaveSpider.class),
			new Entity(EntityCreeper.class),
			new Entity(EntityEnderman.class),
			new Entity(EntityGhast.class),
			new Entity(EntityGolem.class),
			new Entity(EntityGuardian.class),
			new Entity(EntityIronGolem.class),
			new Entity(EntityMagmaCube.class),
			new Entity(EntityPigZombie.class),
			new Entity(EntitySilverfish.class),
			new Entity(EntitySkeleton.class),
			new Entity(EntitySlime.class),
			new Entity(EntitySnowman.class),
			new Entity(EntitySpider.class),
			new Entity(EntityWitch.class),
			new Entity(EntityZombie.class),
			new Entity(EntityItem.class),
			new Entity(EntityMinecart.class),
			new Entity(EntityPlayer.class)
			}));
}
 
开发者ID:TealNerd,项目名称:CivRadar,代码行数:37,代码来源:Config.java

示例9: initBuffs

import net.minecraft.entity.monster.EntityGolem; //导入依赖的package包/类
/**
 * Applies permanent buffs / debuffs to vanilla mobs
 */
private void initBuffs(EntityLivingBase entity) {
	ZSSEntityInfo info = ZSSEntityInfo.get(entity);
	if (!info.getActiveBuffs().isEmpty()) {
		return;
	}
	// double damage from cold effects, highly resistant to fire damage
	if (entity.isImmuneToFire()) {
		info.applyBuff(Buff.RESIST_FIRE, Integer.MAX_VALUE, 75);
		info.applyBuff(Buff.WEAKNESS_COLD, Integer.MAX_VALUE, 100);
	}
	if (entity.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD) {
		if (!entity.isImmuneToFire()) {
			info.applyBuff(Buff.WEAKNESS_FIRE, Integer.MAX_VALUE, 50);
		}
		info.applyBuff(Buff.WEAKNESS_HOLY, Integer.MAX_VALUE, 300);
		info.applyBuff(Buff.RESIST_COLD, Integer.MAX_VALUE, 50);
		info.applyBuff(Buff.RESIST_STUN, Integer.MAX_VALUE, 50);
	}
	if (entity instanceof EntityGolem) {
		info.applyBuff(Buff.RESIST_COLD, Integer.MAX_VALUE, 100);
		info.applyBuff(Buff.RESIST_STUN, Integer.MAX_VALUE, 100);
	}
	if (entity instanceof EntityWitch) {
		info.applyBuff(Buff.RESIST_MAGIC, Integer.MAX_VALUE, 75);
	}
	if (entity instanceof EntityWither) {
		info.removeBuff(Buff.WEAKNESS_COLD);
	}
}
 
开发者ID:coolAlias,项目名称:ZeldaSwordSkills,代码行数:33,代码来源:ZSSEntityEvents.java

示例10: getEntityTypeNonCache

import net.minecraft.entity.monster.EntityGolem; //导入依赖的package包/类
private static String getEntityTypeNonCache(Entity e) {
	if (e instanceof EntityGolem) {
        return "Golem";
    } else if (e instanceof IBossDisplayData) {
    	return "Boss";
    } else if (e instanceof IAnimals) {
    	return "Animal";
    } else if (e instanceof IMob) {
    	return "Monster";
    } else if (e instanceof IProjectile) {
    	return "Projectile";
    } else if (e instanceof INpc) {
    	return "NPC";
    } else if (e instanceof EntityItem) {
    	return "Item";
    } else if (e instanceof EntityMob) {
    	return "Monster";
    } else if (e instanceof EntityPlayer) {
    	return "Player";
    } else if (e instanceof EntityFireball) {
    	return "Projectile";
    } else if (e instanceof EntityTNTPrimed) {
    	return "TNT";
    } else {
    	return "Unknown"; // e.getClass().getName();
    }
}
 
开发者ID:MyEssentials,项目名称:MyEssentials-Core,代码行数:28,代码来源:EntityUtils.java

示例11: warnPlayerIfNecessary

import net.minecraft.entity.monster.EntityGolem; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
private void warnPlayerIfNecessary(LivingSetAttackTargetEvent event){
    EntityPlayer player = FMLClientHandler.instance().getClient().thePlayer;
    if(event.target == player && (event.entityLiving instanceof EntityGolem || event.entityLiving instanceof EntityMob)) {
        ItemStack helmetStack = player.getCurrentArmor(3);
        if(helmetStack != null && helmetStack.getItem() == Itemss.pneumaticHelmet && ((IPressurizable)helmetStack.getItem()).getPressure(helmetStack) > 0 && ItemPneumaticArmor.getUpgrades(ItemMachineUpgrade.UPGRADE_ENTITY_TRACKER, helmetStack) > 0 && GuiKeybindCheckBox.trackedCheckboxes.get("pneumaticHelmet.upgrade.coreComponents").checked && GuiKeybindCheckBox.trackedCheckboxes.get("pneumaticHelmet.upgrade." + EntityTrackUpgradeHandler.UPGRADE_NAME).checked) {
            HUDHandler.instance().getSpecificRenderer(EntityTrackUpgradeHandler.class).warnIfNecessary(event.entityLiving);
        }
    } else {
        HUDHandler.instance().getSpecificRenderer(EntityTrackUpgradeHandler.class).removeTargetingEntity(event.entityLiving);
    }
}
 
开发者ID:MineMaarten,项目名称:PneumaticCraft,代码行数:13,代码来源:EventHandlerPneumaticCraft.java

示例12: applyPumpkinExtraInfo

import net.minecraft.entity.monster.EntityGolem; //导入依赖的package包/类
/**
 * Applies the extra info (name, enchantments) in the pumpkin to the golem created with it.
 * 
 */
public static void applyPumpkinExtraInfo(EntityGolem golem, ItemStack pumpkin) {
    if (golem == null || pumpkin == null) return;
    
    int[] pumpkinEnchants = getEnchantmentIds(pumpkin);
    String customName = pumpkin.getDisplayName();
    if (customName.equals(Blocks.pumpkin.getLocalizedName())) customName = "";
    

    // Check if a custom name exists
    if (customName != "") {
        // Applies the custom name to the golem
        golem.setCustomNameTag(customName);
    }
    
    // Check if it's an enchanted pumpkin
    if (pumpkinEnchants != null && pumpkinEnchants.length > 0) {
        final ExtendedGolem properties = ExtendedGolem.get(golem);
        if (properties == null) {
            LogHelper.warn("Could not load extened properties for Iron Golem ID " + golem.getEntityId() + ", enchantments won't be applied.");
        } else {
            properties.setEnchantments(pumpkinEnchants);
            LogHelper.info("--> Applying enchantments on golem " + golem.getEntityId() + ": " + Arrays.toString(pumpkinEnchants));
            
            NetworkHelper.sendEnchantedGolemInfoMessage(golem, properties);
        }
    }

}
 
开发者ID:sidben,项目名称:VillagerTweaks,代码行数:33,代码来源:MagicHelper.java

示例13: onLivingAttack

import net.minecraft.entity.monster.EntityGolem; //导入依赖的package包/类
@SubscribeEvent
public void onLivingAttack(LivingAttackEvent event)
{
    Entity target = event.entity;

    
    if (target instanceof EntityGolem || event.source.getSourceOfDamage() instanceof EntityGolem) {
        LogHelper.info("== onLivingAttack() ==");
    }

    
    // NOTE: since the offensive enchantments apply special effect and don't just add more damage, 
    // I can intercept this event. If I were to do any damage modifier, the correct event is LivingHurtEvent.
    // NOTE 2: This code also works on LivingHurtEvent, but I feel it's more appropriate here.
    
    // An iron golem attacked a target, apply the offensive enchantments
    if (event.source.getDamageType() == "mob" && event.source.getSourceOfDamage() instanceof EntityIronGolem) {
        MagicHelper.applyAttackEffects(event.source.getSourceOfDamage(), target);
    }

    // A snow golem attacked a target, apply the offensive enchantments
    else if (event.source.getSourceOfDamage() instanceof EntitySnowball && ((EntitySnowball)event.source.getSourceOfDamage()).getThrower() instanceof EntitySnowman) {
        MagicHelper.applyAttackEffects(((EntitySnowball)event.source.getSourceOfDamage()).getThrower(), target);
    }

    
    // A golem was attacked by a target, check if should cancel the event
    if (target instanceof EntityGolem) {
        boolean ignoreDamage = MagicHelper.applyDamageCancelEffects(target, event.source);
        if (ignoreDamage) event.setCanceled(true);
    }

}
 
开发者ID:sidben,项目名称:VillagerTweaks,代码行数:34,代码来源:EntityEventHandler.java

示例14: onLivingHurt

import net.minecraft.entity.monster.EntityGolem; //导入依赖的package包/类
@SubscribeEvent
public void onLivingHurt(LivingHurtEvent event)
{
    Entity target = event.entity;
    

    if (target instanceof EntityGolem || event.source.getSourceOfDamage() instanceof EntityGolem) {
        LogHelper.info("== onLivingHurt() ==");
        LogHelper.info("    " + event.entity);
        LogHelper.info("    source: " + event.source.getDamageType());
        LogHelper.info("    source: " + event.source.getSourceOfDamage());
        LogHelper.info("    damage: " + event.ammount);
    }

    
    
    // A golem was attacked, apply the defensive enchantments
    if (target instanceof EntityGolem) {
        event.ammount = MagicHelper.applyDefenseEffects(target, event.source, event.ammount);
    }

    // An iron golem caused damage, apply damage modifiers
    else if (event.source.getDamageType() == "mob" && event.source.getSourceOfDamage() instanceof EntityIronGolem) {
        event.ammount = MagicHelper.applyDamagingEffects(event.source.getSourceOfDamage(), target, event.ammount);
    }
    
    // A snow golem caused damage, apply damage modifiers
    else if (event.source.getSourceOfDamage() instanceof EntitySnowball && ((EntitySnowball)event.source.getSourceOfDamage()).getThrower() instanceof EntitySnowman) {
        event.ammount = MagicHelper.applyDamagingEffects(((EntitySnowball)event.source.getSourceOfDamage()).getThrower(), target, event.ammount);
    }

}
 
开发者ID:sidben,项目名称:VillagerTweaks,代码行数:33,代码来源:EntityEventHandler.java

示例15: onEntityConstructing

import net.minecraft.entity.monster.EntityGolem; //导入依赖的package包/类
@SubscribeEvent
public void onEntityConstructing(EntityConstructing event)
{

    // Adds the Extended Properties to zombies
    if (GenericHelper.isVanillaZombie(event.entity)  && ExtendedVillagerZombie.get((EntityZombie) event.entity) == null) {
        ExtendedVillagerZombie.register((EntityZombie) event.entity);
    }

    // Adds the Extended Properties to golems
    else if (event.entity instanceof EntityGolem && ExtendedGolem.get((EntityGolem)event.entity) == null) {
        ExtendedGolem.register((EntityGolem) event.entity);
    }

}
 
开发者ID:sidben,项目名称:VillagerTweaks,代码行数:16,代码来源:EntityEventHandler.java


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