本文整理匯總了Java中net.minecraft.entity.monster.EntityMob類的典型用法代碼示例。如果您正苦於以下問題:Java EntityMob類的具體用法?Java EntityMob怎麽用?Java EntityMob使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
EntityMob類屬於net.minecraft.entity.monster包,在下文中一共展示了EntityMob類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: initializeEntityActivationType
import net.minecraft.entity.monster.EntityMob; //導入依賴的package包/類
/**
* Initializes an entities type on construction to specify what group this
* entity is in for activation ranges.
*
* @param entity
* @return group id
*/
public static byte initializeEntityActivationType(Entity entity)
{
Chunk chunk = null;
// Cauldron start - account for entities that dont extend EntityMob, EntityAmbientCreature, EntityCreature
if ( entity instanceof EntityMob || entity instanceof EntitySlime || entity.isCreatureType(EnumCreatureType.monster, false)) // Cauldron - account for entities that dont extend EntityMob
{
return 1; // Monster
} else if ( entity instanceof EntityCreature || entity instanceof EntityAmbientCreature || entity.isCreatureType(EnumCreatureType.creature, false)
|| entity.isCreatureType(EnumCreatureType.waterCreature, false) || entity.isCreatureType(EnumCreatureType.ambient, false))
{
return 2; // Animal
// Cauldron end
} else
{
return 3; // Misc
}
}
示例2: checkValidity
import net.minecraft.entity.monster.EntityMob; //導入依賴的package包/類
private boolean checkValidity(final EntityLivingBase entity) {
if (entity == this.mc.thePlayer) {
return false;
}
if (!entity.isEntityAlive()) {
return false;
}
if (this.mc.thePlayer.getDistanceToEntity(entity) > this.range) {
return false;
}
if (!(entity instanceof EntityPlayer)) {
return (this.monsters && entity instanceof EntityMob) || (this.animals && (entity instanceof EntityAnimal || entity instanceof EntitySquid)) || (this.bats && entity instanceof EntityBat);
}
if (this.players) {
final EntityPlayer player = (EntityPlayer)entity;
return (this.friend && FriendManager.isFriend(player.getName())) || (!FriendManager.isFriend(player.getName()) && (!this.noArmor || this.hasArmor(player)));
}
return false;
}
示例3: onUpdateMinimal
import net.minecraft.entity.monster.EntityMob; //導入依賴的package包/類
private void onUpdateMinimal()
{
++this.entityAge;
if (this instanceof EntityMob)
{
float f = this.getBrightness(1.0F);
if (f > 0.5F)
{
this.entityAge += 2;
}
}
this.despawnEntity();
}
示例4: initializeDrone
import net.minecraft.entity.monster.EntityMob; //導入依賴的package包/類
/**
* Make the drone mob attack the target player
*/
private boolean initializeDrone(EntityMob mob)
{
// ensure that the drone has sufficient follow range to be able to path to the player
double followRange = mob.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE).getAttributeValue();
float distance = mob.getDistanceToEntity(this.attackTarget);
if (followRange < distance)
{
mob.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE).setBaseValue(distance * 1.1D);
}
// set the drone on a path to the player
boolean canNavigate = mob.getNavigator().tryMoveToEntityLiving(this.attackTarget, this.currentDrone.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).getAttributeValue());
if (canNavigate)
{
// set the drone's attack target to be the player
mob.setAttackTarget(this.attackTarget);
}
else
{
this.currentDrone = null;
}
return canNavigate;
}
示例5: onSpawn
import net.minecraft.entity.monster.EntityMob; //導入依賴的package包/類
/**
* Checks spawning
*/
@SubscribeEvent
public void onSpawn(CheckSpawn event) {
//If the entity is not a mob or above the forced-spawn-y-level, stop
if (!(event.getEntity() instanceof EntityMob && event.getY() < underground))
return;
EntityMob mob = (EntityMob) event.getEntity();
String name = EntityList.getEntityString(mob);
//If whitelist and list contains mob, or blacklist and list does not contain mob
if ((spawnWhitelist && mobsToSpawn.contains(name)) || (!(spawnWhitelist && mobsToSpawn.contains(name)))){
//If the chance is within allowed mob-spawn-under-y-level range, and the game is not on Peaceful
if (rand.nextFloat() < undergroundChance && event.getWorld().getDifficulty() != EnumDifficulty.PEACEFUL){
//If there are no other entities in this area, and there are no collisions, and there is not a liquid
if (event.getWorld().checkNoEntityCollision(mob.getEntityBoundingBox())
&& event.getWorld().getCollisionBoxes(mob, mob.getEntityBoundingBox()).isEmpty()
&& !event.getWorld().containsAnyLiquid(mob.getEntityBoundingBox())){
//Allow the spawn
event.setResult(Result.ALLOW);
}
}
}
}
示例6: activateSkill
import net.minecraft.entity.monster.EntityMob; //導入依賴的package包/類
@Override
public int activateSkill(IWeaponSkillInfo info, EntityLivingBase attacker, ItemStack item, DamageSource source, EntityLivingBase opponent) {
//If you don't know about Earthbound, we can't be friends. Sorry, I don't make the rules.
DamageSource smaaaaaaash = new EntityDamageSource("weaponskill.smash", attacker);
opponent.attackEntityFrom(smaaaaaaash, 4f);
opponent.addPotionEffect( new PotionEffect(Potion.getPotionFromResourceLocation("minecraft:blindness"), 20*3, 2 ));
//Thermionics.LOG.info("SMAAAAAAASH WeaponSkill activated against entity {} at {},{},{}", opponent, opponent.posX, opponent.posY, opponent.posZ);
if (opponent instanceof EntityMob) {
EntityMob monster = (EntityMob)opponent;
monster.setAttackTarget(null);
monster.setRevengeTarget(null);
}
if (!attacker.world.isRemote) {
//Serverside, queue the effect
SpawnParticleEmitterMessage fx = new SpawnParticleEmitterMessage(Thermionics.CONTEXT, EnumWeaponSkill.SMAAAAAAASH, opponent);
fx.sendToAllWatching(opponent);
}
return 20*5;
}
示例7: getEntityColor
import net.minecraft.entity.monster.EntityMob; //導入依賴的package包/類
public Color getEntityColor() {
if ((entity instanceof EntityAnimal)) {
return Color.white;
}
if ((entity instanceof EntityMob)) {
return Color.red;
}
if ((entity instanceof EntitySlime)) {
return Color.green;
}
if ((entity instanceof EntityVillager)) {
return new Color(245, 245, 220);
}
if ((entity instanceof EntityBat)) {
return Color.BLACK;
}
if ((entity instanceof EntitySquid)) {
return Color.PINK;
}
return Color.white;
}
示例8: buffMobInAroundNemeses
import net.minecraft.entity.monster.EntityMob; //導入依賴的package包/類
private void buffMobInAroundNemeses(World world, EntityCreature entity) {
if (!(entity instanceof EntityMob)) {
return;
}
if (entity.getTags().contains(NemesisSystem.TAG_BUFF_MOB_REINFORCEMENT)) {
return;
}
List<NemesisEntry> nemeses = NemesisRegistryProvider.get(world).list();
sortByHighestLevel(nemeses);
for (NemesisEntry nemesis : nemeses) {
if (buffEntity(entity, nemesis)) {
return;
}
}
}
示例9: SpawnMob
import net.minecraft.entity.monster.EntityMob; //導入依賴的package包/類
public boolean SpawnMob(final EntityLiving t) {
if (t.getCanSpawnHere()) {
t.onSpawnWithEgg((IEntityLivingData)null);
if (t instanceof EntityMob) {
t.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 3600, 1));
t.addPotionEffect(new PotionEffect(Potion.damageBoost.id, 3600, 1));
}
else {
t.addPotionEffect(new PotionEffect(Potion.regeneration.id, 3600, 1));
}
t.getEntityData().setLong("CursedEarth", 3600L);
t.forceSpawn = true;
t.func_110163_bv();
return true;
}
return false;
}
示例10: beginSiege
import net.minecraft.entity.monster.EntityMob; //導入依賴的package包/類
public static void beginSiege(final World world) {
if (world.isRemote) {
return;
}
if (world.provider.dimensionId != 1) {
return;
}
for (int i = 0; i < world.loadedEntityList.size(); ++i) {
if (world.loadedEntityList.get(i) instanceof EntityMob) {
world.removeEntity((Entity)world.loadedEntityList.get(i));
}
else if (world.loadedEntityList.get(i) instanceof EntityPlayer) {
final EntityPlayer player = (EntityPlayer)world.loadedEntityList.get(i);
EventHandlerSiege.SiegeParticipants.add(player.getGameProfile().getName());
player.getEntityData().setInteger("SiegeKills", 0);
}
}
if (EventHandlerSiege.SiegeParticipants.size() != 0) {
MinecraftServer.getServer().getConfigurationManager().sendChatMsg((IChatComponent)new ChatComponentText("The Siege has begun in 'The End'"));
}
else {
endSiege(world, false);
}
}
示例11: SiegeCheckSpawn
import net.minecraft.entity.monster.EntityMob; //導入依賴的package包/類
@SubscribeEvent
public void SiegeCheckSpawn(final LivingSpawnEvent.CheckSpawn event) {
if (EventHandlerSiege.SiegeParticipants.isEmpty()) {
return;
}
if (event.entity.worldObj.isRemote) {
return;
}
if (event.world.provider.dimensionId != 1) {
return;
}
if (event.entityLiving instanceof EntityMob && event.entityLiving.worldObj.checkNoEntityCollision(event.entityLiving.boundingBox) && event.entityLiving.worldObj.getCollidingBoundingBoxes((Entity)event.entityLiving, event.entityLiving.boundingBox).isEmpty() && !event.entityLiving.worldObj.isAnyLiquid(event.entityLiving.boundingBox)) {
event.entityLiving.getEntityData().setBoolean("Siege", true);
event.entityLiving.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 7200, 2));
event.setResult(Event.Result.ALLOW);
}
}
示例12: noMobs
import net.minecraft.entity.monster.EntityMob; //導入依賴的package包/類
@SubscribeEvent
public void noMobs(final LivingSpawnEvent.CheckSpawn event) {
if (event.getResult() == Event.Result.DEFAULT && event.world.provider.dimensionId == ExtraUtils.underdarkDimID && event.entity instanceof EntityMob) {
if (EventHandlerUnderdark.rand.nextDouble() < Math.min(0.95, event.entity.posY / 80.0)) {
event.setResult(Event.Result.DENY);
}
else {
IAttributeInstance t = ((EntityMob)event.entity).getEntityAttribute(SharedMonsterAttributes.maxHealth);
t.setBaseValue(t.getBaseValue() * 2.0);
((EntityMob)event.entity).heal((float)t.getAttributeValue());
t = ((EntityMob)event.entity).getEntityAttribute(SharedMonsterAttributes.attackDamage);
t.setBaseValue(t.getBaseValue() * 2.0);
if (!EventHandlerServer.isInRangeOfTorch(event.entity) && event.entityLiving.worldObj.checkNoEntityCollision(event.entityLiving.boundingBox) && event.entityLiving.worldObj.getCollidingBoundingBoxes((Entity)event.entityLiving, event.entityLiving.boundingBox).isEmpty() && !event.entityLiving.worldObj.isAnyLiquid(event.entityLiving.boundingBox)) {
event.setResult(Event.Result.ALLOW);
}
}
}
}
示例13: isEntityValidToAttack
import net.minecraft.entity.monster.EntityMob; //導入依賴的package包/類
public boolean isEntityValidToAttack(EntityMinionWarrior minion, EntityLivingBase entity)
{
if(entity == minion || entity == minion.getRidingEntity() || !EntityAITarget.isSuitableTarget(minion, entity, false, false) || entity.getClass() == EntityCreeper.class) return false;
if (entity instanceof EntityMob &&
(getTargetBehavior() == EnumCombatBehaviors.TARGET_HOSTILE_MOBS ||
getTargetBehavior() == EnumCombatBehaviors.TARGET_PASSIVE_OR_HOSTILE_MOBS))
{
return true;
}
else if (entity instanceof EntityAnimal &&
(getTargetBehavior() == EnumCombatBehaviors.TARGET_PASSIVE_MOBS ||
getTargetBehavior() == EnumCombatBehaviors.TARGET_PASSIVE_OR_HOSTILE_MOBS))
{
return true;
}
else
{
return false;
}
}
示例14: EntitySlave
import net.minecraft.entity.monster.EntityMob; //導入依賴的package包/類
public EntitySlave(World p_i1688_1_)
{
super(p_i1688_1_);
this.setSize(0.8F, 1.6F);
this.getNavigator().setAvoidsWater(true);
this.tasks.addTask(1, new EntityAISwimming(this));
this.tasks.addTask(2, this.aiSit);
this.tasks.addTask(3, this.aiTempt = new EntityAITempt(this, 0.6D, Items.diamond, true));
this.tasks.addTask(4, new EntityAIFollowOwner(this, 1.0D, 10.0F, 5.0F));
this.tasks.addTask(5, new EntityAIAvoidEntity(this, EntityCreeper.class, 16.0F, 0.8D, 1.33D));
this.tasks.addTask(6, new EntityAILeapAtTarget(this, 0.3F));
this.tasks.addTask(7, new EntityAIOcelotAttack(this));
this.tasks.addTask(8, new EntityAIMate(this, 0.8D));
this.tasks.addTask(9, new EntityAIWander(this, 0.8D));
this.tasks.addTask(10, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));
this.targetTasks.addTask(1, new EntityAITargetNonTamed(this, EntityMob.class, 750, false));
this.setType(this.rand.nextInt(4));
this.setRandomStuff();
}
示例15: onEntityDrops
import net.minecraft.entity.monster.EntityMob; //導入依賴的package包/類
@SubscribeEvent
public void onEntityDrops(LivingDropsEvent event)
{
int alea;
if (event.entityLiving instanceof EntityMob)
alea = 20;
else
alea = 50;
if (event.entityLiving.worldObj.rand.nextInt(alea) < 1 + event.lootingLevel * 2)
{
EntityItem e;
e = new EntityItem(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, new ItemStack(ItemRegister.getRandomArmor(), 1));
e = new EntityItem(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, new ItemStack(ItemRegistry1.bagdrop, 1));
event.drops.add(e);
}
}