本文整理汇总了Java中net.minecraft.entity.EntityAgeable.isChild方法的典型用法代码示例。如果您正苦于以下问题:Java EntityAgeable.isChild方法的具体用法?Java EntityAgeable.isChild怎么用?Java EntityAgeable.isChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.entity.EntityAgeable
的用法示例。
在下文中一共展示了EntityAgeable.isChild方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: work
import net.minecraft.entity.EntityAgeable; //导入方法依赖的package包/类
@Override
public float work() {
if (WorkUtils.isDisabled(this.getBlockType())) return 0;
AxisAlignedBB area = getWorkingArea();
List<EntityAgeable> animals = this.world.getEntitiesWithinAABB(EntityAgeable.class, area);
int totalFluidAdded = 0;
for (EntityAgeable animal : animals) {
int toFill = animal.isChild() ? BlockRegistry.animalByproductRecolectorBlock.getSewageBaby() : BlockRegistry.animalByproductRecolectorBlock.getSewageAdult();
tank.fill(new FluidStack(FluidsRegistry.SEWAGE, toFill), true);
totalFluidAdded += toFill;
if (totalFluidAdded > ((AnimalByproductRecolectorBlock) this.getBlockType()).getMaxSludgeOperation()) {
break;
}
}
return 1;
}
示例2: work
import net.minecraft.entity.EntityAgeable; //导入方法依赖的package包/类
@Override
public float work() {
if (WorkUtils.isDisabled(this.getBlockType())) return 0;
AxisAlignedBB area = getWorkingArea();
List<EntityAgeable> animals = this.world.getEntitiesWithinAABB(EntityAgeable.class, area);
if (animals.size() == 0) return 0;
EntityAgeable animal = animals.get(0);
while (animal.isChild() == this.hasAddon(AdultFilterAddonItem.class) && animals.indexOf(animal) + 1 < animals.size())
animal = animals.get(animals.indexOf(animal) + 1);
if (animal.isChild() == this.hasAddon(AdultFilterAddonItem.class)) return 0;
BlockPos pos = this.getPos().offset(this.getFacing(), 1);
animal.setPositionAndUpdate(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5);
return 1;
}
示例3: doTheZorroThing
import net.minecraft.entity.EntityAgeable; //导入方法依赖的package包/类
@SubscribeEvent
public void doTheZorroThing(EntityInteractEvent event) {
EntityPlayer player = event.entityPlayer;
if (player.worldObj.isRemote) return;
if (player.isRiding()) return;
if (!(event.target instanceof EntityHorse)) return;
EntityHorse horse = (EntityHorse) event.target;
if (player.fallDistance <= 2) return;
if (!horse.isHorseSaddled()) return;
if (horse.getLeashed()) {
if (!(horse.getLeashedToEntity() instanceof EntityLeashKnot)) return;
horse.getLeashedToEntity().interactFirst(player);
}
boolean awesome = false;
if (player.fallDistance > 5 && player.getHeldItem() != null) {
Item held = player.getHeldItem().getItem();
boolean has_baby = false;
if (player.riddenByEntity instanceof EntityAgeable) {
EntityAgeable ea = (EntityAgeable) player.riddenByEntity;
has_baby = ea.isChild();
}
awesome = held instanceof ItemSword || held instanceof ItemAxe || held instanceof ItemBow || player.riddenByEntity instanceof EntityPlayer || has_baby;
}
if (awesome) {
horse.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 20 * 40, 2, false, false));
horse.addPotionEffect(new PotionEffect(Potion.resistance.id, 20 * 40, 1, true, true));
horse.addPotionEffect(new PotionEffect(Potion.jump.id, 20 * 40, 1, true, true));
} else {
horse.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 20 * 8, 1, false, false));
}
horse.playLivingSound();
}
示例4: entitySpawnEgg
import net.minecraft.entity.EntityAgeable; //导入方法依赖的package包/类
public static void entitySpawnEgg(EntityPlayer entityPlayer, Entity target)
{
int entity_id = 0;
//DO NOT USE = target.getEntityId();. that is the runtime id, so each instance of EntityCow has its own RUNTIME id
//different than the class level id which we need here
if( target instanceof EntityHorse ||
target instanceof EntityWolf)
{
return;//these are Ageable, but disabled.
}
if(target instanceof EntitySquid)
{
entity_id = Reference.entity_squid;
}
else if(target instanceof EntityBat)
{
entity_id = Reference.entity_bat;
}
else if(target instanceof EntityAgeable )
{
EntityAgeable targ = (EntityAgeable) target;
//these guys all extend EntityAnimal extends EntityAgeable implements IAnimals
if(targ.isChild() == false)
{
if(target instanceof EntityCow )
{
entity_id = Reference.entity_cow;
}
if(target instanceof EntityPig )
{
entity_id = Reference.entity_pig;
}
if(target instanceof EntitySheep )
{
entity_id = Reference.entity_sheep;
}
if(target instanceof EntityChicken )
{
entity_id = Reference.entity_chicken;
}
if(target instanceof EntityMooshroom )
{
entity_id = Reference.entity_mooshroom;
}
if(target instanceof EntityRabbit )
{
entity_id = Reference.entity_rabbit;
}
}
}
if(entity_id > 0)
{
entityPlayer.swingItem();
entityPlayer.worldObj.removeEntity(target);
if(entityPlayer.worldObj.isRemote)
ModSpells.spawnParticle(entityPlayer.worldObj, EnumParticleTypes.VILLAGER_HAPPY, target.getPosition());
else
{
//TODO:
/*
ItemStack stack = new ItemStack(ItemRegistry.respawn_egg,1,entity_id);
if(target.hasCustomName())
stack.setStackDisplayName(target.getCustomNameTag());
entityPlayer.dropPlayerItemWithRandomChoice(stack,true);
*/
}
ModSpells.playSoundAt(entityPlayer, "mob.zombie.remedy");
//ModSpells.decrHeldStackSize(entityPlayer);
}
}