Java Code Examples for net.minecraft.entity.EntityCategory#CREATURE

The following examples show how to use net.minecraft.entity.EntityCategory#CREATURE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SpawnReporter.java    From fabric-carpet with MIT License 6 votes vote down vote up
public static EntityCategory get_creature_type_from_code(String type_code)
{
    if ("hostile".equalsIgnoreCase(type_code))
    {
        return EntityCategory.MONSTER;
    }
    else if ("passive".equalsIgnoreCase(type_code))
    {
        return EntityCategory.CREATURE;
    }
    else if ("water".equalsIgnoreCase(type_code))
    {
        return EntityCategory.WATER_CREATURE;
    }
    else if ("ambient".equalsIgnoreCase(type_code))
    {
        return EntityCategory.AMBIENT;
    }
    return null;
}
 
Example 2
Source File: SpawnReporter.java    From fabric-carpet with MIT License 5 votes vote down vote up
public static EntityCategory get_type_code_from_wool_code(DyeColor color)
{
    switch (color)
    {
        case RED:
            return EntityCategory.MONSTER;
        case GREEN:
            return EntityCategory.CREATURE;
        case BLUE:
            return EntityCategory.WATER_CREATURE;
        case BROWN:
            return EntityCategory.AMBIENT;
    }
    return null;
}
 
Example 3
Source File: SpawnHelperMixin.java    From fabric-carpet with MIT License 5 votes vote down vote up
@Redirect(method = "spawnEntitiesInChunk", at = @At(
        value = "INVOKE",
        target = "Lnet/minecraft/entity/player/PlayerEntity;squaredDistanceTo(DDD)D"
))
private static double getSqDistanceTo(PlayerEntity playerEntity, double double_1, double double_2, double double_3,
                                      EntityCategory entityCategory_1, ServerWorld world_1, WorldChunk worldChunk_1, BlockPos blockPos_1)
{
    double distanceTo = playerEntity.squaredDistanceTo(double_1, double_2, double_3);
    if (CarpetSettings.lagFreeSpawning && distanceTo > 16384.0D && entityCategory_1 != EntityCategory.CREATURE)
        return 0.0;
    return distanceTo;
}
 
Example 4
Source File: FlatChunkGeneratorMixin.java    From fabric-carpet with MIT License 4 votes vote down vote up
@Override
public List<Biome.SpawnEntry> getEntitySpawnList(EntityCategory category, BlockPos pos)
{
    if (CarpetSettings.flatWorldStructureSpawning)
    {
        if (Feature.SWAMP_HUT.method_14029(this.world, pos))
        {
            if (category == EntityCategory.MONSTER)
            {
                return Feature.SWAMP_HUT.getMonsterSpawns();
            }
    
            if (category == EntityCategory.CREATURE)
            {
                return Feature.SWAMP_HUT.getCreatureSpawns();
            }
        }
        else if (category == EntityCategory.MONSTER)
        {
            if (Feature.PILLAGER_OUTPOST.isApproximatelyInsideStructure(this.world, pos))
            {
                return Feature.PILLAGER_OUTPOST.getMonsterSpawns();
            }

            if (CarpetSettings.huskSpawningInTemples)
            {
                if (Feature.DESERT_PYRAMID.isApproximatelyInsideStructure(this.world, pos))
                {
                    return Feature.DESERT_PYRAMID.getMonsterSpawns();
                }
            }
    
            if (Feature.OCEAN_MONUMENT.isApproximatelyInsideStructure(this.world, pos))
            {
                return Feature.OCEAN_MONUMENT.getMonsterSpawns();
            }

            if (Feature.NETHER_BRIDGE.isInsideStructure(this.world, pos))
            {
                return Feature.NETHER_BRIDGE.getMonsterSpawns();
            }

            if (Feature.NETHER_BRIDGE.isApproximatelyInsideStructure(this.world, pos) && this.world.getBlockState(pos.down(1)).getBlock() == Blocks.NETHER_BRICKS)
            {
                return Feature.NETHER_BRIDGE.getMonsterSpawns();
            }

            if (CarpetSettings.shulkerSpawningInEndCities)
            {
                if (Feature.END_CITY.isInsideStructure(this.world, pos))
                {
                    return Feature.END_CITY.getMonsterSpawns();
                }
            }
        }
    }
    
    return super.getEntitySpawnList(category, pos);
}