本文整理汇总了Java中net.minecraft.entity.EntityCreature类的典型用法代码示例。如果您正苦于以下问题:Java EntityCreature类的具体用法?Java EntityCreature怎么用?Java EntityCreature使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EntityCreature类属于net.minecraft.entity包,在下文中一共展示了EntityCreature类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initializeEntityActivationType
import net.minecraft.entity.EntityCreature; //导入依赖的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: onDrops
import net.minecraft.entity.EntityCreature; //导入依赖的package包/类
@SubscribeEvent
public void onDrops(LivingDropsEvent event) {
World world = event.getEntity().getEntityWorld();
if (world.isRemote || !(event.getEntity() instanceof EntityCreature)) {
return;
}
if (event.getSource() == null || event.getSource().getTrueSource() == null){
return;
}
if (!(event.getSource().getTrueSource() instanceof EntityPlayer)) {
return;
}
if (event.getEntity().getTags().contains(NemesisSystem.TAG_NEMESIS)) {
handleNemesisDrops(event.getDrops(), (EntityCreature) event.getEntity());
}
}
示例3: buffMobInAroundNemeses
import net.minecraft.entity.EntityCreature; //导入依赖的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;
}
}
}
示例4: handleNemesisDeath
import net.minecraft.entity.EntityCreature; //导入依赖的package包/类
private static void handleNemesisDeath(EntityCreature nemesisEntity, Entity attacker) {
NemesisEntry nemesis = NemesisUtil.loadNemesisFromEntity(nemesisEntity);
if (nemesis == null) {
return;
}
if (attacker == null || !(attacker instanceof EntityLivingBase)) {
return;
}
NemesisActions.demote(nemesisEntity.world, nemesis, attacker.getName());
NemesisUtil.findNemesisBodyGuards(nemesisEntity.world, nemesis.getId(), nemesisEntity.getPosition())
.forEach((EntityCreature guard) -> {
guard.setAttackTarget(null);
guard.getTags().add(TAG_RONIN);
});
}
示例5: EntityAIFindEntityNearest
import net.minecraft.entity.EntityCreature; //导入依赖的package包/类
public EntityAIFindEntityNearest(EntityLiving p_i45884_1_, Class <? extends EntityLivingBase > p_i45884_2_)
{
this.field_179442_b = p_i45884_1_;
this.field_179439_f = p_i45884_2_;
if (p_i45884_1_ instanceof EntityCreature)
{
field_179444_a.warn("Use NearestAttackableTargetGoal.class for PathfinerMob mobs!");
}
this.field_179443_c = new Predicate<EntityLivingBase>()
{
public boolean apply(EntityLivingBase p_apply_1_)
{
double d0 = EntityAIFindEntityNearest.this.func_179438_f();
if (p_apply_1_.isSneaking())
{
d0 *= 0.800000011920929D;
}
return p_apply_1_.isInvisible() ? false : ((double)p_apply_1_.getDistanceToEntity(EntityAIFindEntityNearest.this.field_179442_b) > d0 ? false : EntityAITarget.isSuitableTarget(EntityAIFindEntityNearest.this.field_179442_b, p_apply_1_, false, true));
}
};
this.field_179440_d = new EntityAINearestAttackableTarget.Sorter(p_i45884_1_);
}
示例6: onDeath
import net.minecraft.entity.EntityCreature; //导入依赖的package包/类
@SubscribeEvent
public void onDeath(LivingDeathEvent event) {
World world = event.getEntity().getEntityWorld();
if (world.isRemote) {
return;
}
Entity slayer = event.getSource().getTrueSource();
if (event.getEntity() instanceof EntityPlayer && slayer instanceof EntityCreature) {
handlePlayerDeath((EntityPlayer) event.getEntity(), (EntityCreature) slayer);
return;
}
if (!(event.getEntity() instanceof EntityCreature)) {
return;
}
if (event.getEntity().getTags().contains(NemesisSystem.TAG_NEMESIS)) {
handleNemesisDeath((EntityCreature) event.getEntity(), slayer);
}
}
示例7: alertOthers
import net.minecraft.entity.EntityCreature; //导入依赖的package包/类
protected void alertOthers()
{
double d0 = this.getTargetDistance();
for (EntityCreature entitycreature : this.taskOwner.worldObj.getEntitiesWithinAABB(this.taskOwner.getClass(), (new AxisAlignedBB(this.taskOwner.posX, this.taskOwner.posY, this.taskOwner.posZ, this.taskOwner.posX + 1.0D, this.taskOwner.posY + 1.0D, this.taskOwner.posZ + 1.0D)).expand(d0, 10.0D, d0)))
{
if (this.taskOwner != entitycreature && entitycreature.getAttackTarget() == null && (!(this.taskOwner instanceof EntityTameable) || ((EntityTameable)this.taskOwner).getOwner() == ((EntityTameable)entitycreature).getOwner()) && !entitycreature.isOnSameTeam(this.taskOwner.getAITarget()))
{
boolean flag = false;
for (Class<?> oclass : this.targetClasses)
{
if (entitycreature.getClass() == oclass)
{
flag = true;
break;
}
}
if (!flag)
{
this.setEntityAttackTarget(entitycreature, this.taskOwner.getAITarget());
}
}
}
}
示例8: EntityAIFindEntityNearest
import net.minecraft.entity.EntityCreature; //导入依赖的package包/类
public EntityAIFindEntityNearest(EntityLiving mobIn, Class <? extends EntityLivingBase > p_i45884_2_)
{
this.mob = mobIn;
this.classToCheck = p_i45884_2_;
if (mobIn instanceof EntityCreature)
{
LOGGER.warn("Use NearestAttackableTargetGoal.class for PathfinerMob mobs!");
}
this.predicate = new Predicate<EntityLivingBase>()
{
public boolean apply(@Nullable EntityLivingBase p_apply_1_)
{
double d0 = EntityAIFindEntityNearest.this.getFollowRange();
if (p_apply_1_.isSneaking())
{
d0 *= 0.800000011920929D;
}
return p_apply_1_.isInvisible() ? false : ((double)p_apply_1_.getDistanceToEntity(EntityAIFindEntityNearest.this.mob) > d0 ? false : EntityAITarget.isSuitableTarget(EntityAIFindEntityNearest.this.mob, p_apply_1_, false, true));
}
};
this.sorter = new EntityAINearestAttackableTarget.Sorter(mobIn);
}
示例9: EntityAIMoveThroughVillage
import net.minecraft.entity.EntityCreature; //导入依赖的package包/类
public EntityAIMoveThroughVillage(EntityCreature theEntityIn, double movementSpeedIn, boolean isNocturnalIn)
{
this.theEntity = theEntityIn;
this.movementSpeed = movementSpeedIn;
this.isNocturnal = isNocturnalIn;
this.setMutexBits(1);
if (!(theEntityIn.getNavigator() instanceof PathNavigateGround))
{
throw new IllegalArgumentException("Unsupported mob for MoveThroughVillageGoal");
}
}
示例10: EntityAIMoveToBlock
import net.minecraft.entity.EntityCreature; //导入依赖的package包/类
public EntityAIMoveToBlock(EntityCreature creature, double speedIn, int length)
{
this.theEntity = creature;
this.movementSpeed = speedIn;
this.searchLength = length;
this.setMutexBits(5);
}
示例11: onAttacked
import net.minecraft.entity.EntityCreature; //导入依赖的package包/类
@SubscribeEvent
public void onAttacked(LivingHurtEvent event) {
World world = event.getEntity().getEntityWorld();
if (world.isRemote || !(event.getEntity() instanceof EntityCreature)) {
return;
}
if (event.getEntity().getTags().contains(NemesisSystem.TAG_NEMESIS)) {
orderGuardsToAttackAggressor((EntityCreature) event.getEntity(), event.getSource().getTrueSource());
}
}
示例12: EntityAIWander
import net.minecraft.entity.EntityCreature; //导入依赖的package包/类
public EntityAIWander(EntityCreature creatureIn, double speedIn, int chance)
{
this.entity = creatureIn;
this.speed = speedIn;
this.executionChance = chance;
this.setMutexBits(1);
}
示例13: setTarget
import net.minecraft.entity.EntityCreature; //导入依赖的package包/类
public void setTarget(LivingEntity target) {
EntityCreature entity = getHandle();
if (target == null) {
entity.entityToAttack = null;
} else if (target instanceof CraftLivingEntity) {
entity.entityToAttack = ((CraftLivingEntity) target).getHandle();
entity.pathToEntity = entity.worldObj.getPathEntityToEntity(entity, entity.entityToAttack, 16.0F, true, false, false, true);
}
}
示例14: EntityAIAttackMelee
import net.minecraft.entity.EntityCreature; //导入依赖的package包/类
public EntityAIAttackMelee(EntityCreature creature, double speedIn, boolean useLongMemory)
{
this.attacker = creature;
this.worldObj = creature.worldObj;
this.speedTowardsTarget = speedIn;
this.longMemory = useLongMemory;
this.setMutexBits(3);
}
示例15: EntityAIFleeSun
import net.minecraft.entity.EntityCreature; //导入依赖的package包/类
public EntityAIFleeSun(EntityCreature theCreatureIn, double movementSpeedIn)
{
this.theCreature = theCreatureIn;
this.movementSpeed = movementSpeedIn;
this.theWorld = theCreatureIn.worldObj;
this.setMutexBits(1);
}