本文整理匯總了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);
}
}