本文整理汇总了Java中net.minecraft.entity.passive.EntityWaterMob类的典型用法代码示例。如果您正苦于以下问题:Java EntityWaterMob类的具体用法?Java EntityWaterMob怎么用?Java EntityWaterMob使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EntityWaterMob类属于net.minecraft.entity.passive包,在下文中一共展示了EntityWaterMob类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: canCreatureTypeSpawnAtLocation
import net.minecraft.entity.passive.EntityWaterMob; //导入依赖的package包/类
/**
* Returns whether or not the specified creature type can spawn at the specified location.
*/
public static boolean canCreatureTypeSpawnAtLocation(EnumCreatureType creatureType, World world, BlockPos pos) {
Block block = world.getBlockState(pos).getBlock();
Block belowblock = world.getBlockState(pos.down(1)).getBlock();
Block aboveblock = world.getBlockState(pos.up(1)).getBlock();
if (creatureType.getCreatureClass() == EntityWaterMob.class) {
return block.getMaterial().isLiquid() && belowblock.getMaterial().isLiquid() && !aboveblock.isNormalCube();
}
boolean spawnBlock = block != null && canCreatureSpawn(belowblock, world, pos.down(1), SpawnPlacementType.ON_GROUND);
//System.out.println("tests: " + spawnBlock);
return spawnBlock && block != Blocks.bedrock &&
!block.isNormalCube() &&
!block.getMaterial().isLiquid() &&
!aboveblock.isNormalCube();
}
示例2: matches
import net.minecraft.entity.passive.EntityWaterMob; //导入依赖的package包/类
@Override
protected boolean matches(EntityLivingBase entity) {
if (type == BOSS) return !entity.isNonBoss();
else if (!entity.isNonBoss()) return false;
switch (type) {
case ANIMAL: return entity instanceof EntityAnimal;
case MONSTER: return entity instanceof IMob;
case TAMEABLE: return entity instanceof IEntityOwnable;
case PLAYER: return entity instanceof EntityPlayer;
case WATER: return entity instanceof EntityWaterMob || entity instanceof EntityGuardian;
case NPC: return entity instanceof INpc;
case GOLEM: return entity instanceof EntityGolem;
default: return false;
}
}
示例3: getCreatureType
import net.minecraft.entity.passive.EntityWaterMob; //导入依赖的package包/类
private static EnumCreatureType getCreatureType(EntityLiving entity)
{
Class<? extends EntityLiving> entityClass = entity.getClass();
if (IMob.class.isAssignableFrom(entityClass))
{
return EnumCreatureType.MONSTER;
}
else if (EntityAnimal.class.isAssignableFrom(entityClass))
{
return EnumCreatureType.CREATURE;
}
else if (EntityAmbientCreature.class.isAssignableFrom(entityClass))
{
return EnumCreatureType.AMBIENT;
}
else if (EntityWaterMob.class.isAssignableFrom(entityClass))
{
return EnumCreatureType.WATER_CREATURE;
}
else
{
return null;
}
}
示例4: updateEntityWithOptionalForce
import net.minecraft.entity.passive.EntityWaterMob; //导入依赖的package包/类
/**
* Will update the entity in the world if the chunk the entity is in is currently loaded or its forced to update.
* Args: entity, forceUpdate
*/
public void updateEntityWithOptionalForce(Entity entityIn, boolean forceUpdate)
{
if (!this.canSpawnAnimals() && (entityIn instanceof EntityAnimal || entityIn instanceof EntityWaterMob))
{
entityIn.setDead();
}
if (!this.canSpawnNPCs() && entityIn instanceof INpc)
{
entityIn.setDead();
}
super.updateEntityWithOptionalForce(entityIn, forceUpdate);
}
示例5: instanceOf
import net.minecraft.entity.passive.EntityWaterMob; //导入依赖的package包/类
public boolean instanceOf(EntityType e) {
// Generic types and players
if (e.equals(EntityType.ENTITY_PLAYER_SP)) {
return entity instanceof EntityPlayerSP;
} else if (e.equals(EntityType.ENTITY_PLAYER)) {
return entity instanceof EntityPlayer;
} else if (e.equals(EntityType.ENTITY_LIVING_BASE)) {
return entity instanceof EntityLivingBase;
} else if (e.equals(EntityType.ENTITY_LIVING)) {
return entity instanceof EntityLiving;
}
// Mobs
if (e.equals(EntityType.ENTITY_WOLF)) {
return entity instanceof EntityWolf;
} else if (e.equals(EntityType.Entity_Ageable)) {
return entity instanceof EntityAgeable;
} else if (e.equals(EntityType.EntityAmbientCreature)) {
return entity instanceof EntityAmbientCreature;
} else if (e.equals(EntityType.EntityWaterMob)) {
return entity instanceof EntityWaterMob;
} else if (e.equals(EntityType.EntityMob)) {
return entity instanceof EntityMob;
} else if (e.equals(EntityType.EntitySlime)) {
return entity instanceof EntitySlime;
} else if (e.equals(EntityType.EntityFlying)) {
return entity instanceof EntityFlying;
} else if (e.equals(EntityType.EntityGolem)) {
return entity instanceof EntityGolem;
} else if (e.equals(EntityType.ENTITY_SPIDER)) {
return entity instanceof EntitySpider;
} else if (e.equals(EntityType.ENTITY_SPIDER)) {
return entity instanceof EntitySpider;
} else if (e.equals(EntityType.ENTITY_ZOMBIE_PIGMAN)) {
return entity instanceof EntityZombie;
} else if (e.equals(EntityType.ENTITY_ENDERMAN)) {
return entity instanceof EntityEnderman;
}
return false;
}
示例6: updateEntityWithOptionalForce
import net.minecraft.entity.passive.EntityWaterMob; //导入依赖的package包/类
/**
* Updates the entity in the world if the chunk the entity is in is currently loaded or its forced to update.
*/
public void updateEntityWithOptionalForce(Entity entityIn, boolean forceUpdate)
{
if (!this.canSpawnAnimals() && (entityIn instanceof EntityAnimal || entityIn instanceof EntityWaterMob))
{
entityIn.setDead();
}
if (!this.canSpawnNPCs() && entityIn instanceof INpc)
{
entityIn.setDead();
}
super.updateEntityWithOptionalForce(entityIn, forceUpdate);
}
示例7: updateEntityWithOptionalForce
import net.minecraft.entity.passive.EntityWaterMob; //导入依赖的package包/类
/**
* Will update the entity in the world if the chunk the entity is in is
* currently loaded or its forced to update. Args: entity, forceUpdate
*/
public void updateEntityWithOptionalForce(Entity entity, boolean forceUpdate) {
if (!this.mcServer.getCanSpawnAnimals()
&& (entity instanceof EntityAnimal || entity instanceof EntityWaterMob)) {
entity.setDead();
}
if (!this.mcServer.getCanSpawnNPCs() && entity instanceof INpc) {
entity.setDead();
}
super.updateEntityWithOptionalForce(entity, forceUpdate);
}
示例8: updateEntityWithOptionalForce
import net.minecraft.entity.passive.EntityWaterMob; //导入依赖的package包/类
/**
* Will update the entity in the world if the chunk the entity is in is currently loaded or its forced to update.
* Args: entity, forceUpdate
*/
public void updateEntityWithOptionalForce(Entity par1Entity, boolean par2)
{
if (!this.mcServer.getCanSpawnAnimals() && (par1Entity instanceof EntityAnimal || par1Entity instanceof EntityWaterMob))
{
par1Entity.setDead();
}
if (!this.mcServer.getCanSpawnNPCs() && par1Entity instanceof INpc)
{
par1Entity.setDead();
}
super.updateEntityWithOptionalForce(par1Entity, par2);
}
示例9: applyMobPersistence
import net.minecraft.entity.passive.EntityWaterMob; //导入依赖的package包/类
/**
* Adds the persistenceRequired flag to entities, if they need it in order to not despawn.
* The checks are probably at most accurate for vanilla entities.
* @param livingBase
* @return
*/
public static boolean applyMobPersistence(EntityLiving living)
{
if (living.isNoDespawnRequired() == false)
{
boolean canDespawn = ((living instanceof EntityMob) && living.isNonBoss()) ||
(living instanceof EntityWaterMob) ||
((living instanceof EntityTameable) && ((EntityTameable)living).isTamed() == false);
if (canDespawn == false)
{
try
{
canDespawn = (boolean) methodHandle_EntityLiving_canDespawn.invokeExact(living);
}
catch (Throwable t)
{
EnderUtilities.logger.warn("Error while trying to invoke EntityLiving.canDespawn() on entity '{}' via a MethodHandle", living, t);
}
}
if (canDespawn)
{
// Sets the persistenceRequired boolean
living.enablePersistence();
living.getEntityWorld().playSound(null, living.getPosition(), Sounds.JAILER, SoundCategory.MASTER, 0.8f, 1.2f);
return true;
}
}
return false;
}
示例10: updateEntityWithOptionalForce
import net.minecraft.entity.passive.EntityWaterMob; //导入依赖的package包/类
public void updateEntityWithOptionalForce(Entity p_72866_1_, boolean p_72866_2_)
{
if (!this.mcServer.getCanSpawnAnimals() && (p_72866_1_ instanceof EntityAnimal || p_72866_1_ instanceof EntityWaterMob))
{
p_72866_1_.setDead();
}
if (!this.mcServer.getCanSpawnNPCs() && p_72866_1_ instanceof INpc)
{
p_72866_1_.setDead();
}
super.updateEntityWithOptionalForce(p_72866_1_, p_72866_2_);
}
示例11: func_72866_a
import net.minecraft.entity.passive.EntityWaterMob; //导入依赖的package包/类
public void func_72866_a(Entity p_72866_1_, boolean p_72866_2_) {
if(!this.field_73061_a.func_71268_U() && (p_72866_1_ instanceof EntityAnimal || p_72866_1_ instanceof EntityWaterMob)) {
p_72866_1_.func_70106_y();
}
if(!this.field_73061_a.func_71220_V() && p_72866_1_ instanceof INpc) {
p_72866_1_.func_70106_y();
}
super.func_72866_a(p_72866_1_, p_72866_2_);
}
示例12: getDefaultMobType
import net.minecraft.entity.passive.EntityWaterMob; //导入依赖的package包/类
public static EnumCreatureType getDefaultMobType(Class<? extends EntityLiving> cls) {
EnumCreatureType type = defaultMap.get(cls);
if (type == null) {
if (EntityAmbientCreature.class.isAssignableFrom(cls))
return EnumCreatureType.ambient;
if (EntityWaterMob.class.isAssignableFrom(cls))
return EnumCreatureType.waterCreature;
if (IMob.class.isAssignableFrom(cls))
return EnumCreatureType.monster;
if (EntityCreature.class.isAssignableFrom(cls))
return EnumCreatureType.creature;
}
return type;
}
示例13: getEntityClass
import net.minecraft.entity.passive.EntityWaterMob; //导入依赖的package包/类
@Override
public Class<? extends EntityLivingBase> getEntityClass() {
return EntityWaterMob.class;
}
示例14: passesFilter
import net.minecraft.entity.passive.EntityWaterMob; //导入依赖的package包/类
public boolean passesFilter(Entity entity){
if(filter == null || filter == FilterType.NONE) return false;
switch(filter){
default : case ALL : {
return true;
}
case PLAYER : {
return entity instanceof EntityPlayer;
}
case UNDEAD : {
return (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).getCreatureAttribute() == EnumCreatureAttribute.UNDEAD);
}
case ARTHROPOD : {
return (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).getCreatureAttribute() == EnumCreatureAttribute.ARTHROPOD);
}
case MONSTER : {
return (entity instanceof IMob);
}
case ANIMAL : {
return (entity instanceof EntityAnimal);
}
case LIVING : {
return (entity instanceof EntityLiving);
}
case WATER : {
return (entity instanceof EntityWaterMob || entity instanceof EntityGuardian);
}
case BABY : {
return (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).isChild());
}
case PET : {
return (entity instanceof IEntityOwnable);
}
case SLIME : {
return (entity instanceof EntitySlime);
}
case VILLAGER : {
return (entity instanceof EntityVillager);
}
case ITEM : {
return (entity instanceof EntityItem);
}
}
}
示例15: updateSpawner
import net.minecraft.entity.passive.EntityWaterMob; //导入依赖的package包/类
public void updateSpawner() {
if (isActivated() && !powered) {
double d2;
if (this.getSpawnerWorld().isRemote) {
double d0 = this.getSpawnerX() + this.getSpawnerWorld().rand.nextFloat();
double d1 = this.getSpawnerY() + this.getSpawnerWorld().rand.nextFloat();
d2 = this.getSpawnerZ() + this.getSpawnerWorld().rand.nextFloat();
this.getSpawnerWorld().spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0, d1, d2, 0.0D, 0.0D, 0.0D);
this.getSpawnerWorld().spawnParticle(EnumParticleTypes.FLAME, d0, d1, d2, 0.0D, 0.0D, 0.0D);
if (this.spawnDelay > 0) {
--this.spawnDelay;
}
this.renderRotation1 = this.renderRotation0;
this.renderRotation0 = (this.renderRotation0 + 1000.0F / (this.spawnDelay + 200.0F)) % 360.0D;
} else {
if (this.spawnDelay == -1) {
this.resetTimer();
}
if (this.spawnDelay > 0) {
--this.spawnDelay;
return;
}
boolean flag = false;
for (int i = 0; i < this.spawnCount; ++i) {
EntityEssenceInstance<?> essence = ItemMobEssence.getEssence(getEntityNameToSpawn());
Entity entity = essence.createEntity(getSpawnerWorld());
if (entity == null) {
return;
}
int j = this.getSpawnerWorld().getEntitiesWithinAABB(entity.getClass(), new AxisAlignedBB(this.getSpawnerX(), this.getSpawnerY(), this.getSpawnerZ(), this.getSpawnerX() + 1, this.getSpawnerY() + 1, this.getSpawnerZ() + 1).expand(this.spawnRange * 2, 4.0D, this.spawnRange * 2)).size();
if (j >= this.maxNearbyEntities) {
this.resetTimer();
return;
}
World world = getSpawnerWorld();
BlockPos blockpos = new BlockPos(getSpawnerX(), getSpawnerY(), getSpawnerZ());
double x = blockpos.getX() + (world.rand.nextDouble() - world.rand.nextDouble()) * this.spawnRange + 0.5D;
double y = blockpos.getY() + world.rand.nextInt(3) - 1;
double z = blockpos.getZ() + (world.rand.nextDouble() - world.rand.nextDouble()) * this.spawnRange + 0.5D;
EntityLiving entityliving = entity instanceof EntityLiving ? (EntityLiving) entity : null;
entity.setLocationAndAngles(x, y, z, world.rand.nextFloat() * 360.0F, 0.0F);
//Make Water Mobs require water
boolean specialCheck = ignoreSpawnRequirements && getSpawnerWorld().isAirBlock(new BlockPos(x, y, z));
if(!ignoreSpawnRequirements && (entity instanceof EntityWaterMob || entity instanceof EntityGuardian)){
specialCheck = world.isMaterialInBB(entity.getEntityBoundingBox(), Material.WATER);
}
if (entityliving == null || (net.minecraftforge.event.ForgeEventFactory.canEntitySpawnSpawner(entityliving, getSpawnerWorld(), (float)entity.posX, (float)entity.posY, (float)entity.posZ) || specialCheck)) {
this.spawnEntity(entity);
this.getSpawnerWorld().playEvent(2004, this.getSpawnerPos(), 0);
if (entityliving != null) {
entityliving.spawnExplosionParticle();
}
flag = true;
}
}
if (flag) {
this.resetTimer();
}
}
}
}