Search in sources :

Example 1 with SpawnReason

use of net.minecraft.entity.SpawnReason in project VariousOddities by Lyinginbedmon.

the class VOEntities method register.

private static <T extends Entity> EntityType<T> register(String name, EntityType.IFactory<T> factory, EntityClassification type, float width, float height, int trackingRange) {
    ResourceLocation location = new ResourceLocation(Reference.ModInfo.MOD_ID, name);
    EntityType<T> entity = EntityType.Builder.create(factory, type).size(width, height).setTrackingRange(trackingRange).setUpdateInterval(1).build(location.toString());
    entity.setRegistryName(location);
    MISC_PROPERTIES_MAP.put(entity, new EntityRegistry(PlacementType.NO_RESTRICTIONS, Heightmap.Type.MOTION_BLOCKING, new IPlacementPredicate<T>() {

        public boolean test(EntityType<T> p_test_1_, IServerWorld p_test_2_, SpawnReason p_test_3_, BlockPos p_test_4_, Random p_test_5_) {
            return true;
        }
    }));
    return entity;
}
Also used : EntityType(net.minecraft.entity.EntityType) IPlacementPredicate(net.minecraft.entity.EntitySpawnPlacementRegistry.IPlacementPredicate) IServerWorld(net.minecraft.world.IServerWorld) Random(java.util.Random) SpawnReason(net.minecraft.entity.SpawnReason) ResourceLocation(net.minecraft.util.ResourceLocation) BlockPos(net.minecraft.util.math.BlockPos)

Aggregations

Random (java.util.Random)1 IPlacementPredicate (net.minecraft.entity.EntitySpawnPlacementRegistry.IPlacementPredicate)1 EntityType (net.minecraft.entity.EntityType)1 SpawnReason (net.minecraft.entity.SpawnReason)1 ResourceLocation (net.minecraft.util.ResourceLocation)1 BlockPos (net.minecraft.util.math.BlockPos)1 IServerWorld (net.minecraft.world.IServerWorld)1