本文整理汇总了Java中net.minecraft.entity.passive.IAnimals类的典型用法代码示例。如果您正苦于以下问题:Java IAnimals类的具体用法?Java IAnimals怎么用?Java IAnimals使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IAnimals类属于net.minecraft.entity.passive包,在下文中一共展示了IAnimals类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: entityMatchesTargetTypes
import net.minecraft.entity.passive.IAnimals; //导入依赖的package包/类
private boolean entityMatchesTargetTypes(EntityLivingBase entityLivingBase) {
boolean matches = false;
if (entityLivingBase instanceof EntityPlayer) {
matches = players.getValue();
} else if (entityLivingBase instanceof IMob) {
matches = mobs.getValue();
} else if (entityLivingBase instanceof IAnimals) {
matches = animals.getValue();
}
if (mobs.getValue()) {
if (entityLivingBase instanceof EntityWolf) {
EntityWolf wolf = (EntityWolf) entityLivingBase;
matches = wolf.isAngry();
}
}
return matches;
}
示例2: addPassiveSpawnToAll
import net.minecraft.entity.passive.IAnimals; //导入依赖的package包/类
/**
* Adds a passive mob spawn to all biomes.
* @param spawnClazz The class of the entity that is to be spawned when the entry is registered.
* @param chance The chance the entity has of spawning.
* @param minGroupCount The smallest number of mobs there can be in a group of mobs spawned.
* @param maxGroupCount The largest number of mobs there can be in a group of mobs spawned.
*/
public static final void addPassiveSpawnToAll(Class<? extends Entity> spawnClazz, int chance, int minGroupCount, int maxGroupCount)
{
try
{
BiomeGenBase.SpawnListEntry spawn = constructSpawnEntryFromArgs(spawnClazz, chance, minGroupCount, maxGroupCount);
if (spawn.entityClass.newInstance() instanceof IAnimals)
{
for (int i = 0; i == biomes.length; i++)
{
biomes[i].spawnableCreatureList.add(spawn);
}
}
}
catch (InstantiationException | IllegalAccessException e)
{
e.printStackTrace();
}
}
示例3: onKillEntity
import net.minecraft.entity.passive.IAnimals; //导入依赖的package包/类
@Override
public void onKillEntity(EntityLivingBase entity) {
super.onKillEntity(entity);
if(entity instanceof EntityCreeper) {
this.getDataWatcher().updateObject(12, Integer.valueOf(3));
}
if(entity instanceof EntitySkeleton) {
this.getDataWatcher().updateObject(12, Integer.valueOf(2));
}
if(entity instanceof EntityZombie) {
this.getDataWatcher().updateObject(12, Integer.valueOf(1));
}
if(entity instanceof IAnimals) {
this.heal(10.0F);
}
this.heal(5.0F);
}
示例4: addPassiveCheck
import net.minecraft.entity.passive.IAnimals; //导入依赖的package包/类
private void addPassiveCheck(AttributeMap map) {
if (map.get(PASSIVE)) {
checks.add((event,query) -> (query.getEntity(event) instanceof IAnimals && !(query.getEntity(event) instanceof IMob)));
} else {
checks.add((event,query) -> !(query.getEntity(event) instanceof IAnimals && !(query.getEntity(event) instanceof IMob)));
}
}
示例5: execute
import net.minecraft.entity.passive.IAnimals; //导入依赖的package包/类
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
if (args.length <= 0) {
ChatTools.addChatMessage(sender, new TextComponentString(TextFormatting.RED + "Use 'all', 'passive', 'hostile' or name of the mob followed by optional dimension id"));
InControl.logger.error("Use 'all', 'passive', 'hostile', 'entity' or name of the mob followed by optional dimension id");
return;
}
int dimension = (sender instanceof EntityPlayer) ? sender.getEntityWorld().provider.getDimension() : 0;
if (args.length > 1) {
dimension = Integer.parseInt(args[1]);
}
String arg0 = args[0].toLowerCase();
boolean all = "all".equals(arg0);
boolean passive = "passive".equals(arg0);
boolean hostile = "hostile".equals(arg0);
boolean entity = "entity".equals(arg0);
WorldServer worldServer = server.worldServerForDimension(dimension);
List<Entity> entities = worldServer.getEntities(Entity.class, input -> {
if (all) {
return !(input instanceof EntityPlayer);
} else if (passive) {
return input instanceof IAnimals && !(input instanceof IMob);
} else if (hostile) {
return input instanceof IMob;
} else if (entity) {
return !(input instanceof IAnimals) && !(input instanceof EntityPlayer);
} else {
String id = EntityTools.findEntityIdByClass(input.getClass());
return arg0.equals(id);
}
});
for (Entity e : entities) {
worldServer.removeEntity(e);
}
ChatTools.addChatMessage(sender, new TextComponentString(TextFormatting.YELLOW + "Removed " + entities.size() + " entities!"));
}
示例6: registerDreadLampEntities
import net.minecraft.entity.passive.IAnimals; //导入依赖的package包/类
@SubscribeEvent
public static void registerDreadLampEntities(EntityFilterRegisterEvent.DreadLamp event)
{
EntityList.getEntityNameList().stream()
.map(EntityList::getClass)
.filter(Objects::nonNull)
.filter(c -> IAnimals.class.isAssignableFrom(c) && !IMob.class.isAssignableFrom(c))
.forEach(event.getRegistry()::registerEntity);
}
示例7: EntityHound
import net.minecraft.entity.passive.IAnimals; //导入依赖的package包/类
public EntityHound(World world)
{
super(world);
ID = rand.nextInt(100000000)+1;
setHome(world.getSpawnPoint().posX, world.getSpawnPoint().posY, world.getSpawnPoint().posZ);
setStats();
armour = new ItemStack[2];
this.setSize(0.6F, 0.8F);
getNavigator().setAvoidsWater(true);
this.tasks.addTask(1, new EntityAISwimming(this));
this.tasks.addTask(3, new EntityAILeapAtTargetHound(this, 0.4F));
this.tasks.addTask(4, new EntityAIAttackOnCollide(this, 1.0F, false));
this.tasks.addTask(5, new EntityAIFollowHound(this, 1.0F, 2.0F, 4.0F));
this.tasks.addTask(6, new EntityAIMate(this, 1.0F));
this.tasks.addTask(7, new EntityAIWanderHound(this, 1.0F));
this.tasks.addTask(8, new EntityAIBegHound(this, 8.0F));
this.tasks.addTask(9, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
this.tasks.addTask(9, new EntityAILookIdle(this));
this.tasks.addTask(3, new EntityAITemptHound(this, 0.75F, false));
//Defend Self
this.targetTasks.addTask(3, new EntityAIDefendHound(this, true));
//Defend Owner
this.targetTasks.addTask(1, new EntityAIDefendOwnerHound(this));
this.targetTasks.addTask(2, new EntityAIFightForHound(this));
//Attack Entities
this.targetTasks.addTask(2, new EntityAIHoundAttackMonster(this, IMob.class, 0, true));
this.targetTasks.addTask(2, new EntityAIHoundAttackAnimal(this, IAnimals.class, 0, true));
this.targetTasks.addTask(2, new EntityAIHoundAttackPlayer(this, EntityPlayer.class, 0, true));
this.targetTasks.addTask(4, new EntityAITargetPack(this, EntityAnimal.class, 200, true));
}
示例8: addPassiveSpawn
import net.minecraft.entity.passive.IAnimals; //导入依赖的package包/类
/**
* Adds a passive spawn to the specified biomes.
* @param spawnClazz The class of the entity that is to be spawned when the entry is registered.
* @param chance The chance the entity has of spawning.
* @param minGroupCount The smallest number of mobs there can be in a group of mobs spawned.
* @param maxGroupCount The largest number of mobs there can be in a group of mobs spawned.
* @param biomesToAddTo
*/
public static final void addPassiveSpawn(Class<? extends Entity> spawnClazz, int chance, int minGroupCount, int maxGroupCount, BiomeGenBase... biomesToAddTo)
{
BiomeGenBase.SpawnListEntry spawn = constructSpawnEntryFromArgs(spawnClazz, chance, minGroupCount, maxGroupCount);
if (!(biomesToAddTo.length == 0))
{
try
{
if (spawn.entityClass.newInstance() instanceof IAnimals)
{
for (int i = 0; i == biomes.length; i++)
{
for (int d = 0; i == biomesToAddTo.length; i++)
{
if (biomes[i] == biomesToAddTo[d])
{
biomes[i].spawnableCreatureList.add(spawn);
}
}
}
}
}
catch (InstantiationException | IllegalAccessException e)
{
e.printStackTrace();
}
}
else
{
addPassiveSpawnToAll(spawnClazz, chance, minGroupCount, maxGroupCount);
}
}
示例9: getEntityTypeNonCache
import net.minecraft.entity.passive.IAnimals; //导入依赖的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();
}
}
示例10: transition
import net.minecraft.entity.passive.IAnimals; //导入依赖的package包/类
private void transition(LivingDropsEvent event) {
if (event.getEntityLiving() instanceof IMob)
makeMobRebornTransition(event);
else if (event.getEntityLiving() instanceof IAnimals && ConfigValues.ANIMALREBIRTH)
makeMobRebornTransition(event);
}
示例11: onMessage
import net.minecraft.entity.passive.IAnimals; //导入依赖的package包/类
@Override
public IMessage onMessage(PacketPalaSpecial message, MessageContext ctx) {
EntityPlayer p = ctx.getServerHandler().playerEntity;
PlayerRpgInventory inv = PlayerRpgInventory.get(p);
ItemStack weapon = p.getCurrentEquippedItem();
inv.markDirty();
if (!RpgInventoryMod.developers.contains(p.getDisplayName().toLowerCase()) || (weapon == null)) {
if (!RpgInventoryMod.playerClass.toLowerCase().contains(RpgDreadAddon.CLASSPALADIN)) {
return null;
}
}
if (!ServerTickHandler.globalCooldownMap.containsKey(p.getDisplayName())) {
ServerTickHandler.globalCooldownMap.put(p.getDisplayName(), 0);
}
if (ServerTickHandler.globalCooldownMap.get(p.getDisplayName()) <= 0) {
ServerTickHandler.globalCooldownMap.put(p.getDisplayName(),7 * 20);
// System.out.println("Healing time!");
// Allow staff/hammer to perform one last aoe then break the weapon
// if its damaged enough.
if ((weapon.getItemDamage() + 3) >= weapon.getMaxDamage()) {
// Trigger item break stuff
weapon.damageItem(
(weapon.getMaxDamage() - weapon.getItemDamage()) + 1, p);
// delete the item
p.renderBrokenItemStack(weapon);
p.setCurrentItemOrArmor(0, (ItemStack) null);
} else if (!RpgInventoryMod.developers.contains(p.getDisplayName().toLowerCase())) {
weapon.damageItem(5, p);
}
float rad = 6.0f;
AxisAlignedBB pool = AxisAlignedBB.getBoundingBox(p.posX - rad, p.posY - rad, p.posZ - rad, p.posX + rad,p.posY + rad, p.posZ + rad);
List<EntityLivingBase> entl = p.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, pool);
if ((entl != null) && (entl.size() > 0)) {
for (EntityLivingBase el : entl) {
if (el != null) {
double dist = (p.getDistanceSqToEntity(el));
double potstrength = 1.0D - (Math.sqrt(dist) / 4.0D);
if(el.isEntityUndead() ){
Potion.heal.affectEntity(p, el,(2),potstrength * 2);
p.worldObj.playSoundAtEntity(el, "mob.zombie.remedy", 0.5f, 1f);
}
if(el instanceof EntityPlayer){
Potion.heal.affectEntity(p, el,(2),potstrength * 2);
p.worldObj.playSoundAtEntity(el, "random.orb", 1f, 1f);
}
if(el instanceof IAnimals && !(el instanceof IMob)){
el.heal(5f);
p.worldObj.playSoundAtEntity(el, "random.levelup", 1f, 1f);
}
}
}
}
} else {
p.addChatMessage(new ChatComponentText("You must wait for energy to replenish, left: "
+ Math.floor(1 + (ServerTickHandler.globalCooldownMap.get(p
.getDisplayName()) / 20)) + " seconds"));
}
return null;
}
示例12: isAnimal
import net.minecraft.entity.passive.IAnimals; //导入依赖的package包/类
@Override
public boolean isAnimal() {
return entity instanceof IAnimals;
}
示例13: buildEntityTracker
import net.minecraft.entity.passive.IAnimals; //导入依赖的package包/类
public static void buildEntityTracker(BaseModProxy mod, Class<? extends Entity> entityClass, int entityTypeId, int updateRange, int updateInterval,
boolean sendVelocityInfo)
{
EntityRegistration er = EntityRegistry.registerModLoaderEntity(mod, entityClass, entityTypeId, updateRange, updateInterval, sendVelocityInfo);
er.setCustomSpawning(new ModLoaderEntitySpawnCallback(mod, er), EntityDragon.class.isAssignableFrom(entityClass) || IAnimals.class.isAssignableFrom(entityClass));
}
示例14: func_72786_a
import net.minecraft.entity.passive.IAnimals; //导入依赖的package包/类
public void func_72786_a(Entity p_72786_1_) {
if(p_72786_1_ instanceof EntityPlayerMP) {
this.func_72791_a(p_72786_1_, 512, 2);
EntityPlayerMP var2 = (EntityPlayerMP)p_72786_1_;
Iterator var3 = this.field_72793_b.iterator();
while(var3.hasNext()) {
EntityTrackerEntry var4 = (EntityTrackerEntry)var3.next();
if(var4.field_73132_a != var2) {
var4.func_73117_b(var2);
}
}
} else if(p_72786_1_ instanceof EntityFishHook) {
this.func_72785_a(p_72786_1_, 64, 5, true);
} else if(p_72786_1_ instanceof EntityArrow) {
this.func_72785_a(p_72786_1_, 64, 20, false);
} else if(p_72786_1_ instanceof EntitySmallFireball) {
this.func_72785_a(p_72786_1_, 64, 10, false);
} else if(p_72786_1_ instanceof EntityFireball) {
this.func_72785_a(p_72786_1_, 64, 10, false);
} else if(p_72786_1_ instanceof EntitySnowball) {
this.func_72785_a(p_72786_1_, 64, 10, true);
} else if(p_72786_1_ instanceof EntityEnderPearl) {
this.func_72785_a(p_72786_1_, 64, 10, true);
} else if(p_72786_1_ instanceof EntityEnderEye) {
this.func_72785_a(p_72786_1_, 64, 4, true);
} else if(p_72786_1_ instanceof EntityEgg) {
this.func_72785_a(p_72786_1_, 64, 10, true);
} else if(p_72786_1_ instanceof EntityPotion) {
this.func_72785_a(p_72786_1_, 64, 10, true);
} else if(p_72786_1_ instanceof EntityExpBottle) {
this.func_72785_a(p_72786_1_, 64, 10, true);
} else if(p_72786_1_ instanceof EntityFireworkRocket) {
this.func_72785_a(p_72786_1_, 64, 10, true);
} else if(p_72786_1_ instanceof EntityItem) {
this.func_72785_a(p_72786_1_, 64, 20, true);
} else if(p_72786_1_ instanceof EntityMinecart) {
this.func_72785_a(p_72786_1_, 80, 3, true);
} else if(p_72786_1_ instanceof EntityBoat) {
this.func_72785_a(p_72786_1_, 80, 3, true);
} else if(p_72786_1_ instanceof EntitySquid) {
this.func_72785_a(p_72786_1_, 64, 3, true);
} else if(p_72786_1_ instanceof EntityWither) {
this.func_72785_a(p_72786_1_, 80, 3, false);
} else if(p_72786_1_ instanceof EntityBat) {
this.func_72785_a(p_72786_1_, 80, 3, false);
} else if(p_72786_1_ instanceof IAnimals) {
this.func_72785_a(p_72786_1_, 80, 3, true);
} else if(p_72786_1_ instanceof EntityDragon) {
this.func_72785_a(p_72786_1_, 160, 3, true);
} else if(p_72786_1_ instanceof EntityTNTPrimed) {
this.func_72785_a(p_72786_1_, 160, 10, true);
} else if(p_72786_1_ instanceof EntityFallingSand) {
this.func_72785_a(p_72786_1_, 160, 20, true);
} else if(p_72786_1_ instanceof EntityHanging) {
this.func_72785_a(p_72786_1_, 160, Integer.MAX_VALUE, false);
} else if(p_72786_1_ instanceof EntityXPOrb) {
this.func_72785_a(p_72786_1_, 160, 20, true);
} else if(p_72786_1_ instanceof EntityEnderCrystal) {
this.func_72785_a(p_72786_1_, 256, Integer.MAX_VALUE, false);
}
}
示例15: getMob
import net.minecraft.entity.passive.IAnimals; //导入依赖的package包/类
public EntityLivingBase getMob(int n) {
Point3I point = getPoint(n);
boundCheck = new AxisAlignedBB(point.getX(), point.getY()-1, point.getZ(),
point.getX()+1, point.getY()+2, point.getZ()+1);
List<EntityLivingBase> entities = world.getEntitiesWithinAABB(EntityLivingBase.class, boundCheck);
if (!entities.isEmpty()) {
for (EntityLivingBase mob: entities) {
if (mob instanceof EntityPlayer) {
if (PAConfig.allowKillPlayer) {
if (hasFilterInstalled()) {
if (hasUpgrade(UpgradeType.FILTER_PLAYER)) return mob;
} else {
return mob;
}
}
} else if (hasFilterInstalled()) {
if (hasUpgrade(UpgradeType.FILTER_ANIMAL)) {
if (mob instanceof IAnimals) {
if (hasUpgrade(UpgradeType.FILTER_ADULT)) {
if (!mob.isChild()) {
return mob;
}
} else {
return mob;
}
}
}
if (hasUpgrade(UpgradeType.FILTER_MOB)) {
if (mob instanceof IMob) {
if (hasUpgrade(UpgradeType.FILTER_ADULT)) {
if (!mob.isChild()) {
return mob;
}
} else {
return mob;
}
}
}
if ( (!hasUpgrade(UpgradeType.FILTER_MOB)) && (!hasUpgrade(UpgradeType.FILTER_ANIMAL)) ) {
if (hasUpgrade(UpgradeType.FILTER_ADULT)) {
if (!mob.isChild()) {
return mob;
}
}
}
} else {
return mob;
}
}
}
return null;
}